summaryrefslogtreecommitdiff
path: root/src/map/status.c
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/status.c
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/status.c')
-rw-r--r--src/map/status.c1764
1 files changed, 855 insertions, 909 deletions
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 && (