summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-25 21:26:54 +0200
committerHaru <haru@dotalux.com>2013-09-25 22:15:53 +0200
commitafcad494411995396b906f214d1c4ffcf485cc0a (patch)
treee70b21658276ddef885322b7c9b18935b6c0235e /src/map
parent13afb7e0bf35bacc9c90c7dffe34120ddd2fd099 (diff)
downloadhercules-afcad494411995396b906f214d1c4ffcf485cc0a.tar.gz
hercules-afcad494411995396b906f214d1c4ffcf485cc0a.tar.bz2
hercules-afcad494411995396b906f214d1c4ffcf485cc0a.tar.xz
hercules-afcad494411995396b906f214d1c4ffcf485cc0a.zip
Renamed local variables that would conflict with a rename of iStatus to status
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c80
-rw-r--r--src/map/battle.c68
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/chrif.c8
-rw-r--r--src/map/clif.c157
-rw-r--r--src/map/elemental.c60
-rw-r--r--src/map/mercenary.c65
-rw-r--r--src/map/mob.c145
-rw-r--r--src/map/pc.c123
-rw-r--r--src/map/pet.c22
-rw-r--r--src/map/quest.c8
-rw-r--r--src/map/quest.h2
-rw-r--r--src/map/skill.c141
-rw-r--r--src/map/status.c1764
-rw-r--r--src/map/status.h4
15 files changed, 1284 insertions, 1365 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 41d93fa4d..0fd54200d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2377,11 +2377,10 @@ ACMD(zeny)
/*==========================================
*
*------------------------------------------*/
-ACMD(param)
-{
+ACMD(param) {
int i, value = 0, new_value, max;
const char* param[] = { "str", "agi", "vit", "int", "dex", "luk" };
- short* status[6];
+ short* stats[6];
//we don't use direct initialization because it isn't part of the c standard.
nullpo_retr(-1, sd);
@@ -2399,28 +2398,28 @@ ACMD(param)
return false;
}
- status[0] = &sd->status.str;
- status[1] = &sd->status.agi;
- status[2] = &sd->status.vit;
- status[3] = &sd->status.int_;
- status[4] = &sd->status.dex;
- status[5] = &sd->status.luk;
+ stats[0] = &sd->status.str;
+ stats[1] = &sd->status.agi;
+ stats[2] = &sd->status.vit;
+ stats[3] = &sd->status.int_;
+ stats[4] = &sd->status.dex;
+ stats[5] = &sd->status.luk;
if( battle_config.atcommand_max_stat_bypass )
max = SHRT_MAX;
else
max = pc_maxparameter(sd);
- if(value < 0 && *status[i] <= -value) {
+ if(value < 0 && *stats[i] <= -value) {
new_value = 1;
- } else if(max - *status[i] < value) {
+ } else if(max - *stats[i] < value) {
new_value = max;
} else {
- new_value = *status[i] + value;
+ new_value = *stats[i] + value;
}
- if (new_value != *status[i]) {
- *status[i] = new_value;
+ if (new_value != *stats[i]) {
+ *stats[i] = new_value;
clif->updatestatus(sd, SP_STR + i);
clif->updatestatus(sd, SP_USTR + i);
status_calc_pc(sd, 0);
@@ -2439,19 +2438,18 @@ ACMD(param)
/*==========================================
* Stat all by fritz (rewritten by [Yor])
*------------------------------------------*/
-ACMD(stat_all)
-{
+ACMD(stat_all) {
int index, count, value, max, new_value;
- short* status[6];
+ short* stats[6];
//we don't use direct initialization because it isn't part of the c standard.
nullpo_retr(-1, sd);
- status[0] = &sd->status.str;
- status[1] = &sd->status.agi;
- status[2] = &sd->status.vit;
- status[3] = &sd->status.int_;
- status[4] = &sd->status.dex;
- status[5] = &sd->status.luk;
+ stats[0] = &sd->status.str;
+ stats[1] = &sd->status.agi;
+ stats[2] = &sd->status.vit;
+ stats[3] = &sd->status.int_;
+ stats[4] = &sd->status.dex;
+ stats[5] = &sd->status.luk;
if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) {
value = pc_maxparameter(sd);
@@ -2464,17 +2462,17 @@ ACMD(stat_all)
}
count = 0;
- for (index = 0; index < ARRAYLENGTH(status); index++) {
+ for (index = 0; index < ARRAYLENGTH(stats); index++) {
- if (value > 0 && *status[index] > max - value)
+ if (value > 0 && *stats[index] > max - value)
new_value = max;
- else if (value < 0 && *status[index] <= -value)
+ else if (value < 0 && *stats[index] <= -value)
new_value = 1;
else
- new_value = *status[index] +value;
+ new_value = *stats[index] +value;
- if (new_value != (int)*status[index]) {
- *status[index] = new_value;
+ if (new_value != (int)*stats[index]) {
+ *stats[index] = new_value;
clif->updatestatus(sd, SP_STR + index);
clif->updatestatus(sd, SP_USTR + index);
count++;
@@ -5440,9 +5438,8 @@ ACMD(useskill)
* Debug command to locate new skill IDs. It sends the
* three possible skill-effect packets to the area.
*------------------------------------------*/
-ACMD(displayskill)
-{
- struct status_data * status;
+ACMD(displayskill) {
+ struct status_data *st;
unsigned int tick;
uint16 skill_id;
uint16 skill_lv = 1;
@@ -5453,9 +5450,9 @@ ACMD(displayskill)
clif->message(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>}
return false;
}
- status = iStatus->get_status_data(&sd->bl);
+ st = iStatus->get_status_data(&sd->bl);
tick = timer->gettick();
- clif->skill_damage(&sd->bl,&sd->bl, tick, status->amotion, status->dmotion, 1, 1, skill_id, skill_lv, 5);
+ clif->skill_damage(&sd->bl,&sd->bl, tick, st->amotion, st->dmotion, 1, 1, skill_id, skill_lv, 5);
clif->skill_nodamage(&sd->bl, &sd->bl, skill_id, skill_lv, 1);
clif->skill_poseffect(&sd->bl, skill_id, skill_lv, sd->bl.x, sd->bl.y, tick);
return true;
@@ -7071,10 +7068,9 @@ ACMD(homtalk)
/*==========================================
* Show homunculus stats
*------------------------------------------*/
-ACMD(hominfo)
-{
+ACMD(hominfo) {
struct homun_data *hd;
- struct status_data *status;
+ struct status_data *st;
nullpo_retr(-1, sd);
if ( !homun_alive(sd->hd) ) {
@@ -7083,15 +7079,15 @@ ACMD(hominfo)
}
hd = sd->hd;
- status = iStatus->get_status_data(&hd->bl);
+ st = iStatus->get_status_data(&hd->bl);
clif->message(fd, msg_txt(1261)); // Homunculus stats:
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1262), // HP: %d/%d - SP: %d/%d
- status->hp, status->max_hp, status->sp, status->max_sp);
+ st->hp, st->max_hp, st->sp, st->max_sp);
clif->message(fd, atcmd_output);
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1263), // ATK: %d - MATK: %d~%d
- status->rhw.atk2 +status->batk, status->matk_min, status->matk_max);
+ st->rhw.atk2 +st->batk, st->matk_min, st->matk_max);
clif->message(fd, atcmd_output);
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1264), // Hungry: %d - Intimacy: %u
@@ -7100,8 +7096,8 @@ ACMD(hominfo)
snprintf(atcmd_output, sizeof(atcmd_output) ,
msg_txt(1265), // Stats: Str %d / Agi %d / Vit %d / Int %d / Dex %d / Luk %d
- status->str, status->agi, status->vit,
- status->int_, status->dex, status->luk);
+ st->str, st->agi, st->vit,
+ st->int_, st->dex, st->luk);
clif->message(fd, atcmd_output);
return true;
diff --git a/src/map/battle.c b/src/map/battle.c
index 7900581c6..6427fb157 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -501,28 +501,26 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u
*&16: Arrow attack but BOW, REVOLVER, RIFLE, SHOTGUN, GATLING or GRENADE type weapon not equipped (i.e. shuriken, kunai and venom knives not affected by DEX)
*/
#ifdef RENEWAL
-int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2)
-{
+int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2) {
int64 damage, batk;
- struct status_data *status = iStatus->get_status_data(src);
+ struct status_data *st = iStatus->get_status_data(src);
- batk = battle->calc_elefix(src, bl, skill_id, skill_lv, iStatus->calc_batk(bl, iStatus->get_sc(src), status->batk, false), nk, n_ele, ELE_NEUTRAL, ELE_NEUTRAL, false, flag);
+ batk = battle->calc_elefix(src, bl, skill_id, skill_lv, iStatus->calc_batk(bl, iStatus->get_sc(src), st->batk, false), nk, n_ele, ELE_NEUTRAL, ELE_NEUTRAL, false, flag);
if( type == EQI_HAND_L )
- damage = batk + 3 * battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &status->lhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2) / 4;
+ damage = batk + 3 * battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &st->lhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2) / 4;
else
- damage = (batk << 1) + battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &status->rhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2);
+ damage = (batk << 1) + battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &st->rhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2);
#else
-static int64 battle_calc_base_damage(struct status_data *status, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag)
-{
+static int64 battle_calc_base_damage(struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag) {
unsigned int atkmin=0, atkmax=0;
short type = 0;
int64 damage = 0;
if (!sd) { //Mobs/Pets
if(flag&4) {
- atkmin = status->matk_min;
- atkmax = status->matk_max;
+ atkmin = st->matk_min;
+ atkmax = st->matk_max;
} else {
atkmin = wa->atk;
atkmax = wa->atk2;
@@ -531,10 +529,10 @@ static int64 battle_calc_base_damage(struct status_data *status, struct weapon_a
atkmin = atkmax;
} else { //PCs
atkmax = wa->atk;
- type = (wa == &status->lhw)?EQI_HAND_L:EQI_HAND_R;
+ type = (wa == &st->lhw)?EQI_HAND_L:EQI_HAND_R;
if (!(flag&1) || (flag&2)) { //Normal attacks
- atkmin = status->dex;
+ atkmin = st->dex;
if (sd->equip_index[type] >= 0 && sd->inventory_data[sd->equip_index[type]])
atkmin = atkmin*(80 + sd->inventory_data[sd->equip_index[type]]->wlv*20)/100;
@@ -571,9 +569,9 @@ static int64 battle_calc_base_damage(struct status_data *status, struct weapon_a
//Finally, add baseatk
if(flag&4)
- damage += status->matk_min;
+ damage += st->matk_min;
else
- damage += status->batk;
+ damage += st->batk;
//rodatazone says that Overrefine bonuses are part of baseatk
//Here we also apply the weapon_atk_rate bonus so it is correctly applied on left/right hands.
@@ -606,7 +604,7 @@ int64 battle_calc_sizefix(struct map_session_data *sd, int64 damage, int type, i
*------------------------------------------*/
int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,int64 dmg,int type) {
int64 damage;
- struct status_data *status = iStatus->get_status_data(target);
+ struct status_data *st = iStatus->get_status_data(target);
int weapon, skill_lv;
damage = dmg;
@@ -614,12 +612,12 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
if((skill_lv = pc->checkskill(sd,AL_DEMONBANE)) > 0 &&
target->type == BL_MOB && //This bonus doesnt work against players.
- (battle->check_undead(status->race,status->def_ele) || status->race==RC_DEMON) )
+ (battle->check_undead(st->race,st->def_ele) || st->race==RC_DEMON) )
damage += (int)(skill_lv*(3+sd->status.base_level/20.0));
//damage += (skill_lv * 3);
- if( (skill_lv = pc->checkskill(sd, RA_RANGERMAIN)) > 0 && (status->race == RC_BRUTE || status->race == RC_PLANT || status->race == RC_FISH) )
+ if( (skill_lv = pc->checkskill(sd, RA_RANGERMAIN)) > 0 && (st->race == RC_BRUTE || st->race == RC_PLANT || st->race == RC_FISH) )
damage += (skill_lv * 5);
- if( (skill_lv = pc->checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) )
+ if( (skill_lv = pc->checkskill(sd,NC_RESEARCHFE)) > 0 && (st->def_ele == ELE_FIRE || st->def_ele == ELE_EARTH) )
damage += (skill_lv * 10);
if( pc_ismadogear(sd) )
damage += 20 + 20 * pc->checkskill(sd, NC_MADOLICENCE);
@@ -627,7 +625,7 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
if( (skill_lv = pc->checkskill(sd,BS_WEAPONRESEARCH)) > 0 )
damage += (skill_lv * 2);
#endif
- if((skill_lv = pc->checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) {
+ if((skill_lv = pc->checkskill(sd,HT_BEASTBANE)) > 0 && (st->race==RC_BRUTE || st->race==RC_INSECT) ) {
damage += (skill_lv * 4);
if (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_HUNTER)
damage += sd->status.str;
@@ -1377,7 +1375,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
int i;
struct status_change *sc, *tsc;
struct map_session_data *sd, *tsd;
- struct status_data *status, *tstatus;
+ struct status_data *st, *tst;
nullpo_ret(src);
nullpo_ret(target);
@@ -1386,8 +1384,8 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
tsd = BL_CAST(BL_PC, target);
sc = iStatus->get_sc(src);
tsc = iStatus->get_sc(target);
- status = iStatus->get_status_data(src);
- tstatus = iStatus->get_status_data(target);
+ st = iStatus->get_status_data(src);
+ tst = iStatus->get_status_data(target);
switch(attack_type){
case BF_MAGIC:
@@ -1403,7 +1401,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
#endif
break;
case MG_SOULSTRIKE:
- if (battle->check_undead(tstatus->race,tstatus->def_ele))
+ if (battle->check_undead(tst->race,tst->def_ele))
skillratio += 5*skill_lv;
break;
case MG_FIREWALL:
@@ -1450,10 +1448,10 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
skillratio += 10 * skill_lv - 30;
break;
case SL_STIN:
- skillratio += (tstatus->size!=SZ_SMALL?-99:10*skill_lv); //target size must be small (0) for full damage.
+ skillratio += (tst->size!=SZ_SMALL?-99:10*skill_lv); //target size must be small (0) for full damage.
break;
case SL_STUN:
- skillratio += (tstatus->size!=SZ_BIG?5*skill_lv:-99); //Full damage is dealt on small/medium targets
+ skillratio += (tst->size!=SZ_BIG?5*skill_lv:-99); //Full damage is dealt on small/medium targets
break;
case SL_SMA:
skillratio += -60 + iStatus->get_lv(src); //Base damage is 40% + lv%
@@ -1904,7 +1902,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
#ifndef RENEWAL
case MO_EXTREMITYFIST:
{ //Overflow check. [Skotlex]
- unsigned int ratio = skillratio + 100*(8 + status->sp/10);
+ unsigned int ratio = skillratio + 100*(8 + st->sp/10);
//You'd need something like 6K SP to reach this max, so should be fine for most purposes.
if (ratio > 60000) ratio = 60000; //We leave some room here in case skillratio gets further increased.
skillratio = (unsigned short)ratio;
@@ -2009,8 +2007,8 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
break;
case GS_BULLSEYE:
//Only works well against brute/demihumans non bosses.
- if((tstatus->race == RC_BRUTE || tstatus->race == RC_DEMIHUMAN)
- && !(tstatus->mode&MD_BOSS))
+ if((tst->race == RC_BRUTE || tst->race == RC_DEMIHUMAN)
+ && !(tst->mode&MD_BOSS))
skillratio += 400;
break;
case GS_TRACKING:
@@ -2109,7 +2107,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
else
skillratio += 200 * skill_lv;
skillratio = (skillratio - 100) * (100 + (iStatus->get_lv(src)-100)) / 100;
- if( status->rhw.ele == ELE_FIRE )
+ if( st->rhw.ele == ELE_FIRE )
skillratio += 100 * skill_lv;
break;
case RK_CRUSHSTRIKE:
@@ -2117,7 +2115,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
{//ATK [{Weapon Level * (Weapon Upgrade Level + 6) * 100} + (Weapon ATK) + (Weapon Weight)]%
short index = sd->equip_index[EQI_HAND_R];
if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON )
- skillratio += -100 + sd->inventory_data[index]->weight/10 + status->rhw.atk +
+ skillratio += -100 + sd->inventory_data[index]->weight/10 + st->rhw.atk +
100 * sd->inventory_data[index]->wlv * (sd->status.inventory[index].refine + 6);
}
break;
@@ -2210,7 +2208,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
RE_LVL_DMOD(100);
break;
case NC_ARMSCANNON:
- switch( tstatus->size ) {
+ switch( tst->size ) {
case SZ_SMALL: skillratio += 100 + 500 * skill_lv; break;// Small
case SZ_MEDIUM: skillratio += 100 + 400 * skill_lv; break;// Medium
case SZ_BIG: skillratio += 100 + 300 * skill_lv; break;// Large
@@ -2379,7 +2377,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
RE_LVL_DMOD(150);
break;
case SR_RIDEINLIGHTNING: // ATK [{(Skill Level x 200) + Additional Damage} x Caster Base Level / 100] %
- if( (status->rhw.ele) == ELE_WIND || (status->lhw.ele) == ELE_WIND )
+ if( (st->rhw.ele) == ELE_WIND || (st->lhw.ele) == ELE_WIND )
skillratio += skill_lv * 50;
skillratio += -100 + 200 * skill_lv;
RE_LVL_DMOD(100);
@@ -2855,11 +2853,11 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON && skill_id != WS_CARTTERMINATION))
#endif
{
- struct status_data *status = iStatus->get_status_data(bl);
- int per = 100*status->sp / status->max_sp -1; //100% should be counted as the 80~99% interval
+ struct status_data *sstatus = iStatus->get_status_data(bl);
+ int per = 100*sstatus->sp / sstatus->max_sp -1; //100% should be counted as the 80~99% interval
per /=20; //Uses 20% SP intervals.
//SP Cost: 1% + 0.5% per every 20% SP
- if (!iStatus->charge(bl, 0, (10+5*per)*status->max_sp/1000))
+ if (!iStatus->charge(bl, 0, (10+5*per)*sstatus->max_sp/1000))
status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER);
//Reduction: 6% + 6% every 20%
damage -= damage * (6 * (1+per)) / 100;
diff --git a/src/map/battle.h b/src/map/battle.h
index f56bff3be..6909160c9 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -546,7 +546,7 @@ struct battle_interface {
#ifdef RENEWAL
(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2);
#else
- (struct status_data *status, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag);
+ (struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag);
#endif
struct Damage (*calc_misc_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag);
struct Damage (*calc_magic_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag);
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 87fa0fc0b..15bf80da3 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -598,7 +598,7 @@ void chrif_authok(int fd) {
int account_id, group_id, char_id;
uint32 login_id1,login_id2;
time_t expiration_time;
- struct mmo_charstatus* status;
+ struct mmo_charstatus* charstatus;
struct auth_node *node;
bool changing_mapservers;
TBL_PC* sd;
@@ -615,8 +615,8 @@ void chrif_authok(int fd) {
expiration_time = (time_t)(int32)RFIFOL(fd,16);
group_id = RFIFOL(fd,20);
changing_mapservers = (RFIFOB(fd,24));
- status = (struct mmo_charstatus*)RFIFOP(fd,25);
- char_id = status->char_id;
+ charstatus = (struct mmo_charstatus*)RFIFOP(fd,25);
+ char_id = charstatus->char_id;
//Check if we don't already have player data in our server
//Causes problems if the currently connected player tries to quit or this data belongs to an already connected player which is trying to re-auth.
@@ -646,7 +646,7 @@ void chrif_authok(int fd) {
node->char_id == char_id &&
node->login_id1 == login_id1 )
{ //Auth Ok
- if (pc->authok(sd, login_id2, expiration_time, group_id, status, changing_mapservers))
+ if (pc->authok(sd, login_id2, expiration_time, group_id, charstatus, changing_mapservers))
return;
} else { //Auth Failed
pc->authfail(sd);
diff --git a/src/map/clif.c b/src/map/clif.c
index 7bc808eed..488e2cf0f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1370,13 +1370,13 @@ int clif_spawn(struct block_list *bl)
/// Sends information about owned homunculus to the client (ZC_PROPERTY_HOMUN). [orn]
/// 022e <name>.24B <modified>.B <level>.W <hunger>.W <intimacy>.W <equip id>.W <atk>.W <matk>.W <hit>.W <crit>.W <def>.W <mdef>.W <flee>.W <aspd>.W <hp>.W <max hp>.W <sp>.W <max sp>.W <exp>.L <max exp>.L <skill points>.W <atk range>.W
void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) {
- struct status_data *status;
+ struct status_data *hstatus;
unsigned char buf[128];
enum homun_type htype;
nullpo_retv(hd);
- status = &hd->battle_status;
+ hstatus = &hd->battle_status;
htype = homun->class2type(hd->homunculus.class_);
memset(buf,0,packet_len(0x22e));
@@ -1388,30 +1388,30 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
WBUFW(buf,29)=hd->homunculus.hunger;
WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ;
WBUFW(buf,33)=0; // equip id
- WBUFW(buf,35)=cap_value(status->rhw.atk2+status->batk, 0, INT16_MAX);
- WBUFW(buf,37)=cap_value(status->matk_max, 0, INT16_MAX);
- WBUFW(buf,39)=status->hit;
+ WBUFW(buf,35)=cap_value(hstatus->rhw.atk2+hstatus->batk, 0, INT16_MAX);
+ WBUFW(buf,37)=cap_value(hstatus->matk_max, 0, INT16_MAX);
+ WBUFW(buf,39)=hstatus->hit;
if (battle_config.hom_setting&0x10)
- WBUFW(buf,41)=status->luk/3 + 1; //crit is a +1 decimal value! Just display purpose.[Vicious]
+ WBUFW(buf,41)=hstatus->luk/3 + 1; //crit is a +1 decimal value! Just display purpose.[Vicious]
else
- WBUFW(buf,41)=status->cri/10;
- WBUFW(buf,43)=status->def + status->vit ;
- WBUFW(buf,45)=status->mdef;
- WBUFW(buf,47)=status->flee;
- WBUFW(buf,49)=(flag)?0:status->amotion;
- if (status->max_hp > INT16_MAX) {
- WBUFW(buf,51) = status->hp/(status->max_hp/100);
+ WBUFW(buf,41)=hstatus->cri/10;
+ WBUFW(buf,43)=hstatus->def + hstatus->vit ;
+ WBUFW(buf,45)=hstatus->mdef;
+ WBUFW(buf,47)=hstatus->flee;
+ WBUFW(buf,49)=(flag)?0:hstatus->amotion;
+ if (hstatus->max_hp > INT16_MAX) {
+ WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100);
WBUFW(buf,53) = 100;
} else {
- WBUFW(buf,51)=status->hp;
- WBUFW(buf,53)=status->max_hp;
+ WBUFW(buf,51)=hstatus->hp;
+ WBUFW(buf,53)=hstatus->max_hp;
}
- if (status->max_sp > INT16_MAX) {
- WBUFW(buf,55) = status->sp/(status->max_sp/100);
+ if (hstatus->max_sp > INT16_MAX) {
+ WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100);
WBUFW(buf,57) = 100;
} else {
- WBUFW(buf,55)=status->sp;
- WBUFW(buf,57)=status->max_sp;
+ WBUFW(buf,55)=hstatus->sp;
+ WBUFW(buf,57)=hstatus->max_sp;
}
WBUFL(buf,59)=hd->homunculus.exp;
WBUFL(buf,63)=hd->exp_next;
@@ -5462,9 +5462,8 @@ void clif_skill_mapinfomessage(struct map_session_data *sd, int type)
/// Displays Sense (WZ_ESTIMATION) information window (ZC_MONSTER_INFO).
/// 018c <class>.W <level>.W <size>.W <hp>.L <def>.W <race>.W <mdef>.W <element>.W
/// <water%>.B <earth%>.B <fire%>.B <wind%>.B <poison%>.B <holy%>.B <shadow%>.B <ghost%>.B <undead%>.B
-void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst)
-{
- struct status_data *status;
+void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) {
+ struct status_data *dstatus;
unsigned char buf[64];
int i;//, fix;
@@ -5474,23 +5473,23 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst)
if( dst->type != BL_MOB )
return;
- status = iStatus->get_status_data(dst);
+ dstatus = iStatus->get_status_data(dst);
WBUFW(buf, 0)=0x18c;
WBUFW(buf, 2)=iStatus->get_class(dst);
WBUFW(buf, 4)=iStatus->get_lv(dst);
- WBUFW(buf, 6)=status->size;
- WBUFL(buf, 8)=status->hp;
- WBUFW(buf,12)= (battle_config.estimation_type&1?status->def:0)
- +(battle_config.estimation_type&2?status->def2:0);
- WBUFW(buf,14)=status->race;
- WBUFW(buf,16)= (battle_config.estimation_type&1?status->mdef:0)
- +(battle_config.estimation_type&2?status->mdef2:0);
- WBUFW(buf,18)= status->def_ele;
+ WBUFW(buf, 6)=dstatus->size;
+ WBUFL(buf, 8)=dstatus->hp;
+ WBUFW(buf,12)= (battle_config.estimation_type&1?dstatus->def:0)
+ +(battle_config.estimation_type&2?dstatus->def2:0);
+ WBUFW(buf,14)=dstatus->race;
+ WBUFW(buf,16)= (battle_config.estimation_type&1?dstatus->mdef:0)
+ +(battle_config.estimation_type&2?dstatus->mdef2:0);
+ WBUFW(buf,18)= dstatus->def_ele;
for(i=0;i<9;i++)
- WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,status->def_ele, status->ele_lv);
+ WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv);
// The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex]
-// WBUFB(buf,20+i)= (unsigned char)((fix=battle_attr_ratio(i+1,status->def_ele, status->ele_lv))<0?0:fix);
+// WBUFB(buf,20+i)= (unsigned char)((fix=battle_attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv))<0?0:fix);
clif->send(buf,packet_len(0x18c),&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF);
}
@@ -15668,58 +15667,57 @@ void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, s
/// Notification about a mercenary status parameter change (ZC_MER_PAR_CHANGE).
/// 02a2 <var id>.W <value>.L
-void clif_mercenary_updatestatus(struct map_session_data *sd, int type)
-{
+void clif_mercenary_updatestatus(struct map_session_data *sd, int type) {
struct mercenary_data *md;
- struct status_data *status;
+ struct status_data *mstatus;
int fd;
if( sd == NULL || (md = sd->md) == NULL )
return;
fd = sd->fd;
- status = &md->battle_status;
+ mstatus = &md->battle_status;
WFIFOHEAD(fd,packet_len(0x2a2));
WFIFOW(fd,0) = 0x2a2;
WFIFOW(fd,2) = type;
switch( type ) {
case SP_ATK1:
- {
- int atk = rnd()%(status->rhw.atk2 - status->rhw.atk + 1) + status->rhw.atk;
- WFIFOL(fd,4) = cap_value(atk, 0, INT16_MAX);
- }
+ {
+ int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk;
+ WFIFOL(fd,4) = cap_value(atk, 0, INT16_MAX);
+ }
break;
case SP_MATK1:
- WFIFOL(fd,4) = cap_value(status->matk_max, 0, INT16_MAX);
+ WFIFOL(fd,4) = cap_value(mstatus->matk_max, 0, INT16_MAX);
break;
case SP_HIT:
- WFIFOL(fd,4) = status->hit;
+ WFIFOL(fd,4) = mstatus->hit;
break;
case SP_CRITICAL:
- WFIFOL(fd,4) = status->cri/10;
+ WFIFOL(fd,4) = mstatus->cri/10;
break;
case SP_DEF1:
- WFIFOL(fd,4) = status->def;
+ WFIFOL(fd,4) = mstatus->def;
break;
case SP_MDEF1:
- WFIFOL(fd,4) = status->mdef;
+ WFIFOL(fd,4) = mstatus->mdef;
break;
case SP_MERCFLEE:
- WFIFOL(fd,4) = status->flee;
+ WFIFOL(fd,4) = mstatus->flee;
break;
case SP_ASPD:
- WFIFOL(fd,4) = status->amotion;
+ WFIFOL(fd,4) = mstatus->amotion;
break;
case SP_HP:
- WFIFOL(fd,4) = status->hp;
+ WFIFOL(fd,4) = mstatus->hp;
break;
case SP_MAXHP:
- WFIFOL(fd,4) = status->max_hp;
+ WFIFOL(fd,4) = mstatus->max_hp;
break;
case SP_SP:
- WFIFOL(fd,4) = status->sp;
+ WFIFOL(fd,4) = mstatus->sp;
break;
case SP_MAXSP:
- WFIFOL(fd,4) = status->max_sp;
+ WFIFOL(fd,4) = mstatus->max_sp;
break;
case SP_MERCKILLS:
WFIFOL(fd,4) = md->mercenary.kill_count;
@@ -15736,39 +15734,38 @@ void clif_mercenary_updatestatus(struct map_session_data *sd, int type)
/// 029b <id>.L <atk>.W <matk>.W <hit>.W <crit>.W <def>.W <mdef>.W <flee>.W <aspd>.W
/// <name>.24B <level>.W <hp>.L <maxhp>.L <sp>.L <maxsp>.L <expire time>.L <faith>.W
/// <calls>.L <kills>.L <atk range>.W
-void clif_mercenary_info(struct map_session_data *sd)
-{
+void clif_mercenary_info(struct map_session_data *sd) {
int fd;
struct mercenary_data *md;
- struct status_data *status;
+ struct status_data *mstatus;
int atk;
if( sd == NULL || (md = sd->md) == NULL )
return;
fd = sd->fd;
- status = &md->battle_status;
+ mstatus = &md->battle_status;
WFIFOHEAD(fd,packet_len(0x29b));
WFIFOW(fd,0) = 0x29b;
WFIFOL(fd,2) = md->bl.id;
// Mercenary shows ATK as a random value between ATK ~ ATK2
- atk = rnd()%(status->rhw.atk2 - status->rhw.atk + 1) + status->rhw.atk;
+ atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk;
WFIFOW(fd,6) = cap_value(atk, 0, INT16_MAX);
- WFIFOW(fd,8) = cap_value(status->matk_max, 0, INT16_MAX);
- WFIFOW(fd,10) = status->hit;
- WFIFOW(fd,12) = status->cri/10;
- WFIFOW(fd,14) = status->def;
- WFIFOW(fd,16) = status->mdef;
- WFIFOW(fd,18) = status->flee;
- WFIFOW(fd,20) = status->amotion;
+ WFIFOW(fd,8) = cap_value(mstatus->matk_max, 0, INT16_MAX);
+ WFIFOW(fd,10) = mstatus->hit;
+ WFIFOW(fd,12) = mstatus->cri/10;
+ WFIFOW(fd,14) = mstatus->def;
+ WFIFOW(fd,16) = mstatus->mdef;
+ WFIFOW(fd,18) = mstatus->flee;
+ WFIFOW(fd,20) = mstatus->amotion;
safestrncpy((char*)WFIFOP(fd,22), md->db->name, NAME_LENGTH);
WFIFOW(fd,46) = md->db->lv;
- WFIFOL(fd,48) = status->hp;
- WFIFOL(fd,52) = status->max_hp;
- WFIFOL(fd,56) = status->sp;
- WFIFOL(fd,60) = status->max_sp;
+ WFIFOL(fd,48) = mstatus->hp;
+ WFIFOL(fd,52) = mstatus->max_hp;
+ WFIFOL(fd,56) = mstatus->sp;
+ WFIFOL(fd,60) = mstatus->max_sp;
WFIFOL(fd,64) = (int)time(NULL) + (mercenary->get_lifetime(md) / 1000);
WFIFOW(fd,68) = mercenary->get_faith(md);
WFIFOL(fd,70) = mercenary->get_calls(md);
@@ -16291,29 +16288,29 @@ void clif_parse_ItemListWindowSelected(int fd, struct map_session_data* sd) {
*==========================================*/
void clif_elemental_updatestatus(struct map_session_data *sd, int type) {
struct elemental_data *ed;
- struct status_data *status;
+ struct status_data *estatus;
int fd;
if( sd == NULL || (ed = sd->ed) == NULL )
return;
fd = sd->fd;
- status = &ed->battle_status;
+ estatus = &ed->battle_status;
WFIFOHEAD(fd,8);
WFIFOW(fd,0) = 0x81e;
WFIFOW(fd,2) = type;
switch( type ) {
case SP_HP:
- WFIFOL(fd,4) = status->hp;
+ WFIFOL(fd,4) = estatus->hp;
break;
case SP_MAXHP:
- WFIFOL(fd,4) = status->max_hp;
+ WFIFOL(fd,4) = estatus->max_hp;
break;
case SP_SP:
- WFIFOL(fd,4) = status->sp;
+ WFIFOL(fd,4) = estatus->sp;
break;
case SP_MAXSP:
- WFIFOL(fd,4) = status->max_sp;
+ WFIFOL(fd,4) = estatus->max_sp;
break;
}
WFIFOSET(fd,8);
@@ -16322,21 +16319,21 @@ void clif_elemental_updatestatus(struct map_session_data *sd, int type) {
void clif_elemental_info(struct map_session_data *sd) {
int fd;
struct elemental_data *ed;
- struct status_data *status;
+ struct status_data *estatus;
if( sd == NULL || (ed = sd->ed) == NULL )
return;
fd = sd->fd;
- status = &ed->battle_status;
+ estatus = &ed->battle_status;
WFIFOHEAD(fd,22);
WFIFOW(fd, 0) = 0x81d;
WFIFOL(fd, 2) = ed->bl.id;
- WFIFOL(fd, 6) = status->hp;
- WFIFOL(fd,10) = status->max_hp;
- WFIFOL(fd,14) = status->sp;
- WFIFOL(fd,18) = status->max_sp;
+ WFIFOL(fd, 6) = estatus->hp;
+ WFIFOL(fd,10) = estatus->max_hp;
+ WFIFOL(fd,14) = estatus->sp;
+ WFIFOL(fd,18) = estatus->max_sp;
WFIFOSET(fd,22);
}
diff --git a/src/map/elemental.c b/src/map/elemental.c
index 3a6ab2105..b1ad4073b 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -762,7 +762,7 @@ int read_elementaldb(void) {
char *str[26];
int i, j = 0, k = 0, ele;
struct s_elemental_db *db;
- struct status_data *status;
+ struct status_data *estatus;
sprintf(line, "%s/%s", iMap->db_path, "elemental_db.txt");
memset(elemental->elemental_db,0,sizeof(elemental->elemental_db));
@@ -798,44 +798,44 @@ int read_elementaldb(void) {
safestrncpy(db->name, str[2], NAME_LENGTH);
db->lv = atoi(str[3]);
- status = &db->status;
+ estatus = &db->status;
db->vd.class_ = db->class_;
- status->max_hp = atoi(str[4]);
- status->max_sp = atoi(str[5]);
- status->rhw.range = atoi(str[6]);
- status->rhw.atk = atoi(str[7]);
- status->rhw.atk2 = atoi(str[8]);
- status->def = atoi(str[9]);
- status->mdef = atoi(str[10]);
- status->str = atoi(str[11]);
- status->agi = atoi(str[12]);
- status->vit = atoi(str[13]);
- status->int_ = atoi(str[14]);
- status->dex = atoi(str[15]);
- status->luk = atoi(str[16]);
+ estatus->max_hp = atoi(str[4]);
+ estatus->max_sp = atoi(str[5]);
+ estatus->rhw.range = atoi(str[6]);
+ estatus->rhw.atk = atoi(str[7]);
+ estatus->rhw.atk2 = atoi(str[8]);
+ estatus->def = atoi(str[9]);
+ estatus->mdef = atoi(str[10]);
+ estatus->str = atoi(str[11]);
+ estatus->agi = atoi(str[12]);
+ estatus->vit = atoi(str[13]);
+ estatus->int_ = atoi(str[14]);
+ estatus->dex = atoi(str[15]);
+ estatus->luk = atoi(str[16]);
db->range2 = atoi(str[17]);
db->range3 = atoi(str[18]);
- status->size = atoi(str[19]);
- status->race = atoi(str[20]);
+ estatus->size = atoi(str[19]);
+ estatus->race = atoi(str[20]);
ele = atoi(str[21]);
- status->def_ele = ele%10;
- status->ele_lv = ele/20;
- if( status->def_ele >= ELE_MAX ) {
- ShowWarning("Elemental %d has invalid element type %d (max element is %d)\n", db->class_, status->def_ele, ELE_MAX - 1);
- status->def_ele = ELE_NEUTRAL;
+ estatus->def_ele = ele%10;
+ estatus->ele_lv = ele/20;
+ if( estatus->def_ele >= ELE_MAX ) {
+ ShowWarning("Elemental %d has invalid element type %d (max element is %d)\n", db->class_, estatus->def_ele, ELE_MAX - 1);
+ estatus->def_ele = ELE_NEUTRAL;
}
- if( status->ele_lv < 1 || status->ele_lv > 4 ) {
- ShowWarning("Elemental %d has invalid element level %d (max is 4)\n", db->class_, status->ele_lv);
- status->ele_lv = 1;
+ if( estatus->ele_lv < 1 || estatus->ele_lv > 4 ) {
+ ShowWarning("Elemental %d has invalid element level %d (max is 4)\n", db->class_, estatus->ele_lv);
+ estatus->ele_lv = 1;
}
- status->aspd_rate = 1000;
- status->speed = atoi(str[22]);
- status->adelay = atoi(str[23]);
- status->amotion = atoi(str[24]);
- status->dmotion = atoi(str[25]);
+ estatus->aspd_rate = 1000;
+ estatus->speed = atoi(str[22]);
+ estatus->adelay = atoi(str[23]);
+ estatus->amotion = atoi(str[24]);
+ estatus->dmotion = atoi(str[25]);
j++;
}
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 0e89d62a9..402c477bf 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -397,11 +397,10 @@ int mercenary_checkskill(struct mercenary_data *md, uint16 skill_id)
return 0;
}
-static bool read_mercenarydb_sub(char* str[], int columns, int current)
-{
+static bool read_mercenarydb_sub(char* str[], int columns, int current) {
int ele;
struct s_mercenary_db *db;
- struct status_data *status;
+ struct status_data *mstatus;
db = &mercenary->db[current];
db->class_ = atoi(str[0]);
@@ -409,46 +408,44 @@ static bool read_mercenarydb_sub(char* str[], int columns, int current)
safestrncpy(db->name, str[2], NAME_LENGTH);
db->lv = atoi(str[3]);
- status = &db->status;
+ mstatus = &db->status;
db->vd.class_ = db->class_;
- status->max_hp = atoi(str[4]);
- status->max_sp = atoi(str[5]);
- status->rhw.range = atoi(str[6]);
- status->rhw.atk = atoi(str[7]);
- status->rhw.atk2 = status->rhw.atk + atoi(str[8]);
- status->def = atoi(str[9]);
- status->mdef = atoi(str[10]);
- status->str = atoi(str[11]);
- status->agi = atoi(str[12]);
- status->vit = atoi(str[13]);
- status->int_ = atoi(str[14]);
- status->dex = atoi(str[15]);
- status->luk = atoi(str[16]);
+ mstatus->max_hp = atoi(str[4]);
+ mstatus->max_sp = atoi(str[5]);
+ mstatus->rhw.range = atoi(str[6]);
+ mstatus->rhw.atk = atoi(str[7]);
+ mstatus->rhw.atk2 = mstatus->rhw.atk + atoi(str[8]);
+ mstatus->def = atoi(str[9]);
+ mstatus->mdef = atoi(str[10]);
+ mstatus->str = atoi(str[11]);
+ mstatus->agi = atoi(str[12]);
+ mstatus->vit = atoi(str[13]);
+ mstatus->int_ = atoi(str[14]);
+ mstatus->dex = atoi(str[15]);
+ mstatus->luk = atoi(str[16]);
db->range2 = atoi(str[17]);
db->range3 = atoi(str[18]);
- status->size = atoi(str[19]);
- status->race = atoi(str[20]);
+ mstatus->size = atoi(str[19]);
+ mstatus->race = atoi(str[20]);
ele = atoi(str[21]);
- status->def_ele = ele%10;
- status->ele_lv = ele/20;
- if( status->def_ele >= ELE_MAX )
- {
- ShowWarning("Mercenary %d has invalid element type %d (max element is %d)\n", db->class_, status->def_ele, ELE_MAX - 1);
- status->def_ele = ELE_NEUTRAL;
+ mstatus->def_ele = ele%10;
+ mstatus->ele_lv = ele/20;
+ if( mstatus->def_ele >= ELE_MAX ) {
+ ShowWarning("Mercenary %d has invalid element type %d (max element is %d)\n", db->class_, mstatus->def_ele, ELE_MAX - 1);
+ mstatus->def_ele = ELE_NEUTRAL;
}
- if( status->ele_lv < 1 || status->ele_lv > 4 )
- {
- ShowWarning("Mercenary %d has invalid element level %d (max is 4)\n", db->class_, status->ele_lv);
- status->ele_lv = 1;
+ if( mstatus->ele_lv < 1 || mstatus->ele_lv > 4 ) {
+ ShowWarning("Mercenary %d has invalid element level %d (max is 4)\n", db->class_, mstatus->ele_lv);
+ mstatus->ele_lv = 1;
}
- status->aspd_rate = 1000;
- status->speed = atoi(str[22]);
- status->adelay = atoi(str[23]);
- status->amotion = atoi(str[24]);
- status->dmotion = atoi(str[25]);
+ mstatus->aspd_rate = 1000;
+ mstatus->speed = atoi(str[22]);
+ mstatus->adelay = atoi(str[23]);
+ mstatus->amotion = atoi(str[24]);
+ mstatus->dmotion = atoi(str[25]);
return true;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index d1b6990c4..32bf3d72a 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2077,9 +2077,8 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) {
* Signals death of mob.
* type&1 -> no drops, type&2 -> no exp
*------------------------------------------*/
-int mob_dead(struct mob_data *md, struct block_list *src, int type)
-{
- struct status_data *status;
+int mob_dead(struct mob_data *md, struct block_list *src, int type) {
+ struct status_data *mstatus;
struct map_session_data *sd = NULL, *tmpsd[DAMAGELOG_SIZE];
struct map_session_data *mvp_sd = NULL, *second_sd = NULL, *third_sd = NULL;
@@ -2093,7 +2092,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
unsigned int mvp_damage, tick = timer->gettick();
bool rebirth, homkillonly;
- status = &md->status;
+ mstatus = &md->status;
if( src && src->type == BL_PC )
{
@@ -2198,7 +2197,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
per = (double)md->dmglog[i].dmg/(double)md->tdmg;
else {
//eAthena's exp formula based on max hp.
- per = (double)md->dmglog[i].dmg/(double)status->max_hp;
+ per = (double)md->dmglog[i].dmg/(double)mstatus->max_hp;
if (per > 2) per = 2; // prevents unlimited exp gain
}
@@ -2399,8 +2398,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
{
if ( sd->add_drop[i].race == -md->class_ ||
( sd->add_drop[i].race > 0 && (
- sd->add_drop[i].race & (1<<status->race) ||
- sd->add_drop[i].race & (1<<(status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS))
+ sd->add_drop[i].race & (1<<mstatus->race) ||
+ sd->add_drop[i].race & (1<<(mstatus->mode&MD_BOSS?RC_BOSS:RC_NONBOSS))
)))
{
//check if the bonus item drop rate should be multiplied with mob level/10 [Lupus]
@@ -3323,14 +3322,13 @@ int mob_is_clone(int class_)
//If mode is not passed, a default aggressive mode is used.
//If master_id is passed, clone is attached to him.
//Returns: ID of newly crafted copy.
-int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, int mode, int flag, unsigned int duration)
-{
+int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, int mode, int flag, unsigned int duration) {
int class_;
int i,j,h,inf,skill_id, fd;
struct mob_data *md;
struct mob_skill *ms;
struct mob_db* db;
- struct status_data *status;
+ struct status_data *mstatus;
nullpo_ret(sd);
@@ -3342,24 +3340,24 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
return 0;
db = mob->db_data[class_]=(struct mob_db*)aCalloc(1, sizeof(struct mob_db));
- status = &db->status;
+ mstatus = &db->status;
strcpy(db->sprite,sd->status.name);
strcpy(db->name,sd->status.name);
strcpy(db->jname,sd->status.name);
db->lv=iStatus->get_lv(&sd->bl);
- memcpy(status, &sd->base_status, sizeof(struct status_data));
- status->rhw.atk2= status->dex + status->rhw.atk + status->rhw.atk2; //Max ATK
- status->rhw.atk = status->dex; //Min ATK
- if (status->lhw.atk) {
- status->lhw.atk2= status->dex + status->lhw.atk + status->lhw.atk2; //Max ATK
- status->lhw.atk = status->dex; //Min ATK
+ memcpy(mstatus, &sd->base_status, sizeof(struct status_data));
+ mstatus->rhw.atk2= mstatus->dex + mstatus->rhw.atk + mstatus->rhw.atk2; //Max ATK
+ mstatus->rhw.atk = mstatus->dex; //Min ATK
+ if (mstatus->lhw.atk) {
+ mstatus->lhw.atk2= mstatus->dex + mstatus->lhw.atk + mstatus->lhw.atk2; //Max ATK
+ mstatus->lhw.atk = mstatus->dex; //Min ATK
}
if (mode) //User provided mode.
- status->mode = mode;
+ mstatus->mode = mode;
else if (flag&1) //Friendly Character, remove looting.
- status->mode &= ~MD_LOOTER;
- status->hp = status->max_hp;
- status->sp = status->max_sp;
+ mstatus->mode &= ~MD_LOOTER;
+ mstatus->hp = mstatus->max_hp;
+ mstatus->sp = mstatus->max_sp;
memcpy(&db->vd, &sd->vd, sizeof(struct view_data));
db->base_exp=1;
db->job_exp=1;
@@ -3639,10 +3637,9 @@ static inline int mob_parse_dbrow_cap_value(int class_, int min, int max, int va
/*==========================================
* processes one mobdb entry
*------------------------------------------*/
-bool mob_parse_dbrow(char** str)
-{
+bool mob_parse_dbrow(char** str) {
struct mob_db *db, entry;
- struct status_data *status;
+ struct status_data *mstatus;
int class_, i, k;
double exp, maxhp;
struct mob_data data;
@@ -3666,7 +3663,7 @@ bool mob_parse_dbrow(char** str)
memset(&entry, 0, sizeof(entry));
db = &entry;
- status = &db->status;
+ mstatus = &db->status;
db->vd.class_ = class_;
safestrncpy(db->sprite, str[1], sizeof(db->sprite));
@@ -3674,8 +3671,8 @@ bool mob_parse_dbrow(char** str)
safestrncpy(db->name, str[3], sizeof(db->name));
db->lv = atoi(str[4]);
db->lv = cap_value(db->lv, 1, USHRT_MAX);
- status->max_hp = atoi(str[5]);
- status->max_sp = atoi(str[6]);
+ mstatus->max_hp = atoi(str[5]);
+ mstatus->max_sp = atoi(str[6]);
exp = (double)atoi(str[7]) * (double)battle_config.base_exp_rate / 100.;
db->base_exp = (unsigned int)cap_value(exp, 0, UINT_MAX);
@@ -3683,28 +3680,28 @@ bool mob_parse_dbrow(char** str)
exp = (double)atoi(str[8]) * (double)battle_config.job_exp_rate / 100.;
db->job_exp = (unsigned int)cap_value(exp, 0, UINT_MAX);
- status->rhw.range = atoi(str[9]);
+ mstatus->rhw.range = atoi(str[9]);
- status->rhw.atk = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[10]));
- status->rhw.atk2 = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[11]));
+ mstatus->rhw.atk = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[10]));
+ mstatus->rhw.atk2 = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[11]));
- status->def = mob_parse_dbrow_cap_value(class_,DEFTYPE_MIN,DEFTYPE_MAX,atoi(str[12]));
- status->mdef = mob_parse_dbrow_cap_value(class_,DEFTYPE_MIN,DEFTYPE_MAX,atoi(str[13]));
+ mstatus->def = mob_parse_dbrow_cap_value(class_,DEFTYPE_MIN,DEFTYPE_MAX,atoi(str[12]));
+ mstatus->mdef = mob_parse_dbrow_cap_value(class_,DEFTYPE_MIN,DEFTYPE_MAX,atoi(str[13]));
- status->str = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[14]));
- status->agi = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[15]));
- status->vit = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[16]));
- status->int_ = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[17]));
- status->dex = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[18]));
- status->luk = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[19]));
+ mstatus->str = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[14]));
+ mstatus->agi = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[15]));
+ mstatus->vit = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[16]));
+ mstatus->int_ = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[17]));
+ mstatus->dex = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[18]));
+ mstatus->luk = mob_parse_dbrow_cap_value(class_,UINT16_MIN,UINT16_MAX,atoi(str[19]));
//All status should be min 1 to prevent divisions by zero from some skills. [Skotlex]
- if (status->str < 1) status->str = 1;
- if (status->agi < 1) status->agi = 1;
- if (status->vit < 1) status->vit = 1;
- if (status->int_< 1) status->int_= 1;
- if (status->dex < 1) status->dex = 1;
- if (status->luk < 1) status->luk = 1;
+ if (mstatus->str < 1) mstatus->str = 1;
+ if (mstatus->agi < 1) mstatus->agi = 1;
+ if (mstatus->vit < 1) mstatus->vit = 1;
+ if (mstatus->int_< 1) mstatus->int_= 1;
+ if (mstatus->dex < 1) mstatus->dex = 1;
+ if (mstatus->luk < 1) mstatus->luk = 1;
db->range2 = atoi(str[20]);
db->range3 = atoi(str[21]);
@@ -3719,44 +3716,44 @@ bool mob_parse_dbrow(char** str)
db->range3 = db->range2;
}
- status->size = atoi(str[22]);
- status->race = atoi(str[23]);
+ mstatus->size = atoi(str[22]);
+ mstatus->race = atoi(str[23]);
i = atoi(str[24]); //Element
- status->def_ele = i%10;
- status->ele_lv = i/20;
- if (status->def_ele >= ELE_MAX) {
- ShowError("mob_parse_dbrow: Invalid element type %d for monster ID %d (max=%d).\n", status->def_ele, class_, ELE_MAX-1);
+ mstatus->def_ele = i%10;
+ mstatus->ele_lv = i/20;
+ if (mstatus->def_ele >= ELE_MAX) {
+ ShowError("mob_parse_dbrow: Invalid element type %d for monster ID %d (max=%d).\n", mstatus->def_ele, class_, ELE_MAX-1);
return false;
}
- if (status->ele_lv < 1 || status->ele_lv > 4) {
- ShowError("mob_parse_dbrow: Invalid element level %d for monster ID %d, must be in range 1-4.\n", status->ele_lv, class_);
+ if (mstatus->ele_lv < 1 || mstatus->ele_lv > 4) {
+ ShowError("mob_parse_dbrow: Invalid element level %d for monster ID %d, must be in range 1-4.\n", mstatus->ele_lv, class_);
return false;
}
- status->mode = (int)strtol(str[25], NULL, 0);
+ mstatus->mode = (int)strtol(str[25], NULL, 0);
if (!battle_config.monster_active_enable)
- status->mode &= ~MD_AGGRESSIVE;
+ mstatus->mode &= ~MD_AGGRESSIVE;
- status->speed = atoi(str[26]);
- status->aspd_rate = 1000;
+ mstatus->speed = atoi(str[26]);
+ mstatus->aspd_rate = 1000;
i = atoi(str[27]);
- status->adelay = cap_value(i, battle_config.monster_max_aspd*2, 4000);
+ mstatus->adelay = cap_value(i, battle_config.monster_max_aspd*2, 4000);
i = atoi(str[28]);
- status->amotion = cap_value(i, battle_config.monster_max_aspd, 2000);
+ mstatus->amotion = cap_value(i, battle_config.monster_max_aspd, 2000);
//If the attack animation is longer than the delay, the client crops the attack animation!
//On aegis there is no real visible effect of having a recharge-time less than amotion anyway.
- if (status->adelay < status->amotion)
- status->adelay = status->amotion;
- status->dmotion = atoi(str[29]);
+ if (mstatus->adelay < mstatus->amotion)
+ mstatus->adelay = mstatus->amotion;
+ mstatus->dmotion = atoi(str[29]);
if(battle_config.monster_damage_delay_rate != 100)
- status->dmotion = status->dmotion * battle_config.monster_damage_delay_rate / 100;
+ mstatus->dmotion = mstatus->dmotion * battle_config.monster_damage_delay_rate / 100;
// Fill in remaining status data by using a dummy monster.
data.bl.type = BL_MOB;
data.level = db->lv;
- memcpy(&data.status, status, sizeof(struct status_data));
- iStatus->calc_misc(&data.bl, status, db->lv);
+ memcpy(&data.status, mstatus, sizeof(struct status_data));
+ iStatus->calc_misc(&data.bl, mstatus, db->lv);
// MVP EXP Bonus: MEXP
// Some new MVP's MEXP multipled by high exp-rate cause overflow. [LuzZza]
@@ -3764,7 +3761,7 @@ bool mob_parse_dbrow(char** str)
db->mexp = (unsigned int)cap_value(exp, 0, UINT_MAX);
//Now that we know if it is an mvp or not, apply battle_config modifiers [Skotlex]
- maxhp = (double)status->max_hp;
+ maxhp = (double)mstatus->max_hp;
if (db->mexp > 0) { //Mvp
if (battle_config.mvp_hp_rate != 100)
maxhp = maxhp * (double)battle_config.mvp_hp_rate / 100.;
@@ -3772,12 +3769,12 @@ bool mob_parse_dbrow(char** str)
if (battle_config.monster_hp_rate != 100)
maxhp = maxhp * (double)battle_config.monster_hp_rate / 100.;
- status->max_hp = (unsigned int)cap_value(maxhp, 1, UINT_MAX);
- if(status->max_sp < 1) status->max_sp = 1;
+ mstatus->max_hp = (unsigned int)cap_value(maxhp, 1, UINT_MAX);
+ if(mstatus->max_sp < 1) mstatus->max_sp = 1;
//Since mobs always respawn with full life...
- status->hp = status->max_hp;
- status->sp = status->max_sp;
+ mstatus->hp = mstatus->max_hp;
+ mstatus->sp = mstatus->max_sp;
// MVP Drops: MVP1id,MVP1per,MVP2id,MVP2per,MVP3id,MVP3per
for(i = 0; i < MAX_MVP_DROP; i++) {
@@ -3823,30 +3820,30 @@ bool mob_parse_dbrow(char** str)
else switch (type)
{ // Added suport to restrict normal drops of MVP's [Reddozen]
case IT_HEALING:
- rate_adjust = (status->mode&MD_BOSS) ? battle_config.item_rate_heal_boss : battle_config.item_rate_heal;
+ rate_adjust = (mstatus->mode&MD_BOSS) ? battle_config.item_rate_heal_boss : battle_config.item_rate_heal;
ratemin = battle_config.item_drop_heal_min;
ratemax = battle_config.item_drop_heal_max;
break;
case IT_USABLE:
case IT_CASH:
- rate_adjust = (status->mode&MD_BOSS) ? battle_config.item_rate_use_boss : battle_config.item_rate_use;
+ rate_adjust = (mstatus->mode&MD_BOSS) ? battle_config.item_rate_use_boss : battle_config.item_rate_use;
ratemin = battle_config.item_drop_use_min;
ratemax = battle_config.item_drop_use_max;
break;
case IT_WEAPON:
case IT_ARMOR:
case IT_PETARMOR:
- rate_adjust = (status->mode&MD_BOSS) ? battle_config.item_rate_equip_boss : battle_config.item_rate_equip;
+ rate_adjust = (mstatus->mode&MD_BOSS) ? battle_config.item_rate_equip_boss : battle_config.item_rate_equip;
ratemin = battle_config.item_drop_equip_min;
ratemax = battle_config.item_drop_equip_max;
break;
case IT_CARD:
- rate_adjust = (status->mode&MD_BOSS) ? battle_config.item_rate_card_boss : battle_config.item_rate_card;
+ rate_adjust = (mstatus->mode&MD_BOSS) ? battle_config.item_rate_card_boss : battle_config.item_rate_card;
ratemin = battle_config.item_drop_card_min;
ratemax = battle_config.item_drop_card_max;
break;
default:
- rate_adjust = (status->mode&MD_BOSS) ? battle_config.item_rate_common_boss : battle_config.item_rate_common;
+ rate_adjust = (mstatus->mode&MD_BOSS) ? battle_config.item_rate_common_boss : battle_config.item_rate_common;
ratemin = battle_config.item_drop_common_min;
ratemax = battle_config.item_drop_common_max;
break;
diff --git a/src/map/pc.c b/src/map/pc.c
index 441230c29..c485baa43 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -444,20 +444,20 @@ unsigned char pc_famerank(int char_id, int job)
}
int pc_setrestartvalue(struct map_session_data *sd,int type) {
- struct status_data *status, *b_status;
+ struct status_data *st, *bst;
nullpo_ret(sd);
- b_status = &sd->base_status;
- status = &sd->battle_status;
+ bst = &sd->base_status;
+ st = &sd->battle_status;
if (type&1) { //Normal resurrection
- status->hp = 1; //Otherwise iStatus->heal may fail if dead.
- iStatus->heal(&sd->bl, b_status->hp, 0, 1);
- if( status->sp < b_status->sp )
- iStatus->set_sp(&sd->bl, b_status->sp, 1);
+ st->hp = 1; //Otherwise iStatus->heal may fail if dead.
+ iStatus->heal(&sd->bl, bst->hp, 0, 1);
+ if( st->sp < bst->sp )
+ iStatus->set_sp(&sd->bl, bst->sp, 1);
} else { //Just for saving on the char-server (with values as if respawned)
- sd->status.hp = b_status->hp;
- sd->status.sp = (status->sp < b_status->sp)?b_status->sp:status->sp;
+ sd->status.hp = bst->hp;
+ sd->status.sp = (st->sp < bst->sp) ? bst->sp : st->sp;
}
return 0;
}
@@ -2100,13 +2100,12 @@ int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate,
/*==========================================
* Add a bonus(type) to player sd
*------------------------------------------*/
-int pc_bonus(struct map_session_data *sd,int type,int val)
-{
- struct status_data *status;
+int pc_bonus(struct map_session_data *sd,int type,int val) {
+ struct status_data *bst;
int bonus;
nullpo_ret(sd);
- status = &sd->base_status;
+ bst = &sd->base_status;
switch(type){
case SP_STR:
@@ -2120,57 +2119,57 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
case SP_ATK1:
if(!sd->state.lr_flag) {
- bonus = status->rhw.atk + val;
- status->rhw.atk = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->rhw.atk + val;
+ bst->rhw.atk = cap_value(bonus, 0, USHRT_MAX);
}
else if(sd->state.lr_flag == 1) {
- bonus = status->lhw.atk + val;
- status->lhw.atk = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->lhw.atk + val;
+ bst->lhw.atk = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_ATK2:
if(!sd->state.lr_flag) {
- bonus = status->rhw.atk2 + val;
- status->rhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->rhw.atk2 + val;
+ bst->rhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
}
else if(sd->state.lr_flag == 1) {
- bonus = status->lhw.atk2 + val;
- status->lhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->lhw.atk2 + val;
+ bst->lhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_BASE_ATK:
if(sd->state.lr_flag != 2) {
#ifdef RENEWAL
- status->equip_atk += val;
+ bst->equip_atk += val;
#else
- bonus = status->batk + val;
- status->batk = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->batk + val;
+ bst->batk = cap_value(bonus, 0, USHRT_MAX);
#endif
}
break;
case SP_DEF1:
if(sd->state.lr_flag != 2) {
- bonus = status->def + val;
+ bonus = bst->def + val;
#ifdef RENEWAL
- status->def = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bst->def = cap_value(bonus, SHRT_MIN, SHRT_MAX);
#else
- status->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
+ bst->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
#endif
}
break;
case SP_DEF2:
if(sd->state.lr_flag != 2) {
- bonus = status->def2 + val;
- status->def2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->def2 + val;
+ bst->def2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_MDEF1:
if(sd->state.lr_flag != 2) {
- bonus = status->mdef + val;
+ bonus = bst->mdef + val;
#ifdef RENEWAL
- status->mdef = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bst->mdef = cap_value(bonus, SHRT_MIN, SHRT_MAX);
#else
- status->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
+ bst->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
#endif
if( sd->state.lr_flag == 3 ) {//Shield, used for royal guard
sd->bonus.shieldmdef += bonus;
@@ -2179,33 +2178,33 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
case SP_MDEF2:
if(sd->state.lr_flag != 2) {
- bonus = status->mdef2 + val;
- status->mdef2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->mdef2 + val;
+ bst->mdef2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_HIT:
if(sd->state.lr_flag != 2) {
- bonus = status->hit + val;
- status->hit = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->hit + val;
+ bst->hit = cap_value(bonus, SHRT_MIN, SHRT_MAX);
} else
sd->bonus.arrow_hit+=val;
break;
case SP_FLEE1:
if(sd->state.lr_flag != 2) {
- bonus = status->flee + val;
- status->flee = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->flee + val;
+ bst->flee = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_FLEE2:
if(sd->state.lr_flag != 2) {
- bonus = status->flee2 + val*10;
- status->flee2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->flee2 + val*10;
+ bst->flee2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_CRITICAL:
if(sd->state.lr_flag != 2) {
- bonus = status->cri + val*10;
- status->cri = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->cri + val*10;
+ bst->cri = cap_value(bonus, SHRT_MIN, SHRT_MAX);
} else
sd->bonus.arrow_cri += val*10;
break;
@@ -2214,8 +2213,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
ShowError("pc_bonus: SP_ATKELE: Invalid element %d\n", val);
break;
}
- switch (sd->state.lr_flag)
- {
+ switch (sd->state.lr_flag) {
case 2:
switch (sd->status.weapon) {
case W_BOW:
@@ -2225,7 +2223,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case W_SHOTGUN:
case W_GRENADE:
//Become weapon element.
- status->rhw.ele=val;
+ bst->rhw.ele=val;
break;
default: //Become arrow element.
sd->bonus.arrow_ele=val;
@@ -2233,10 +2231,10 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
}
break;
case 1:
- status->lhw.ele=val;
+ bst->lhw.ele=val;
break;
default:
- status->rhw.ele=val;
+ bst->rhw.ele=val;
break;
}
break;
@@ -2246,21 +2244,21 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
}
if(sd->state.lr_flag != 2)
- status->def_ele=val;
+ bst->def_ele=val;
break;
case SP_MAXHP:
if(sd->state.lr_flag == 2)
break;
- val += (int)status->max_hp;
+ val += (int)bst->max_hp;
//Negative bonuses will underflow, this will be handled in status_calc_pc through casting
//If this is called outside of status_calc_pc, you'd better pray they do not underflow and end with UINT_MAX max_hp.
- status->max_hp = (unsigned int)val;
+ bst->max_hp = (unsigned int)val;
break;
case SP_MAXSP:
if(sd->state.lr_flag == 2)
break;
- val += (int)status->max_sp;
- status->max_sp = (unsigned int)val;
+ val += (int)bst->max_sp;
+ bst->max_sp = (unsigned int)val;
break;
#ifndef RENEWAL_CAST
case SP_VARCASTRATE:
@@ -2291,14 +2289,14 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case W_GATLING:
case W_SHOTGUN:
case W_GRENADE:
- status->rhw.range += val;
+ bst->rhw.range += val;
}
break;
case 1:
- status->lhw.range += val;
+ bst->lhw.range += val;
break;
default:
- status->rhw.range += val;
+ bst->rhw.range += val;
break;
}
break;
@@ -2317,9 +2315,9 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case SP_ASPD_RATE: //Stackable increase - Made it linear as per rodatazone
if(sd->state.lr_flag != 2)
#ifndef RENEWAL_ASPD
- status->aspd_rate -= 10*val;
+ bst->aspd_rate -= 10*val;
#else
- status->aspd_rate2 += val;
+ bst->aspd_rate2 += val;
#endif
break;
case SP_HP_RECOV_RATE:
@@ -5855,14 +5853,13 @@ int pc_checkjoblevelup(struct map_session_data *sd)
/*==========================================
* Alters experienced based on self bonuses that do not get even shared to the party.
*------------------------------------------*/
-static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src)
-{
+static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src) {
int bonus = 0;
- struct status_data *status = iStatus->get_status_data(src);
+ struct status_data *st = iStatus->get_status_data(src);
- if (sd->expaddrace[status->race])
- bonus += sd->expaddrace[status->race];
- bonus += sd->expaddrace[status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
+ if (sd->expaddrace[st->race])
+ bonus += sd->expaddrace[st->race];
+ bonus += sd->expaddrace[st->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
if (battle_config.pk_mode &&
(int)(iStatus->get_lv(src) - sd->status.base_level) >= 20)
diff --git a/src/map/pet.c b/src/map/pet.c
index d064ddfe0..bb5982e7a 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1114,10 +1114,9 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
-int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd=iMap->id2sd(id);
- struct status_data *status;
+ struct status_data *st;
struct pet_data *pd;
unsigned int rate = 100;
@@ -1131,11 +1130,11 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- status = iStatus->get_status_data(&sd->bl);
+ st = iStatus->get_status_data(&sd->bl);
if(pc_isdead(sd) ||
- (rate = get_percentage(status->sp, status->max_sp)) > pd->s_skill->sp ||
- (rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
+ (rate = get_percentage(st->sp, st->max_sp)) > pd->s_skill->sp ||
+ (rate = get_percentage(st->hp, st->max_hp)) > pd->s_skill->hp ||
(rate = (pd->ud.skilltimer != INVALID_TIMER)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
pd->s_skill->timer=timer->add(timer->gettick()+(rate>10?rate:10)*100,pet->heal_timer,sd->bl.id,0);
@@ -1152,11 +1151,10 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
/*==========================================
* pet support skills [Skotlex]
*------------------------------------------*/
-int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd=iMap->id2sd(id);
struct pet_data *pd;
- struct status_data *status;
+ struct status_data *st;
short rate = 100;
if(sd==NULL || sd->pd == NULL || sd->pd->s_skill == NULL)
return 1;
@@ -1168,7 +1166,7 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- status = iStatus->get_status_data(&sd->bl);
+ st = iStatus->get_status_data(&sd->bl);
if (DIFF_TICK(pd->ud.canact_tick, tick) > 0)
{ //Wait until the pet can act again.
@@ -1177,8 +1175,8 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
}
if(pc_isdead(sd) ||
- (rate = get_percentage(status->sp, status->max_sp)) > pd->s_skill->sp ||
- (rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
+ (rate = get_percentage(st->sp, st->max_sp)) > pd->s_skill->sp ||
+ (rate = get_percentage(st->hp, st->max_hp)) > pd->s_skill->hp ||
(rate = (pd->ud.skilltimer != INVALID_TIMER)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
pd->s_skill->timer=timer->add(tick+(rate>10?rate:10)*100,pet->skill_support_timer,sd->bl.id,0);
diff --git a/src/map/quest.c b/src/map/quest.c
index 881037081..40030560a 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -226,7 +226,7 @@ void quest_update_objective(TBL_PC * sd, int mob_id) {
}
}
-int quest_update_status(TBL_PC * sd, int quest_id, quest_state status) {
+int quest_update_status(TBL_PC * sd, int quest_id, quest_state qs) {
int i;
//Only status of active and inactive quests can be updated. Completed quests can't (for now). [Inkfish]
@@ -236,11 +236,11 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state status) {
return -1;
}
- sd->quest_log[i].state = status;
+ sd->quest_log[i].state = qs;
sd->save_quest = true;
- if( status < Q_COMPLETE ) {
- clif->quest_update_status(sd, quest_id, (bool)status);
+ if( qs < Q_COMPLETE ) {
+ clif->quest_update_status(sd, quest_id, (bool)qs);
return 0;
}
diff --git a/src/map/quest.h b/src/map/quest.h
index c127dd402..340bc8608 100644
--- a/src/map/quest.h
+++ b/src/map/quest.h
@@ -29,7 +29,7 @@ struct quest_interface {
int (*delete) (TBL_PC *sd, int quest_id);
int (*update_objective_sub) (struct block_list *bl, va_list ap);
void (*update_objective) (TBL_PC *sd, int mob_id);
- int (*update_status) (TBL_PC *sd, int quest_id, quest_state status);
+ int (*update_status) (TBL_PC *sd, int quest_id, quest_state qs);
int (*check) (TBL_PC *sd, int quest_id, quest_check_type type);
int (*read_db) (void);
};
diff --git a/src/map/skill.c b/src/map/skill.c
index 3669431f0..3e9817faf 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -688,7 +688,6 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
struct status_data *sstatus, *tstatus;
struct status_change *sc, *tsc;
- enum sc_type status;
int temp;
int rate;
@@ -1074,9 +1073,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
break;
case LK_JOINTBEAT:
- status = iStatus->skill2sc(skill_id);
if (tsc->jb_flag) {
- sc_start4(bl,status,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill->get_time2(skill_id,skill_lv));
+ enum sc_type type = iStatus->skill2sc(skill_id);
+ sc_start4(bl,type,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill->get_time2(skill_id,skill_lv));
tsc->jb_flag = 0;
}
break;
@@ -2155,8 +2154,7 @@ int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type)
* flag&0x2000 is used to signal that the skill_lv should be passed as -1 to the
* client (causes player characters to not scream skill name)
*-------------------------------------------------------------------------*/
-int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
-{
+int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) {
struct Damage dmg;
struct status_data *sstatus, *tstatus;
struct status_change *sc;
@@ -2263,11 +2261,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
dmg.damage = battle->attr_fix(bl, bl, dmg.damage, s_ele, status_get_element(bl), status_get_element_level(bl));
if( sc && sc->data[SC_ENERGYCOAT] ) {
- struct status_data *status = iStatus->get_status_data(bl);
- int per = 100*status->sp / status->max_sp -1; //100% should be counted as the 80~99% interval
+ struct status_data *st = iStatus->get_status_data(bl);
+ int per = 100*st->sp / st->max_sp -1; //100% should be counted as the 80~99% interval
per /=20; //Uses 20% SP intervals.
//SP Cost: 1% + 0.5% per every 20% SP
- if (!iStatus->charge(bl, 0, (10+5*per)*status->max_sp/1000))
+ if (!iStatus->charge(bl, 0, (10+5*per)*st->max_sp/1000))
status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER);
//Reduction: 6% + 6% every 20%
dmg.damage -= dmg.damage * (6 * (1+per)) / 100;
@@ -2967,7 +2965,7 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i
* &2: picked menu entry (Warp Portal, Teleport and other menu based skills)
*------------------------------------------*/
int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, int type) {
- struct status_data *status;
+ struct status_data *st;
struct map_session_data *sd = NULL;
int i, hp, sp, hp_rate, sp_rate, state, mhp;
uint16 idx;
@@ -2983,7 +2981,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
case BL_MER: sd = ((TBL_MER*)bl)->master; break;
}
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
if( (idx = skill->get_index(skill_id)) == 0 )
return 0;
@@ -2999,15 +2997,15 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
sp_rate = skill_db[idx].sp_rate[lv-1];
state = skill_db[idx].state;
if( (mhp = skill_db[idx].mhp[lv-1]) > 0 )
- hp += (status->max_hp * mhp) / 100;
+ hp += (st->max_hp * mhp) / 100;
if( hp_rate > 0 )
- hp += (status->hp * hp_rate) / 100;
+ hp += (st->hp * hp_rate) / 100;
else
- hp += (status->max_hp * (-hp_rate)) / 100;
+ hp += (st->max_hp * (-hp_rate)) / 100;
if( sp_rate > 0 )
- sp += (status->sp * sp_rate) / 100;
+ sp += (st->sp * sp_rate) / 100;
else
- sp += (status->max_sp * (-sp_rate)) / 100;
+ sp += (st->max_sp * (-sp_rate)) / 100;
if( bl->type == BL_HOM ) { // Intimacy Requeriments
struct homun_data *hd = BL_CAST(BL_HOM, bl);
@@ -3024,11 +3022,11 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
}
if( !(type&2) ) {
- if( hp > 0 && status->hp <= (unsigned int)hp ) {
+ if( hp > 0 && st->hp <= (unsigned int)hp ) {
clif->skill_fail(sd, skill_id, USESKILL_FAIL_HP_INSUFFICIENT, 0);
return 0;
}
- if( sp > 0 && status->sp <= (unsigned int)sp ) {
+ if( sp > 0 && st->sp <= (unsigned int)sp ) {
clif->skill_fail(sd, skill_id, USESKILL_FAIL_SP_INSUFFICIENT, 0);
return 0;
}
@@ -10497,14 +10495,13 @@ int skill_icewall_block(struct block_list *bl,va_list ap) {
* Initializes and sets a ground skill.
* flag&1 is used to determine when the skill 'morphs' (Warp portal becomes active, or Fire Pillar becomes active)
*------------------------------------------*/
-struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag)
-{
+struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag) {
struct skill_unit_group *group;
int i,limit,val1=0,val2=0,val3=0;
int target,interval,range,unit_flag,req_item=0;
struct s_skill_unit_layout *layout;
struct map_session_data *sd;
- struct status_data *status;
+ struct status_data *st;
struct status_change *sc;
int active_flag=1;
int subunt=0;
@@ -10527,7 +10524,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
}
sd = BL_CAST(BL_PC, src);
- status = iStatus->get_status_data(src);
+ st = iStatus->get_status_data(src);
sc = iStatus->get_sc(src); // for traps, firewall and fogwall - celest
switch( skill_id ) {
@@ -10652,18 +10649,18 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
case BA_DISSONANCE:
case DC_UGLYDANCE:
- val1 = 10; //FIXME: This value is not used anywhere, what is it for? [Skotlex]
+ val1 = 10; //FIXME: This value is not used anywhere, what is it for? [Skotlex]
break;
case BA_WHISTLE:
- val1 = skill_lv +status->agi/10; // Flee increase
- val2 = ((skill_lv+1)/2)+status->luk/10; // Perfect dodge increase
+ val1 = skill_lv +st->agi/10; // Flee increase
+ val2 = ((skill_lv+1)/2)+st->luk/10; // Perfect dodge increase
if(sd){
val1 += pc->checkskill(sd,BA_MUSICALLESSON);
val2 += pc->checkskill(sd,BA_MUSICALLESSON);
}
break;
case DC_HUMMING:
- val1 = 2*skill_lv+status->dex/10; // Hit increase
+ val1 = 2*skill_lv+st->dex/10; // Hit increase
#ifdef RENEWAL
val1 *= 2;
#endif
@@ -10671,9 +10668,9 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val1 += pc->checkskill(sd,DC_DANCINGLESSON);
break;
case BA_POEMBRAGI:
- val1 = 3*skill_lv+status->dex/10; // Casting time reduction
+ val1 = 3*skill_lv+st->dex/10; // Casting time reduction
//For some reason at level 10 the base delay reduction is 50%.
- val2 = (skill_lv<10?3*skill_lv:50)+status->int_/5; // After-cast delay reduction
+ val2 = (skill_lv<10?3*skill_lv:50)+st->int_/5; // After-cast delay reduction
if(sd){
val1 += 2*pc->checkskill(sd,BA_MUSICALLESSON);
val2 += 2*pc->checkskill(sd,BA_MUSICALLESSON);
@@ -10681,11 +10678,11 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
break;
case DC_DONTFORGETME:
#ifdef RENEWAL
- val1 = status->dex/10 + 3*skill_lv; // ASPD decrease
- val2 = status->agi/10 + 2*skill_lv; // Movement speed adjustment.
+ val1 = st->dex/10 + 3*skill_lv; // ASPD decrease
+ val2 = st->agi/10 + 2*skill_lv; // Movement speed adjustment.
#else
- val1 = status->dex/10 + 3*skill_lv + 5; // ASPD decrease
- val2 = status->agi/10 + 3*skill_lv + 5; // Movement speed adjustment.
+ val1 = st->dex/10 + 3*skill_lv + 5; // ASPD decrease
+ val2 = st->agi/10 + 3*skill_lv + 5; // Movement speed adjustment.
#endif
if(sd){
val1 += pc->checkskill(sd,DC_DANCINGLESSON);
@@ -10693,13 +10690,13 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
}
break;
case BA_APPLEIDUN:
- val1 = 5+2*skill_lv+status->vit/10; // MaxHP percent increase
+ val1 = 5+2*skill_lv+st->vit/10; // MaxHP percent increase
if(sd)
val1 += pc->checkskill(sd,BA_MUSICALLESSON);
break;
case DC_SERVICEFORYOU:
- val1 = 15+skill_lv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed
- val2 = 20+3*skill_lv+(status->int_/10); // SP cost reduction
+ val1 = 15+skill_lv+(st->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed
+ val2 = 20+3*skill_lv+(st->int_/10); // SP cost reduction
if(sd){
val1 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed
val2 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value
@@ -10707,17 +10704,17 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
break;
case BA_ASSASSINCROSS:
#ifdef RENEWAL
- val1 = 10 + skill_lv + (status->agi/10); // ASPD increase
+ val1 = 10 + skill_lv + (st->agi/10); // ASPD increase
if(sd)
val1 += 4*pc->checkskill(sd,BA_MUSICALLESSON);
#else
- val1 = 100+(10*skill_lv)+(status->agi/10); // ASPD increase
+ val1 = 100+(10*skill_lv)+(st->agi/10); // ASPD increase
if(sd)
val1 += 5*pc->checkskill(sd,BA_MUSICALLESSON);
#endif
break;
case DC_FORTUNEKISS:
- val1 = 10+skill_lv+(status->luk/10); // Critical increase
+ val1 = 10+skill_lv+(st->luk/10); // Critical increase
if(sd)
val1 += pc->checkskill(sd,DC_DANCINGLESSON);
val1*=10; //Because every 10 crit is an actual cri point.
@@ -10765,7 +10762,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
{
int element[5]={ELE_WIND,ELE_DARK,ELE_POISON,ELE_WATER,ELE_FIRE};
- val1 = status->rhw.ele;
+ val1 = st->rhw.ele;
if (!val1)
val1=element[rnd()%5];
@@ -12334,7 +12331,7 @@ int skill_isammotype (struct map_session_data *sd, int skill_id)
}
int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) {
- struct status_data *status;
+ struct status_data *st;
struct status_change *sc;
struct skill_condition require;
int i;
@@ -12370,7 +12367,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
return 0;
break;
}
- status = &sd->battle_status;
+ st = &sd->battle_status;
sc = &sd->sc;
if( !sc->count )
sc = NULL;
@@ -12695,9 +12692,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
break;
//Auron insists we should implement SP consumption when you are not Soul Linked. [Skotlex]
//Only invoke on skill begin cast (instant cast skill). [Kevin]
- if( require.sp > 0 )
- {
- if (status->sp < (unsigned int)require.sp)
+ if( require.sp > 0 ) {
+ if (st->sp < (unsigned int)require.sp)
clif->skill_fail(sd,skill_id,USESKILL_FAIL_SP_INSUFFICIENT,0);
else
status_zap(&sd->bl, 0, require.sp);
@@ -12725,9 +12721,9 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
case NJ_ISSEN:
#ifdef RENEWAL
- if (status->hp < (status->hp/100)) {
+ if (st->hp < (st->hp/100)) {
#else
- if (status->hp < 2) {
+ if (st->hp < 2) {
#endif
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -12747,7 +12743,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
}
break;
case PF_HPCONVERSION:
- if (status->sp == status->max_sp)
+ if (st->sp == st->max_sp)
return 0; //Unusable when at full SP.
break;
case AM_CALLHOMUN: //Can't summon if a hom is already out
@@ -13162,7 +13158,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
break;
}
- if(require.mhp > 0 && get_percentage(status->hp, status->max_hp) > require.mhp) {
+ if(require.mhp > 0 && get_percentage(st->hp, st->max_hp) > require.mhp) {
//mhp is the max-hp-requirement, that is,
//you must have this % or less of HP to cast it.
clif->skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0);
@@ -13174,7 +13170,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
return 0;
}
- if( require.sp > 0 && status->sp < (unsigned int)require.sp) {
+ if( require.sp > 0 && st->sp < (unsigned int)require.sp) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_SP_INSUFFICIENT,0);
return 0;
}
@@ -13216,10 +13212,9 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
return 1;
}
-int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv)
-{
+int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) {
struct skill_condition require;
- struct status_data *status;
+ struct status_data *st;
int i;
int index[MAX_SKILL_ITEM_REQUIRE];
@@ -13322,11 +13317,11 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
break;
}
- status = &sd->battle_status;
+ st = &sd->battle_status;
require = skill->get_requirement(sd,skill_id,skill_lv);
- if( require.hp > 0 && status->hp <= (unsigned int)require.hp) {
+ if( require.hp > 0 && st->hp <= (unsigned int)require.hp) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0);
return 0;
}
@@ -13489,10 +13484,9 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
return 1;
}
-struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv)
-{
+struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) {
struct skill_condition req;
- struct status_data *status;
+ struct status_data *st;
struct status_change *sc;
int i,hp_rate,sp_rate, sp_skill_rate_bonus = 100;
uint16 idx;
@@ -13528,23 +13522,23 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
if( skill_lv < 1 || skill_lv > MAX_SKILL_LEVEL )
return req;
- status = &sd->battle_status;
+ st = &sd->battle_status;
req.hp = skill_db[idx].hp[skill_lv-1];
hp_rate = skill_db[idx].hp_rate[skill_lv-1];
if(hp_rate > 0)
- req.hp += (status->hp * hp_rate)/100;
+ req.hp += (st->hp * hp_rate)/100;
else
- req.hp += (status->max_hp * (-hp_rate))/100;
+ req.hp += (st->max_hp * (-hp_rate))/100;
req.sp = skill_db[idx].sp[skill_lv-1];
if((sd->skill_id_old == BD_ENCORE) && skill_id == sd->skill_id_dance)
req.sp /= 2;
sp_rate = skill_db[idx].sp_rate[skill_lv-1];
if(sp_rate > 0)
- req.sp += (status->sp * sp_rate)/100;
+ req.sp += (st->sp * sp_rate)/100;
else
- req.sp += (status->max_sp * (-sp_rate))/100;
+ req.sp += (st->max_sp * (-sp_rate))/100;
if( sd->dsprate != 100 )
req.sp = req.sp * sd->dsprate / 100;
@@ -16018,16 +16012,15 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
/*==========================================
*
*------------------------------------------*/
-int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty)
-{
+int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) {
int slot[3];
int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skill_lv = 0;
int num = -1; // exclude the recipe
- struct status_data *status;
+ struct status_data *st;
struct item_data* data;
nullpo_ret(sd);
- status = iStatus->get_status_data(&sd->bl);
+ st = iStatus->get_status_data(&sd->bl);
if( sd->skill_id_old == skill_id )
skill_lv = sd->skill_lv_old;
@@ -16125,7 +16118,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
case BS_ENCHANTEDSTONE:
// Ores & Metals Refining - skill bonuses are straight from kRO website [DracoRPG]
i = pc->checkskill(sd,skill_id);
- make_per = sd->status.job_level*20 + status->dex*10 + status->luk*10; //Base chance
+ make_per = sd->status.job_level*20 + st->dex*10 + st->luk*10; //Base chance
switch(nameid){
case 998: // Iron
make_per += 4000+i*500; // Temper Iron bonus: +26/+32/+38/+44/+50
@@ -16142,7 +16135,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
}
break;
case ASC_CDP:
- make_per = (2000 + 40*status->dex + 20*status->luk);
+ make_per = (2000 + 40*st->dex + 20*st->luk);
break;
case AL_HOLYWATER:
/**
@@ -16157,7 +16150,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
case AM_TWILIGHT3:
make_per = pc->checkskill(sd,AM_LEARNINGPOTION)*50
+ pc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
- + (status->int_/2)*10 + status->dex*10+status->luk*10;
+ + (st->int_/2)*10 + st->dex*10+st->luk*10;
if(homun_alive(sd->hd)) {//Player got a homun
int skill2_lv;
if((skill2_lv=homun->checkskill(sd->hd,HVAN_INSTRUCT)) > 0) //His homun is a vanil with instruction change
@@ -16205,7 +16198,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
case RK_RUNEMASTERY:
{
int A = 5100 + 200 * pc->checkskill(sd, skill_id);
- int B = 10 * status->dex / 3 + (status->luk + sd->status.job_level);
+ int B = 10 * st->dex / 3 + (st->luk + sd->status.job_level);
int C = 100 * cap_value(sd->itemid,0,100); //itemid depend on makerune()
int D = 2500;
switch (nameid) { //rune rank it_diff 9 craftable rune
@@ -16252,7 +16245,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
difficulty = (620 - 20 * skill_lv);// (620 - 20 * Skill Level)
- make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) +
+ make_per = st->int_ + st->dex/2 + st->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) +
(sd->status.base_level-100) + pc->checkskill(sd, AM_LEARNINGPOTION) + pc->checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10)
switch(nameid){// difficulty factor
@@ -16294,7 +16287,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
{
int difficulty = 30 + rnd()%120; // Random number between (30 ~ 150)
- make_per = sd->status.job_level / 4 + status->luk / 2 + status->dex / 3; // (Caster?s Job Level / 4) + (Caster?s LUK / 2) + (Caster?s DEX / 3)
+ make_per = sd->status.job_level / 4 + st->luk / 2 + st->dex / 3; // (Caster?s Job Level / 4) + (Caster?s LUK / 2) + (Caster?s DEX / 3)
qty = ~(5 + rnd()%5) + 1;
switch(nameid){// difficulty factor
@@ -16342,10 +16335,10 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
else
make_per = 1200 * (sd->menuskill_val - 10)
+ 20 * (sd->status.base_level + 1)
- + 20 * (status->dex + 1)
+ + 20 * (st->dex + 1)
+ 100 * (rnd()%(30+5*(sd->cook_mastery/400) - (6+sd->cook_mastery/80)) + (6+sd->cook_mastery/80))
- 400 * (skill_produce_db[idx].itemlv - 11 + 1)
- - 10 * (100 - status->luk + 1)
+ - 10 * (100 - st->luk + 1)
- 500 * (num - 1)
- 100 * (rnd()%4 + 1);
break;
@@ -16354,7 +16347,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
break;
}
} else { // Weapon Forging - skill bonuses are straight from kRO website, other things from a jRO calculator [DracoRPG]
- make_per = 5000 + sd->status.job_level*20 + status->dex*10 + status->luk*10; // Base
+ make_per = 5000 + sd->status.job_level*20 + st->dex*10 + st->luk*10; // Base
make_per += pc->checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15
make_per += pc->checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? pc->checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5
make_per -= (ele?2000:0) + sc*1500 + (wlv>1?wlv*1000:0); // Element Stone: -20%, Star Crumb: -15% each, Weapon level malus: -0/-20/-30
diff --git a/src/map/status.c b/src/map/status.c
index 5d856cfb9..eb398806b 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1089,37 +1089,35 @@ static inline void status_cpy(struct status_data* a, const struct status_data* b
//Sets HP to given value. Flag is the flag passed to iStatus->heal in case
//final value is higher than current (use 2 to make a healing effect display
//on players) It will always succeed (overrides Berserk block), but it can't kill.
-int status_set_hp(struct block_list *bl, unsigned int hp, int flag)
-{
- struct status_data *status;
+int status_set_hp(struct block_list *bl, unsigned int hp, int flag) {
+ struct status_data *st;
if (hp < 1) return 0;
- status = iStatus->get_status_data(bl);
- if (status == &dummy_status)
+ st = iStatus->get_status_data(bl);
+ if (st == &dummy_status)
return 0;
- if (hp > status->max_hp) hp = status->max_hp;
- if (hp == status->hp) return 0;
- if (hp > status->hp)
- return iStatus->heal(bl, hp - status->hp, 0, 1|flag);
- return status_zap(bl, status->hp - hp, 0);
+ if (hp > st->max_hp) hp = st->max_hp;
+ if (hp == st->hp) return 0;
+ if (hp > st->hp)
+ return iStatus->heal(bl, hp - st->hp, 0, 1|flag);
+ return status_zap(bl, st->hp - hp, 0);
}
//Sets SP to given value. Flag is the flag passed to iStatus->heal in case
//final value is higher than current (use 2 to make a healing effect display
//on players)
-int status_set_sp(struct block_list *bl, unsigned int sp, int flag)
-{
- struct status_data *status;
+int status_set_sp(struct block_list *bl, unsigned int sp, int flag) {
+ struct status_data *st;
- status = iStatus->get_status_data(bl);
- if (status == &dummy_status)
+ st = iStatus->get_status_data(bl);
+ if (st == &dummy_status)
return 0;
- if (sp > status->max_sp) sp = status->max_sp;
- if (sp == status->sp) return 0;
- if (sp > status->sp)
- return iStatus->heal(bl, 0, sp - status->sp, 1|flag);
- return status_zap(bl, 0, status->sp - sp);
+ if (sp > st->max_sp) sp = st->max_sp;
+ if (sp == st->sp) return 0;
+ if (sp > st->sp)
+ return iStatus->heal(bl, 0, sp - st->sp, 1|flag);
+ return status_zap(bl, 0, st->sp - sp);
}
int status_charge(struct block_list* bl, int64 hp, int64 sp)
@@ -1135,7 +1133,7 @@ int status_charge(struct block_list* bl, int64 hp, int64 sp)
//If flag&4, if killed, mob must not give exp/loot.
//flag will be set to &8 when damaging sp of a dead character
int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, int64 in_sp, int walkdelay, int flag) {
- struct status_data *status;
+ struct status_data *st;
struct status_change *sc;
int hp,sp;
@@ -1159,24 +1157,24 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
if (target->type == BL_SKILL)
return skill->unit_ondamaged((struct skill_unit *)target, src, hp, timer->gettick());
- status = iStatus->get_status_data(target);
- if( status == &dummy_status )
+ st = iStatus->get_status_data(target);
+ if( st == &dummy_status )
return 0;
- if ((unsigned int)hp >= status->hp) {
+ if ((unsigned int)hp >= st->hp) {
if (flag&2) return 0;
- hp = status->hp;
+ hp = st->hp;
}
- if ((unsigned int)sp > status->sp) {
+ if ((unsigned int)sp > st->sp) {
if (flag&2) return 0;
- sp = status->sp;
+ sp = st->sp;
}
if (!hp && !sp)
return 0;
- if( !status->hp )
+ if( !st->hp )
flag |= 8;
// Let through. battle.c/skill.c have the whole logic of when it's possible or
@@ -1218,7 +1216,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
status_change_end(target, SC_GRAVITATION, INVALID_TIMER);
}
}
- if(sc->data[SC_DANCING] && (unsigned int)hp > status->max_hp>>2)
+ if(sc->data[SC_DANCING] && (unsigned int)hp > st->max_hp>>2)
status_change_end(target, SC_DANCING, INVALID_TIMER);
if(sc->data[SC_CLOAKINGEXCEED] && --(sc->data[SC_CLOAKINGEXCEED]->val2) <= 0)
status_change_end(target, SC_CLOAKINGEXCEED, INVALID_TIMER);
@@ -1228,19 +1226,19 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
unit->skillcastcancel(target, 2);
}
- status->hp-= hp;
- status->sp-= sp;
+ st->hp-= hp;
+ st->sp-= sp;
- if (sc && hp && status->hp) {
+ if (sc && hp && st->hp) {
if (sc->data[SC_AUTOBERSERK] &&
(!sc->data[SC_PROVOKE] || !sc->data[SC_PROVOKE]->val2) &&
- status->hp < status->max_hp>>2)
+ st->hp < st->max_hp>>2)
sc_start4(target,SC_PROVOKE,100,10,1,0,0,0);
- if (sc->data[SC_BERSERK] && status->hp <= 100)
+ if (sc->data[SC_BERSERK] && st->hp <= 100)
status_change_end(target, SC_BERSERK, INVALID_TIMER);
- if( sc->data[SC_RAISINGDRAGON] && status->hp <= 1000 )
+ if( sc->data[SC_RAISINGDRAGON] && st->hp <= 1000 )
status_change_end(target, SC_RAISINGDRAGON, INVALID_TIMER);
- if (sc->data[SC_SATURDAY_NIGHT_FEVER] && status->hp <= 100)
+ if (sc->data[SC_SATURDAY_NIGHT_FEVER] && st->hp <= 100)
status_change_end(target, SC_SATURDAY_NIGHT_FEVER, INVALID_TIMER);
}
@@ -1256,14 +1254,14 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
unit->stop_walking( target, 1 );
}
- if( status->hp || (flag&8) )
+ if( st->hp || (flag&8) )
{ //Still lives or has been dead before this damage.
if (walkdelay)
unit->set_walkdelay(target, timer->gettick(), walkdelay, 0);
return (int)(hp+sp);
}
- status->hp = 1; //To let the dead function cast skills and all that.
+ st->hp = 1; //To let the dead function cast skills and all that.
//NOTE: These dead functions should return: [Skotlex]
//0: Death cancelled, auto-revived.
//Non-zero: Standard death. Clear status, cancel move/attack, etc
@@ -1284,7 +1282,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
return (int)(hp+sp);
//Normal death
- status->hp = 0;
+ st->hp = 0;
if (battle_config.clear_unit_ondeath &&
battle_config.clear_unit_ondeath&target->type)
skill->clear_unitgroup(target);
@@ -1356,15 +1354,14 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
//Heals a character. If flag&1, this is forced healing (otherwise stuff like Berserk can block it)
//If flag&2, when the player is healed, show the HP/SP heal effect.
-int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag)
-{
- struct status_data *status;
+int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) {
+ struct status_data *st;
struct status_change *sc;
int hp,sp;
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
- if (status == &dummy_status || !status->hp)
+ if (st == &dummy_status || !st->hp)
return 0;
/* here onwards we consider it a 32-type, the client does not support higher and from here onwards the value doesn't get thru percentage modifiers */
@@ -1389,8 +1386,8 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag)
hp = 0;
}
- if((unsigned int)hp > status->max_hp - status->hp)
- hp = status->max_hp - status->hp;
+ if((unsigned int)hp > st->max_hp - st->hp)
+ hp = st->max_hp - st->hp;
}
if(sp < 0) {
@@ -1400,21 +1397,21 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag)
}
if(sp) {
- if((unsigned int)sp > status->max_sp - status->sp)
- sp = status->max_sp - status->sp;
+ if((unsigned int)sp > st->max_sp - st->sp)
+ sp = st->max_sp - st->sp;
}
if(!sp && !hp) return 0;
- status->hp+= hp;
- status->sp+= sp;
+ st->hp+= hp;
+ st->sp+= sp;
- if(hp && sc &&
- sc->data[SC_AUTOBERSERK] &&
- sc->data[SC_PROVOKE] &&
- sc->data[SC_PROVOKE]->val2==1 &&
- status->hp>=status->max_hp>>2
- ) //End auto berserk.
+ if( hp && sc
+ && sc->data[SC_AUTOBERSERK]
+ && sc->data[SC_PROVOKE]
+ && sc->data[SC_PROVOKE]->val2==1
+ && st->hp>=st->max_hp>>2
+ ) //End auto berserk.
status_change_end(bl, SC_PROVOKE, INVALID_TIMER);
// send hp update to client
@@ -1435,41 +1432,40 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag)
//If rates are < 0, percent is of max HP/SP
//If !flag, this is heal, otherwise it is damage.
//Furthermore, if flag==2, then the target must not die from the substraction.
-int status_percent_change(struct block_list *src,struct block_list *target,signed char hp_rate, signed char sp_rate, int flag)
-{
- struct status_data *status;
- unsigned int hp =0, sp = 0;
+int status_percent_change(struct block_list *src,struct block_list *target,signed char hp_rate, signed char sp_rate, int flag) {
+ struct status_data *st;
+ unsigned int hp = 0, sp = 0;
- status = iStatus->get_status_data(target);
+ st = iStatus->get_status_data(target);
//It's safe now [MarkZD]
if (hp_rate > 99)
- hp = status->hp;
+ hp = st->hp;
else if (hp_rate > 0)
- hp = status->hp>10000?
- hp_rate*(status->hp/100):
- ((int64)hp_rate*status->hp)/100;
+ hp = st->hp>10000?
+ hp_rate*(st->hp/100):
+ ((int64)hp_rate*st->hp)/100;
else if (hp_rate < -99)
- hp = status->max_hp;
+ hp = st->max_hp;
else if (hp_rate < 0)
- hp = status->max_hp>10000?
- (-hp_rate)*(status->max_hp/100):
- ((int64)-hp_rate*status->max_hp)/100;
+ hp = st->max_hp>10000?
+ (-hp_rate)*(st->max_hp/100):
+ ((int64)-hp_rate*st->max_hp)/100;
if (hp_rate && !hp)
hp = 1;
- if (flag == 2 && hp >= status->hp)
- hp = status->hp-1; //Must not kill target.
+ if (flag == 2 && hp >= st->hp)
+ hp = st->hp-1; //Must not kill target.
if (sp_rate > 99)
- sp = status->sp;
+ sp = st->sp;
else if (sp_rate > 0)
- sp = ((int64)sp_rate*status->sp)/100;
+ sp = ((int64)sp_rate*st->sp)/100;
else if (sp_rate < -99)
- sp = status->max_sp;
+ sp = st->max_sp;
else if (sp_rate < 0)
- sp = ((int64)-sp_rate)*status->max_sp/100;
+ sp = ((int64)-sp_rate)*st->max_sp/100;
if (sp_rate && !sp)
sp = 1;
@@ -1494,31 +1490,30 @@ int status_percent_change(struct block_list *src,struct block_list *target,signe
return iStatus->heal(target, hp, sp, 0);
}
-int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp)
-{
- struct status_data *status;
+int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp) {
+ struct status_data *st;
unsigned int hp, sp;
if (!iStatus->isdead(bl)) return 0;
- status = iStatus->get_status_data(bl);
- if (status == &dummy_status)
+ st = iStatus->get_status_data(bl);
+ if (st == &dummy_status)
return 0; //Invalid target.
- hp = (int64)status->max_hp * per_hp/100;
- sp = (int64)status->max_sp * per_sp/100;
+ hp = (int64)st->max_hp * per_hp/100;
+ sp = (int64)st->max_sp * per_sp/100;
- if(hp > status->max_hp - status->hp)
- hp = status->max_hp - status->hp;
+ if(hp > st->max_hp - st->hp)
+ hp = st->max_hp - st->hp;
else if (per_hp && !hp)
hp = 1;
- if(sp > status->max_sp - status->sp)
- sp = status->max_sp - status->sp;
+ if(sp > st->max_sp - st->sp)
+ sp = st->max_sp - st->sp;
else if (per_sp && !sp)
sp = 1;
- status->hp += hp;
- status->sp += sp;
+ st->hp += hp;
+ st->sp += sp;
if (bl->prev) //Animation only if character is already on a map.
clif->resurrection(bl, 1);
@@ -1543,19 +1538,18 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
* target MAY Be null, in which case the checks are only to see
* whether the source can cast or not the skill on the ground.
*------------------------------------------*/
-int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag)
-{
- struct status_data *status;
+int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag) {
+ struct status_data *st;
struct status_change *sc=NULL, *tsc;
int hide_flag;
- status = src?iStatus->get_status_data(src):&dummy_status;
+ st = src ? iStatus->get_status_data(src) : &dummy_status;
if (src && src->type != BL_PC && iStatus->isdead(src))
return 0;
if (!skill_id) { //Normal attack checks.
- if (!(status->mode&MD_CANATTACK))
+ if (!(st->mode&MD_CANATTACK))
return 0; //This mode is only needed for melee attacking.
//Dead state is not checked for skills as some skills can be used
//on dead characters, said checks are left to skill.c [Skotlex]
@@ -1575,7 +1569,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
if( src->type == BL_PC )
clif->msg((TBL_PC*)src, SKILL_CANT_USE_AREA); // This skill cannot be used within this area
else if( src->type == BL_MOB && map[src->m].zone->disabled_skills[i]->subtype != MZS_NONE ) {
- if( (status->mode&MD_BOSS) && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ if( (st->mode&MD_BOSS) && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
break;
}
return 0;
@@ -1599,7 +1593,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
case AL_TELEPORT:
//Should fail when used on top of Land Protector [Skotlex]
if (src && iMap->getcell(src->m, src->x, src->y, CELL_CHKLANDPROTECTOR)
- && !(status->mode&MD_BOSS)
+ && !(st->mode&MD_BOSS)
&& (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_id))
return 0;
break;
@@ -1774,8 +1768,8 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
switch( target->type ) {
case BL_PC: {
struct map_session_data *sd = (TBL_PC*) target;
- bool is_boss = (status->mode&MD_BOSS);
- bool is_detect = ((status->mode&MD_DETECTOR)?true:false);//god-knows-why gcc doesn't shut up until this happens
+ bool is_boss = (st->mode&MD_BOSS);
+ bool is_detect = ((st->mode&MD_DETECTOR)?true:false);//god-knows-why gcc doesn't shut up until this happens
if (pc_isinvisible(sd))
return 0;
if (tsc->option&hide_flag && !is_boss &&
@@ -1790,7 +1784,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
break;
case BL_ITEM: //Allow targetting of items to pick'em up (or in the case of mobs, to loot them).
//TODO: Would be nice if this could be used to judge whether the player can or not pick up the item it targets. [Skotlex]
- if (status->mode&MD_LOOTER)
+ if (st->mode&MD_LOOTER)
return 1;
return 0;
case BL_HOM:
@@ -1805,9 +1799,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
default:
//Check for chase-walk/hiding/cloaking opponents.
if( tsc ) {
- if( tsc->option&hide_flag && !(status->mode&(MD_BOSS|MD_DETECTOR)))
+ if( tsc->option&hide_flag && !(st->mode&(MD_BOSS|MD_DETECTOR)))
return 0;
- if( tsc->data[SC_STEALTHFIELD] && !(status->mode&MD_BOSS) )
+ if( tsc->data[SC_STEALTHFIELD] && !(st->mode&MD_BOSS) )
return 0;
}
}
@@ -1816,11 +1810,10 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
}
//Checks whether the source can see and chase target.
-int status_check_visibility(struct block_list *src, struct block_list *target)
-{
+int status_check_visibility(struct block_list *src, struct block_list *target) {
int view_range;
- struct status_data* status = iStatus->get_status_data(src);
- struct status_change* tsc = iStatus->get_sc(target);
+ struct status_data *st = iStatus->get_status_data(src);
+ struct status_change *tsc = iStatus->get_sc(target);
switch (src->type) {
case BL_MOB:
view_range = ((TBL_MOB*)src)->min_chase;
@@ -1841,14 +1834,14 @@ int status_check_visibility(struct block_list *src, struct block_list *target)
switch (target->type)
{ //Check for chase-walk/hiding/cloaking opponents.
case BL_PC:
- if ( tsc->data[SC_CLOAKINGEXCEED] && !(status->mode&MD_BOSS) )
+ if ( tsc->data[SC_CLOAKINGEXCEED] && !(st->mode&MD_BOSS) )
return 0;
- if( (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || tsc->data[SC__INVISIBILITY] || tsc->data[SC_CAMOUFLAGE]) && !(status->mode&MD_BOSS) &&
- ( ((TBL_PC*)target)->special_state.perfect_hiding || !(status->mode&MD_DETECTOR) ) )
+ if( (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || tsc->data[SC__INVISIBILITY] || tsc->data[SC_CAMOUFLAGE]) && !(st->mode&MD_BOSS) &&
+ ( ((TBL_PC*)target)->special_state.perfect_hiding || !(st->mode&MD_DETECTOR) ) )
return 0;
break;
default:
- if( tsc && (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || tsc->data[SC__INVISIBILITY] || tsc->data[SC_CAMOUFLAGE]) && !(status->mode&(MD_BOSS|MD_DETECTOR)) )
+ if( tsc && (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || tsc->data[SC__INVISIBILITY] || tsc->data[SC_CAMOUFLAGE]) && !(st->mode&(MD_BOSS|MD_DETECTOR)) )
return 0;
}
@@ -1857,8 +1850,7 @@ int status_check_visibility(struct block_list *src, struct block_list *target)
}
// Basic ASPD value
-int status_base_amotion_pc(struct map_session_data* sd, struct status_data* status)
-{
+int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) {
int amotion;
#ifdef RENEWAL_ASPD
short mod = -1;
@@ -1889,7 +1881,7 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat
: (aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield
// percentual delay reduction from stats
- amotion -= amotion * (4*status->agi + status->dex)/1000;
+ amotion -= amotion * (4*st->agi + st->dex)/1000;
#endif
// raw delay adjustment from bAspd bonus
amotion += sd->bonus.aspd_add;
@@ -1897,8 +1889,7 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat
return amotion;
}
-static unsigned short status_base_atk(const struct block_list *bl, const struct status_data *status)
-{
+static unsigned short status_base_atk(const struct block_list *bl, const struct status_data *st) {
int flag = 0, str, dex,
#ifdef RENEWAL
rstr,
@@ -1925,14 +1916,14 @@ static unsigned short status_base_atk(const struct block_list *bl, const struct
#ifdef RENEWAL
rstr =
#endif
- str = status->dex;
- dex = status->str;
+ str = st->dex;
+ dex = st->str;
} else {
#ifdef RENEWAL
rstr =
#endif
- str = status->str;
- dex = status->dex;
+ str = st->str;
+ dex = st->dex;
}
//Normally only players have base-atk, but homunc have a different batk
// equation, hinting that perhaps non-players should use this for batk.
@@ -1941,94 +1932,92 @@ static unsigned short status_base_atk(const struct block_list *bl, const struct
str += dstr*dstr;
if (bl->type == BL_PC)
#ifdef RENEWAL
- str = (int)(rstr + (float)dex/5 + (float)status->luk/3 + (float)((TBL_PC*)bl)->status.base_level/4);
+ str = (int)(rstr + (float)dex/5 + (float)st->luk/3 + (float)((TBL_PC*)bl)->status.base_level/4);
else if(bl->type == BL_MOB)
str = rstr + ((TBL_MOB*)bl)->level;
#else
- str+= dex/5 + status->luk/5;
+ str+= dex/5 + st->luk/5;
#endif
return cap_value(str, 0, USHRT_MAX);
}
-static inline unsigned short status_base_matk_min(const struct status_data* status){ return status->int_+(status->int_/7)*(status->int_/7); }
-static inline unsigned short status_base_matk_max(const struct status_data* status){ return status->int_+(status->int_/5)*(status->int_/5); }
+static inline unsigned short status_base_matk_min(const struct status_data *st){ return st->int_+(st->int_/7)*(st->int_/7); }
+static inline unsigned short status_base_matk_max(const struct status_data *st){ return st->int_+(st->int_/5)*(st->int_/5); }
#ifdef RENEWAL
-unsigned short status_base_matk(const struct status_data* status, int level){ return status->int_+(status->int_/2)+(status->dex/5)+(status->luk/3)+(level/4); }
+unsigned short status_base_matk(const struct status_data *st, int level){ return st->int_+(st->int_/2)+(st->dex/5)+(st->luk/3)+(level/4); }
#endif
//Fills in the misc data that can be calculated from the other status info (except for level)
-void status_calc_misc(struct block_list *bl, struct status_data *status, int level)
-{
+void status_calc_misc(struct block_list *bl, struct status_data *st, int level) {
//Non players get the value set, players need to stack with previous bonuses.
if( bl->type != BL_PC )
- status->batk =
- status->hit = status->flee =
- status->def2 = status->mdef2 =
- status->cri = status->flee2 = 0;
+ st->batk =
+ st->hit = st->flee =
+ st->def2 = st->mdef2 =
+ st->cri = st->flee2 = 0;
#ifdef RENEWAL // renewal formulas
- status->matk_min = status->matk_max = bl->type == BL_PC ? iStatus->base_matk(status, level) : level + status->int_;
- status->hit += level + status->dex + (bl->type == BL_PC ? status->luk/3 + 175 : 150); //base level + ( every 1 dex = +1 hit ) + (every 3 luk = +1 hit) + 175
- status->flee += level + status->agi + (bl->type == BL_PC ? status->luk/5 : 0) + 100; //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100
- status->def2 += (int)(((float)level + status->vit)/2 + ( bl->type == BL_PC ? ((float)status->agi/5) : 0 )); //base level + (every 2 vit = +1 def) + (every 5 agi = +1 def)
- status->mdef2 += (int)( bl->type == BL_PC ?(status->int_ + ((float)level/4) + ((float)(status->dex+status->vit)/5)):((float)(status->int_ + level)/4)); //(every 4 base level = +1 mdef) + (every 1 int = +1 mdef) + (every 5 dex = +1 mdef) + (every 5 vit = +1 mdef)
+ st->matk_min = st->matk_max = bl->type == BL_PC ? iStatus->base_matk(st, level) : level + st->int_;
+ st->hit += level + st->dex + (bl->type == BL_PC ? st->luk/3 + 175 : 150); //base level + ( every 1 dex = +1 hit ) + (every 3 luk = +1 hit) + 175
+ st->flee += level + st->agi + (bl->type == BL_PC ? st->luk/5 : 0) + 100; //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100
+ st->def2 += (int)(((float)level + st->vit)/2 + ( bl->type == BL_PC ? ((float)st->agi/5) : 0 )); //base level + (every 2 vit = +1 def) + (every 5 agi = +1 def)
+ st->mdef2 += (int)( bl->type == BL_PC ?(st->int_ + ((float)level/4) + ((float)(st->dex+st->vit)/5)):((float)(st->int_ + level)/4)); //(every 4 base level = +1 mdef) + (every 1 int = +1 mdef) + (every 5 dex = +1 mdef) + (every 5 vit = +1 mdef)
#else
- status->matk_min = status_base_matk_min(status);
- status->matk_max = status_base_matk_max(status);
- status->hit += level + status->dex;
- status->flee += level + status->agi;
- status->def2 += status->vit;
- status->mdef2 += status->int_ + (status->vit>>1);
+ st->matk_min = status_base_matk_min(st);
+ st->matk_max = status_base_matk_max(st);
+ st->hit += level + st->dex;
+ st->flee += level + st->agi;
+ st->def2 += st->vit;
+ st->mdef2 += st->int_ + (st->vit>>1);
#endif
if( bl->type&battle_config.enable_critical )
- status->cri += 10 + (status->luk*10/3); //(every 1 luk = +0.3 critical)
+ st->cri += 10 + (st->luk*10/3); //(every 1 luk = +0.3 critical)
else
- status->cri = 0;
+ st->cri = 0;
if (bl->type&battle_config.enable_perfect_flee)
- status->flee2 += status->luk + 10; //(every 10 luk = +1 perfect flee)
+ st->flee2 += st->luk + 10; //(every 10 luk = +1 perfect flee)
else
- status->flee2 = 0;
+ st->flee2 = 0;
- if (status->batk) {
- int temp = status->batk + status_base_atk(bl, status);
- status->batk = cap_value(temp, 0, USHRT_MAX);
+ if (st->batk) {
+ int temp = st->batk + status_base_atk(bl, st);
+ st->batk = cap_value(temp, 0, USHRT_MAX);
} else
- status->batk = status_base_atk(bl, status);
- if (status->cri)
+ st->batk = status_base_atk(bl, st);
+ if (st->cri)
switch (bl->type) {
case BL_MOB:
if(battle_config.mob_critical_rate != 100)
- status->cri = status->cri*battle_config.mob_critical_rate/100;
- if(!status->cri && battle_config.mob_critical_rate)
- status->cri = 10;
+ st->cri = st->cri*battle_config.mob_critical_rate/100;
+ if(!st->cri && battle_config.mob_critical_rate)
+ st->cri = 10;
break;
case BL_PC:
//Players don't have a critical adjustment setting as of yet.
break;
case BL_MER:
#ifdef RENEWAL
- status->matk_min = status->matk_max = status_base_matk_max(status);
- status->def2 = status->vit + level / 10 + status->vit / 5;
- status->mdef2 = level / 10 + status->int_ / 5;
+ st->matk_min = st->matk_max = status_base_matk_max(st);
+ st->def2 = st->vit + level / 10 + st->vit / 5;
+ st->mdef2 = level / 10 + st->int_ / 5;
#endif
break;
default:
if(battle_config.critical_rate != 100)
- status->cri = status->cri*battle_config.critical_rate/100;
- if (!status->cri && battle_config.critical_rate)
- status->cri = 10;
+ st->cri = st->cri*battle_config.critical_rate/100;
+ if (!st->cri && battle_config.critical_rate)
+ st->cri = 10;
}
if(bl->type&BL_REGEN)
- iStatus->calc_regen(bl, status, iStatus->get_regen_data(bl));
+ iStatus->calc_regen(bl, st, iStatus->get_regen_data(bl));
}
//Skotlex: Calculates the initial status for the given mob
//first will only be false when the mob leveled up or got a GuardUp level.
-int status_calc_mob_(struct mob_data* md, bool first)
-{
- struct status_data *status;
+int status_calc_mob_(struct mob_data* md, bool first) {
+ struct status_data *mstatus;
struct block_list *mbl = NULL;
int flag=0;
@@ -2071,8 +2060,8 @@ int status_calc_mob_(struct mob_data* md, bool first)
if (!md->base_status)
md->base_status = (struct status_data*)aCalloc(1, sizeof(struct status_data));
- status = md->base_status;
- memcpy(status, &md->db->status, sizeof(struct status_data));
+ mstatus = md->base_status;
+ memcpy(mstatus, &md->db->status, sizeof(struct status_data));
if (flag&(8|16))
mbl = iMap->id2bl(md->master_id);
@@ -2081,84 +2070,84 @@ int status_calc_mob_(struct mob_data* md, bool first)
struct status_data *mstatus = iStatus->get_base_status(mbl);
if (mstatus &&
battle_config.slaves_inherit_speed&(mstatus->mode&MD_CANMOVE?1:2))
- status->speed = mstatus->speed;
- if( status->speed < 2 ) /* minimum for the unit to function properly */
- status->speed = 2;
+ mstatus->speed = mstatus->speed;
+ if( mstatus->speed < 2 ) /* minimum for the unit to function properly */
+ mstatus->speed = 2;
}
- if (flag&16 && mbl)
- { //Max HP setting from Summon Flora/marine Sphere
+ if (flag&16 && mbl) {
+ //Max HP setting from Summon Flora/marine Sphere
struct unit_data *ud = unit->bl2ud(mbl);
//Remove special AI when this is used by regular mobs.
if (mbl->type == BL_MOB && !((TBL_MOB*)mbl)->special_state.ai)
md->special_state.ai = 0;
- if (ud)
- { // different levels of HP according to skill level
+ if (ud) {
+ // different levels of HP according to skill level
if (ud->skill_id == AM_SPHEREMINE) {
- status->max_hp = 2000 + 400*ud->skill_lv;
- } else if(ud->skill_id == KO_ZANZOU){
- status->max_hp = 3000 + 3000 * ud->skill_lv + status_get_max_sp(battle->get_master(mbl));
+ mstatus->max_hp = 2000 + 400*ud->skill_lv;
+ } else if(ud->skill_id == KO_ZANZOU) {
+ mstatus->max_hp = 3000 + 3000 * ud->skill_lv + status_get_max_sp(battle->get_master(mbl));
} else { //AM_CANNIBALIZE
- status->max_hp = 1500 + 200*ud->skill_lv + 10*iStatus->get_lv(mbl);
- status->mode|= MD_CANATTACK|MD_AGGRESSIVE;
+ mstatus->max_hp = 1500 + 200*ud->skill_lv + 10*iStatus->get_lv(mbl);
+ mstatus->mode|= MD_CANATTACK|MD_AGGRESSIVE;
}
- status->hp = status->max_hp;
+ mstatus->hp = mstatus->max_hp;
}
}
- if (flag&1)
- { // increase from mobs leveling up [Valaris]
+ if (flag&1) {
+ // increase from mobs leveling up [Valaris]
int diff = md->level - md->db->lv;
- status->str+= diff;
- status->agi+= diff;
- status->vit+= diff;
- status->int_+= diff;
- status->dex+= diff;
- status->luk+= diff;
- status->max_hp += diff*status->vit;
- status->max_sp += diff*status->int_;
- status->hp = status->max_hp;
- status->sp = status->max_sp;
- status->speed -= cap_value(diff, 0, status->speed - 10);
- }
-
-
- if (flag&2 && battle_config.mob_size_influence)
- { // change for sized monsters [Valaris]
+ mstatus->str+= diff;
+ mstatus->agi+= diff;
+ mstatus->vit+= diff;
+ mstatus->int_+= diff;
+ mstatus->dex+= diff;
+ mstatus->luk+= diff;
+ mstatus->max_hp += diff*mstatus->vit;
+ mstatus->max_sp += diff*mstatus->int_;
+ mstatus->hp = mstatus->max_hp;
+ mstatus->sp = mstatus->max_sp;
+ mstatus->speed -= cap_value(diff, 0, mstatus->speed - 10);
+ }
+
+
+ if (flag&2 && battle_config.mob_size_influence) {
+ // change for sized monsters [Valaris]
if (md->special_state.size==SZ_MEDIUM) {
- status->max_hp>>=1;
- status->max_sp>>=1;
- if (!status->max_hp) status->max_hp = 1;
- if (!status->max_sp) status->max_sp = 1;
- status->hp=status->max_hp;
- status->sp=status->max_sp;
- status->str>>=1;
- status->agi>>=1;
- status->vit>>=1;
- status->int_>>=1;
- status->dex>>=1;
- status->luk>>=1;
- if (!status->str) status->str = 1;
- if (!status->agi) status->agi = 1;
- if (!status->vit) status->vit = 1;
- if (!status->int_) status->int_ = 1;
- if (!status->dex) status->dex = 1;
- if (!status->luk) status->luk = 1;
+ mstatus->max_hp>>=1;
+ mstatus->max_sp>>=1;
+ if (!mstatus->max_hp) mstatus->max_hp = 1;
+ if (!mstatus->max_sp) mstatus->max_sp = 1;
+ mstatus->hp=mstatus->max_hp;
+ mstatus->sp=mstatus->max_sp;
+ mstatus->str>>=1;
+ mstatus->agi>>=1;
+ mstatus->vit>>=1;
+ mstatus->int_>>=1;
+ mstatus->dex>>=1;
+ mstatus->luk>>=1;
+ if (!mstatus->str) mstatus->str = 1;
+ if (!mstatus->agi) mstatus->agi = 1;
+ if (!mstatus->vit) mstatus->vit = 1;
+ if (!mstatus->int_) mstatus->int_ = 1;
+ if (!mstatus->dex) mstatus->dex = 1;
+ if (!mstatus->luk) mstatus->luk = 1;
} else if (md->special_state.size==SZ_BIG) {
- status->max_hp<<=1;
- status->max_sp<<=1;
- status->hp=status->max_hp;
- status->sp=status->max_sp;
- status->str<<=1;
- status->agi<<=1;
- status->vit<<=1;
- status->int_<<=1;
- status->dex<<=1;
- status->luk<<=1;
+ mstatus->max_hp<<=1;
+ mstatus->max_sp<<=1;
+ mstatus->hp=mstatus->max_hp;
+ mstatus->sp=mstatus->max_sp;
+ mstatus->str<<=1;
+ mstatus->agi<<=1;
+ mstatus->vit<<=1;
+ mstatus->int_<<=1;
+ mstatus->dex<<=1;
+ mstatus->luk<<=1;
}
}
- iStatus->calc_misc(&md->bl, status, md->level);
+ iStatus->calc_misc(&md->bl, mstatus, md->level);
if(flag&4)
{ // Strengthen Guardians - custom value +10% / lv
@@ -2169,27 +2158,27 @@ int status_calc_mob_(struct mob_data* md, bool first)
else
if(gc->castle_id < 24 || md->class_ == MOBID_EMPERIUM) {
#ifdef RENEWAL
- status->max_hp += 50 * gc->defense;
- status->max_sp += 70 * gc->defense;
+ mstatus->max_hp += 50 * gc->defense;
+ mstatus->max_sp += 70 * gc->defense;
#else
- status->max_hp += 1000 * gc->defense;
- status->max_sp += 200 * gc->defense;
+ mstatus->max_hp += 1000 * gc->defense;
+ mstatus->max_sp += 200 * gc->defense;
#endif
- status->hp = status->max_hp;
- status->sp = status->max_sp;
- status->def += (gc->defense+2)/3;
- status->mdef += (gc->defense+2)/3;
+ mstatus->hp = mstatus->max_hp;
+ mstatus->sp = mstatus->max_sp;
+ mstatus->def += (gc->defense+2)/3;
+ mstatus->mdef += (gc->defense+2)/3;
}
if(md->class_ != MOBID_EMPERIUM) {
- status->batk += status->batk * 10*md->guardian_data->guardup_lv/100;
- status->rhw.atk += status->rhw.atk * 10*md->guardian_data->guardup_lv/100;
- status->rhw.atk2 += status->rhw.atk2 * 10*md->guardian_data->guardup_lv/100;
- status->aspd_rate -= 100*md->guardian_data->guardup_lv;
+ mstatus->batk += mstatus->batk * 10*md->guardian_data->guardup_lv/100;
+ mstatus->rhw.atk += mstatus->rhw.atk * 10*md->guardian_data->guardup_lv/100;
+ mstatus->rhw.atk2 += mstatus->rhw.atk2 * 10*md->guardian_data->guardup_lv/100;
+ mstatus->aspd_rate -= 100*md->guardian_data->guardup_lv;
}
}
if( first ) //Initial battle status
- memcpy(&md->status, status, sizeof(struct status_data));
+ memcpy(&md->status, mstatus, sizeof(struct status_data));
return 1;
}
@@ -2210,37 +2199,35 @@ int status_calc_pet_(struct pet_data *pd, bool first)
}
}
- if (battle_config.pet_lv_rate && pd->msd)
- {
+ if (battle_config.pet_lv_rate && pd->msd) {
struct map_session_data *sd = pd->msd;
int lv;
lv =sd->status.base_level*battle_config.pet_lv_rate/100;
if (lv < 0)
lv = 1;
- if (lv != pd->pet.level || first)
- {
- struct status_data *bstat = &pd->db->status, *status = &pd->status;
+ if (lv != pd->pet.level || first) {
+ struct status_data *bstat = &pd->db->status, *pstatus = &pd->status;
pd->pet.level = lv;
if (!first) //Lv Up animation
clif->misceffect(&pd->bl, 0);
- status->rhw.atk = (bstat->rhw.atk*lv)/pd->db->lv;
- status->rhw.atk2 = (bstat->rhw.atk2*lv)/pd->db->lv;
- status->str = (bstat->str*lv)/pd->db->lv;
- status->agi = (bstat->agi*lv)/pd->db->lv;
- status->vit = (bstat->vit*lv)/pd->db->lv;
- status->int_ = (bstat->int_*lv)/pd->db->lv;
- status->dex = (bstat->dex*lv)/pd->db->lv;
- status->luk = (bstat->luk*lv)/pd->db->lv;
-
- status->rhw.atk = cap_value(status->rhw.atk, 1, battle_config.pet_max_atk1);
- status->rhw.atk2 = cap_value(status->rhw.atk2, 2, battle_config.pet_max_atk2);
- status->str = cap_value(status->str,1,battle_config.pet_max_stats);
- status->agi = cap_value(status->agi,1,battle_config.pet_max_stats);
- status->vit = cap_value(status->vit,1,battle_config.pet_max_stats);
- status->int_= cap_value(status->int_,1,battle_config.pet_max_stats);
- status->dex = cap_value(status->dex,1,battle_config.pet_max_stats);
- status->luk = cap_value(status->luk,1,battle_config.pet_max_stats);
+ pstatus->rhw.atk = (bstat->rhw.atk*lv)/pd->db->lv;
+ pstatus->rhw.atk2 = (bstat->rhw.atk2*lv)/pd->db->lv;
+ pstatus->str = (bstat->str*lv)/pd->db->lv;
+ pstatus->agi = (bstat->agi*lv)/pd->db->lv;
+ pstatus->vit = (bstat->vit*lv)/pd->db->lv;
+ pstatus->int_ = (bstat->int_*lv)/pd->db->lv;
+ pstatus->dex = (bstat->dex*lv)/pd->db->lv;
+ pstatus->luk = (bstat->luk*lv)/pd->db->lv;
+
+ pstatus->rhw.atk = cap_value(pstatus->rhw.atk, 1, battle_config.pet_max_atk1);
+ pstatus->rhw.atk2 = cap_value(pstatus->rhw.atk2, 2, battle_config.pet_max_atk2);
+ pstatus->str = cap_value(pstatus->str,1,battle_config.pet_max_stats);
+ pstatus->agi = cap_value(pstatus->agi,1,battle_config.pet_max_stats);
+ pstatus->vit = cap_value(pstatus->vit,1,battle_config.pet_max_stats);
+ pstatus->int_= cap_value(pstatus->int_,1,battle_config.pet_max_stats);
+ pstatus->dex = cap_value(pstatus->dex,1,battle_config.pet_max_stats);
+ pstatus->luk = cap_value(pstatus->luk,1,battle_config.pet_max_stats);
iStatus->calc_misc(&pd->bl, &pd->status, lv);
@@ -2287,8 +2274,7 @@ static void status_calc_sigma(void)
/// f(0) = 35 | f(x+1) = f(x) + A + (x + B)*C/D
/// which reduces to something close to
/// f(x) = 35 + x*(A + B*C/D) + sum(i=2..x){ i*C/D }
-static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct status_data* status)
-{
+static unsigned int status_base_pc_maxhp(struct map_session_data *sd, struct status_data *st) {
uint64 val = pc->class2idx(sd->status.class_);
val = 35 + sd->status.base_level*(int64)hp_coefficient2[val]/100 + hp_sigma_val[val][sd->status.base_level];
@@ -2299,7 +2285,7 @@ static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct sta
if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99)
val += 2000; //Supernovice lvl99 hp bonus.
- val += val * status->vit/100; // +1% per each point of VIT
+ val += val * st->vit/100; // +1% per each point of VIT
if (sd->class_&JOBL_UPPER)
val += val * 25/100; //Trans classes get a 25% hp bonus
@@ -2308,12 +2294,11 @@ static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct sta
return (unsigned int)val;
}
-static unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct status_data *status)
-{
+static unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct status_data *st) {
uint64 val;
val = 10 + sd->status.base_level*(int64)sp_coefficient[pc->class2idx(sd->status.class_)]/100;
- val += val * status->int_/100;
+ val += val * st->int_/100;
if (sd->class_&JOBL_UPPER)
val += val * 25/100;
@@ -2327,10 +2312,9 @@ static unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct sta
//Calculates player data from scratch without counting SC adjustments.
//Should be invoked whenever players raise stats, learn passive skills or change equipment.
-int status_calc_pc_(struct map_session_data* sd, bool first)
-{
+int status_calc_pc_(struct map_session_data* sd, bool first) {
static int calculating = 0; //Check for recursive call preemption. [Skotlex]
- struct status_data *status; // pointer to the player's base status
+ struct status_data *bstatus; // pointer to the player's base status
const struct status_change *sc = &sd->sc;
struct s_skill b_skill[MAX_SKILL]; // previous skill tree
int b_weight, b_max_weight, b_cart_weight_max, // previous weight
@@ -2372,7 +2356,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
}
}
- status = &sd->base_status;
+ bstatus = &sd->base_status;
// these are not zeroed. [zzo]
sd->hprate=100;
sd->sprate=100;
@@ -2422,26 +2406,26 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_CLAIRVOYANCE);
memset(&sd->special_state,0,sizeof(sd->special_state));
- memset(&status->max_hp, 0, sizeof(struct status_data)-(sizeof(status->hp)+sizeof(status->sp)));
+ memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp)));
//FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex]
if (!sd->state.permanent_speed)
- status->speed = DEFAULT_WALK_SPEED;
+ bstatus->speed = DEFAULT_WALK_SPEED;
//Give them all modes except these (useful for clones)
- status->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK);
+ bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK);
- status->size = (sd->class_&JOBL_BABY)?SZ_SMALL:SZ_MEDIUM;
+ bstatus->size = (sd->class_&JOBL_BABY)?SZ_SMALL:SZ_MEDIUM;
if (battle_config.character_size && (pc_isriding(sd) || pc_isridingdragon(sd)) ) { //[Lupus]
if (sd->class_&JOBL_BABY) {
if (battle_config.character_size&SZ_BIG)
- status->size++;
+ bstatus->size++;
} else
if(battle_config.character_size&SZ_MEDIUM)
- status->size++;
+ bstatus->size++;
}
- status->aspd_rate = 1000;
- status->ele_lv = 1;
- status->race = RC_DEMIHUMAN;
+ bstatus->aspd_rate = 1000;
+ bstatus->ele_lv = 1;
+ bstatus->race = RC_DEMIHUMAN;
//zero up structures...
memset(&sd->autospell,0,sizeof(sd->autospell)
@@ -2507,7 +2491,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if( k < map[sd->bl.m].zone->disabled_items_count )
continue;
- status->def += sd->inventory_data[index]->def;
+ bstatus->def += sd->inventory_data[index]->def;
if(first && sd->inventory_data[index]->equip_script)
{ //Execute equip-script on login
@@ -2528,10 +2512,10 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
wlv = REFINE_TYPE_MAX - 1;
if(i == EQI_HAND_L && sd->status.inventory[index].equip == EQP_HAND_L) {
wd = &sd->left_weapon; // Left-hand weapon
- wa = &status->lhw;
+ wa = &bstatus->lhw;
} else {
wd = &sd->right_weapon;
- wa = &status->rhw;
+ wa = &bstatus->rhw;
}
wa->atk += sd->inventory_data[index]->atk;
if ( (r = sd->status.inventory[index].refine) )
@@ -2613,7 +2597,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
memcpy(sd->param_equip,sd->param_bonus,sizeof(sd->param_equip));
memset(sd->param_bonus, 0, sizeof(sd->param_bonus));
- status->def += (refinedef+50)/100;
+ bstatus->def += (refinedef+50)/100;
//Parse Cards
for(i=0;i<EQI_MAX-1;i++) {
@@ -2687,10 +2671,10 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
}
//param_bonus now holds card bonuses.
- if(status->rhw.range < 1) status->rhw.range = 1;
- if(status->lhw.range < 1) status->lhw.range = 1;
- if(status->rhw.range < status->lhw.range)
- status->rhw.range = status->lhw.range;
+ if(bstatus->rhw.range < 1) bstatus->rhw.range = 1;
+ if(bstatus->lhw.range < 1) bstatus->lhw.range = 1;
+ if(bstatus->rhw.range < bstatus->lhw.range)
+ bstatus->rhw.range = bstatus->lhw.range;
sd->bonus.double_rate += sd->bonus.double_add_rate;
sd->bonus.perfect_hit += sd->bonus.perfect_hit_add;
@@ -2720,205 +2704,205 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if(!job_bonus[index][i])
continue;
switch(job_bonus[index][i]) {
- case 1: status->str++; break;
- case 2: status->agi++; break;
- case 3: status->vit++; break;
- case 4: status->int_++; break;
- case 5: status->dex++; break;
- case 6: status->luk++; break;
+ case 1: bstatus->str++; break;
+ case 2: bstatus->agi++; break;
+ case 3: bstatus->vit++; break;
+ case 4: bstatus->int_++; break;
+ case 5: bstatus->dex++; break;
+ case 6: bstatus->luk++; break;
}
}
// If a Super Novice has never died and is at least joblv 70, he gets all stats +10
- if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->die_counter == 0 && sd->status.job_level >= 70){
- status->str += 10;
- status->agi += 10;
- status->vit += 10;
- status->int_+= 10;
- status->dex += 10;
- status->luk += 10;
+ if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->die_counter == 0 && sd->status.job_level >= 70) {
+ bstatus->str += 10;
+ bstatus->agi += 10;
+ bstatus->vit += 10;
+ bstatus->int_+= 10;
+ bstatus->dex += 10;
+ bstatus->luk += 10;
}
// Absolute modifiers from passive skills
if(pc->checkskill(sd,BS_HILTBINDING)>0)
- status->str++;
+ bstatus->str++;
if((skill_lv=pc->checkskill(sd,SA_DRAGONOLOGY))>0)
- status->int_ += (skill_lv+1)/2; // +1 INT / 2 lv
+ bstatus->int_ += (skill_lv+1)/2; // +1 INT / 2 lv
if((skill_lv=pc->checkskill(sd,AC_OWL))>0)
- status->dex += skill_lv;
+ bstatus->dex += skill_lv;
if((skill_lv = pc->checkskill(sd,RA_RESEARCHTRAP))>0)
- status->int_ += skill_lv;
+ bstatus->int_ += skill_lv;
// Bonuses from cards and equipment as well as base stat, remember to avoid overflows.
- i = status->str + sd->status.str + sd->param_bonus[0] + sd->param_equip[0];
- status->str = cap_value(i,0,USHRT_MAX);
- i = status->agi + sd->status.agi + sd->param_bonus[1] + sd->param_equip[1];
- status->agi = cap_value(i,0,USHRT_MAX);
- i = status->vit + sd->status.vit + sd->param_bonus[2] + sd->param_equip[2];
- status->vit = cap_value(i,0,USHRT_MAX);
- i = status->int_+ sd->status.int_+ sd->param_bonus[3] + sd->param_equip[3];
- status->int_ = cap_value(i,0,USHRT_MAX);
- i = status->dex + sd->status.dex + sd->param_bonus[4] + sd->param_equip[4];
- status->dex = cap_value(i,0,USHRT_MAX);
- i = status->luk + sd->status.luk + sd->param_bonus[5] + sd->param_equip[5];
- status->luk = cap_value(i,0,USHRT_MAX);
+ i = bstatus->str + sd->status.str + sd->param_bonus[0] + sd->param_equip[0];
+ bstatus->str = cap_value(i,0,USHRT_MAX);
+ i = bstatus->agi + sd->status.agi + sd->param_bonus[1] + sd->param_equip[1];
+ bstatus->agi = cap_value(i,0,USHRT_MAX);
+ i = bstatus->vit + sd->status.vit + sd->param_bonus[2] + sd->param_equip[2];
+ bstatus->vit = cap_value(i,0,USHRT_MAX);
+ i = bstatus->int_+ sd->status.int_+ sd->param_bonus[3] + sd->param_equip[3];
+ bstatus->int_ = cap_value(i,0,USHRT_MAX);
+ i = bstatus->dex + sd->status.dex + sd->param_bonus[4] + sd->param_equip[4];
+ bstatus->dex = cap_value(i,0,USHRT_MAX);
+ i = bstatus->luk + sd->status.luk + sd->param_bonus[5] + sd->param_equip[5];
+ bstatus->luk = cap_value(i,0,USHRT_MAX);
// ------ BASE ATTACK CALCULATION ------
// Base batk value is set on iStatus->calc_misc
// weapon-type bonus (FIXME: Why is the weapon_atk bonus applied to base attack?)
if (sd->status.weapon < MAX_WEAPON_TYPE && sd->weapon_atk[sd->status.weapon])
- status->batk += sd->weapon_atk[sd->status.weapon];
+ bstatus->batk += sd->weapon_atk[sd->status.weapon];
// Absolute modifiers from passive skills
#ifndef RENEWAL
if((skill_lv=pc->checkskill(sd,BS_HILTBINDING))>0) // it doesn't work in RE.
- status->batk += 4;
+ bstatus->batk += 4;
#endif
// ----- HP MAX CALCULATION -----
// Basic MaxHP value
//We hold the standard Max HP here to make it faster to recalculate on vit changes.
- sd->status.max_hp = status_base_pc_maxhp(sd,status);
+ sd->status.max_hp = status_base_pc_maxhp(sd,bstatus);
//This is done to handle underflows from negative Max HP bonuses
- i64 = sd->status.max_hp + (int)status->max_hp;
- status->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX);
+ i64 = sd->status.max_hp + (int)bstatus->max_hp;
+ bstatus->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
if((skill_lv=pc->checkskill(sd,CR_TRUST))>0)
- status->max_hp += skill_lv*200;
+ bstatus->max_hp += skill_lv*200;
// Apply relative modifiers from equipment
if(sd->hprate < 0)
sd->hprate = 0;
if(sd->hprate!=100)
- status->max_hp = (int64)status->max_hp * sd->hprate/100;
+ bstatus->max_hp = (int64)bstatus->max_hp * sd->hprate/100;
if(battle_config.hp_rate != 100)
- status->max_hp = (int64)status->max_hp * battle_config.hp_rate/100;
+ bstatus->max_hp = (int64)bstatus->max_hp * battle_config.hp_rate/100;
- if(status->max_hp > (unsigned int)battle_config.max_hp)
- status->max_hp = battle_config.max_hp;
- else if(!status->max_hp)
- status->max_hp = 1;
+ if(bstatus->max_hp > (unsigned int)battle_config.max_hp)
+ bstatus->max_hp = battle_config.max_hp;
+ else if(!bstatus->max_hp)
+ bstatus->max_hp = 1;
// ----- SP MAX CALCULATION -----
// Basic MaxSP value
- sd->status.max_sp = status_base_pc_maxsp(sd,status);
+ sd->status.max_sp = status_base_pc_maxsp(sd,bstatus);
//This is done to handle underflows from negative Max SP bonuses
- i64 = sd->status.max_sp + (int)status->max_sp;
- status->max_sp = (unsigned int)cap_value(i64, 0, INT_MAX);
+ i64 = sd->status.max_sp + (int)bstatus->max_sp;
+ bstatus->max_sp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
if((skill_lv=pc->checkskill(sd,SL_KAINA))>0)
- status->max_sp += 30*skill_lv;
+ bstatus->max_sp += 30*skill_lv;
if((skill_lv=pc->checkskill(sd,HP_MEDITATIO))>0)
- status->max_sp += (int64)status->max_sp * skill_lv/100;
+ bstatus->max_sp += (int64)bstatus->max_sp * skill_lv/100;
if((skill_lv=pc->checkskill(sd,HW_SOULDRAIN))>0)
- status->max_sp += (int64)status->max_sp * 2*skill_lv/100;
+ bstatus->max_sp += (int64)bstatus->max_sp * 2*skill_lv/100;
if( (skill_lv = pc->checkskill(sd,RA_RESEARCHTRAP)) > 0 )
- status->max_sp += 200 + 20 * skill_lv;
+ bstatus->max_sp += 200 + 20 * skill_lv;
if( (skill_lv = pc->checkskill(sd,WM_LESSON)) > 0 )
- status->max_sp += 30 * skill_lv;
+ bstatus->max_sp += 30 * skill_lv;
// Apply relative modifiers from equipment
if(sd->sprate < 0)
sd->sprate = 0;
if(sd->sprate!=100)
- status->max_sp = (int64)status->max_sp * sd->sprate/100;
+ bstatus->max_sp = (int64)bstatus->max_sp * sd->sprate/100;
if(battle_config.sp_rate != 100)
- status->max_sp = (int64)status->max_sp * battle_config.sp_rate/100;
+ bstatus->max_sp = (int64)bstatus->max_sp * battle_config.sp_rate/100;
- if(status->max_sp > (unsigned int)battle_config.max_sp)
- status->max_sp = battle_config.max_sp;
- else if(!status->max_sp)
- status->max_sp = 1;
+ if(bstatus->max_sp > (unsigned int)battle_config.max_sp)
+ bstatus->max_sp = battle_config.max_sp;
+ else if(!bstatus->max_sp)
+ bstatus->max_sp = 1;
// ----- RESPAWN HP/SP -----
//
//Calc respawn hp and store it on base_status
if (sd->special_state.restart_full_recover)
{
- status->hp = status->max_hp;
- status->sp = status->max_sp;
+ bstatus->hp = bstatus->max_hp;
+ bstatus->sp = bstatus->max_sp;
} else {
if((sd->class_&MAPID_BASEMASK) == MAPID_NOVICE && !(sd->class_&JOBL_2)
&& battle_config.restart_hp_rate < 50)
- status->hp = status->max_hp>>1;
+ bstatus->hp = bstatus->max_hp>>1;
else
- status->hp = (int64)status->max_hp * battle_config.restart_hp_rate/100;
- if(!status->hp)
- status->hp = 1;
+ bstatus->hp = (int64)bstatus->max_hp * battle_config.restart_hp_rate/100;
+ if(!bstatus->hp)
+ bstatus->hp = 1;
- status->sp = (int64)status->max_sp * battle_config.restart_sp_rate /100;
+ bstatus->sp = (int64)bstatus->max_sp * battle_config.restart_sp_rate /100;
- if( !status->sp ) /* the minimum for the respawn setting is SP:1 */
- status->sp = 1;
+ if( !bstatus->sp ) /* the minimum for the respawn setting is SP:1 */
+ bstatus->sp = 1;
}
// ----- MISC CALCULATION -----
- iStatus->calc_misc(&sd->bl, status, sd->status.base_level);
+ iStatus->calc_misc(&sd->bl, bstatus, sd->status.base_level);
//Equipment modifiers for misc settings
if(sd->matk_rate < 0)
sd->matk_rate = 0;
if(sd->matk_rate != 100){
- status->matk_max = status->matk_max * sd->matk_rate/100;
- status->matk_min = status->matk_min * sd->matk_rate/100;
+ bstatus->matk_max = bstatus->matk_max * sd->matk_rate/100;
+ bstatus->matk_min = bstatus->matk_min * sd->matk_rate/100;
}
if(sd->hit_rate < 0)
sd->hit_rate = 0;
if(sd->hit_rate != 100)
- status->hit = status->hit * sd->hit_rate/100;
+ bstatus->hit = bstatus->hit * sd->hit_rate/100;
if(sd->flee_rate < 0)
sd->flee_rate = 0;
if(sd->flee_rate != 100)
- status->flee = status->flee * sd->flee_rate/100;
+ bstatus->flee = bstatus->flee * sd->flee_rate/100;
if(sd->def2_rate < 0)
sd->def2_rate = 0;
if(sd->def2_rate != 100)
- status->def2 = status->def2 * sd->def2_rate/100;
+ bstatus->def2 = bstatus->def2 * sd->def2_rate/100;
if(sd->mdef2_rate < 0)
sd->mdef2_rate = 0;
if(sd->mdef2_rate != 100)
- status->mdef2 = status->mdef2 * sd->mdef2_rate/100;
+ bstatus->mdef2 = bstatus->mdef2 * sd->mdef2_rate/100;
if(sd->critical_rate < 0)
sd->critical_rate = 0;
if(sd->critical_rate != 100)
- status->cri = status->cri * sd->critical_rate/100;
+ bstatus->cri = bstatus->cri * sd->critical_rate/100;
if(sd->flee2_rate < 0)
sd->flee2_rate = 0;
if(sd->flee2_rate != 100)
- status->flee2 = status->flee2 * sd->flee2_rate/100;
+ bstatus->flee2 = bstatus->flee2 * sd->flee2_rate/100;
// ----- HIT CALCULATION -----
// Absolute modifiers from passive skills
#ifndef RENEWAL
if((skill_lv=pc->checkskill(sd,BS_WEAPONRESEARCH))>0) // is this correct in pre? there is already hitrate bonus in battle.c
- status->hit += skill_lv*2;
+ bstatus->hit += skill_lv*2;
#endif
if((skill_lv=pc->checkskill(sd,AC_VULTURE))>0) {
#ifndef RENEWAL
- status->hit += skill_lv;
+ bstatus->hit += skill_lv;
#endif
if(sd->status.weapon == W_BOW)
- status->rhw.range += skill_lv;
+ bstatus->rhw.range += skill_lv;
}
if(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE) {
if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0)
- status->hit += 2*skill_lv;
+ bstatus->hit += 2*skill_lv;
if((skill_lv=pc->checkskill(sd,GS_SNAKEEYE))>0) {
- status->hit += skill_lv;
- status->rhw.range += skill_lv;
+ bstatus->hit += skill_lv;
+ bstatus->rhw.range += skill_lv;
}
}
@@ -2926,24 +2910,23 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// Absolute modifiers from passive skills
if((skill_lv=pc->checkskill(sd,TF_MISS))>0)
- status->flee += skill_lv*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3);
+ bstatus->flee += skill_lv*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3);
if((skill_lv=pc->checkskill(sd,MO_DODGE))>0)
- status->flee += (skill_lv*3)>>1;
+ bstatus->flee += (skill_lv*3)>>1;
// ----- EQUIPMENT-DEF CALCULATION -----
// Apply relative modifiers from equipment
if(sd->def_rate < 0)
sd->def_rate = 0;
if(sd->def_rate != 100) {
- i = status->def * sd->def_rate/100;
- status->def = cap_value(i, DEFTYPE_MIN, DEFTYPE_MAX);
+ i = bstatus->def * sd->def_rate/100;
+ bstatus->def = cap_value(i, DEFTYPE_MIN, DEFTYPE_MAX);
}
#ifndef RENEWAL
- if (!battle_config.weapon_defense_type && status->def > battle_config.max_def)
- {
- status->def2 += battle_config.over_def_bonus*(status->def -battle_config.max_def);
- status->def = (unsigned char)battle_config.max_def;
+ if (!battle_config.weapon_defense_type && bstatus->def > battle_config.max_def) {
+ bstatus->def2 += battle_config.over_def_bonus*(bstatus->def -battle_config.max_def);
+ bstatus->def = (unsigned char)battle_config.max_def;
}
#endif
@@ -2953,15 +2936,14 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if(sd->mdef_rate < 0)
sd->mdef_rate = 0;
if(sd->mdef_rate != 100) {
- i = status->mdef * sd->mdef_rate/100;
- status->mdef = cap_value(i, DEFTYPE_MIN, DEFTYPE_MAX);
+ i = bstatus->mdef * sd->mdef_rate/100;
+ bstatus->mdef = cap_value(i, DEFTYPE_MIN, DEFTYPE_MAX);
}
#ifndef RENEWAL
- if (!battle_config.magic_defense_type && status->mdef > battle_config.max_def)
- {
- status->mdef2 += battle_config.over_def_bonus*(status->mdef -battle_config.max_def);
- status->mdef = (signed char)battle_config.max_def;
+ if (!battle_config.magic_defense_type && bstatus->mdef > battle_config.max_def) {
+ bstatus->mdef2 += battle_config.over_def_bonus*(bstatus->mdef -battle_config.max_def);
+ bstatus->mdef = (signed char)battle_config.max_def;
}
#endif
@@ -2969,44 +2951,44 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// Unlike other stats, ASPD rate modifiers from skills/SCs/items/etc are first all added together, then the final modifier is applied
// Basic ASPD value
- i = status_base_amotion_pc(sd,status);
- status->amotion = cap_value(i,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000);
+ i = status_base_amotion_pc(sd,bstatus);
+ bstatus->amotion = cap_value(i,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000);
// Relative modifiers from passive skills
#ifndef RENEWAL_ASPD
if((skill_lv=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
- status->aspd_rate -= 5*skill_lv;
+ bstatus->aspd_rate -= 5*skill_lv;
if((skill_lv = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
- status->aspd_rate -= 30*skill_lv;
+ bstatus->aspd_rate -= 30*skill_lv;
if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
- status->aspd_rate -= ((skill_lv+1)/2) * 10;
+ bstatus->aspd_rate -= ((skill_lv+1)/2) * 10;
if(pc_isriding(sd))
- status->aspd_rate += 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
+ bstatus->aspd_rate += 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
- status->aspd_rate += 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
+ bstatus->aspd_rate += 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#else // needs more info
if((skill_lv=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
- status->aspd_rate += 5*skill_lv;
+ bstatus->aspd_rate += 5*skill_lv;
if((skill_lv = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
- status->aspd_rate += 30*skill_lv;
+ bstatus->aspd_rate += 30*skill_lv;
if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
- status->aspd_rate += ((skill_lv+1)/2) * 10;
+ bstatus->aspd_rate += ((skill_lv+1)/2) * 10;
if(pc_isriding(sd))
- status->aspd_rate -= 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
+ bstatus->aspd_rate -= 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
- status->aspd_rate -= 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
+ bstatus->aspd_rate -= 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#endif
- status->adelay = 2*status->amotion;
+ bstatus->adelay = 2*bstatus->amotion;
// ----- DMOTION -----
//
- i = 800-status->agi*4;
- status->dmotion = cap_value(i, 400, 800);
+ i = 800-bstatus->agi*4;
+ bstatus->dmotion = cap_value(i, 400, 800);
if(battle_config.pc_damage_delay_rate != 100)
- status->dmotion = status->dmotion*battle_config.pc_damage_delay_rate/100;
+ bstatus->dmotion = bstatus->dmotion*battle_config.pc_damage_delay_rate/100;
// ----- MISC CALCULATIONS -----
@@ -3136,7 +3118,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if( sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 3 )
sd->magic_addele[ELE_EARTH] += 25;
}
- status_cpy(&sd->battle_status, status);
+ status_cpy(&sd->battle_status, bstatus);
// ----- CLIENT-SIDE REFRESH -----
if(!sd->bl.prev) {
@@ -3161,106 +3143,104 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
return 0;
}
-int status_calc_mercenary_(struct mercenary_data *md, bool first)
-{
- struct status_data *status = &md->base_status;
+int status_calc_mercenary_(struct mercenary_data *md, bool first) {
+ struct status_data *mstatus = &md->base_status;
struct s_mercenary *merc = &md->mercenary;
- if( first )
- {
- memcpy(status, &md->db->status, sizeof(struct status_data));
- status->mode = MD_CANMOVE|MD_CANATTACK;
- status->hp = status->max_hp;
- status->sp = status->max_sp;
+ if( first ) {
+ memcpy(mstatus, &md->db->status, sizeof(struct status_data));
+ mstatus->mode = MD_CANMOVE|MD_CANATTACK;
+ mstatus->hp = mstatus->max_hp;
+ mstatus->sp = mstatus->max_sp;
md->battle_status.hp = merc->hp;
md->battle_status.sp = merc->sp;
}
- iStatus->calc_misc(&md->bl, status, md->db->lv);
- status_cpy(&md->battle_status, status);
+ iStatus->calc_misc(&md->bl, mstatus, md->db->lv);
+ status_cpy(&md->battle_status, mstatus);
return 0;
}
int status_calc_homunculus_(struct homun_data *hd, bool first) {
- struct status_data *status = &hd->base_status;
+ struct status_data *hstatus = &hd->base_status;
struct s_homunculus *hom = &hd->homunculus;
int skill_lv;
int amotion;
- status->str = hom->str / 10;
- status->agi = hom->agi / 10;
- status->vit = hom->vit / 10;
- status->dex = hom->dex / 10;
- status->int_ = hom->int_ / 10;
- status->luk = hom->luk / 10;
+ hstatus->str = hom->str / 10;
+ hstatus->agi = hom->agi / 10;
+ hstatus->vit = hom->vit / 10;
+ hstatus->dex = hom->dex / 10;
+ hstatus->int_ = hom->int_ / 10;
+ hstatus->luk = hom->luk / 10;
if (first) { //[orn]
const struct s_homunculus_db *db = hd->homunculusDB;
- status->def_ele = db->element;
- status->ele_lv = 1;
- status->race = db->race;
- status->size = (hom->class_ == db->evo_class)?db->evo_size:db->base_size;
- status->rhw.range = 1 + status->size;
- status->mode = MD_CANMOVE|MD_CANATTACK;
- status->speed = DEFAULT_WALK_SPEED;
+ hstatus->def_ele = db->element;
+ hstatus->ele_lv = 1;
+ hstatus->race = db->race;
+ hstatus->size = (hom->class_ == db->evo_class)?db->evo_size:db->base_size;
+ hstatus->rhw.range = 1 + hstatus->size;
+ hstatus->mode = MD_CANMOVE|MD_CANATTACK;
+ hstatus->speed = DEFAULT_WALK_SPEED;
if (battle_config.hom_setting&0x8 && hd->master)
- status->speed = iStatus->get_speed(&hd->master->bl);
+ hstatus->speed = iStatus->get_speed(&hd->master->bl);
- status->hp = 1;
- status->sp = 1;
+ hstatus->hp = 1;
+ hstatus->sp = 1;
}
- skill_lv = hom->level/10 + status->vit/5;
- status->def = cap_value(skill_lv, 0, 99);
+ skill_lv = hom->level/10 + hstatus->vit/5;
+ hstatus->def = cap_value(skill_lv, 0, 99);
- skill_lv = hom->level/10 + status->int_/5;
- status->mdef = cap_value(skill_lv, 0, 99);
+ skill_lv = hom->level/10 + hstatus->int_/5;
+ hstatus->mdef = cap_value(skill_lv, 0, 99);
- status->max_hp = hom->max_hp ;
- status->max_sp = hom->max_sp ;
+ hstatus->max_hp = hom->max_hp;
+ hstatus->max_sp = hom->max_sp;
homun->calc_skilltree(hd, 0);
if((skill_lv=homun->checkskill(hd,HAMI_SKIN)) > 0)
- status->def += skill_lv * 4;
+ hstatus->def += skill_lv * 4;
if((skill_lv = homun->checkskill(hd,HVAN_INSTRUCT)) > 0) {
- status->int_ += 1 +skill_lv/2 +skill_lv/4 +skill_lv/5;
- status->str += 1 +skill_lv/3 +skill_lv/3 +skill_lv/4;
+ hstatus->int_ += 1 +skill_lv/2 +skill_lv/4 +skill_lv/5;
+ hstatus->str += 1 +skill_lv/3 +skill_lv/3 +skill_lv/4;
}
if((skill_lv=homun->checkskill(hd,HAMI_SKIN)) > 0)
- status->max_hp += skill_lv * 2 * status->max_hp / 100;
+ hstatus->max_hp += skill_lv * 2 * hstatus->max_hp / 100;
if((skill_lv = homun->checkskill(hd,HLIF_BRAIN)) > 0)
- status->max_sp += (1 +skill_lv/2 -skill_lv/4 +skill_lv/5) * status->max_sp / 100 ;
+ hstatus->max_sp += (1 +skill_lv/2 -skill_lv/4 +skill_lv/5) * hstatus->max_sp / 100;
if (first) {
- hd->battle_status.hp = hom->hp ;
- hd->battle_status.sp = hom->sp ;
+ hd->battle_status.hp = hom->hp;
+ hd->battle_status.sp = hom->sp;
}
- status->rhw.atk = status->dex;
- status->rhw.atk2 = status->str + hom->level;
+ hstatus->rhw.atk = hstatus->dex;
+ hstatus->rhw.atk2 = hstatus->str + hom->level;
- status->aspd_rate = 1000;
+ hstatus->aspd_rate = 1000;
- amotion = (1000 -4*status->agi -status->dex) * hd->homunculusDB->baseASPD/1000;
- status->amotion = cap_value(amotion,battle_config.max_aspd,2000);
- status->adelay = status->amotion; //It seems adelay = amotion for Homunculus.
+ amotion = (1000 -4*hstatus->agi -hstatus->dex) * hd->homunculusDB->baseASPD/1000;
+ hstatus->amotion = cap_value(amotion,battle_config.max_aspd,2000);
+ hstatus->adelay = hstatus->amotion; //It seems adelay = amotion for Homunculus.
- iStatus->calc_misc(&hd->bl, status, hom->level);
+ iStatus->calc_misc(&hd->bl, hstatus, hom->level);
#ifdef RENEWAL
- status->matk_max = status->matk_min;
+ hstatus->matk_max = hstatus->matk_min;
#endif
- status_cpy(&hd->battle_status, status);
+ status_cpy(&hd->battle_status, hstatus);
return 1;
}
int status_calc_elemental_(struct elemental_data *ed, bool first) {
- struct status_data *status = &ed->base_status;
+ struct status_data *estatus = &ed->base_status;
struct s_elemental *ele = &ed->elemental;
struct map_session_data *sd = ed->master;
@@ -3268,66 +3248,66 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) {
return 0;
if( first ) {
- memcpy(status, &ed->db->status, sizeof(struct status_data));
+ memcpy(estatus, &ed->db->status, sizeof(struct status_data));
if( !ele->mode )
- status->mode = EL_MODE_PASSIVE;
+ estatus->mode = EL_MODE_PASSIVE;
else
- status->mode = ele->mode;
+ estatus->mode = ele->mode;
- iStatus->calc_misc(&ed->bl, status, 0);
+ iStatus->calc_misc(&ed->bl, estatus, 0);
- status->max_hp = ele->max_hp;
- status->max_sp = ele->max_sp;
- status->hp = ele->hp;
- status->sp = ele->sp;
- status->rhw.atk = ele->atk;
- status->rhw.atk2 = ele->atk2;
+ estatus->max_hp = ele->max_hp;
+ estatus->max_sp = ele->max_sp;
+ estatus->hp = ele->hp;
+ estatus->sp = ele->sp;
+ estatus->rhw.atk = ele->atk;
+ estatus->rhw.atk2 = ele->atk2;
- status->matk_min += ele->matk;
- status->def += ele->def;
- status->mdef += ele->mdef;
- status->flee = ele->flee;
- status->hit = ele->hit;
+ estatus->matk_min += ele->matk;
+ estatus->def += ele->def;
+ estatus->mdef += ele->mdef;
+ estatus->flee = ele->flee;
+ estatus->hit = ele->hit;
- memcpy(&ed->battle_status,status,sizeof(struct status_data));
+ memcpy(&ed->battle_status,estatus,sizeof(struct status_data));
} else {
- iStatus->calc_misc(&ed->bl, status, 0);
- status_cpy(&ed->battle_status, status);
+ iStatus->calc_misc(&ed->bl, estatus, 0);
+ status_cpy(&ed->battle_status, estatus);
}
return 0;
}
int status_calc_npc_(struct npc_data *nd, bool first) {
- struct status_data *status = &nd->status;
+ struct status_data *nstatus = &nd->status;
if (!nd)
return 0;
if (first) {
- status->hp = 1;
- status->sp = 1;
- status->max_hp = 1;
- status->max_sp = 1;
-
- status->def_ele = ELE_NEUTRAL;
- status->ele_lv = 1;
- status->race = RC_DEMIHUMAN;
- status->size = nd->size;
- status->rhw.range = 1 + status->size;
- status->mode = (MD_CANMOVE|MD_CANATTACK);
- status->speed = nd->speed;
- }
-
- status->str = nd->stat_point;
- status->agi = nd->stat_point;
- status->vit = nd->stat_point;
- status->int_= nd->stat_point;
- status->dex = nd->stat_point;
- status->luk = nd->stat_point;
-
- iStatus->calc_misc(&nd->bl, status, nd->level);
- status_cpy(&nd->status, status);
+ nstatus->hp = 1;
+ nstatus->sp = 1;
+ nstatus->max_hp = 1;
+ nstatus->max_sp = 1;
+
+ nstatus->def_ele = ELE_NEUTRAL;
+ nstatus->ele_lv = 1;
+ nstatus->race = RC_DEMIHUMAN;
+ nstatus->size = nd->size;
+ nstatus->rhw.range = 1 + nstatus->size;
+ nstatus->mode = (MD_CANMOVE|MD_CANATTACK);
+ nstatus->speed = nd->speed;
+ }
+
+ nstatus->str = nd->stat_point;
+ nstatus->agi = nd->stat_point;
+ nstatus->vit = nd->stat_point;
+ nstatus->int_= nd->stat_point;
+ nstatus->dex = nd->stat_point;
+ nstatus->luk = nd->stat_point;
+
+ iStatus->calc_misc(&nd->bl, nstatus, nd->level);
+ status_cpy(&nd->status, nstatus);
return 0;
}
@@ -3363,7 +3343,7 @@ static unsigned short status_calc_batk(struct block_list *,struct status_change
#endif
//Calculates base regen values.
-void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen) {
+void status_calc_regen(struct block_list *bl, struct status_data *st, struct regen_data *regen) {
struct map_session_data *sd;
int val, skill_lv, reg_flag;
@@ -3371,7 +3351,7 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
return;
sd = BL_CAST(BL_PC,bl);
- val = 1 + (status->vit/5) + (status->max_hp/200);
+ val = 1 + (st->vit/5) + (st->max_hp/200);
if( sd && sd->hprecov_rate != 100 )
val = val*sd->hprecov_rate/100;
@@ -3380,9 +3360,9 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
regen->hp = cap_value(val, reg_flag, SHRT_MAX);
- val = 1 + (status->int_/6) + (status->max_sp/100);
- if( status->int_ >= 120 )
- val += ((status->int_-120)>>1) + 4;
+ val = 1 + (st->int_/6) + (st->max_sp/100);
+ if( st->int_ >= 120 )
+ val += ((st->int_-120)>>1) + 4;
if( sd && sd->sprecov_rate != 100 )
val = val*sd->sprecov_rate/100;
@@ -3400,14 +3380,14 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
val = 0;
if( (skill_lv=pc->checkskill(sd,SM_RECOVERY)) > 0 )
- val += skill_lv*5 + skill_lv*status->max_hp/500;
+ val += skill_lv*5 + skill_lv*st->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
if( (skill_lv=pc->checkskill(sd,MG_SRECOVERY)) > 0 )
- val += skill_lv*3 + skill_lv*status->max_sp/500;
+ val += skill_lv*3 + skill_lv*st->max_sp/500;
if( (skill_lv=pc->checkskill(sd,NJ_NINPOU)) > 0 )
- val += skill_lv*3 + skill_lv*status->max_sp/500;
+ val += skill_lv*3 + skill_lv*st->max_sp/500;
if( (skill_lv=pc->checkskill(sd,WM_LESSON)) > 0 )
val += 3 + 3 * skill_lv;
@@ -3418,20 +3398,20 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
val = 0;
if( (skill_lv=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
- val += skill_lv*4 + skill_lv*status->max_hp/500;
+ val += skill_lv*4 + skill_lv*st->max_hp/500;
if( (skill_lv=pc->checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest )
- val += skill_lv*30 + skill_lv*status->max_hp/500;
+ val += skill_lv*30 + skill_lv*st->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
if( (skill_lv=pc->checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest ) {
- val += skill_lv*3 + skill_lv*status->max_sp/500;
+ val += skill_lv*3 + skill_lv*st->max_sp/500;
if ((skill_lv=pc->checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
val += (30+10*skill_lv)*val/100;
}
if( (skill_lv=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
- val += skill_lv*2 + skill_lv*status->max_sp/500;
+ val += skill_lv*2 + skill_lv*st->max_sp/500;
sregen->sp = cap_value(val, 0, SHRT_MAX);
}
@@ -3446,16 +3426,16 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
regen->sp = cap_value(val, 1, SHRT_MAX);
}
} else if( bl->type == BL_MER ) {
- val = (status->max_hp * status->vit / 10000 + 1) * 6;
+ val = (st->max_hp * st->vit / 10000 + 1) * 6;
regen->hp = cap_value(val, 1, SHRT_MAX);
- val = (status->max_sp * (status->int_ + 10) / 750) + 1;
+ val = (st->max_sp * (st->int_ + 10) / 750) + 1;
regen->sp = cap_value(val, 1, SHRT_MAX);
} else if( bl->type == BL_ELEM ) {
- val = (status->max_hp * status->vit / 10000 + 1) * 6;
+ val = (st->max_hp * st->vit / 10000 + 1) * 6;
regen->hp = cap_value(val, 1, SHRT_MAX);
- val = (status->max_sp * (status->int_ + 10) / 750) + 1;
+ val = (st->max_sp * (st->int_ + 10) / 750) + 1;
regen->sp = cap_value(val, 1, SHRT_MAX);
}
}
@@ -3546,31 +3526,30 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str
}
/// Recalculates parts of an object's battle status according to the specified flags.
/// @param flag bitfield of values from enum scb_flag
-void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
-{
- const struct status_data *b_status = iStatus->get_base_status(bl);
- struct status_data *status = iStatus->get_status_data(bl);
+void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
+ const struct status_data *bst = iStatus->get_base_status(bl);
+ struct status_data *st = iStatus->get_status_data(bl);
struct status_change *sc = iStatus->get_sc(bl);
TBL_PC *sd = BL_CAST(BL_PC,bl);
int temp;
- if (!b_status || !status)
+ if (!bst || !st)
return;
if((!(bl->type&BL_REGEN)) && (!sc || !sc->count)) { //No difference.
- status_cpy(status, b_status);
+ status_cpy(st, bst);
return;
}
if(flag&SCB_STR) {
- status->str = status_calc_str(bl, sc, b_status->str);
+ st->str = status_calc_str(bl, sc, bst->str);
flag|=SCB_BATK;
if( bl->type&BL_HOM )
flag |= SCB_WATK;
}
if(flag&SCB_AGI) {
- status->agi = status_calc_agi(bl, sc, b_status->agi);
+ st->agi = status_calc_agi(bl, sc, bst->agi);
flag|=SCB_FLEE
#ifdef RENEWAL
|SCB_DEF2
@@ -3581,7 +3560,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
}
if(flag&SCB_VIT) {
- status->vit = status_calc_vit(bl, sc, b_status->vit);
+ st->vit = status_calc_vit(bl, sc, bst->vit);
flag|=SCB_DEF2|SCB_MDEF2;
if( bl->type&(BL_PC|BL_HOM|BL_MER|BL_ELEM) )
flag |= SCB_MAXHP;
@@ -3590,7 +3569,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
}
if(flag&SCB_INT) {
- status->int_ = status_calc_int(bl, sc, b_status->int_);
+ st->int_ = status_calc_int(bl, sc, bst->int_);
flag|=SCB_MATK|SCB_MDEF2;
if( bl->type&(BL_PC|BL_HOM|BL_MER|BL_ELEM) )
flag |= SCB_MAXSP;
@@ -3599,7 +3578,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
}
if(flag&SCB_DEX) {
- status->dex = status_calc_dex(bl, sc, b_status->dex);
+ st->dex = status_calc_dex(bl, sc, bst->dex);
flag|=SCB_BATK|SCB_HIT
#ifdef RENEWAL
|SCB_MATK|SCB_MDEF2
@@ -3612,7 +3591,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
}
if(flag&SCB_LUK) {
- status->luk = status_calc_luk(bl, sc, b_status->luk);
+ st->luk = status_calc_luk(bl, sc, bst->luk);
flag|=SCB_BATK|SCB_CRI|SCB_FLEE2
#ifdef RENEWAL
|SCB_MATK|SCB_HIT|SCB_FLEE
@@ -3620,125 +3599,121 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
;
}
- if(flag&SCB_BATK && b_status->batk) {
- status->batk = status_base_atk(bl,status);
- temp = b_status->batk - status_base_atk(bl,b_status);
- if (temp)
- {
- temp += status->batk;
- status->batk = cap_value(temp, 0, USHRT_MAX);
+ if(flag&SCB_BATK && bst->batk) {
+ st->batk = status_base_atk(bl,st);
+ temp = bst->batk - status_base_atk(bl,bst);
+ if (temp) {
+ temp += st->batk;
+ st->batk = cap_value(temp, 0, USHRT_MAX);
}
- status->batk = iStatus->calc_batk(bl, sc, status->batk, true);
+ st->batk = iStatus->calc_batk(bl, sc, st->batk, true);
}
if(flag&SCB_WATK) {
- status->rhw.atk = status_calc_watk(bl, sc, b_status->rhw.atk, true);
+ st->rhw.atk = status_calc_watk(bl, sc, bst->rhw.atk, true);
if (!sd) //Should not affect weapon refine bonus
- status->rhw.atk2 = status_calc_watk(bl, sc, b_status->rhw.atk2, true);
+ st->rhw.atk2 = status_calc_watk(bl, sc, bst->rhw.atk2, true);
- if(b_status->lhw.atk) {
+ if(bst->lhw.atk) {
if (sd) {
sd->state.lr_flag = 1;
- status->lhw.atk = status_calc_watk(bl, sc, b_status->lhw.atk, true);
+ st->lhw.atk = status_calc_watk(bl, sc, bst->lhw.atk, true);
sd->state.lr_flag = 0;
} else {
- status->lhw.atk = status_calc_watk(bl, sc, b_status->lhw.atk, true);
- status->lhw.atk2 = status_calc_watk(bl, sc, b_status->lhw.atk2, true);
+ st->lhw.atk = status_calc_watk(bl, sc, bst->lhw.atk, true);
+ st->lhw.atk2 = status_calc_watk(bl, sc, bst->lhw.atk2, true);
}
}
- if( bl->type&BL_HOM )
- {
- status->rhw.atk += (status->dex - b_status->dex);
- status->rhw.atk2 += (status->str - b_status->str);
- if( status->rhw.atk2 < status->rhw.atk )
- status->rhw.atk2 = status->rhw.atk;
+ if( bl->type&BL_HOM ) {
+ st->rhw.atk += (st->dex - bst->dex);
+ st->rhw.atk2 += (st->str - bst->str);
+ if( st->rhw.atk2 < st->rhw.atk )
+ st->rhw.atk2 = st->rhw.atk;
}
}
if(flag&SCB_HIT) {
- if (status->dex == b_status->dex
+ if (st->dex == bst->dex
#ifdef RENEWAL
- && status->luk == b_status->luk
+ && st->luk == bst->luk
#endif
)
- status->hit = status_calc_hit(bl, sc, b_status->hit, true);
+ st->hit = status_calc_hit(bl, sc, bst->hit, true);
else
- status->hit = status_calc_hit(bl, sc, b_status->hit + (status->dex - b_status->dex)
+ st->hit = status_calc_hit(bl, sc, bst->hit + (st->dex - bst->dex)
#ifdef RENEWAL
- + (status->luk/3 - b_status->luk/3)
+ + (st->luk/3 - bst->luk/3)
#endif
, true);
}
if(flag&SCB_FLEE) {
- if (status->agi == b_status->agi
+ if (st->agi == bst->agi
#ifdef RENEWAL
- && status->luk == b_status->luk
+ && st->luk == bst->luk
#endif
)
- status->flee = status_calc_flee(bl, sc, b_status->flee, true);
+ st->flee = status_calc_flee(bl, sc, bst->flee, true);
else
- status->flee = status_calc_flee(bl, sc, b_status->flee +(status->agi - b_status->agi)
+ st->flee = status_calc_flee(bl, sc, bst->flee +(st->agi - bst->agi)
#ifdef RENEWAL
- + (status->luk/5 - b_status->luk/5)
+ + (st->luk/5 - bst->luk/5)
#endif
, true);
}
- if(flag&SCB_DEF)
- {
- status->def = iStatus->calc_def(bl, sc, b_status->def, true);
+ if(flag&SCB_DEF) {
+ st->def = iStatus->calc_def(bl, sc, bst->def, true);
if( bl->type&BL_HOM )
- status->def += (status->vit/5 - b_status->vit/5);
+ st->def += (st->vit/5 - bst->vit/5);
}
if(flag&SCB_DEF2) {
- if (status->vit == b_status->vit
+ if (st->vit == bst->vit
#ifdef RENEWAL
- && status->agi == b_status->agi
+ && st->agi == bst->agi
#endif
)
- status->def2 = iStatus->calc_def2(bl, sc, b_status->def2, true);
+ st->def2 = iStatus->calc_def2(bl, sc, bst->def2, true);
else
- status->def2 = iStatus->calc_def2(bl, sc, b_status->def2
+ st->def2 = iStatus->calc_def2(bl, sc, bst->def2
#ifdef RENEWAL
- + (int)( ((float)status->vit/2 - (float)b_status->vit/2) + ((float)status->agi/5 - (float)b_status->agi/5) )
+ + (int)( ((float)st->vit/2 - (float)bst->vit/2) + ((float)st->agi/5 - (float)bst->agi/5) )
#else
- + (status->vit - b_status->vit)
+ + (st->vit - bst->vit)
#endif
, true);
}
- if(flag&SCB_MDEF)
- {
- status->mdef = iStatus->calc_mdef(bl, sc, b_status->mdef, true);
+ if(flag&SCB_MDEF) {
+ st->mdef = iStatus->calc_mdef(bl, sc, bst->mdef, true);
if( bl->type&BL_HOM )
- status->mdef += (status->int_/5 - b_status->int_/5);
+ st->mdef += (st->int_/5 - bst->int_/5);
}
if(flag&SCB_MDEF2) {
- if (status->int_ == b_status->int_ && status->vit == b_status->vit
+ if (st->int_ == bst->int_ && st->vit == bst->vit
#ifdef RENEWAL
- && status->dex == b_status->dex
+ && st->dex == bst->dex
#endif
)
- status->mdef2 = iStatus->calc_mdef2(bl, sc, b_status->mdef2, true);
+ st->mdef2 = iStatus->calc_mdef2(bl, sc, bst->mdef2, true);
else
- status->mdef2 = iStatus->calc_mdef2(bl, sc, b_status->mdef2 +(status->int_ - b_status->int_)
+ st->mdef2 = iStatus->calc_mdef2(bl, sc, bst->mdef2 +(st->int_ - bst->int_)
#ifdef RENEWAL
- + (int)( ((float)status->dex/5 - (float)b_status->dex/5) + ((float)status->vit/5 - (float)b_status->vit/5) )
+ + (int)( ((float)st->dex/5 - (float)bst->dex/5) + ((float)st->vit/5 - (float)bst->vit/5) )
#else
- + ((status->vit - b_status->vit)>>1)
+ + ((st->vit - bst->vit)>>1)
#endif
, true);
}
if(flag&SCB_SPEED) {
struct unit_data *ud = unit->bl2ud(bl);
- status->speed = status_calc_speed(bl, sc, b_status->speed);
+ st->speed = status_calc_speed(bl, sc, bst->speed);
//Re-walk to adjust speed (we do not check if walktimer != INVALID_TIMER
//because if you step on something while walking, the moment this
@@ -3746,54 +3721,53 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
if (ud)
ud->state.change_walk_target = ud->state.speed_changed = 1;
- if( bl->type&BL_PC && status->speed < battle_config.max_walk_speed )
- status->speed = battle_config.max_walk_speed;
+ if( bl->type&BL_PC && st->speed < battle_config.max_walk_speed )
+ st->speed = battle_config.max_walk_speed;
if( bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((TBL_HOM*)bl)->master)
- status->speed = iStatus->get_speed(&((TBL_HOM*)bl)->master->bl);
+ st->speed = iStatus->get_speed(&((TBL_HOM*)bl)->master->bl);
}
- if(flag&SCB_CRI && b_status->cri) {
- if (status->luk == b_status->luk)
- status->cri = status_calc_critical(bl, sc, b_status->cri, true);
+ if(flag&SCB_CRI && bst->cri) {
+ if (st->luk == bst->luk)
+ st->cri = status_calc_critical(bl, sc, bst->cri, true);
else
- status->cri = status_calc_critical(bl, sc, b_status->cri + 3*(status->luk - b_status->luk), true);
+ st->cri = status_calc_critical(bl, sc, bst->cri + 3*(st->luk - bst->luk), true);
/**
* after status_calc_critical so the bonus is applied despite if you have or not a sc bugreport:5240
**/
if( bl->type == BL_PC && ((TBL_PC*)bl)->status.weapon == W_KATAR )
- status->cri <<= 1;
+ st->cri <<= 1;
}
- if(flag&SCB_FLEE2 && b_status->flee2) {
- if (status->luk == b_status->luk)
- status->flee2 = status_calc_flee2(bl, sc, b_status->flee2, true);
+ if(flag&SCB_FLEE2 && bst->flee2) {
+ if (st->luk == bst->luk)
+ st->flee2 = status_calc_flee2(bl, sc, bst->flee2, true);
else
- status->flee2 = status_calc_flee2(bl, sc, b_status->flee2 +(status->luk - b_status->luk), true);
+ st->flee2 = status_calc_flee2(bl, sc, bst->flee2 +(st->luk - bst->luk), true);
}
if(flag&SCB_ATK_ELE) {
- status->rhw.ele = iStatus->calc_attack_element(bl, sc, b_status->rhw.ele);
+ st->rhw.ele = iStatus->calc_attack_element(bl, sc, bst->rhw.ele);
if (sd) sd->state.lr_flag = 1;
- status->lhw.ele = iStatus->calc_attack_element(bl, sc, b_status->lhw.ele);
+ st->lhw.ele = iStatus->calc_attack_element(bl, sc, bst->lhw.ele);
if (sd) sd->state.lr_flag = 0;
}
if(flag&SCB_DEF_ELE) {
- status->def_ele = status_calc_element(bl, sc, b_status->def_ele);
- status->ele_lv = status_calc_element_lv(bl, sc, b_status->ele_lv);
+ st->def_ele = status_calc_element(bl, sc, bst->def_ele);
+ st->ele_lv = status_calc_element_lv(bl, sc, bst->ele_lv);
}
- if(flag&SCB_MODE)
- {
- status->mode = status_calc_mode(bl, sc, b_status->mode);
+ if(flag&SCB_MODE) {
+ st->mode = status_calc_mode(bl, sc, bst->mode);
//Since mode changed, reset their state.
- if (!(status->mode&MD_CANATTACK))
+ if (!(st->mode&MD_CANATTACK))
unit->stop_attack(bl);
- if (!(status->mode&MD_CANMOVE))
+ if (!(st->mode&MD_CANMOVE))
unit->stop_walking(bl,1);
}
@@ -3803,47 +3777,40 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
// if(flag&SCB_RANGE)
if(flag&SCB_MAXHP) {
- if( bl->type&BL_PC )
- {
- status->max_hp = status_base_pc_maxhp(sd,status);
- status->max_hp += b_status->max_hp - sd->status.max_hp;
+ if( bl->type&BL_PC ) {
+ st->max_hp = status_base_pc_maxhp(sd,st);
+ st->max_hp += bst->max_hp - sd->status.max_hp;
- status->max_hp = status_calc_maxhp(bl, sc, status->max_hp);
+ st->max_hp = status_calc_maxhp(bl, sc, st->max_hp);
- if( status->max_hp > (unsigned int)battle_config.max_hp )
- status->max_hp = (unsigned int)battle_config.max_hp;
- }
- else
- {
- status->max_hp = status_calc_maxhp(bl, sc, b_status->max_hp);
+ if( st->max_hp > (unsigned int)battle_config.max_hp )
+ st->max_hp = (unsigned int)battle_config.max_hp;
+ } else {
+ st->max_hp = status_calc_maxhp(bl, sc, bst->max_hp);
}
- if( status->hp > status->max_hp ) //FIXME: Should perhaps a status_zap should be issued?
- {
- status->hp = status->max_hp;
+ if( st->hp > st->max_hp ) {
+ //FIXME: Should perhaps a status_zap should be issued?
+ st->hp = st->max_hp;
if( sd ) clif->updatestatus(sd,SP_HP);
}
}
if(flag&SCB_MAXSP) {
- if( bl->type&BL_PC )
- {
- status->max_sp = status_base_pc_maxsp(sd,status);
- status->max_sp += b_status->max_sp - sd->status.max_sp;
+ if( bl->type&BL_PC ) {
+ st->max_sp = status_base_pc_maxsp(sd,st);
+ st->max_sp += bst->max_sp - sd->status.max_sp;
- status->max_sp = status_calc_maxsp(&sd->bl, &sd->sc, status->max_sp);
+ st->max_sp = status_calc_maxsp(&sd->bl, &sd->sc, st->max_sp);
- if( status->max_sp > (unsigned int)battle_config.max_sp )
- status->max_sp = (unsigned int)battle_config.max_sp;
- }
- else
- {
- status->max_sp = status_calc_maxsp(bl, sc, b_status->max_sp);
+ if( st->max_sp > (unsigned int)battle_config.max_sp )
+ st->max_sp = (unsigned int)battle_config.max_sp;
+ } else {
+ st->max_sp = status_calc_maxsp(bl, sc, bst->max_sp);
}
- if( status->sp > status->max_sp )
- {
- status->sp = status->max_sp;
+ if( st->sp > st->max_sp ) {
+ st->sp = st->max_sp;
if( sd ) clif->updatestatus(sd,SP_SP);
}
}
@@ -3854,84 +3821,78 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
if(flag&SCB_ASPD) {
int amotion;
- if( bl->type&BL_PC )
- {
- amotion = status_base_amotion_pc(sd,status);
+ if( bl->type&BL_PC ) {
+ amotion = status_base_amotion_pc(sd,st);
#ifndef RENEWAL_ASPD
- status->aspd_rate = status_calc_aspd_rate(bl, sc, b_status->aspd_rate);
+ st->aspd_rate = status_calc_aspd_rate(bl, sc, bst->aspd_rate);
- if(status->aspd_rate != 1000)
- amotion = amotion*status->aspd_rate/1000;
+ if(st->aspd_rate != 1000)
+ amotion = amotion*st->aspd_rate/1000;
#else
// aspd = baseaspd + floor(sqrt((agi^2/2) + (dex^2/5))/4 + (potskillbonus*agi/200))
- amotion -= (int)(sqrt( (pow(status->agi, 2) / 2) + (pow(status->dex, 2) / 5) ) / 4 + ((float)status_calc_aspd(bl, sc, 1) * status->agi / 200)) * 10;
+ amotion -= (int)(sqrt( (pow(st->agi, 2) / 2) + (pow(st->dex, 2) / 5) ) / 4 + ((float)status_calc_aspd(bl, sc, 1) * st->agi / 200)) * 10;
- if( (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) != 0 ) // RE ASPD percertage modifier
+ if( (status_calc_aspd(bl, sc, 2) + st->aspd_rate2) != 0 ) // RE ASPD percertage modifier
amotion -= (( amotion - ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd) )
- * (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) / 10 + 5) / 10;
+ * (status_calc_aspd(bl, sc, 2) + st->aspd_rate2) / 10 + 5) / 10;
- if(status->aspd_rate != 1000) // absolute percentage modifier
- amotion = ( 200 - (200-amotion/10) * status->aspd_rate / 1000 ) * 10;
+ if(st->aspd_rate != 1000) // absolute percentage modifier
+ amotion = ( 200 - (200-amotion/10) * st->aspd_rate / 1000 ) * 10;
#endif
amotion = status_calc_fix_aspd(bl, sc, amotion);
- status->amotion = cap_value(amotion,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000);
+ st->amotion = cap_value(amotion,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000);
- status->adelay = 2*status->amotion;
- }
- else
- if( bl->type&BL_HOM )
- {
- amotion = (1000 -4*status->agi -status->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD/1000;
- status->aspd_rate = status_calc_aspd_rate(bl, sc, b_status->aspd_rate);
+ st->adelay = 2*st->amotion;
+ } else if( bl->type&BL_HOM ) {
+ amotion = (1000 - 4*st->agi - st->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD/1000;
+ st->aspd_rate = status_calc_aspd_rate(bl, sc, bst->aspd_rate);
- if(status->aspd_rate != 1000)
- amotion = amotion*status->aspd_rate/1000;
+ if(st->aspd_rate != 1000)
+ amotion = amotion*st->aspd_rate/1000;
- amotion = status_calc_fix_aspd(bl, sc, amotion);
- status->amotion = cap_value(amotion,battle_config.max_aspd,2000);
+ amotion = status_calc_fix_aspd(bl, sc, amotion);
+ st->amotion = cap_value(amotion,battle_config.max_aspd,2000);
- status->adelay = status->amotion;
- }
- else // mercenary and mobs
- {
- amotion = b_status->amotion;
- status->aspd_rate = status_calc_aspd_rate(bl, sc, b_status->aspd_rate);
+ st->adelay = st->amotion;
+ } else { // mercenary and mobs
+ amotion = bst->amotion;
+ st->aspd_rate = status_calc_aspd_rate(bl, sc, bst->aspd_rate);
- if(status->aspd_rate != 1000)
- amotion = amotion*status->aspd_rate/1000;
+ if(st->aspd_rate != 1000)
+ amotion = amotion*st->aspd_rate/1000;
- amotion = status_calc_fix_aspd(bl, sc, amotion);
- status->amotion = cap_value(amotion, battle_config.monster_max_aspd, 2000);
+ amotion = status_calc_fix_aspd(bl, sc, amotion);
+ st->amotion = cap_value(amotion, battle_config.monster_max_aspd, 2000);
- temp = b_status->adelay*status->aspd_rate/1000;
- status->adelay = cap_value(temp, battle_config.monster_max_aspd*2, 4000);
- }
+ temp = bst->adelay*st->aspd_rate/1000;
+ st->adelay = cap_value(temp, battle_config.monster_max_aspd*2, 4000);
+ }
}
if(flag&SCB_DSPD) {
int dmotion;
if( bl->type&BL_PC ) {
- if (b_status->agi == status->agi)
- status->dmotion = status_calc_dmotion(bl, sc, b_status->dmotion);
+ if (bst->agi == st->agi)
+ st->dmotion = status_calc_dmotion(bl, sc, bst->dmotion);
else {
- dmotion = 800-status->agi*4;
- status->dmotion = cap_value(dmotion, 400, 800);
+ dmotion = 800-st->agi*4;
+ st->dmotion = cap_value(dmotion, 400, 800);
if(battle_config.pc_damage_delay_rate != 100)
- status->dmotion = status->dmotion*battle_config.pc_damage_delay_rate/100;
- //It's safe to ignore b_status->dmotion since no bonus affects it.
- status->dmotion = status_calc_dmotion(bl, sc, status->dmotion);
+ st->dmotion = st->dmotion*battle_config.pc_damage_delay_rate/100;
+ //It's safe to ignore bst->dmotion since no bonus affects it.
+ st->dmotion = status_calc_dmotion(bl, sc, st->dmotion);
}
} else if( bl->type&BL_HOM ) {
- dmotion = 800-status->agi*4;
- status->dmotion = cap_value(dmotion, 400, 800);
- status->dmotion = status_calc_dmotion(bl, sc, b_status->dmotion);
+ dmotion = 800-st->agi*4;
+ st->dmotion = cap_value(dmotion, 400, 800);
+ st->dmotion = status_calc_dmotion(bl, sc, bst->dmotion);
} else { // mercenary and mobs
- status->dmotion = status_calc_dmotion(bl, sc, b_status->dmotion);
+ st->dmotion = status_calc_dmotion(bl, sc, bst->dmotion);
}
}
if(flag&(SCB_VIT|SCB_MAXHP|SCB_INT|SCB_MAXSP) && bl->type&BL_REGEN)
- iStatus->calc_regen(bl, status, iStatus->get_regen_data(bl));
+ iStatus->calc_regen(bl, st, iStatus->get_regen_data(bl));
if(flag&SCB_REGEN && bl->type&BL_REGEN)
iStatus->calc_regen_rate(bl, iStatus->get_regen_data(bl), sc);
@@ -3940,10 +3901,9 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
/// Also sends updates to the client wherever applicable.
/// @param flag bitfield of values from enum scb_flag
/// @param first if true, will cause status_calc_* functions to run their base status initialization code
-void status_calc_bl_(struct block_list* bl, enum scb_flag flag, bool first)
-{
- struct status_data b_status; // previous battle status
- struct status_data* status; // pointer to current battle status
+void status_calc_bl_(struct block_list *bl, enum scb_flag flag, bool first) {
+ struct status_data bst; // previous battle status
+ struct status_data *st; // pointer to current battle status
if( bl->type == BL_PC && ((TBL_PC*)bl)->delayed_damage != 0 ) {
((TBL_PC*)bl)->state.hold_recalc = 1;
@@ -3951,8 +3911,8 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, bool first)
}
// remember previous values
- status = iStatus->get_status_data(bl);
- memcpy(&b_status, status, sizeof(struct status_data));
+ st = iStatus->get_status_data(bl);
+ memcpy(&bst, st, sizeof(struct status_data));
if( flag&SCB_BASE ) {// calculate the object's base status too
switch( bl->type ) {
@@ -3978,137 +3938,136 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, bool first)
return; // client update handled by caller
// compare against new values and send client updates
- if( bl->type == BL_PC )
- {
+ if( bl->type == BL_PC ) {
TBL_PC* sd = BL_CAST(BL_PC, bl);
- if(b_status.str != status->str)
+ if(bst.str != st->str)
clif->updatestatus(sd,SP_STR);
- if(b_status.agi != status->agi)
+ if(bst.agi != st->agi)
clif->updatestatus(sd,SP_AGI);
- if(b_status.vit != status->vit)
+ if(bst.vit != st->vit)
clif->updatestatus(sd,SP_VIT);
- if(b_status.int_ != status->int_)
+ if(bst.int_ != st->int_)
clif->updatestatus(sd,SP_INT);
- if(b_status.dex != status->dex)
+ if(bst.dex != st->dex)
clif->updatestatus(sd,SP_DEX);
- if(b_status.luk != status->luk)
+ if(bst.luk != st->luk)
clif->updatestatus(sd,SP_LUK);
- if(b_status.hit != status->hit)
+ if(bst.hit != st->hit)
clif->updatestatus(sd,SP_HIT);
- if(b_status.flee != status->flee)
+ if(bst.flee != st->flee)
clif->updatestatus(sd,SP_FLEE1);
- if(b_status.amotion != status->amotion)
+ if(bst.amotion != st->amotion)
clif->updatestatus(sd,SP_ASPD);
- if(b_status.speed != status->speed)
+ if(bst.speed != st->speed)
clif->updatestatus(sd,SP_SPEED);
- if(b_status.batk != status->batk
+ if(bst.batk != st->batk
#ifndef RENEWAL
- || b_status.rhw.atk != status->rhw.atk || b_status.lhw.atk != status->lhw.atk
+ || bst.rhw.atk != st->rhw.atk || bst.lhw.atk != st->lhw.atk
#endif
- )
+ )
clif->updatestatus(sd,SP_ATK1);
- if(b_status.def != status->def){
+ if(bst.def != st->def) {
clif->updatestatus(sd,SP_DEF1);
#ifdef RENEWAL
clif->updatestatus(sd,SP_DEF2);
#endif
}
- if(b_status.rhw.atk2 != status->rhw.atk2 || b_status.lhw.atk2 != status->lhw.atk2
+ if(bst.rhw.atk2 != st->rhw.atk2 || bst.lhw.atk2 != st->lhw.atk2
#ifdef RENEWAL
- || b_status.rhw.atk != status->rhw.atk || b_status.lhw.atk != status->lhw.atk
+ || bst.rhw.atk != st->rhw.atk || bst.lhw.atk != st->lhw.atk
#endif
)
clif->updatestatus(sd,SP_ATK2);
- if(b_status.def2 != status->def2){
+ if(bst.def2 != st->def2){
clif->updatestatus(sd,SP_DEF2);
#ifdef RENEWAL
clif->updatestatus(sd,SP_DEF1);
#endif
}
- if(b_status.flee2 != status->flee2)
+ if(bst.flee2 != st->flee2)
clif->updatestatus(sd,SP_FLEE2);
- if(b_status.cri != status->cri)
+ if(bst.cri != st->cri)
clif->updatestatus(sd,SP_CRITICAL);
#ifndef RENEWAL
- if(b_status.matk_max != status->matk_max)
+ if(bst.matk_max != st->matk_max)
clif->updatestatus(sd,SP_MATK1);
- if(b_status.matk_min != status->matk_min)
+ if(bst.matk_min != st->matk_min)
clif->updatestatus(sd,SP_MATK2);
#else
- if(b_status.matk_max != status->matk_max || b_status.matk_min != status->matk_min){
+ if(bst.matk_max != st->matk_max || bst.matk_min != st->matk_min){
clif->updatestatus(sd,SP_MATK2);
clif->updatestatus(sd,SP_MATK1);
}
#endif
- if(b_status.mdef != status->mdef){
+ if(bst.mdef != st->mdef) {
clif->updatestatus(sd,SP_MDEF1);
#ifdef RENEWAL
clif->updatestatus(sd,SP_MDEF2);
#endif
}
- if(b_status.mdef2 != status->mdef2){
+ if(bst.mdef2 != st->mdef2) {
clif->updatestatus(sd,SP_MDEF2);
#ifdef RENEWAL
clif->updatestatus(sd,SP_MDEF1);
#endif
}
- if(b_status.rhw.range != status->rhw.range)
+ if(bst.rhw.range != st->rhw.range)
clif->updatestatus(sd,SP_ATTACKRANGE);
- if(b_status.max_hp != status->max_hp)
+ if(bst.max_hp != st->max_hp)
clif->updatestatus(sd,SP_MAXHP);
- if(b_status.max_sp != status->max_sp)
+ if(bst.max_sp != st->max_sp)
clif->updatestatus(sd,SP_MAXSP);
- if(b_status.hp != status->hp)
+ if(bst.hp != st->hp)
clif->updatestatus(sd,SP_HP);
- if(b_status.sp != status->sp)
+ if(bst.sp != st->sp)
clif->updatestatus(sd,SP_SP);
#ifdef RENEWAL
- if(b_status.equip_atk != status->equip_atk)
+ if(bst.equip_atk != st->equip_atk)
clif->updatestatus(sd,SP_ATK2);
#endif
} else if( bl->type == BL_HOM ) {
TBL_HOM* hd = BL_CAST(BL_HOM, bl);
- if( hd->master && memcmp(&b_status, status, sizeof(struct status_data)) != 0 )
+ if( hd->master && memcmp(&bst, st, sizeof(struct status_data)) != 0 )
clif->hominfo(hd->master,hd,0);
} else if( bl->type == BL_MER ) {
TBL_MER* md = BL_CAST(BL_MER, bl);
- if( b_status.rhw.atk != status->rhw.atk || b_status.rhw.atk2 != status->rhw.atk2 )
+ if( bst.rhw.atk != st->rhw.atk || bst.rhw.atk2 != st->rhw.atk2 )
clif->mercenary_updatestatus(md->master, SP_ATK1);
- if( b_status.matk_max != status->matk_max )
+ if( bst.matk_max != st->matk_max )
clif->mercenary_updatestatus(md->master, SP_MATK1);
- if( b_status.hit != status->hit )
+ if( bst.hit != st->hit )
clif->mercenary_updatestatus(md->master, SP_HIT);
- if( b_status.cri != status->cri )
+ if( bst.cri != st->cri )
clif->mercenary_updatestatus(md->master, SP_CRITICAL);
- if( b_status.def != status->def )
+ if( bst.def != st->def )
clif->mercenary_updatestatus(md->master, SP_DEF1);
- if( b_status.mdef != status->mdef )
+ if( bst.mdef != st->mdef )
clif->mercenary_updatestatus(md->master, SP_MDEF1);
- if( b_status.flee != status->flee )
+ if( bst.flee != st->flee )
clif->mercenary_updatestatus(md->master, SP_MERCFLEE);
- if( b_status.amotion != status->amotion )
+ if( bst.amotion != st->amotion )
clif->mercenary_updatestatus(md->master, SP_ASPD);
- if( b_status.max_hp != status->max_hp )
+ if( bst.max_hp != st->max_hp )
clif->mercenary_updatestatus(md->master, SP_MAXHP);
- if( b_status.max_sp != status->max_sp )
+ if( bst.max_sp != st->max_sp )
clif->mercenary_updatestatus(md->master, SP_MAXSP);
- if( b_status.hp != status->hp )
+ if( bst.hp != st->hp )
clif->mercenary_updatestatus(md->master, SP_HP);
- if( b_status.sp != status->sp )
+ if( bst.sp != st->sp )
clif->mercenary_updatestatus(md->master, SP_SP);
} else if( bl->type == BL_ELEM ) {
TBL_ELEM* ed = BL_CAST(BL_ELEM, bl);
- if( b_status.max_hp != status->max_hp )
+ if( bst.max_hp != st->max_hp )
clif->elemental_updatestatus(ed->master, SP_MAXHP);
- if( b_status.max_sp != status->max_sp )
+ if( bst.max_sp != st->max_sp )
clif->elemental_updatestatus(ed->master, SP_MAXSP);
- if( b_status.hp != status->hp )
+ if( bst.hp != st->hp )
clif->elemental_updatestatus(ed->master, SP_HP);
- if( b_status.sp != status->sp )
+ if( bst.sp != st->sp )
clif->mercenary_updatestatus(ed->master, SP_SP);
}
}
@@ -5875,8 +5834,8 @@ struct status_data *status_get_base_status(struct block_list *bl)
}
defType status_get_def(struct block_list *bl) {
struct unit_data *ud;
- struct status_data *status = iStatus->get_status_data(bl);
- int def = status?status->def:0;
+ struct status_data *st = iStatus->get_status_data(bl);
+ int def = st ? st->def : 0;
ud = unit->bl2ud(bl);
if (ud && ud->skilltimer != INVALID_TIMER)
def -= def * skill->get_castdef(ud->skill_id)/100;
@@ -6222,16 +6181,15 @@ void status_change_init(struct block_list *bl)
//Applies SC defense to a given status change.
//Returns the adjusted duration based on flag values.
//the flag values are the same as in iStatus->change_start.
-int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int tick, int flag)
-{
+int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int tick, int flag) {
//Percentual resistance: 10000 = 100% Resist
//Example: 50% -> sc_def=5000 -> 25%; 5000ms -> tick_def=5000 -> 2500ms
int sc_def = 0, tick_def = -1; //-1 = use sc_def
//Linear resistance substracted from rate and tick after percentual resistance was applied
//Example: 25% -> sc_def2=2000 -> 5%; 2500ms -> tick_def2=2000 -> 500ms
int sc_def2 = 0, tick_def2 = -1; //-1 = use sc_def2
- struct status_data* status;
- struct status_change* sc;
+ struct status_data *st;
+ struct status_change *sc;
struct map_session_data *sd;
nullpo_ret(bl);
@@ -6269,10 +6227,10 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti
case SC__UNLUCKY:
case SC__WEAKNESS:
return 0;
- }
+ }
sd = BL_CAST(BL_PC,bl);
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
sc = iStatus->get_sc(bl);
if( sc && !sc->count )
sc = NULL;
@@ -6284,16 +6242,16 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti
case SC_DPOISON:
case SC_SILENCE:
case SC_BLOODING:
- sc_def = status->vit*100;
- sc_def2 = status->luk*10;
+ sc_def = st->vit*100;
+ sc_def2 = st->luk*10;
break;
case SC_SLEEP:
- sc_def = status->int_*100;
- sc_def2 = status->luk*10;
+ sc_def = st->int_*100;
+ sc_def2 = st->luk*10;
break;
case SC_DEEP_SLEEP:
- sc_def = status->int_*50;
- tick_def = status->int_*10 + iStatus->get_lv(bl) * 65 / 10; //Seems to be -1 sec every 10 int and -5% chance every 10 int.
+ sc_def = st->int_*50;
+ tick_def = st->int_*10 + iStatus->get_lv(bl) * 65 / 10; //Seems to be -1 sec every 10 int and -5% chance every 10 int.
break;
case SC_DEC_AGI:
case SC_ADORAMUS: //Arch Bishop
@@ -6303,87 +6261,87 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti
tick_def = 0;
tick_def2 = 0;
case SC_FREEZE:
- sc_def = status->mdef*100;
- sc_def2 = status->luk*10;
+ sc_def = st->mdef*100;
+ sc_def2 = st->luk*10;
break;
case SC_CURSE:
//Special property: inmunity when luk is greater than level or zero
- if (status->luk > iStatus->get_lv(bl) || status->luk == 0)
+ if (st->luk > iStatus->get_lv(bl) || st->luk == 0)
return 0;
- sc_def = status->luk*100;
- sc_def2 = status->luk*10;
- tick_def = status->vit*100;
+ sc_def = st->luk*100;
+ sc_def2 = st->luk*10;
+ tick_def = st->vit*100;
break;
case SC_BLIND:
if( sc && sc->data[SC__UNLUCKY] )
return tick;
- sc_def = (status->vit + status->int_)*50;
- sc_def2 = status->luk*10;
+ sc_def = (st->vit + st->int_)*50;
+ sc_def2 = st->luk*10;
break;
case SC_CONFUSION:
- sc_def = (status->str + status->int_)*50;
- sc_def2 = status->luk*10;
+ sc_def = (st->str + st->int_)*50;
+ sc_def2 = st->luk*10;
break;
case SC_ANKLESNARE:
- if(status->mode&MD_BOSS) // Lasts 5 times less on bosses
+ if(st->mode&MD_BOSS) // Lasts 5 times less on bosses
tick /= 5;
- sc_def = status->agi*50;
+ sc_def = st->agi*50;
break;
case SC_MAGICMIRROR:
case SC_STONESKIN:
if (sd) //Duration greatly reduced for players.
tick /= 15;
- sc_def2 = iStatus->get_lv(bl)*20 + status->vit*25 + status->agi*10; // Lineal Reduction of Rate
+ sc_def2 = iStatus->get_lv(bl)*20 + st->vit*25 + st->agi*10; // Lineal Reduction of Rate
tick_def2 = 0; //No duration reduction
break;
case SC_MARSHOFABYSS:
//5 second (Fixed) + 25 second - {( INT + LUK ) / 20 second }
- tick_def2 = (status->int_ + status->luk)*50;
+ tick_def2 = (st->int_ + st->luk)*50;
break;
case SC_STASIS:
//5 second (fixed) + { Stasis Skill level * 5 - (Target's VIT + DEX) / 20 }
- tick_def2 = (status->vit + status->dex)*50;
+ tick_def2 = (st->vit + st->dex)*50;
break;
if( bl->type == BL_PC )
- tick -= (iStatus->get_lv(bl) / 5 + status->vit / 4 + status->agi / 10)*100;
+ tick -= (iStatus->get_lv(bl) / 5 + st->vit / 4 + st->agi / 10)*100;
else
- tick -= (status->vit + status->luk) / 20 * 1000;
+ tick -= (st->vit + st->luk) / 20 * 1000;
break;
case SC_BURNING:
- tick -= 75 * status->luk + 125 * status->agi;
+ tick -= 75 * st->luk + 125 * st->agi;
tick = max(tick,5000); // Minimum Duration 5s.
break;
case SC_FROSTMISTY:
- tick -= 1000 * ((status->vit + status->dex) / 20);
+ tick -= 1000 * ((st->vit + st->dex) / 20);
tick = max(tick,6000); // Minimum Duration 6s.
break;
case SC_OBLIVIONCURSE: // 100% - (100 - 0.8 x INT)
- sc_def = 100 - ( 100 - status->int_* 8 / 10 );
+ sc_def = 100 - ( 100 - st->int_* 8 / 10 );
sc_def = max(sc_def, 5); // minimum of 5%
break;
case SC_WUGBITE: // {(Base Success chance) - (Target's AGI / 4)}
- rate -= status->agi*100/4;
+ rate -= st->agi*100/4;
rate = max(rate,5000); // minimum of 50%
break;
case SC_ELECTRICSHOCKER:
if( bl->type == BL_MOB )
- tick -= 1000 * (status->agi/10);
+ tick -= 1000 * (st->agi/10);
break;
case SC_COLD:
- tick -= (1000*(status->vit/10))+(iStatus->get_lv(bl)/50);
+ tick -= (1000*(st->vit/10))+(iStatus->get_lv(bl)/50);
break;
case SC_SIREN:
tick -= 1000 * ((iStatus->get_lv(bl) / 10) + ((sd?sd->status.job_level:0) / 5));
tick = max(tick,10000);
break;
case SC_MANDRAGORA:
- sc_def = (status->vit+status->luk)/5;
+ sc_def = (st->vit+st->luk)/5;
break;
case SC_KYOUGAKU:
tick -= 1000 * status_get_int(bl) / 20;
break;
case SC_NEEDLE_OF_PARALYZE:
- tick -= 50 * (status->vit + status->luk); //(1000/20);
+ tick -= 50 * (st->vit + st->luk); //(1000/20);
break;
default:
//Effect that cannot be reduced? Likely a buff.
@@ -6563,16 +6521,15 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
struct map_session_data *sd = NULL;
struct status_change* sc;
struct status_change_entry* sce;
- struct status_data *status;
+ struct status_data *st;
struct view_data *vd;
int opt_flag, calc_flag, undead_flag, val_flag = 0, tick_time = 0;
nullpo_ret(bl);
sc = iStatus->get_sc(bl);
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
- if( type <= SC_NONE || type >= SC_MAX )
- {
+ if( type <= SC_NONE || type >= SC_MAX ) {
ShowError("status_change_start: invalid status change (%d)!\n", type);
return 0;
}
@@ -6642,13 +6599,12 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
sd = BL_CAST(BL_PC, bl);
//Adjust tick according to status resistances
- if( !(flag&(1|4)) )
- {
+ if( !(flag&(1|4)) ) {
tick = iStatus->get_sc_def(bl, type, rate, tick, flag);
if( !tick ) return 0;
}
- undead_flag = battle->check_undead(status->race,status->def_ele);
+ undead_flag = battle->check_undead(st->race,st->def_ele);
//Check for inmunities / sc fails
switch (type) {
case SC_DRUMBATTLE:
@@ -6697,7 +6653,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_CRUCIS:
//Only affects demons and undead element (but not players)
- if((!undead_flag && status->race!=RC_DEMON) || bl->type == BL_PC)
+ if((!undead_flag && st->race!=RC_DEMON) || bl->type == BL_PC)
return 0;
break;
case SC_LEXAETERNA:
@@ -6765,18 +6721,18 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_MODECHANGE:
{
int mode;
- struct status_data *bstatus = iStatus->get_base_status(bl);
- if (!bstatus) return 0;
- if (sc->data[type])
- { //Pile up with previous values.
+ struct status_data *bst = iStatus->get_base_status(bl);
+ if (!bst) return 0;
+ if (sc->data[type]) {
+ //Pile up with previous values.
if(!val2) val2 = sc->data[type]->val2;
val3 |= sc->data[type]->val3;
val4 |= sc->data[type]->val4;
}
- mode = val2?val2:bstatus->mode; //Base mode
+ mode = val2 ? val2 : bst->mode; //Base mode
if (val4) mode&=~val4; //Del mode
if (val3) mode|= val3; //Add mode
- if (mode == bstatus->mode) { //No change.
+ if (mode == bst->mode) { //No change.
if (sc->data[type]) //Abort previous status
return status_change_end(bl, type, INVALID_TIMER);
return 0;
@@ -6940,7 +6896,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
}
//Check for BOSS resistances
- if(status->mode&MD_BOSS && !(flag&1)) {
+ if(st->mode&MD_BOSS && !(flag&1)) {
if (type>=SC_COMMON_MIN && type <= SC_COMMON_MAX)
return 0;
switch (type) {
@@ -6993,7 +6949,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_BLESSING:
//TO-DO Blessing and Agi up should do 1 damage against players on Undead Status, even on PvM
//but cannot be plagiarized (this requires aegis investigation on packets and official behavior) [Brainstorm]
- if ((!undead_flag && status->race!=RC_DEMON) || bl->type == BL_PC) {
+ if ((!undead_flag && st->race!=RC_DEMON) || bl->type == BL_PC) {
status_change_end(bl, SC_CURSE, INVALID_TIMER);
if (sc->data[SC_STONE] && sc->opt1 == OPT1_STONE)
status_change_end(bl, SC_STONE, INVALID_TIMER);
@@ -7357,7 +7313,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick = -1;
break;
case SC_AUTOBERSERK:
- if (status->hp < status->max_hp>>2 &&
+ if (st->hp < st->max_hp>>2 &&
(!sc->data[SC_PROVOKE] || sc->data[SC_PROVOKE]->val2==0))
sc_start4(bl,SC_PROVOKE,100,10,1,0,0,60000);
tick = -1;
@@ -7388,7 +7344,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = val1*20; //SP gained
break;
case SC_KYRIE:
- val2 = (int64)status->max_hp * (val1 * 2 + 10) / 100; //%Max HP to absorb
+ val2 = (int64)st->max_hp * (val1 * 2 + 10) / 100; //%Max HP to absorb
val3 = (val1 / 2 + 5); //Hits
break;
case SC_MAGICPOWER:
@@ -7470,21 +7426,21 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_VOLCANO:
val2 = val1*10; //Watk increase
#ifndef RENEWAL
- if (status->def_ele != ELE_FIRE)
+ if (st->def_ele != ELE_FIRE)
val2 = 0;
#endif
break;
case SC_VIOLENTGALE:
val2 = val1*3; //Flee increase
#ifndef RENEWAL
- if (status->def_ele != ELE_WIND)
+ if (st->def_ele != ELE_WIND)
val2 = 0;
#endif
break;
case SC_DELUGE:
val2 = deluge_eff[val1-1]; //HP increase
#ifndef RENEWAL
- if(status->def_ele != ELE_WATER)
+ if(st->def_ele != ELE_WATER)
val2 = 0;
#endif
break;
@@ -7572,10 +7528,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_DPOISON:
//Lose 10/15% of your life as long as it doesn't brings life below 25%
- if (status->hp > status->max_hp>>2) {
- int diff = status->max_hp*(bl->type==BL_PC?10:15)/100;
- if (status->hp - diff < status->max_hp>>2)
- diff = status->hp - (status->max_hp>>2);
+ if (st->hp > st->max_hp>>2) {
+ int diff = st->max_hp*(bl->type==BL_PC?10:15)/100;
+ if (st->hp - diff < st->max_hp>>2)
+ diff = st->hp - (st->max_hp>>2);
if( val2 && bl->type == BL_MOB ) {
struct block_list* src = iMap->id2bl(val2);
if( src )
@@ -7590,9 +7546,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick_time = 1000; // [GodLesZ] tick time
//val4: HP damage
if (bl->type == BL_PC)
- val4 = (type == SC_DPOISON) ? 3 + status->max_hp/50 : 3 + status->max_hp*3/200;
+ val4 = (type == SC_DPOISON) ? 3 + st->max_hp/50 : 3 + st->max_hp*3/200;
else
- val4 = (type == SC_DPOISON) ? 3 + status->max_hp/100 : 3 + status->max_hp/200;
+ val4 = (type == SC_DPOISON) ? 3 + st->max_hp/100 : 3 + st->max_hp/200;
break;
case SC_CONFUSION:
@@ -7796,7 +7752,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
struct status_change *psc = pbl?iStatus->get_sc(pbl):NULL;
struct status_change_entry *psce = psc?psc->data[SC_MARIONETTE_MASTER]:NULL;
// fetch target's stats
- struct status_data* status = iStatus->get_status_data(bl); // battle status
+ struct status_data* tst = iStatus->get_status_data(bl); // battle status
if (!psce)
return 0;
@@ -7804,12 +7760,12 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val3 = 0;
val4 = 0;
max_stat = battle_config.max_parameter; //Cap to 99 (default)
- stat = (psce->val3 >>16)&0xFF; stat = min(stat, max_stat - status->str ); val3 |= cap_value(stat,0,0xFF)<<16;
- stat = (psce->val3 >> 8)&0xFF; stat = min(stat, max_stat - status->agi ); val3 |= cap_value(stat,0,0xFF)<<8;
- stat = (psce->val3 >> 0)&0xFF; stat = min(stat, max_stat - status->vit ); val3 |= cap_value(stat,0,0xFF);
- stat = (psce->val4 >>16)&0xFF; stat = min(stat, max_stat - status->int_); val4 |= cap_value(stat,0,0xFF)<<16;
- stat = (psce->val4 >> 8)&0xFF; stat = min(stat, max_stat - status->dex ); val4 |= cap_value(stat,0,0xFF)<<8;
- stat = (psce->val4 >> 0)&0xFF; stat = min(stat, max_stat - status->luk ); val4 |= cap_value(stat,0,0xFF);
+ stat = (psce->val3 >>16)&0xFF; stat = min(stat, max_stat - tst->str ); val3 |= cap_value(stat,0,0xFF)<<16;
+ stat = (psce->val3 >> 8)&0xFF; stat = min(stat, max_stat - tst->agi ); val3 |= cap_value(stat,0,0xFF)<<8;
+ stat = (psce->val3 >> 0)&0xFF; stat = min(stat, max_stat - tst->vit ); val3 |= cap_value(stat,0,0xFF);
+ stat = (psce->val4 >>16)&0xFF; stat = min(stat, max_stat - tst->int_); val4 |= cap_value(stat,0,0xFF)<<16;
+ stat = (psce->val4 >> 8)&0xFF; stat = min(stat, max_stat - tst->dex ); val4 |= cap_value(stat,0,0xFF)<<8;
+ stat = (psce->val4 >> 0)&0xFF; stat = min(stat, max_stat - tst->luk ); val4 |= cap_value(stat,0,0xFF);
break;
}
case SC_SWORDREJECT:
@@ -7861,9 +7817,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( val3 && bl->type == BL_MOB ) {
struct block_list* src = iMap->id2bl(val3);
if( src )
- mob->log_damage((TBL_MOB*)bl,src,status->hp - 1);
+ mob->log_damage((TBL_MOB*)bl,src,st->hp - 1);
}
- status_zap(bl, status->hp-1, val2?0:status->sp);
+ status_zap(bl, st->hp-1, val2 ? 0 : st->sp);
return 1;
break;
case SC_RG_CCONFINE_S:
@@ -7931,7 +7887,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val4 = INVALID_TIMER; //Kaahi Timer.
break;
case SC_BLESSING:
- if ((!undead_flag && status->race!=RC_DEMON) || bl->type == BL_PC)
+ if ((!undead_flag && st->race!=RC_DEMON) || bl->type == BL_PC)
val2 = val1;
else
val2 = 0; //0 -> Half stat.
@@ -7986,13 +7942,13 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val3 = 3*val1; //Hit increase
break;
case SC_SUN_COMFORT:
- val2 = (iStatus->get_lv(bl) + status->dex + status->luk)/2; //def increase
+ val2 = (iStatus->get_lv(bl) + st->dex + st->luk)/2; //def increase
break;
case SC_MOON_COMFORT:
- val2 = (iStatus->get_lv(bl) + status->dex + status->luk)/10; //flee increase
+ val2 = (iStatus->get_lv(bl) + st->dex + st->luk)/10; //flee increase
break;
case SC_STAR_COMFORT:
- val2 = (iStatus->get_lv(bl) + status->dex + status->luk); //Aspd increase
+ val2 = (iStatus->get_lv(bl) + st->dex + st->luk); //Aspd increase
break;
case SC_QUAGMIRE:
val2 = (sd?5:10)*val1; //Agi/Dex decrease.
@@ -8076,7 +8032,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val3= 20*val1; //Int increase
break;
case SC_SWOO:
- if(status->mode&MD_BOSS)
+ if(st->mode&MD_BOSS)
tick /= 5; //TODO: Reduce skill's duration. But for how long?
break;
case SC_SPIDERWEB:
@@ -8411,7 +8367,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
}
break;
case SC_VACUUM_EXTREME:
- tick -= (status->str / 20) * 1000;
+ tick -= (st->str / 20) * 1000;
val4 = val3 = tick / 100;
tick_time = 100; // [GodLesZ] tick time
break;
@@ -8520,8 +8476,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
else // Mobs
val1 += (400 * iStatus->get_lv(bl) / 100) + (15 * (iStatus->get_lv(bl) / 2)); // About 1138% at mob_lvl 99. Is an aproximation to a standard weapon. [pakpil]
break;
- case SC_PRESTIGE: // Bassed on suggested formula in iRO Wiki and some test, still need more test. [pakpil]
- val2 = ((status->int_ + status->luk) / 6) + 5; // Chance to evade magic damage.
+ case SC_PRESTIGE: // Based on suggested formula in iRO Wiki and some test, still need more test. [pakpil]
+ val2 = ((st->int_ + st->luk) / 6) + 5; // Chance to evade magic damage.
val1 *= 15; // Defence added
if( sd )
val1 += 10 * pc->checkskill(sd,CR_DEFENDER);
@@ -8569,7 +8525,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_GENTLETOUCH_CHANGE:
{// take note there is no def increase as skill desc says. [malufett]
struct block_list * src;
- val3 = status->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] %
+ val3 = st->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] %
if( (src = iMap->id2bl(val2)) ){
val4 = ( 200/status_get_int(src) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level]
val2 = ( status_get_dex(src)/4 + status_get_str(src)/2 ) * val1 / 5; // ATK increase: ATK [{(Caster DEX / 4) + (Caster STR / 2)} x Skill Level / 5]
@@ -9132,10 +9088,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
switch (type) {
case SC_BERSERK:
if (!(sce->val2)) { //don't heal if already set
- iStatus->heal(bl, status->max_hp, 0, 1); //Do not use percent_heal as this healing must override BERSERK's block.
+ iStatus->heal(bl, st->max_hp, 0, 1); //Do not use percent_heal as this healing must override BERSERK's block.
iStatus->set_sp(bl, 0, 0); //Damage all SP
}
- sce->val2 = 5 * status->max_hp / 100;
+ sce->val2 = 5 * st->max_hp / 100;
break;
case SC_HLIF_CHANGE:
status_percent_heal(bl, 100, 100);
@@ -9203,7 +9159,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
}
break;
case SC_RAISINGDRAGON:
- sce->val2 = status->max_hp / 100;// Officially tested its 1%hp drain. [Jobbie]
+ sce->val2 = st->max_hp / 100;// Officially tested its 1%hp drain. [Jobbie]
break;
}
@@ -9291,14 +9247,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
struct map_session_data *sd;
struct status_change *sc;
struct status_change_entry *sce;
- struct status_data *status;
+ struct status_data *st;
struct view_data *vd;
int opt_flag=0, calc_flag;
nullpo_ret(bl);
sc = iStatus->get_sc(bl);
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
if(type < 0 || type >= SC_MAX || !sc || !(sce = sc->data[type]))
return 0;
@@ -9346,13 +9302,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
vd = iStatus->get_viewdata(bl);
calc_flag = StatusChangeFlagTable[type];
switch(type) {
- case SC_GRANITIC_ARMOR:{
- int dammage = status->max_hp*sce->val3/100;
- if(status->hp < dammage) //to not kill him
- dammage = status->hp-1;
- iStatus->damage(NULL, bl, dammage,0,0,1);
+ case SC_GRANITIC_ARMOR:
+ {
+ int damage = st->max_hp*sce->val3/100;
+ if(st->hp < damage) //to not kill him
+ damage = st->hp-1;
+ iStatus->damage(NULL, bl, damage,0,0,1);
+ }
break;
- }
case SC_PYROCLASTIC:
if(bl->type == BL_PC)
skill->break_equip(bl,EQP_WEAPON,10000,BCT_SELF);
@@ -9573,15 +9530,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
case SC_BERSERK:
case SC_SATURDAY_NIGHT_FEVER:
- if(status->hp > 200 && sc && sc->data[SC__BLOODYLUST]){
+ if(st->hp > 200 && sc && sc->data[SC__BLOODYLUST]) {
status_percent_heal(bl, 100, 0);
status_change_end(bl, SC__BLOODYLUST, INVALID_TIMER);
- }else
- //If val2 is removed, no HP penalty (dispelled?) [Skotlex]
- if(status->hp > 100 && sce->val2)
+ } else if(st->hp > 100 && sce->val2) //If val2 is removed, no HP penalty (dispelled?) [Skotlex]
iStatus->set_hp(bl, 100, 0);
- if(sc->data[SC_ENDURE] && sc->data[SC_ENDURE]->val4 == 2)
- {
+ if(sc->data[SC_ENDURE] && sc->data[SC_ENDURE]->val4 == 2) {
sc->data[SC_ENDURE]->val4 = 0;
status_change_end(bl, SC_ENDURE, INVALID_TIMER);
}
@@ -9982,12 +9936,11 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
return 1;
}
-int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct block_list *bl;
struct status_change *sc;
struct status_change_entry *sce;
- struct status_data *status;
+ struct status_data *st;
int hp;
if(!((bl=iMap->id2bl(id))&&
@@ -10001,13 +9954,13 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- status=iStatus->get_status_data(bl);
+ st=iStatus->get_status_data(bl);
if(!iStatus->charge(bl, 0, sce->val3)) {
sce->val4 = INVALID_TIMER;
return 0;
}
- hp = status->max_hp - status->hp;
+ hp = st->max_hp - st->hp;
if (hp > sce->val2)
hp = sce->val2;
if (hp)
@@ -10020,12 +9973,11 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
* For recusive status, like for each 5s we drop sp etc.
* Reseting the end timer.
*------------------------------------------*/
-int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
enum sc_type type = (sc_type)data;
struct block_list *bl;
struct map_session_data *sd;
- struct status_data *status;
+ struct status_data *st;
struct status_change *sc;
struct status_change_entry *sce;
@@ -10036,7 +9988,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
sc = iStatus->get_sc(bl);
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
if(!(sc && (sce = sc->data[type])))
{
@@ -10134,7 +10086,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
if(--(sce->val3) > 0) {
- if(++(sce->val4)%5 == 0 && status->hp > status->max_hp/4)
+ if(++(sce->val4)%5 == 0 && st->hp > st->max_hp/4)
status_percent_damage(NULL, bl, 1, 0, false);
sc_timer_next(1000+tick,iStatus->change_timer, bl->id, data );
return 0;
@@ -10142,7 +10094,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC_POISON:
- if(status->hp <= max(status->max_hp>>2, sce->val4)) //Stop damaging after 25% HP left.
+ if(st->hp <= max(st->max_hp>>2, sce->val4)) //Stop damaging after 25% HP left.
break;
case SC_DPOISON:
if (--(sce->val3) > 0) {
@@ -10164,7 +10116,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC_TENSIONRELAX:
- if(status->max_hp > status->hp && --(sce->val3) > 0){
+ if(st->max_hp > st->hp && --(sce->val3) > 0){
sc_timer_next(sce->val4+tick, iStatus->change_timer, bl->id, data);
return 0;
}
@@ -10186,12 +10138,12 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
int hp = rnd()%600 + 200;
struct block_list* src = iMap->id2bl(sce->val2);
if( src && bl && bl->type == BL_MOB ) {
- mob->log_damage((TBL_MOB*)bl,src,sd||hp<status->hp?hp:status->hp-1);
+ mob->log_damage((TBL_MOB*)bl,src,sd||hp<st->hp?hp:st->hp-1);
}
iMap->freeblock_lock();
- status_fix_damage(src, bl, sd||hp<status->hp?hp:status->hp-1, 1);
+ status_fix_damage(src, bl, sd||hp<st->hp?hp:st->hp-1, 1);
if( sc->data[type] ) {
- if( status->hp == 1 ) {
+ if( st->hp == 1 ) {
iMap->freeblock_unlock();
break;
}
@@ -10208,7 +10160,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
{
// val1 < 0 = per max% | val1 > 0 = exact amount
int hp = 0;
- if( status->hp < status->max_hp )
+ if( st->hp < st->max_hp )
hp = (sce->val1 < 0) ? (int)(sd->status.max_hp * -1 * sce->val1 / 100.) : sce->val1 ;
iStatus->heal(bl, hp, 0, 2);
sc_timer_next((sce->val2 * 1000) + tick, iStatus->change_timer, bl->id, data);
@@ -10289,7 +10241,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC_BERSERK:
// 5% every 10 seconds [DracoRPG]
- if( --( sce->val3 ) > 0 && iStatus->charge(bl, sce->val2, 0) && status->hp > 100 )
+ if( --( sce->val3 ) > 0 && iStatus->charge(bl, sce->val2, 0) && st->hp > 100 )
{
sc_timer_next(sce->val4+tick, iStatus->change_timer, bl->id, data);
return 0;
@@ -10384,8 +10336,8 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_LEECHESEND:
if( --(sce->val4) > 0 ) {
- int damage = status->max_hp/100; // {Target VIT x (New Poison Research Skill Level - 3)} + (Target HP/100)
- damage += status->vit * (sce->val1 - 3);
+ int damage = st->max_hp/100; // {Target VIT x (New Poison Research Skill Level - 3)} + (Target HP/100)
+ damage += st->vit * (sce->val1 - 3);
unit->skillcastcancel(bl,2);
iMap->freeblock_lock();
iStatus->damage(bl, bl, damage, 0, clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,damage,1,0,0), 1);
@@ -10400,9 +10352,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_MAGICMUSHROOM:
if( --(sce->val4) > 0 ) {
bool flag = 0;
- int damage = status->max_hp * 3 / 100;
- if( status->hp <= damage )
- damage = status->hp - 1; // Cannot Kill
+ int damage = st->max_hp * 3 / 100;
+ if( st->hp <= damage )
+ damage = st->hp - 1; // Cannot Kill
if( damage > 0 ) { // 3% Damage each 4 seconds
iMap->freeblock_lock();
@@ -10447,7 +10399,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
{ //Damage is every 10 seconds including 3%sp drain.
iMap->freeblock_lock();
clif->damage(bl,bl,tick,status_get_amotion(bl),1,1,0,0,0);
- iStatus->damage(NULL, bl, 1, status->max_sp * 3 / 100, 0, 0); //cancel dmg only if cancelable
+ iStatus->damage(NULL, bl, 1, st->max_sp * 3 / 100, 0, 0); //cancel dmg only if cancelable
if( sc->data[type] ) {
sc_timer_next(10000 + tick, iStatus->change_timer, bl->id, data );
}
@@ -10482,9 +10434,8 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
case SC_RENOVATIO:
- if( --(sce->val4) > 0 )
- {
- int heal = status->max_hp * 3 / 100;
+ if( --(sce->val4) > 0 ) {
+ int heal = st->max_hp * 3 / 100;
if( sc && sc->data[SC_AKAITSUKI] && heal )
heal = ~heal + 1;
iStatus->heal(bl, heal, 0, 2);
@@ -10546,9 +10497,8 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
case SC_ELECTRICSHOCKER:
- if( --(sce->val4) > 0 )
- {
- iStatus->charge(bl, 0, status->max_sp / 100 * sce->val1 );
+ if( --(sce->val4) > 0 ) {
+ iStatus->charge(bl, 0, st->max_sp / 100 * sce->val1 );
sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data);
return 0;
}
@@ -10579,9 +10529,8 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC__INVISIBILITY:
- if( --(sce->val4) > 0 )
- {
- if( !iStatus->charge(bl, 0, (status->sp * 6 - sce->val1) / 100) )// 6% - skill_lv.
+ if( --(sce->val4) > 0 ) {
+ if( !iStatus->charge(bl, 0, (st->sp * 6 - sce->val1) / 100) )// 6% - skill_lv.
break;
sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data);
return 0;
@@ -10611,7 +10560,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
iMap->freeblock_lock();
damage = sce->val3;
- iStatus->damage(src, bl, damage, 0, clif->damage(bl,bl,tick,status->amotion,status->dmotion+200,damage,1,0,0), 1);
+ iStatus->damage(src, bl, damage, 0, clif->damage(bl,bl,tick,st->amotion,st->dmotion+200,damage,1,0,0), 1);
unit->skillcastcancel(bl,1);
if ( sc->data[type] ) {
sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data);
@@ -10632,9 +10581,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC_DEEP_SLEEP:
- if( --(sce->val4) > 0 )
- { // Recovers 1% HP/SP every 2 seconds.
- iStatus->heal(bl, status->max_hp / 100, status->max_sp / 100, 2);
+ if( --(sce->val4) > 0 ) {
+ // Recovers 1% HP/SP every 2 seconds.
+ iStatus->heal(bl, st->max_hp / 100, st->max_sp / 100, 2);
sc_timer_next(2000 + tick, iStatus->change_timer, bl->id, data);
return 0;
}
@@ -10663,10 +10612,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_SATURDAY_NIGHT_FEVER:
// 1% HP/SP drain every val4 seconds [Jobbie]
- if( --(sce->val3) > 0 )
- {
- int hp = status->hp / 100;
- int sp = status->sp / 100;
+ if( --(sce->val3) > 0 ) {
+ int hp = st->hp / 100;
+ int sp = st->sp / 100;
if( !iStatus->charge(bl, hp, sp) )
break;
sc_timer_next(sce->val4+tick, iStatus->change_timer, bl->id, data);
@@ -10675,10 +10623,10 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC_COLD:
- if( --(sce->val4) > 0 )
- { // Drains 2% of HP and 1% of SP every seconds.
+ if( --(sce->val4) > 0 ) {
+ // Drains 2% of HP and 1% of SP every seconds.
if( bl->type != BL_MOB) // doesn't work on mobs
- iStatus->charge(bl, status->max_hp * 2 / 100, status->max_sp / 100);
+ iStatus->charge(bl, st->max_hp * 2 / 100, st->max_sp / 100);
sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data);
return 0;
}
@@ -10716,8 +10664,8 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_OVERHEAT:
{
- int damage = status->max_hp / 100; // Suggestion 1% each second
- if( damage >= status->hp ) damage = status->hp - 1; // Do not kill, just keep you with 1 hp minimum
+ int damage = st->max_hp / 100; // Suggestion 1% each second
+ if( damage >= st->hp ) damage = st->hp - 1; // Do not kill, just keep you with 1 hp minimum
iMap->freeblock_lock();
status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,tick,0,0,damage,0,0,0));
if( sc->data[type] ) {
@@ -10748,10 +10696,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC_INSPIRATION:
- if(--(sce->val4) > 0)
- {
- int hp = status->max_hp * (7-sce->val1) / 100;
- int sp = status->max_sp * (9-sce->val1) / 100;
+ if(--(sce->val4) > 0) {
+ int hp = st->max_hp * (7-sce->val1) / 100;
+ int sp = st->max_sp * (9-sce->val1) / 100;
if( !iStatus->charge(bl,hp,sp) ) break;
@@ -10810,8 +10757,8 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
sc_timer_next(600000 + tick, iStatus->change_timer, bl->id, data);
return 0;
case SC_MEIKYOUSISUI:
- if( --(sce->val4) > 0 ){
- iStatus->heal(bl, status->max_hp * (sce->val1+1) / 100, status->max_sp * sce->val1 / 100, 0);
+ if( --(sce->val4) > 0 ) {
+ iStatus->heal(bl, st->max_hp * (sce->val1+1) / 100, st->max_sp * sce->val1 / 100, 0);
sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data);
return 0;
}
@@ -10974,12 +10921,12 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl
}
#endif
-#define GETRANDMATK(){\
- if( status->matk_max > status->matk_min )\
- return status->matk_min + rnd()%(status->matk_max - status->matk_min);\
-else\
- return status->matk_min;\
-}
+#define GETRANDMATK(st) do {\
+ if( (st)->matk_max > (st)->matk_min ) \
+ return (st)->matk_min + rnd()%((st)->matk_max - (st)->matk_min); \
+ else \
+ return (st)->matk_min; \
+ } while(0)
/*==========================================
* flag [malufett]
@@ -10988,72 +10935,72 @@ else\
* 2 - get modified matk
* 3 - get matk w/o eatk & SC bonuses
*------------------------------------------*/
-int status_get_matk(struct block_list *bl, int flag){
- struct status_data *status;
+int status_get_matk(struct block_list *bl, int flag) {
+ struct status_data *st;
struct status_change *sc;
struct map_session_data *sd;
if( bl == NULL )
return 1;
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
sc = iStatus->get_sc(bl);
sd = BL_CAST(BL_PC, bl);
if( flag == 2 ) // just get matk
- GETRANDMATK();
+ GETRANDMATK(st);
#ifndef RENEWAL
- status->matk_min = status_base_matk_min(status) + (sd?sd->bonus.ematk:0);
- status->matk_max = status_base_matk_max(status) + (sd?sd->bonus.ematk:0);
+ st->matk_min = status_base_matk_min(st) + (sd?sd->bonus.ematk:0);
+ st->matk_max = status_base_matk_max(st) + (sd?sd->bonus.ematk:0);
#else
/**
* RE MATK Formula (from irowiki:http://irowiki.org/wiki/MATK)
* MATK = (sMATK + wMATK + eMATK) * Multiplicative Modifiers
**/
- status->matk_min = iStatus->base_matk(status, iStatus->get_lv(bl));
+ st->matk_min = iStatus->base_matk(st, iStatus->get_lv(bl));
// Any +MATK you get from skills and cards, including cards in weapon, is added here.
if( sd && sd->bonus.ematk > 0 && flag != 3 )
- status->matk_min += sd->bonus.ematk;
+ st->matk_min += sd->bonus.ematk;
if( flag != 3 )
- status->matk_min = status_calc_ematk(bl, sc, status->matk_min);
+ st->matk_min = status_calc_ematk(bl, sc, st->matk_min);
- status->matk_max = status->matk_min;
+ st->matk_max = st->matk_min;
//This is the only portion in MATK that varies depending on the weapon level and refinement rate.
- if( bl->type&BL_PC && (status->rhw.matk + status->lhw.matk) > 0 ){
- int wMatk = status->rhw.matk + status->lhw.matk; // Left and right matk stacks
- int variance = wMatk * status->rhw.wlv / 10; // Only use right hand weapon level
- status->matk_min += wMatk - variance;
- status->matk_max += wMatk + variance;
+ if( bl->type&BL_PC && (st->rhw.matk + st->lhw.matk) > 0 ){
+ int wMatk = st->rhw.matk + st->lhw.matk; // Left and right matk stacks
+ int variance = wMatk * st->rhw.wlv / 10; // Only use right hand weapon level
+ st->matk_min += wMatk - variance;
+ st->matk_max += wMatk + variance;
}else if( bl->type&BL_MOB ){
- status->matk_min = status->matk_max = status_get_int(bl) + iStatus->get_lv(bl);
- status->matk_min += 70 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
- status->matk_max += 130 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
+ st->matk_min = st->matk_max = status_get_int(bl) + iStatus->get_lv(bl);
+ st->matk_min += 70 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
+ st->matk_max += 130 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
}
#endif
if (bl->type&BL_PC && sd->matk_rate != 100) {
- status->matk_max = status->matk_max * sd->matk_rate/100;
- status->matk_min = status->matk_min * sd->matk_rate/100;
+ st->matk_max = st->matk_max * sd->matk_rate/100;
+ st->matk_min = st->matk_min * sd->matk_rate/100;
}
if ((bl->type&BL_HOM && battle_config.hom_setting&0x20) //Hom Min Matk is always the same as Max Matk
|| (sc && sc->data[SC_RECOGNIZEDSPELL]))
- status->matk_min = status->matk_max;
+ st->matk_min = st->matk_max;
#ifdef RENEWAL
if( sd && sd->right_weapon.overrefine > 0){
- status->matk_min++;
- status->matk_max += sd->right_weapon.overrefine - 1;
+ st->matk_min++;
+ st->matk_max += sd->right_weapon.overrefine - 1;
}
#endif
if( flag ) // get unmodified from sc matk
- GETRANDMATK();
+ GETRANDMATK(st);
- status->matk_min = status_calc_matk(bl, sc, status->matk_min, true);
- status->matk_max = status_calc_matk(bl, sc, status->matk_max, true);
+ st->matk_min = status_calc_matk(bl, sc, st->matk_min, true);
+ st->matk_max = status_calc_matk(bl, sc, st->matk_max, true);
return 0;
}
@@ -11213,10 +11160,9 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) {
//Natural regen related stuff.
static unsigned int natural_heal_prev_tick,natural_heal_diff_tick;
-static int status_natural_heal(struct block_list* bl, va_list args)
-{
+static int status_natural_heal(struct block_list* bl, va_list args) {
struct regen_data *regen;
- struct status_data *status;
+ struct status_data *st;
struct status_change *sc;
struct unit_data *ud;
struct view_data *vd = NULL;
@@ -11226,16 +11172,16 @@ static int status_natural_heal(struct block_list* bl, va_list args)
regen = iStatus->get_regen_data(bl);
if (!regen) return 0;
- status = iStatus->get_status_data(bl);
+ st = iStatus->get_status_data(bl);
sc = iStatus->get_sc(bl);
if (sc && !sc->count)
sc = NULL;
sd = BL_CAST(BL_PC,bl);
flag = regen->flag;
- if (flag&RGN_HP && (status->hp >= status->max_hp || regen->state.block&1))
+ if (flag&RGN_HP && (st->hp >= st->max_hp || regen->state.block&1))
flag&=~(RGN_HP|RGN_SHP);
- if (flag&RGN_SP && (status->sp >= status->max_sp || regen->state.block&2))
+ if (flag&RGN_SP && (st->sp >= st->max_sp || regen->state.block&2))
flag&=~(RGN_SP|RGN_SSP);
if (flag && (
diff --git a/src/map/status.h b/src/map/status.h
index 9d49ff3af..c6da44d83 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1854,7 +1854,7 @@ struct status_interface {
int (*calc_elemental_) (struct elemental_data *ed, bool first);
void (*calc_misc) (struct block_list *bl, struct status_data *status, int level);
- void (*calc_regen) (struct block_list *bl, struct status_data *status, struct regen_data *regen);
+ void (*calc_regen) (struct block_list *bl, struct status_data *st, struct regen_data *regen);
void (*calc_regen_rate) (struct block_list *bl, struct regen_data *regen, struct status_change *sc);
int (*check_skilluse) (struct block_list *src, struct block_list *target, uint16 skill_id, int flag); // [Skotlex]
@@ -1869,7 +1869,7 @@ struct status_interface {
unsigned short (*calc_batk) (struct block_list *, struct status_change *, int, bool);
#ifdef RENEWAL
- unsigned short (*base_matk) (const struct status_data* status, int level);
+ unsigned short (*base_matk) (const struct status_data *st, int level);
int (*get_weapon_atk) (struct block_list *src, struct weapon_atk *watk, int flag);
#endif
int (*get_total_mdef) (struct block_list *src);