diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 39 | ||||
-rw-r--r-- | src/map/battle.c | 287 | ||||
-rw-r--r-- | src/map/battleground.c | 2 | ||||
-rw-r--r-- | src/map/chrif.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 157 | ||||
-rw-r--r-- | src/map/elemental.c | 14 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/homunculus.c | 12 | ||||
-rw-r--r-- | src/map/map.c | 10 | ||||
-rw-r--r-- | src/map/mercenary.c | 7 | ||||
-rw-r--r-- | src/map/mob.c | 112 | ||||
-rw-r--r-- | src/map/npc.c | 17 | ||||
-rw-r--r-- | src/map/pc.c | 139 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/pet.c | 61 | ||||
-rw-r--r-- | src/map/script.c | 151 | ||||
-rw-r--r-- | src/map/skill.c | 1530 | ||||
-rw-r--r-- | src/map/status.c | 1359 | ||||
-rw-r--r-- | src/map/status.h | 114 | ||||
-rw-r--r-- | src/map/unit.c | 159 |
20 files changed, 2052 insertions, 2126 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 57d2a73ef..9dbe0ab33 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -895,9 +895,9 @@ ACMD(hide) { if (sd->sc.option & OPTION_INVISIBLE) { sd->sc.option &= ~OPTION_INVISIBLE; if (sd->disguise != -1 ) - iStatus->set_viewdata(&sd->bl, sd->disguise); + status->set_viewdata(&sd->bl, sd->disguise); else - iStatus->set_viewdata(&sd->bl, sd->status.class_); + status->set_viewdata(&sd->bl, sd->status.class_); clif->message(fd, msg_txt(10)); // Invisible: Off // increment the number of pvp players on the map @@ -1011,8 +1011,7 @@ ACMD(kill) ACMD(alive) { nullpo_retr(-1, sd); - if (!iStatus->revive(&sd->bl, 100, 100)) - { + if (!status->revive(&sd->bl, 100, 100)) { clif->message(fd, msg_txt(667)); return false; } @@ -1080,7 +1079,7 @@ ACMD(heal) } if ( hp > 0 && sp >= 0 ) { - if(!iStatus->heal(&sd->bl, hp, sp, 0)) + if(!status->heal(&sd->bl, hp, sp, 0)) clif->message(fd, msg_txt(157)); // HP and SP are already with the good value. else clif->message(fd, msg_txt(17)); // HP, SP recovered. @@ -1088,7 +1087,7 @@ ACMD(heal) } if ( hp < 0 && sp <= 0 ) { - iStatus->damage(NULL, &sd->bl, -hp, -sp, 0, 0); + status->damage(NULL, &sd->bl, -hp, -sp, 0, 0); clif->damage(&sd->bl,&sd->bl, timer->gettick(), 0, 0, -hp, 0, 4, 0); clif->message(fd, msg_txt(156)); // HP or/and SP modified. return true; @@ -1097,18 +1096,18 @@ ACMD(heal) //Opposing signs. if ( hp ) { if (hp > 0) - iStatus->heal(&sd->bl, hp, 0, 0); + status->heal(&sd->bl, hp, 0, 0); else { - iStatus->damage(NULL, &sd->bl, -hp, 0, 0, 0); + status->damage(NULL, &sd->bl, -hp, 0, 0, 0); clif->damage(&sd->bl,&sd->bl, timer->gettick(), 0, 0, -hp, 0, 4, 0); } } if ( sp ) { if (sp > 0) - iStatus->heal(&sd->bl, 0, sp, 0); + status->heal(&sd->bl, 0, sp, 0); else - iStatus->damage(NULL, &sd->bl, 0, -sp, 0, 0); + status->damage(NULL, &sd->bl, 0, -sp, 0, 0); } clif->message(fd, msg_txt(156)); // HP or/and SP modified. @@ -2971,7 +2970,7 @@ ACMD(doommap) *------------------------------------------*/ static void atcommand_raise_sub(struct map_session_data* sd) { - iStatus->revive(&sd->bl, 100, 100); + status->revive(&sd->bl, 100, 100); clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); clif->message(sd->fd, msg_txt(63)); // Mercy has been shown. @@ -3679,9 +3678,8 @@ ACMD(reloadbattleconf) /*========================================== * @reloadstatusdb - reloads job_db1.txt job_db2.txt job_db2-2.txt refine_db.txt size_fix.txt *------------------------------------------*/ -ACMD(reloadstatusdb) -{ - iStatus->readdb(); +ACMD(reloadstatusdb) { + status->readdb(); clif->message(fd, msg_txt(256)); return true; } @@ -4444,7 +4442,7 @@ ACMD(servertime) } //Added by Coltaro -//We're using this function here instead of using time_t so that it only counts player's jail time when he/she's online (and since the idea is to reduce the amount of minutes one by one in iStatus->change_timer...). +//We're using this function here instead of using time_t so that it only counts player's jail time when he/she's online (and since the idea is to reduce the amount of minutes one by one in status->change_timer...). //Well, using time_t could still work but for some reason that looks like more coding x_x static void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int* minute) { @@ -4672,7 +4670,7 @@ ACMD(jailfor) break; } - sc_start4(&pl_sd->bl,SC_JAILED,100,jailtime,m_index,x,y,jailtime?60000:1000); //jailtime = 0: Time was reset to 0. Wait 1 second to warp player out (since it's done in iStatus->change_timer). + sc_start4(&pl_sd->bl,SC_JAILED,100,jailtime,m_index,x,y,jailtime?60000:1000); //jailtime = 0: Time was reset to 0. Wait 1 second to warp player out (since it's done in status->change_timer). return true; } @@ -5425,12 +5423,11 @@ ACMD(displayskill) { uint16 skill_lv = 1; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%hu %hu", &skill_id, &skill_lv) < 1) - { + if (!message || !*message || sscanf(message, "%hu %hu", &skill_id, &skill_lv) < 1) { clif->message(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>} return false; } - st = iStatus->get_status_data(&sd->bl); + st = status->get_status_data(&sd->bl); tick = timer->gettick(); clif->skill_damage(&sd->bl,&sd->bl, tick, st->amotion, st->dmotion, 1, 1, skill_id, skill_lv, 5); clif->skill_nodamage(&sd->bl, &sd->bl, skill_id, skill_lv, 1); @@ -5617,7 +5614,7 @@ ACMD(autotrade) { sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); - iStatus->change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); + status->change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } clif->chsys_quit(sd); @@ -7050,7 +7047,7 @@ ACMD(hominfo) { } hd = sd->hd; - st = iStatus->get_status_data(&hd->bl); + st = status->get_status_data(&hd->bl); clif->message(fd, msg_txt(1261)); // Homunculus stats: snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1262), // HP: %d/%d - SP: %d/%d diff --git a/src/map/battle.c b/src/map/battle.c index 54716bd32..abbef8c77 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -130,7 +130,7 @@ int battle_getenemy_sub(struct block_list *bl, va_list ap) { if (*c >= 24) return 0; - if (iStatus->isdead(bl)) + if (status->isdead(bl)) return 0; if (battle->check_target(target, bl, BCT_ENEMY) > 0) { @@ -172,7 +172,7 @@ int battle_getenemyarea_sub(struct block_list *bl, va_list ap) { if( *c >= 23 ) return 0; - if( iStatus->isdead(bl) ) + if( status->isdead(bl) ) return 0; if( battle->check_target(src, bl, BCT_ENEMY) > 0 ) {// Is Enemy!... @@ -221,7 +221,7 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { struct block_list* src = NULL; struct block_list* target = iMap->id2bl(dat->target_id); - if( !target || iStatus->isdead(target) ) {/* nothing we can do */ + if( !target || status->isdead(target) ) {/* nothing we can do */ if( dat->src_type == BL_PC && ( src = iMap->id2bl(dat->src_id) ) && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) { ((TBL_PC*)src)->state.hold_recalc = 0; status_calc_pc(((TBL_PC*)src),0); @@ -238,7 +238,7 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { { iMap->freeblock_lock(); status_fix_damage(src, target, dat->damage, dat->delay); - if( dat->attack_type && !iStatus->isdead(target) && dat->additional_effects ) + if( dat->attack_type && !status->isdead(target) && dat->additional_effects ) skill->additional_effect(src,target,dat->skill_id,dat->skill_lv,dat->attack_type,dat->dmg_lv,tick); if( dat->dmg_lv > ATK_BLOCK && dat->attack_type ) skill->counter_additional_effect(src,target,dat->skill_id,dat->skill_lv,dat->attack_type,tick); @@ -261,14 +261,13 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { return 0; } -int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects) -{ +int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects) { struct delay_damage *dat; struct status_change *sc; nullpo_ret(src); nullpo_ret(target); - sc = iStatus->get_sc(target); + sc = status->get_sc(target); if( sc && sc->data[SC_DEVOTION] && damage > 0 && skill_id != PA_PRESSURE && skill_id != CR_REFLECTSHIELD ) damage = 0; @@ -276,7 +275,7 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, if ( !battle_config.delay_battle_damage || amotion <= 1 ) { iMap->freeblock_lock(); status_fix_damage(src, target, damage, ddelay); // We have to seperate here between reflect damage and others [icescope] - if( attack_type && !iStatus->isdead(target) && additional_effects ) + if( attack_type && !status->isdead(target) && additional_effects ) skill->additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, timer->gettick()); if( dmg_lv > ATK_BLOCK && attack_type ) skill->counter_additional_effect(src, target, skill_id, skill_lv, attack_type, timer->gettick()); @@ -328,8 +327,8 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d struct status_change *sc=NULL, *tsc=NULL; int ratio; - if (src) sc = iStatus->get_sc(src); - if (target) tsc = iStatus->get_sc(target); + if (src) sc = status->get_sc(src); + if (target) tsc = status->get_sc(target); if (atk_elem < 0 || atk_elem >= ELE_MAX) atk_elem = rnd()%ELE_MAX; @@ -356,7 +355,7 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d struct block_list *src; if( !su || !su->alive || (sg = su->group) == NULL || !sg || sg->val3 == -1 || - (src = iMap->id2bl(sg->src_id)) == NULL || iStatus->isdead(src) ) + (src = iMap->id2bl(sg->src_id)) == NULL || status->isdead(src) ) return 0; if( sg->unit_id != UNT_FIREWALL ) { @@ -435,10 +434,10 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u if( !src || !bl ) return 0; - sc = iStatus->get_sc(src); + sc = status->get_sc(src); sd = BL_CAST(BL_PC, src); - damage = iStatus->get_weapon_atk(src, watk, flag); + damage = status->get_weapon_atk(src, watk, flag); if( sd ){ if( type == EQI_HAND_R ) @@ -503,9 +502,9 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u #ifdef RENEWAL int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2) { int64 damage, batk; - struct status_data *st = iStatus->get_status_data(src); + struct status_data *st = status->get_status_data(src); - batk = battle->calc_elefix(src, bl, skill_id, skill_lv, iStatus->calc_batk(bl, iStatus->get_sc(src), st->batk, false), nk, n_ele, ELE_NEUTRAL, ELE_NEUTRAL, false, flag); + batk = battle->calc_elefix(src, bl, skill_id, skill_lv, status->calc_batk(bl, status->get_sc(src), st->batk, false), nk, n_ele, ELE_NEUTRAL, ELE_NEUTRAL, false, flag); if( type == EQI_HAND_L ) damage = batk + 3 * battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &st->lhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2) / 4; @@ -604,7 +603,7 @@ int64 battle_calc_sizefix(struct map_session_data *sd, int64 damage, int type, i *------------------------------------------*/ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,int64 dmg,int type) { int64 damage; - struct status_data *st = iStatus->get_status_data(target); + struct status_data *st = status->get_status_data(target); int weapon, skill_lv; damage = dmg; @@ -721,9 +720,9 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, nullpo_ret(src); nullpo_ret(target); - sc = iStatus->get_sc(src); + sc = status->get_sc(src); sd = BL_CAST(BL_PC, src); - tstatus = iStatus->get_status_data(target); + tstatus = status->get_status_data(target); if ( !sd ) return damage; @@ -820,7 +819,7 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, if ( sc && sc->data[SC_MIRACLE] ) i = 2; //Star anger else - ARR_FIND(0, MAX_PC_FEELHATE, i, iStatus->get_class(target) == sd->hate_mob[i]); + ARR_FIND(0, MAX_PC_FEELHATE, i, status->get_class(target) == sd->hate_mob[i]); if ( i < MAX_PC_FEELHATE && (skill2_lv=pc->checkskill(sd,sg_info[i].anger_id)) && weapon ) { int ratio = sd->status.base_level + status_get_dex(src) + status_get_luk(src); if ( i == 2 ) ratio += status_get_str(src); //Star Anger @@ -846,7 +845,7 @@ int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint nullpo_ret(src); nullpo_ret(target); - tstatus = iStatus->get_status_data(target); + tstatus = status->get_status_data(target); if( (nk&NK_NO_ELEFIX) || n_ele ) return damage; @@ -868,8 +867,8 @@ int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint struct status_data *sstatus; struct status_change *sc; - sstatus = iStatus->get_status_data(src); - sc = iStatus->get_sc(src); + sstatus = status->get_status_data(src); + sc = status->get_sc(src); if( sc && sc->data[SC_SUB_WEAPONPROPERTY] ) { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex] int64 temp = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; @@ -903,11 +902,11 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); - t_class = iStatus->get_class(target); - s_class = iStatus->get_class(src); - sstatus = iStatus->get_status_data(src); - tstatus = iStatus->get_status_data(target); - s_race2 = iStatus->get_race2(src); + t_class = status->get_class(target); + s_class = status->get_class(src); + sstatus = status->get_status_data(src); + tstatus = status->get_status_data(target); + s_race2 = status->get_race2(src); switch(attack_type){ case BF_MAGIC: @@ -973,7 +972,7 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ } break; case BF_WEAPON: - t_race2 = iStatus->get_race2(target); + t_race2 = status->get_race2(target); if( cflag&2 ){ if( sd && !(nk&NK_NO_CARDFIX_ATK) ){ short cardfix_ = 1000; @@ -1206,10 +1205,10 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); - sstatus = iStatus->get_status_data(src); - tstatus = iStatus->get_status_data(target); - sc = iStatus->get_sc(src); - tsc = iStatus->get_sc(target); + sstatus = status->get_status_data(src); + tstatus = status->get_status_data(target); + sc = status->get_sc(src); + tsc = status->get_sc(target); switch(attack_type){ case BF_WEAPON: @@ -1218,14 +1217,14 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ * def1 = equip def * def2 = status def **/ - defType def1 = iStatus->get_def(target); //Don't use tstatus->def1 due to skill timer reductions. + defType def1 = status->get_def(target); //Don't use tstatus->def1 due to skill timer reductions. short def2 = tstatus->def2, vit_def; #ifdef RENEWAL - def1 = iStatus->calc_def2(target, tsc, def1, false); // equip def(RE) - def2 = iStatus->calc_def(target, tsc, def2, false); // status def(RE) + def1 = status->calc_def2(target, tsc, def1, false); // equip def(RE) + def2 = status->calc_def(target, tsc, def2, false); // status def(RE) #else - def1 = iStatus->calc_def(target, tsc, def1, false); // equip def(RE) - def2 = iStatus->calc_def2(target, tsc, def2, false); // status def(RE) + def1 = status->calc_def(target, tsc, def1, false); // equip def(RE) + def2 = status->calc_def2(target, tsc, def2, false); // status def(RE) #endif if( sd ){ @@ -1331,11 +1330,11 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ defType mdef = tstatus->mdef; short mdef2= tstatus->mdef2; #ifdef RENEWAL - mdef2 = iStatus->calc_mdef(target, tsc, mdef2, false); // status mdef(RE) - mdef = iStatus->calc_mdef2(target, tsc, mdef, false); // equip mde(RE) + mdef2 = status->calc_mdef(target, tsc, mdef2, false); // status mdef(RE) + mdef = status->calc_mdef2(target, tsc, mdef, false); // equip mde(RE) #else - mdef2 = iStatus->calc_mdef2(target, tsc, mdef2, false); // status mdef(RE) - mdef = iStatus->calc_mdef(target, tsc, mdef, false); // equip mde(RE) + mdef2 = status->calc_mdef2(target, tsc, mdef2, false); // status mdef(RE) + mdef = status->calc_mdef(target, tsc, mdef, false); // equip mde(RE) #endif if( flag&1 ) mdef = 0; @@ -1382,10 +1381,10 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); - sc = iStatus->get_sc(src); - tsc = iStatus->get_sc(target); - st = iStatus->get_status_data(src); - tst = iStatus->get_status_data(target); + sc = status->get_sc(src); + tsc = status->get_sc(target); + st = status->get_status_data(src); + tst = status->get_status_data(target); switch(attack_type){ case BF_MAGIC: @@ -1454,7 +1453,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += (tst->size!=SZ_BIG?5*skill_lv:-99); //Full damage is dealt on small/medium targets break; case SL_SMA: - skillratio += -60 + iStatus->get_lv(src); //Base damage is 40% + lv% + skillratio += -60 + status->get_lv(src); //Base damage is 40% + lv% break; case NJ_KOUENKA: skillratio -= 10; @@ -1603,7 +1602,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case WL_SUMMON_ATK_WATER: case WL_SUMMON_ATK_WIND: case WL_SUMMON_ATK_GROUND: - skillratio = skill_lv * (iStatus->get_lv(src) + ( sd ? sd->status.job_level : 50 ));// This is close to official, but lacking a little info to finalize. [Rytech] + skillratio = skill_lv * (status->get_lv(src) + ( sd ? sd->status.job_level : 50 ));// This is close to official, but lacking a little info to finalize. [Rytech] RE_LVL_DMOD(100); break; case LG_RAYOFGENESIS: @@ -1617,7 +1616,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block break; case LG_SHIELDSPELL:// [(Casters Base Level x 4) + (Shield MDEF x 100) + (Casters INT x 2)] % if( sd ) { - skillratio = iStatus->get_lv(src) * 4 + sd->bonus.shieldmdef * 100 + status_get_int(src) * 2; + skillratio = status->get_lv(src) * 4 + sd->bonus.shieldmdef * 100 + status_get_int(src) * 2; } else skillratio += 1900; //2000% break; @@ -1994,10 +1993,9 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case TK_JUMPKICK: skillratio += -70 + 10*skill_lv; if (sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == skill_id) - skillratio += 10 * iStatus->get_lv(src) / 3; //Tumble bonus - if (flag) - { - skillratio += 10 * iStatus->get_lv(src) / 3; //Running bonus (TODO: What is the real bonus?) + skillratio += 10 * status->get_lv(src) / 3; //Tumble bonus + if (flag) { + skillratio += 10 * status->get_lv(src) / 3; //Running bonus (TODO: What is the real bonus?) if( sc && sc->data[SC_STRUP] ) // Spurt bonus skillratio *= 2; } @@ -2082,7 +2080,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block break; case RK_SONICWAVE: skillratio += -100 + 100 * (skill_lv + 5); - skillratio = skillratio * (100 + (iStatus->get_lv(src)-100) / 2) / 100; + skillratio = skillratio * (100 + (status->get_lv(src)-100) / 2) / 100; break; case RK_HUNDREDSPEAR: skillratio += 500 + (80 * skill_lv); @@ -2091,7 +2089,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON ) skillratio += (10000 - min(10000, sd->inventory_data[index]->weight)) / 10; - skillratio = skillratio * (100 + (iStatus->get_lv(src)-100) / 2) / 100 + 50 * pc->checkskill(sd,LK_SPIRALPIERCE); + skillratio = skillratio * (100 + (status->get_lv(src)-100) / 2) / 100 + 50 * pc->checkskill(sd,LK_SPIRALPIERCE); } break; case RK_WINDCUTTER: @@ -2106,7 +2104,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += 250 * skill_lv; else skillratio += 200 * skill_lv; - skillratio = (skillratio - 100) * (100 + (iStatus->get_lv(src)-100)) / 100; + skillratio = (skillratio - 100) * (100 + (status->get_lv(src)-100)) / 100; if( st->rhw.ele == ELE_FIRE ) skillratio += 100 * skill_lv; break; @@ -2268,7 +2266,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case LG_SHIELDSPELL:// [(Casters Base Level x 4) + (Shield DEF x 10) + (Casters VIT x 2)] % if( sd ) { struct item_data *shield_data = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; - skillratio += -100 + iStatus->get_lv(src) * 4 + status_get_vit(src) * 2; + skillratio += -100 + status->get_lv(src) * 4 + status_get_vit(src) * 2; if( shield_data ) skillratio += shield_data->def * 10; } else @@ -2349,7 +2347,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block break; case SR_KNUCKLEARROW: if( flag&4 ){ // ATK [(Skill Level x 150) + (1000 x Target current weight / Maximum weight) + (Target Base Level x 5) x (Caster Base Level / 150)] % - skillratio += -100 + 150 * skill_lv + iStatus->get_lv(target) * 5 * (iStatus->get_lv(src) / 100) ; + skillratio += -100 + 150 * skill_lv + status->get_lv(target) * 5 * (status->get_lv(src) / 100) ; if( tsd && tsd->weight ) skillratio += 100 * (tsd->weight / tsd->max_weight); }else // ATK [(Skill Level x 100 + 500) x Caster Base Level / 100] % @@ -2357,7 +2355,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block RE_LVL_DMOD(100); break; case SR_WINDMILL: // ATK [(Caster Base Level + Caster DEX) x Caster Base Level / 100] % - skillratio += -100 + iStatus->get_lv(src) + status_get_dex(src); + skillratio += -100 + status->get_lv(src) + status_get_dex(src); RE_LVL_DMOD(100); break; case SR_GATEOFHELL: @@ -2476,7 +2474,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += -100 + 150 * skill_lv; RE_LVL_DMOD(120); if( tsc && tsc->data[SC_KO_JYUMONJIKIRI] ) - skillratio += iStatus->get_lv(src) * skill_lv; + skillratio += status->get_lv(src) * skill_lv; case KO_HUUMARANKA: skillratio += -100 + 150 * skill_lv + status_get_agi(src) + status_get_dex(src) + 100 * (sd ? pc->checkskill(sd, NJ_HUUMA) : 0); break; @@ -2569,7 +2567,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if(!damage) return 0; } - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if( sc && sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] ) return 1; @@ -2590,7 +2588,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam skill_id == MG_SOULSTRIKE || skill_id == WL_SOULEXPANSION || (skill_id && skill->get_ele(skill_id, skill_lv) == ELE_GHOST) || - (!skill_id && (iStatus->get_status_data(src))->rhw.ele == ELE_GHOST) + (!skill_id && (status->get_status_data(src))->rhw.ele == ELE_GHOST) ){ if( skill_id == WL_SOULEXPANSION ) damage <<= 1; // If used against a player in White Imprison, the skill deals double damage. @@ -2731,7 +2729,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam && flag&BF_WEAPON && !(skill->get_nk(skill_id)&NK_NO_CARDFIX_ATK)) { skill->additional_effect (src, bl, skill_id, skill_lv, flag, ATK_BLOCK, timer->gettick() ); - if( !iStatus->isdead(src) ) + if( !status->isdead(src) ) skill->counter_additional_effect( src, bl, skill_id, skill_lv, flag, timer->gettick() ); if (sce) { clif->specialeffect(bl, 462, AREA); @@ -2853,11 +2851,11 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON && skill_id != WS_CARTTERMINATION)) #endif { - struct status_data *sstatus = iStatus->get_status_data(bl); + struct status_data *sstatus = status->get_status_data(bl); int per = 100*sstatus->sp / sstatus->max_sp -1; //100% should be counted as the 80~99% interval per /=20; //Uses 20% SP intervals. //SP Cost: 1% + 0.5% per every 20% SP - if (!iStatus->charge(bl, 0, (10+5*per)*sstatus->max_sp/1000)) + if (!status->charge(bl, 0, (10+5*per)*sstatus->max_sp/1000)) status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER); //Reduction: 6% + 6% every 20% damage -= damage * (6 * (1+per)) / 100; @@ -2940,7 +2938,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam //(since battle_drain is strictly for players currently) if ((sce=sc->data[SC_HAMI_BLOODLUST]) && flag&BF_WEAPON && damage > 0 && rnd()%100 < sce->val3) - iStatus->heal(src, damage*sce->val4/100, 0, 3); + status->heal(src, damage*sce->val4/100, 0, 3); if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON && rnd()%100 < sce->val2 ) pc->addspiritball(sd,skill->get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3); @@ -2950,13 +2948,13 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam } if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 ) - iStatus->change_spread(bl, src); // Deadly infect attacked side + status->change_spread(bl, src); // Deadly infect attacked side if( sc && sc->data[SC__SHADOWFORM] ) { struct block_list *s_bl = iMap->id2bl(sc->data[SC__SHADOWFORM]->val2); if( !s_bl || s_bl->m != bl->m ) { // If the shadow form target is not present remove the sc. status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER); - } else if( iStatus->isdead(s_bl) || !battle->check_target(src,s_bl,BCT_ENEMY)) { // If the shadow form target is dead or not your enemy remove the sc in both. + } else if( status->isdead(s_bl) || !battle->check_target(src,s_bl,BCT_ENEMY)) { // If the shadow form target is dead or not your enemy remove the sc in both. status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER); if( s_bl->type == BL_PC ) ((TBL_PC*)s_bl)->shadowform_id = 0; @@ -2966,7 +2964,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if( s_bl->type == BL_PC ) ((TBL_PC*)s_bl)->shadowform_id = 0; } else { - iStatus->damage(bl, s_bl, damage, 0, clif->damage(s_bl, s_bl, timer->gettick(), 500, 500, damage, -1, 0, 0), 0); + status->damage(bl, s_bl, damage, 0, clif->damage(s_bl, s_bl, timer->gettick(), 500, 500, damage, -1, 0, 0), 0); return ATK_NONE; } } @@ -2975,7 +2973,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam } //SC effects from caster side. - sc = iStatus->get_sc(src); + sc = status->get_sc(src); if (sc && sc->count) { if( sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] ) @@ -3004,7 +3002,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if( sc->data[SC_POISONINGWEAPON] && skill_id != GC_VENOMPRESSURE && (flag&BF_WEAPON) && damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3 ) sc_start(bl,sc->data[SC_POISONINGWEAPON]->val2,100,sc->data[SC_POISONINGWEAPON]->val1,skill->get_time2(GC_POISONINGWEAPON, 1)); if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 ) - iStatus->change_spread(src, bl); + status->change_spread(src, bl); if (sc->data[SC_STYLE_CHANGE] && rnd()%2) { TBL_HOM *hd = BL_CAST(BL_HOM,bl); if (hd) homun->addspiritball(hd, 10); @@ -3046,7 +3044,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam damage = div_; } - if( bl->type == BL_MOB && !iStatus->isdead(bl) && src != bl) { + if( bl->type == BL_MOB && !status->isdead(bl) && src != bl) { if (damage > 0 ) mob->skill_event((TBL_MOB*)bl,src,timer->gettick(),flag); if (skill_id) @@ -3059,12 +3057,12 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam struct status_data *sstatus = NULL; if( src->type == BL_PC && ((TBL_PC*)src)->bonus.arrow_ele ) element = ((TBL_PC*)src)->bonus.arrow_ele; - else if( (sstatus = iStatus->get_status_data(src)) ) { + else if( (sstatus = status->get_status_data(src)) ) { element = sstatus->rhw.ele; } } else if( element == -2 ) //Use enchantment's element - element = status_get_attack_sc_element(src,iStatus->get_sc(src)); + element = status_get_attack_sc_element(src,status->get_sc(src)); else if( element == -3 ) //Use random element element = rnd()%ELE_MAX; if( element == ELE_FIRE || element == ELE_WATER ) @@ -3096,10 +3094,9 @@ int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64 /*========================================== * Calculates GVG related damage adjustments. *------------------------------------------*/ -int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 damage,int div_,uint16 skill_id,uint16 skill_lv,int flag) -{ +int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 damage,int div_,uint16 skill_id,uint16 skill_lv,int flag) { struct mob_data* md = BL_CAST(BL_MOB, bl); - int class_ = iStatus->get_class(bl); + int class_ = status->get_class(bl); if (!damage) //No reductions to make. return 0; @@ -3118,7 +3115,7 @@ int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 } } if(src->type != BL_MOB) { - struct guild *g = src->type == BL_PC ? ((TBL_PC *)src)->guild : guild->search(iStatus->get_guild_id(src)); + struct guild *g = src->type == BL_PC ? ((TBL_PC *)src)->guild : guild->search(status->get_guild_id(src)); if (class_ == MOBID_EMPERIUM && (!g || guild->checkskill(g,GD_APPROVAL) <= 0 )) return 0; @@ -3233,8 +3230,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list TBL_PC *sd; struct status_change *sc; struct Damage ad; - struct status_data *sstatus = iStatus->get_status_data(src); - struct status_data *tstatus = iStatus->get_status_data(target); + struct status_data *sstatus = status->get_status_data(src); + struct status_data *tstatus = status->get_status_data(target); struct { unsigned imdef : 1; unsigned infdef : 1; @@ -3261,7 +3258,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list sd = BL_CAST(BL_PC, src); - sc = iStatus->get_sc(src); + sc = status->get_sc(src); //Initialize variables that will be used afterwards s_ele = skill->get_ele(skill_id, skill_lv); @@ -3273,7 +3270,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if( i < 5 ) s_ele = i; } }else if (s_ele == -2) //Use status element - s_ele = status_get_attack_sc_element(src,iStatus->get_sc(src)); + s_ele = status_get_attack_sc_element(src,status->get_sc(src)); else if( s_ele == -3 ) //Use random element s_ele = rnd()%ELE_MAX; @@ -3360,16 +3357,16 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list case ALL_RESURRECTION: case PR_TURNUNDEAD: //Undead check is on skill_castend_damageid code. - i = 20*skill_lv + sstatus->luk + sstatus->int_ + iStatus->get_lv(src) + i = 20*skill_lv + sstatus->luk + sstatus->int_ + status->get_lv(src) + 200 - 200*tstatus->hp/tstatus->max_hp; // there is no changed in success chance in renewal. [malufett] if(i > 700) i = 700; if(rnd()%1000 < i && !(tstatus->mode&MD_BOSS)) ad.damage = tstatus->hp; else { #ifdef RENEWAL - MATK_ADD(iStatus->get_matk(src, 2)); + MATK_ADD(status->get_matk(src, 2)); #else - ad.damage = iStatus->get_lv(src) + sstatus->int_ + skill_lv * 10; + ad.damage = status->get_lv(src) + sstatus->int_ + skill_lv * 10; #endif } break; @@ -3381,10 +3378,10 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list **/ case AB_RENOVATIO: //Damage calculation from iRO wiki. [Jobbie] - ad.damage = (int)((15 * iStatus->get_lv(src)) + (1.5 * sstatus->int_)); + ad.damage = (int)((15 * status->get_lv(src)) + (1.5 * sstatus->int_)); break; default: { - MATK_ADD( iStatus->get_matk(src, 2) ); + MATK_ADD( status->get_matk(src, 2) ); if (nk&NK_SPLASHSPLIT) { // Divide MATK in case of multiple targets skill if(mflag>0) @@ -3543,11 +3540,11 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * struct map_session_data *sd, *tsd; struct Damage md; //DO NOT CONFUSE with md of mob_data! - struct status_data *sstatus = iStatus->get_status_data(src); - struct status_data *tstatus = iStatus->get_status_data(target); - struct status_change *tsc = iStatus->get_sc(target); + struct status_data *sstatus = status->get_status_data(src); + struct status_data *tstatus = status->get_status_data(target); + struct status_change *tsc = status->get_sc(target); #ifdef RENEWAL - struct status_change *sc = iStatus->get_sc(src); + struct status_change *sc = status->get_sc(src); #endif memset(&md,0,sizeof(md)); @@ -3591,7 +3588,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * case MA_LANDMINE: case HT_BLASTMINE: case HT_CLAYMORETRAP: - md.damage = skill_lv * sstatus->dex * (3+iStatus->get_lv(src)/100) * (1+sstatus->int_/35); + md.damage = skill_lv * sstatus->dex * (3+status->get_lv(src)/100) * (1+sstatus->int_/35); md.damage += md.damage * (rnd()%20-10) / 100; md.damage += 40 * (sd?pc->checkskill(sd,RA_RESEARCHTRAP):0); break; @@ -3653,8 +3650,8 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * #ifdef RENEWAL {// [malufett] int64 matk=0, atk; - short tdef = iStatus->get_total_def(target); - short tmdef = iStatus->get_total_mdef(target); + short tdef = status->get_total_def(target); + short tmdef = status->get_total_mdef(target); int targetVit = min(120, status_get_vit(target)); short totaldef = (tmdef + tdef - ((uint64)(tmdef + tdef) >> 32)) >> 1; @@ -3712,7 +3709,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.damage=md.damage / 2; break; case GS_FLING: - md.damage = sd?sd->status.job_level:iStatus->get_lv(src); + md.damage = sd?sd->status.job_level:status->get_lv(src); break; case HVAN_EXPLOSION: //[orn] md.damage = sstatus->max_hp * (50 + 50 * skill_lv) / 100; @@ -3725,7 +3722,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * #else int ratio = 300 + 50 * skill_lv; int64 matk = battle->calc_magic_attack(src, target, skill_id, skill_lv, mflag).damage; - short totaldef = iStatus->get_total_def(target) + iStatus->get_total_mdef(target); + short totaldef = status->get_total_def(target) + status->get_total_mdef(target); int64 atk = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, false, s_ele, ELE_NEUTRAL, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), md.flag); if( sc && sc->data[SC_EDP] ) @@ -3774,9 +3771,9 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * case NC_SELFDESTRUCTION: { #ifdef RENEWAL - short totaldef = iStatus->get_total_def(target); + short totaldef = status->get_total_def(target); #else - short totaldef = tstatus->def2 + (short)iStatus->get_def(target); + short totaldef = tstatus->def2 + (short)status->get_def(target); #endif md.damage = ( (sd?pc->checkskill(sd,NC_MAINFRAME):10) + 8 ) * ( skill_lv + 1 ) * ( status_get_sp(src) + sstatus->vit ); RE_LVL_MDMOD(100); @@ -3791,15 +3788,15 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * break; case GN_HELLS_PLANT_ATK: //[{( Hell Plant Skill Level x Casters Base Level ) x 10 } + {( Casters INT x 7 ) / 2 } x { 18 + ( Casters Job Level / 4 )] x ( 5 / ( 10 - Summon Flora Skill Level )) - md.damage = ( skill_lv * iStatus->get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?pc->checkskill(sd,AM_CANNIBALIZE):0)) ); + md.damage = ( skill_lv * status->get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?pc->checkskill(sd,AM_CANNIBALIZE):0)) ); break; case KO_HAPPOKUNAI: { struct Damage wd = battle->calc_weapon_attack(src,target,skill_id,skill_lv,mflag); #ifdef RENEWAL - short totaldef = iStatus->get_total_def(target); + short totaldef = status->get_total_def(target); #else - short totaldef = tstatus->def2 + (short)iStatus->get_def(target); + short totaldef = tstatus->def2 + (short)status->get_def(target); #endif md.damage = 3 * wd.damage * (5 + skill_lv) / 5; md.damage -= totaldef; @@ -3954,10 +3951,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list struct map_session_data *sd, *tsd; struct Damage wd; - struct status_change *sc = iStatus->get_sc(src); - struct status_change *tsc = iStatus->get_sc(target); - struct status_data *sstatus = iStatus->get_status_data(src); - struct status_data *tstatus = iStatus->get_status_data(target); + struct status_change *sc = status->get_sc(src); + struct status_change *tsc = status->get_sc(target); + struct status_data *sstatus = status->get_status_data(src); + struct status_data *tstatus = status->get_status_data(target); struct { unsigned hit : 1; //the attack Hit? (not a miss) unsigned cri : 1; //Critical hit @@ -4230,7 +4227,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Therefore, we use the old value 3 on cases when an sd gets attacked by a mob cri -= tstatus->luk*(!sd&&tsd?3:2); #else - cri -= iStatus->get_lv(target) / 15 + 2 * status_get_luk(target); + cri -= status->get_lv(target) / 15 + 2 * status_get_luk(target); #endif if( tsc && tsc->data[SC_SLEEP] ) { @@ -4420,7 +4417,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list wd.damage2 = 0; #else { - short totaldef = iStatus->get_total_def(target); + short totaldef = status->get_total_def(target); i = 0; GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); if( sc && sc->data[SC_NJ_BUNSINJYUTSU] && (i=sc->data[SC_NJ_BUNSINJYUTSU]->val2) > 0 ) @@ -4437,12 +4434,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list break; case NJ_SYURIKEN: // [malufett] GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); - wd.damage += battle->calc_masteryfix(src, target, skill_id, skill_lv, 4 * skill_lv + (sd ? sd->bonus.arrow_atk : 0), wd.div_, 0, flag.weapon) - iStatus->get_total_def(target); + wd.damage += battle->calc_masteryfix(src, target, skill_id, skill_lv, 4 * skill_lv + (sd ? sd->bonus.arrow_atk : 0), wd.div_, 0, flag.weapon) - status->get_total_def(target); RE_SKILL_REDUCTION(); break; case MO_EXTREMITYFIST: // [malufett] { - short totaldef = iStatus->get_total_def(target); + short totaldef = status->get_total_def(target); GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8 ); if( wd.damage ){ wd.damage = (250 + 150 * skill_lv) + (10 * (status_get_sp(src)+1) * wd.damage / 100) + (8 * wd.damage); @@ -4631,7 +4628,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list break; case GS_MAGICALBULLET: #ifndef RENEWAL - ATK_ADD( iStatus->get_matk(src, 2) ); + ATK_ADD( status->get_matk(src, 2) ); #else ATK_ADD( battle->calc_magic_attack(src, target, skill_id, skill_lv, wflag).damage ); flag.tdef = 1; @@ -4645,17 +4642,17 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_ADD( status_get_agi(src) * 2 + (sd?sd->status.job_level:0) * 4 ); break; case SR_TIGERCANNON: // (Tiger Cannon skill level x 240) + (Target Base Level x 40) - ATK_ADD( skill_lv * 240 + iStatus->get_lv(target) * 40 ); + ATK_ADD( skill_lv * 240 + status->get_lv(target) * 40 ); if( sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == SR_FALLENEMPIRE ) // (Tiger Cannon skill level x 500) + (Target Base Level x 40) - ATK_ADD( skill_lv * 500 + iStatus->get_lv(target) * 40 ); + ATK_ADD( skill_lv * 500 + status->get_lv(target) * 40 ); break; case SR_FALLENEMPIRE:// [(Target Size value + Skill Level - 1) x Caster STR] + [(Target current weight x Caster DEX / 120)] ATK_ADD( ((tstatus->size+1)*2 + skill_lv - 1) * sstatus->str); if( tsd && tsd->weight ){ ATK_ADD( (tsd->weight/10) * sstatus->dex / 120 ); }else{ - ATK_ADD( iStatus->get_lv(target) * 50 ); //mobs + ATK_ADD( status->get_lv(target) * 50 ); //mobs } break; case KO_SETSUDAN: @@ -4821,8 +4818,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( !skill_id ) { if( sc->data[SC_ENCHANTBLADE] ) { //[( ( Skill Lv x 20 ) + 100 ) x ( casterBaseLevel / 150 )] + casterInt - i = ( sc->data[SC_ENCHANTBLADE]->val1 * 20 + 100 ) * iStatus->get_lv(src) / 150 + status_get_int(src); - i = i - iStatus->get_total_mdef(target) + iStatus->get_matk(src, 2); + i = ( sc->data[SC_ENCHANTBLADE]->val1 * 20 + 100 ) * status->get_lv(src) / 150 + status_get_int(src); + i = i - status->get_total_mdef(target) + status->get_matk(src, 2); if( i ) ATK_ADD(i); } @@ -4924,7 +4921,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } #endif if( flag.infdef ) { //Plants receive 1 damage when hit - short class_ = iStatus->get_class(target); + short class_ = status->get_class(target); if( flag.hit || wd.damage > 0 ) wd.damage = wd.div_; // In some cases, right hand no need to have a weapon to increase damage if( flag.lh && (flag.hit || wd.damage2 > 0) ) @@ -5016,9 +5013,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list case SR_GATEOFHELL: ATK_ADD (sstatus->max_hp - status_get_hp(src)); if(sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == SR_FALLENEMPIRE){ - ATK_ADD ( (sstatus->max_sp * (1 + skill_lv * 2 / 10)) + 40 * iStatus->get_lv(src) ); + ATK_ADD ( (sstatus->max_sp * (1 + skill_lv * 2 / 10)) + 40 * status->get_lv(src) ); }else{ - ATK_ADD ( (sstatus->sp * (1 + skill_lv * 2 / 10)) + 10 * iStatus->get_lv(src) ); + ATK_ADD ( (sstatus->sp * (1 + skill_lv * 2 / 10)) + 10 * status->get_lv(src) ); } break; } @@ -5173,10 +5170,10 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i #ifdef RENEWAL int max_reflect_damage; - max_reflect_damage = max(status_get_max_hp(bl), status_get_max_hp(bl) * iStatus->get_lv(bl) / 100); + max_reflect_damage = max(status_get_max_hp(bl), status_get_max_hp(bl) * status->get_lv(bl) / 100); #endif sd = BL_CAST(BL_PC, bl); - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); #ifdef RENEWAL #define NORMALIZE_RDAMAGE(d){ trdamage += rdamage = max(1, min(max_reflect_damage, d)); } @@ -5186,14 +5183,14 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i if( sc && sc->data[SC_CRESCENTELBOW] && !is_boss(src) && rnd()%100 < sc->data[SC_CRESCENTELBOW]->val2 ){ //ATK [{(Target HP / 100) x Skill Level} x Caster Base Level / 125] % + [Received damage x {1 + (Skill Level x 0.2)}] - int ratio = (status_get_hp(src) / 100) * sc->data[SC_CRESCENTELBOW]->val1 * iStatus->get_lv(bl) / 125; + int ratio = (status_get_hp(src) / 100) * sc->data[SC_CRESCENTELBOW]->val1 * status->get_lv(bl) / 125; if (ratio > 5000) ratio = 5000; // Maximum of 5000% ATK rdamage = rdamage * ratio / 100 + (*dmg) * (10 + sc->data[SC_CRESCENTELBOW]->val1 * 20 / 10) / 10; skill->blown(bl, src, skill->get_blewcount(SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1), unit->getdir(src), 0); clif->skill_damage(bl, src, timer->gettick(), status_get_amotion(src), 0, rdamage, 1, SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1, 6); // This is how official does clif->damage(src, bl, timer->gettick(), status_get_amotion(src)+1000, 0, rdamage/10, 1, 0, 0); - iStatus->damage(src, bl, iStatus->damage(bl, src, rdamage, 0, 0, 1)/10, 0, 0, 1); + status->damage(src, bl, status->damage(bl, src, rdamage, 0, 0, 1)/10, 0, 0, 1); status_change_end(bl, SC_CRESCENTELBOW, INVALID_TIMER); return 0; // Just put here to minimize redundancy } @@ -5294,7 +5291,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama if (!thp && !tsp) return; - iStatus->heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1); + status->heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1); if (rhp || rsp) status_zap(tbl, rhp, rsp); @@ -5350,11 +5347,11 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); - sstatus = iStatus->get_status_data(src); - tstatus = iStatus->get_status_data(target); + sstatus = status->get_status_data(src); + tstatus = status->get_status_data(target); - sc = iStatus->get_sc(src); - tsc = iStatus->get_sc(target); + sc = status->get_sc(src); + tsc = status->get_sc(target); if (sc && !sc->count) //Avoid sc checks when there's none to check for. [Skotlex] sc = NULL; @@ -5404,7 +5401,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t else if (sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4 & 2)) status_change_end(src, SC_CLOAKINGEXCEED, INVALID_TIMER); } - if( tsc && tsc->data[SC_AUTOCOUNTER] && iStatus->check_skilluse(target, src, KN_AUTOCOUNTER, 1) ) + if( tsc && tsc->data[SC_AUTOCOUNTER] && status->check_skilluse(target, src, KN_AUTOCOUNTER, 1) ) { uint8 dir = iMap->calc_dir(target,src->x,src->y); int t_dir = unit->getdir(target); @@ -5493,7 +5490,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } if(tsc && tsc->data[SC_KAAHI] && tsc->data[SC_KAAHI]->val4 == INVALID_TIMER && tstatus->hp < tstatus->max_hp) - tsc->data[SC_KAAHI]->val4 = timer->add(tick + skill->get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), iStatus->kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal. + tsc->data[SC_KAAHI]->val4 = timer->add(tick + skill->get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), status->kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal. wd = battle->calc_attack(BF_WEAPON, src, target, 0, 0, flag); @@ -5566,9 +5563,9 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } } else if( tsc->data[SC_WATER_SCREEN_OPTION] && tsc->data[SC_WATER_SCREEN_OPTION]->val1 ) { struct block_list *e_bl = iMap->id2bl(tsc->data[SC_WATER_SCREEN_OPTION]->val1); - if( e_bl && !iStatus->isdead(e_bl) ) { + if( e_bl && !status->isdead(e_bl) ) { clif->damage(e_bl,e_bl,tick,wd.amotion,wd.dmotion,damage,wd.div_,wd.type,wd.damage2); - iStatus->damage(target,e_bl,damage,0,0,0); + status->damage(target,e_bl,damage,0,0,0); // Just show damage in target. clif->damage(src, target, tick, wd.amotion, wd.dmotion, damage, wd.div_, wd.type, wd.damage2 ); iMap->freeblock_unlock(); @@ -5588,7 +5585,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t if (skill_lv < 1) skill_lv = 1; sp = skill->get_sp(skill_id,skill_lv) * 2 / 3; - if (iStatus->charge(src, 0, sp)) { + if (status->charge(src, 0, sp)) { switch (skill->get_casttype(skill_id)) { case CAST_GROUND: skill->castend_pos2(src, target->x, target->y, skill_id, skill_lv, tick, flag); @@ -5674,7 +5671,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t (rnd()%100 < tsc->data[SC_POISONREACT]->val3 || sstatus->def_ele == ELE_POISON) && // check_distance_bl(src, target, tstatus->rhw.range+1) && Doesn't checks range! o.O; - iStatus->check_skilluse(target, src, TF_POISON, 0) + status->check_skilluse(target, src, TF_POISON, 0) ) { //Poison React struct status_change_entry *sce = tsc->data[SC_POISONREACT]; if (sstatus->def_ele == ELE_POISON) { @@ -5792,7 +5789,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f switch( target->type ) { // Checks on actual target case BL_PC: { - struct status_change* sc = iStatus->get_sc(src); + struct status_change* sc = status->get_sc(src); if (((TBL_PC*)target)->invincible_timer != INVALID_TIMER || pc_isinvisible((TBL_PC*)target)) return -1; //Cannot be targeted yet. if( sc && sc->count ) { @@ -6018,8 +6015,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f tbg_id = bg->team_get_id(t_bl); } if( flag&(BCT_PARTY|BCT_ENEMY) ) { - int s_party = iStatus->get_party_id(s_bl); - if( s_party && s_party == iStatus->get_party_id(t_bl) + int s_party = status->get_party_id(s_bl); + if( s_party && s_party == status->get_party_id(t_bl) && !(maplist[m].flag.pvp && maplist[m].flag.pvp_noparty) && !(map_flag_gvg(m) && maplist[m].flag.gvg_noparty) && (!maplist[m].flag.battleground || sbg_id == tbg_id) ) @@ -6028,8 +6025,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f state |= BCT_ENEMY; } if( flag&(BCT_GUILD|BCT_ENEMY) ) { - int s_guild = iStatus->get_guild_id(s_bl); - int t_guild = iStatus->get_guild_id(t_bl); + int s_guild = status->get_guild_id(s_bl); + int t_guild = status->get_guild_id(t_bl); if( !(maplist[m].flag.pvp && maplist[m].flag.pvp_noguild) && s_guild && t_guild && (s_guild == t_guild || (!(flag&BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild))) @@ -6048,7 +6045,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f (sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE || (sd2->class_&MAPID_UPPERMASK) == MAPID_NOVICE || (int)sd->status.base_level < battle_config.pk_min_level || - (int)sd2->status.base_level < battle_config.pk_min_level || + (int)sd2->status.base_level < battle_config.pk_min_level || (battle_config.pk_level_range && abs((int)sd->status.base_level - (int)sd2->status.base_level) > battle_config.pk_level_range) ) state &= ~BCT_ENEMY; @@ -6056,16 +6053,14 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f }//end map_flag_vs chk rivality else { //Non pvp/gvg, check party/guild settings. - if( flag&BCT_PARTY || state&BCT_ENEMY ) - { - int s_party = iStatus->get_party_id(s_bl); - if(s_party && s_party == iStatus->get_party_id(t_bl)) + if( flag&BCT_PARTY || state&BCT_ENEMY ) { + int s_party = status->get_party_id(s_bl); + if(s_party && s_party == status->get_party_id(t_bl)) state |= BCT_PARTY; } - if( flag&BCT_GUILD || state&BCT_ENEMY ) - { - int s_guild = iStatus->get_guild_id(s_bl); - int t_guild = iStatus->get_guild_id(t_bl); + if( flag&BCT_GUILD || state&BCT_ENEMY ) { + int s_guild = status->get_guild_id(s_bl); + int t_guild = status->get_guild_id(t_bl); if(s_guild && t_guild && (s_guild == t_guild || (!(flag&BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild)))) state |= BCT_GUILD; } diff --git a/src/map/battleground.c b/src/map/battleground.c index db6d6cd5a..25d942226 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -163,7 +163,7 @@ int bg_member_respawn(struct map_session_data *sd) { if( bgd->mapindex == 0 ) return 0; // Respawn not handled by Core pc->setpos(sd, bgd->mapindex, bgd->x, bgd->y, CLR_OUTSIGHT); - iStatus->revive(&sd->bl, 1, 100); + status->revive(&sd->bl, 1, 100); return 1; // Warped } diff --git a/src/map/chrif.c b/src/map/chrif.c index 15bf80da3..7277bfe33 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1185,7 +1185,7 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the continue; if (sc->data[i]->timer != INVALID_TIMER) { td = timer->get(sc->data[i]->timer); - if (td == NULL || td->func != iStatus->change_timer || DIFF_TICK(td->tick,tick) < 0) + if (td == NULL || td->func != status->change_timer || DIFF_TICK(td->tick,tick) < 0) continue; data.tick = DIFF_TICK(td->tick,tick); //Duration that is left before ending. } else @@ -1238,7 +1238,7 @@ int chrif_load_scdata(int fd) { for (i = 0; i < count; i++) { data = (struct status_change_data*)RFIFOP(fd,14 + i*sizeof(struct status_change_data)); - iStatus->change_start(&sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, 15); + status->change_start(&sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, 15); } #endif diff --git a/src/map/clif.c b/src/map/clif.c index e85f1131f..59b0723fc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -239,13 +239,13 @@ uint32 clif_refresh_ip(void) { #if PACKETVER >= 20071106 static inline unsigned char clif_bl_type(struct block_list *bl) { switch (bl->type) { - case BL_PC: return (disguised(bl) && !pcdb_checkid(iStatus->get_viewdata(bl)->class_))? 0x1:0x0; //PC_TYPE + case BL_PC: return (disguised(bl) && !pcdb_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; //PC_TYPE case BL_ITEM: return 0x2; //ITEM_TYPE case BL_SKILL: return 0x3; //SKILL_TYPE case BL_CHAT: return 0x4; //UNKNOWN_TYPE - case BL_MOB: return pcdb_checkid(iStatus->get_viewdata(bl)->class_)?0x0:0x5; //NPC_MOB_TYPE + case BL_MOB: return pcdb_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; //NPC_MOB_TYPE case BL_NPC: return 0x6; //NPC_EVT_TYPE - case BL_PET: return pcdb_checkid(iStatus->get_viewdata(bl)->class_)?0x0:0x7; //NPC_PET_TYPE + case BL_PET: return pcdb_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; //NPC_PET_TYPE case BL_HOM: return 0x8; //NPC_HOM_TYPE case BL_MER: return 0x9; //NPC_MERSOL_TYPE case BL_ELEM: return 0xa; //NPC_ELEMENTAL_TYPE @@ -850,7 +850,7 @@ static int clif_setlevel_sub(int lv) { } static int clif_setlevel(struct block_list* bl) { - int lv = iStatus->get_lv(bl); + int lv = status->get_lv(bl); if( battle_config.client_limit_unit_lv&bl->type ) return clif_setlevel_sub(lv); switch( bl->type ) { @@ -865,10 +865,10 @@ static int clif_setlevel(struct block_list* bl) { /* for 'packetver < 20091103' 0x78 non-pc-looking unit handling */ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { struct map_session_data* sd; - struct status_change* sc = iStatus->get_sc(bl); - struct view_data* vd = iStatus->get_viewdata(bl); + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); struct packet_idle_unit2 p; - int g_id = iStatus->get_guild_id(bl); + int g_id = status->get_guild_id(bl); sd = BL_CAST(BL_PC, bl); @@ -877,7 +877,7 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en p.objecttype = clif_bl_type(bl); #endif p.GID = bl->id; - p.speed = iStatus->get_speed(bl); + p.speed = status->get_speed(bl); p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; @@ -889,7 +889,7 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? - p.shield = iStatus->get_emblem_id(bl); + p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); } @@ -897,7 +897,7 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en p.bodypalette = vd->cloth_color; p.headDir = (sd)? sd->head_dir : 0; p.GUID = g_id; - p.GEmblemVer = iStatus->get_emblem_id(bl); + p.GEmblemVer = status->get_emblem_id(bl); p.honor = (sd) ? sd->status.manner : 0; p.virtue = (sc) ? sc->opt3 : 0; p.isPKModeON = (sd) ? sd->status.karma : 0; @@ -915,10 +915,10 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en *------------------------------------------*/ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { struct map_session_data* sd; - struct status_change* sc = iStatus->get_sc(bl); - struct view_data* vd = iStatus->get_viewdata(bl); + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); struct packet_idle_unit p; - int g_id = iStatus->get_guild_id(bl); + int g_id = status->get_guild_id(bl); #if PACKETVER < 20091103 if( !pcdb_checkid(vd->class_) ) { @@ -935,7 +935,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu p.objecttype = clif_bl_type(bl); #endif p.GID = bl->id; - p.speed = iStatus->get_speed(bl); + p.speed = status->get_speed(bl); p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; @@ -949,7 +949,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? - p.accessory = iStatus->get_emblem_id(bl); + p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); } @@ -960,7 +960,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu p.robe = vd->robe; #endif p.GUID = g_id; - p.GEmblemVer = iStatus->get_emblem_id(bl); + p.GEmblemVer = status->get_emblem_id(bl); p.honor = (sd) ? sd->status.manner : 0; p.virtue = (sc) ? sc->opt3 : 0; p.isPKModeON = (sd) ? sd->status.karma : 0; @@ -988,7 +988,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu if( disguised(bl) ) { #if PACKETVER >= 20091103 - p.objecttype = pcdb_checkid(iStatus->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pcdb_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1001,10 +1001,10 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu /* for 'packetver < 20091103' 0x7c non-pc-looking unit handling */ void clif_spawn_unit2(struct block_list* bl, enum send_target target) { struct map_session_data* sd; - struct status_change* sc = iStatus->get_sc(bl); - struct view_data* vd = iStatus->get_viewdata(bl); + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); struct packet_spawn_unit2 p; - int g_id = iStatus->get_guild_id(bl); + int g_id = status->get_guild_id(bl); sd = BL_CAST(BL_PC, bl); @@ -1013,7 +1013,7 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) { p.objecttype = clif_bl_type(bl); #endif p.GID = bl->id; - p.speed = iStatus->get_speed(bl); + p.speed = status->get_speed(bl); p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; @@ -1025,7 +1025,7 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) { p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? - p.shield = iStatus->get_emblem_id(bl); + p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); } @@ -1042,10 +1042,10 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) { #endif void clif_spawn_unit(struct block_list* bl, enum send_target target) { struct map_session_data* sd; - struct status_change* sc = iStatus->get_sc(bl); - struct view_data* vd = iStatus->get_viewdata(bl); + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); struct packet_spawn_unit p; - int g_id = iStatus->get_guild_id(bl); + int g_id = status->get_guild_id(bl); #if PACKETVER < 20091103 if( !pcdb_checkid(vd->class_) ) { @@ -1062,7 +1062,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.objecttype = clif_bl_type(bl); #endif p.GID = bl->id; - p.speed = iStatus->get_speed(bl); + p.speed = status->get_speed(bl); p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; @@ -1076,7 +1076,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? - p.accessory = iStatus->get_emblem_id(bl); + p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); } @@ -1087,7 +1087,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.robe = vd->robe; #endif p.GUID = g_id; - p.GEmblemVer = iStatus->get_emblem_id(bl); + p.GEmblemVer = status->get_emblem_id(bl); p.honor = (sd) ? sd->status.manner : 0; p.virtue = (sc) ? sc->opt3 : 0; p.isPKModeON = (sd) ? sd->status.karma : 0; @@ -1113,7 +1113,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { if( sd->status.class_ != sd->disguise ) clif->send(&p,sizeof(p),bl,target); #if PACKETVER >= 20091103 - p.objecttype = pcdb_checkid(iStatus->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pcdb_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1129,10 +1129,10 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { *------------------------------------------*/ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { struct map_session_data* sd; - struct status_change* sc = iStatus->get_sc(bl); - struct view_data* vd = iStatus->get_viewdata(bl); + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); struct packet_unit_walking p; - int g_id = iStatus->get_guild_id(bl); + int g_id = status->get_guild_id(bl); sd = BL_CAST(BL_PC, bl); @@ -1144,7 +1144,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, p.objecttype = clif_bl_type(bl); #endif p.GID = bl->id; - p.speed = iStatus->get_speed(bl); + p.speed = status->get_speed(bl); p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; @@ -1165,7 +1165,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, p.robe = vd->robe; #endif p.GUID = g_id; - p.GEmblemVer = iStatus->get_emblem_id(bl); + p.GEmblemVer = status->get_emblem_id(bl); p.honor = (sd) ? sd->status.manner : 0; p.virtue = (sc) ? sc->opt3 : 0; p.isPKModeON = (sd) ? sd->status.karma : 0; @@ -1192,7 +1192,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, if( disguised(bl) ) { #if PACKETVER >= 20091103 - p.objecttype = pcdb_checkid(iStatus->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pcdb_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1293,7 +1293,7 @@ int clif_spawn(struct block_list *bl) { struct view_data *vd; - vd = iStatus->get_viewdata(bl); + vd = status->get_viewdata(bl); if( !vd || vd->class_ == INVISIBLE_CLASS ) return 0; @@ -1572,7 +1572,7 @@ void clif_move(struct unit_data *ud) struct view_data* vd; struct block_list* bl = ud->bl; - vd = iStatus->get_viewdata(bl); + vd = status->get_viewdata(bl); if (!vd || vd->class_ == INVISIBLE_CLASS) return; //This performance check is needed to keep GM-hidden objects from being notified to bots. @@ -3193,8 +3193,8 @@ void clif_changelook(struct block_list *bl,int type,int val) nullpo_retv(bl); sd = BL_CAST(BL_PC, bl); - sc = iStatus->get_sc(bl); - vd = iStatus->get_viewdata(bl); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); //nullpo_ret(vd); if( vd ) //temp hack to let Warp Portal change appearance switch(type) { @@ -3614,7 +3614,7 @@ void clif_changeoption(struct block_list* bl) nullpo_retv(bl); - if ( !(sc = iStatus->get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc? + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc? sd = BL_CAST(BL_PC, bl); @@ -3660,7 +3660,7 @@ void clif_changeoption2(struct block_list* bl) { unsigned char buf[20]; struct status_change *sc; - if ( !(sc = iStatus->get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc? + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc? WBUFW(buf,0) = 0x28a; WBUFL(buf,2) = bl->id; @@ -4310,7 +4310,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { struct unit_data *ud; struct view_data *vd; - vd = iStatus->get_viewdata(bl); + vd = status->get_viewdata(bl); if (!vd || vd->class_ == INVISIBLE_CLASS) return; @@ -4447,7 +4447,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic damage2 = (int)cap_value(in_damage2,INT_MIN,INT_MAX); type = clif_calc_delay(type,div,damage+damage2,ddelay); - sc = iStatus->get_sc(dst); + sc = status->get_sc(dst); if(sc && sc->count) { if(sc->data[SC_ILLUSION]) { if(damage) damage = damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; @@ -4792,13 +4792,13 @@ int clif_outsight(struct block_list *bl,va_list ap) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); break; default: - if ((vd=iStatus->get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS) + if ((vd=status->get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); break; } } if (sd && sd->fd) { //sd is watching tbl go out of view. - if (((vd=iStatus->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS) && + if (((vd=status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS) && !(tbl->type == BL_NPC && (((TBL_NPC*)tbl)->option&OPTION_INVISIBLE))) clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); } @@ -5116,8 +5116,7 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned /// Skill attack effect and damage. /// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL) /// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2) -int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 in_damage,int div,uint16 skill_id,uint16 skill_lv,int type) -{ +int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 in_damage,int div,uint16 skill_id,uint16 skill_lv,int type) { unsigned char buf[64]; struct status_change *sc; int damage; @@ -5127,7 +5126,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int damage = (int)cap_value(in_damage,INT_MIN,INT_MAX); type = clif_calc_delay(type,div,damage,ddelay); - sc = iStatus->get_sc(dst); + sc = status->get_sc(dst); if(sc && sc->count) { if(sc->data[SC_ILLUSION] && damage) damage = damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; @@ -5204,9 +5203,8 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int /// Ground skill attack effect and damage (ZC_NOTIFY_SKILL_POSITION). /// 0115 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <x>.W <y>.W <damage>.W <level>.W <div>.W <type>.B -/* -int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type) -{ +#if 0 +int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type) { unsigned char buf[64]; struct status_change *sc; @@ -5215,7 +5213,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned in type = (type>0)?type:skill_get_hit(skill_id); type = clif_calc_delay(type,div,damage,ddelay); - sc = iStatus->get_sc(dst); + sc = status->get_sc(dst); if(sc && sc->count) { if(sc->data[SC_ILLUSION] && damage) @@ -5258,7 +5256,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned in //Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex] return clif_calc_walkdelay(dst,ddelay,type,damage,div); } -*/ +#endif // 0 /// Non-damaging skill effect (ZC_USE_SKILL). @@ -5465,19 +5463,19 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { if( dst->type != BL_MOB ) return; - dstatus = iStatus->get_status_data(dst); + dstatus = status->get_status_data(dst); - WBUFW(buf, 0)=0x18c; - WBUFW(buf, 2)=iStatus->get_class(dst); - WBUFW(buf, 4)=iStatus->get_lv(dst); - WBUFW(buf, 6)=dstatus->size; - WBUFL(buf, 8)=dstatus->hp; - WBUFW(buf,12)= (battle_config.estimation_type&1?dstatus->def:0) - +(battle_config.estimation_type&2?dstatus->def2:0); - WBUFW(buf,14)=dstatus->race; - WBUFW(buf,16)= (battle_config.estimation_type&1?dstatus->mdef:0) - +(battle_config.estimation_type&2?dstatus->mdef2:0); - WBUFW(buf,18)= dstatus->def_ele; + WBUFW(buf, 0) = 0x18c; + WBUFW(buf, 2) = status->get_class(dst); + WBUFW(buf, 4) = status->get_lv(dst); + WBUFW(buf, 6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = (battle_config.estimation_type&1?dstatus->def:0) + + (battle_config.estimation_type&2?dstatus->def2:0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = (battle_config.estimation_type&1?dstatus->mdef:0) + + (battle_config.estimation_type&2?dstatus->mdef2:0); + WBUFW(buf,18) = dstatus->def_ele; for(i=0;i<9;i++) WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); // The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex] @@ -5597,7 +5595,7 @@ void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick, nullpo_retv(bl); - if (!(iStatus->type2relevant_bl_types(type)&bl->type)) // only send status changes that actually matter to the client + if (!(status->type2relevant_bl_types(type)&bl->type)) // only send status changes that actually matter to the client return; if (type == SI_BLANK) //It shows nothing on the client... @@ -5628,7 +5626,7 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val nullpo_retv(bl); - if (!(iStatus->type2relevant_bl_types(type)&bl->type)) // only send status changes that actually matter to the client + if (!(status->type2relevant_bl_types(type)&bl->type)) // only send status changes that actually matter to the client return; if ( tick < 0 ) @@ -7680,8 +7678,8 @@ void clif_guild_emblem_area(struct block_list* bl) // (emblem in the flag npcs and emblem over the head in agit maps) [FlavioJS] WBUFW(buf,0) = 0x1b4; WBUFL(buf,2) = bl->id; - WBUFL(buf,6) = iStatus->get_guild_id(bl); - WBUFW(buf,10) = iStatus->get_emblem_id(bl); + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); clif->send(buf, 12, bl, AREA_WOS); } @@ -9617,7 +9615,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { sd->areanpc_id = 0; /* it broke at some point (e.g. during a crash), so we make it visibly dead again. */ - if( !sd->status.hp && !pc_isdead(sd) && iStatus->isdead(&sd->bl) ) + if( !sd->status.hp && !pc_isdead(sd) && status->isdead(&sd->bl) ) pc_setdead(sd); // If player is dead, and is spawned (such as @refresh) send death packet. [Valaris] @@ -9834,8 +9832,8 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) return; // Block namerequests past view range // 'see people in GM hide' cheat detection - /* disabled due to false positives (network lag + request name of char that's about to hide = race condition) - sc = iStatus->get_sc(bl); +#if 0 /* disabled due to false positives (network lag + request name of char that's about to hide = race condition) */ + sc = status->get_sc(bl); if (sc && sc->option&OPTION_INVISIBLE && !disguised(bl) && bl->type != BL_NPC && //Skip hidden NPCs which can be seen using Maya Purple pc->get_group_level(sd) < battle_config.hack_info_GM_level @@ -9847,7 +9845,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) intif->wis_message_to_gm(iMap->wisp_server_name, battle_config.hack_info_GM_level, gm_msg); return; } - */ +#endif // 0 clif->charnameack(fd, bl); } @@ -9913,7 +9911,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) sd->state.snovice_call_flag = 3; break; case 3: - sc_start(&sd->bl, iStatus->skill2sc(MO_EXPLOSIONSPIRITS), 100, 17, skill->get_time(MO_EXPLOSIONSPIRITS, 5)); //Lv17-> +50 critical (noted by Poki) [Skotlex] + sc_start(&sd->bl, status->skill2sc(MO_EXPLOSIONSPIRITS), 100, 17, skill->get_time(MO_EXPLOSIONSPIRITS, 5)); //Lv17-> +50 critical (noted by Poki) [Skotlex] clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); // prayer always shows successful Lv5 cast and disregards noskill restrictions sd->state.snovice_call_flag = 0; break; @@ -13236,7 +13234,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) case BL_PC: { char command[NAME_LENGTH+6]; - sprintf(command, "%ckick %s", atcommand->at_symbol, iStatus->get_name(target)); + sprintf(command, "%ckick %s", atcommand->at_symbol, status->get_name(target)); atcommand->parse(fd, sd, command, 1); } break; @@ -13251,7 +13249,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) clif->GM_kickack(sd, 0); return; } - sprintf(command, "/kick %s (%d)", iStatus->get_name(target), iStatus->get_class(target)); + sprintf(command, "/kick %s (%d)", status->get_name(target), status->get_class(target)); logs->atcommand(sd, command); status_percent_damage(&sd->bl, target, 100, 0, true); // can invalidate 'target' } @@ -13709,7 +13707,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); if( percent && ( percent%100 ) == 0 ) {// 10.0%, 20.0%, ..., 90.0% - sc_start(&sd->bl, iStatus->skill2sc(MO_EXPLOSIONSPIRITS), 100, 17, skill->get_time(MO_EXPLOSIONSPIRITS, 5)); //Lv17-> +50 critical (noted by Poki) [Skotlex] + sc_start(&sd->bl, status->skill2sc(MO_EXPLOSIONSPIRITS), 100, 17, skill->get_time(MO_EXPLOSIONSPIRITS, 5)); //Lv17-> +50 critical (noted by Poki) [Skotlex] clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); // prayer always shows successful Lv5 cast and disregards noskill restrictions } } @@ -14363,8 +14361,7 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn] /// Request to resurrect oneself using Token of Siegfried (CZ_STANDING_RESURRECTION). /// 0292 -void clif_parse_AutoRevive(int fd, struct map_session_data *sd) -{ +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); if (item_position < 0) @@ -14373,7 +14370,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) if (sd->sc.data[SC_HELLPOWER]) //Cannot res while under the effect of SC_HELLPOWER. return; - if (!iStatus->revive(&sd->bl, 100, 100)) + if (!status->revive(&sd->bl, 100, 100)) return; clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); diff --git a/src/map/elemental.c b/src/map/elemental.c index b1ad4073b..e28a64874 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -242,9 +242,9 @@ int elemental_data_received(struct s_elemental *ele, bool flag) { ed->master = sd; ed->db = db; memcpy(&ed->elemental, ele, sizeof(struct s_elemental)); - iStatus->set_viewdata(&ed->bl, ed->elemental.class_); + status->set_viewdata(&ed->bl, ed->elemental.class_); ed->vd->head_mid = 10; // Why? - iStatus->change_init(&ed->bl); + status->change_init(&ed->bl); unit->dataset(&ed->bl); ed->ud.dir = sd->ud.dir; @@ -281,7 +281,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) { int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id) { struct block_list *bl; - sc_type type = iStatus->skill2sc(skill_id); + sc_type type = status->skill2sc(skill_id); nullpo_ret(ed); @@ -430,9 +430,9 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned ed->ud.skill_lv = skill_lv; if( skill->get_inf(skill_id) & INF_GROUND_SKILL ) - ed->ud.skilltimer = timer->add( tick+iStatus->get_speed(&ed->bl)*walk_dist, skill->castend_pos, ed->bl.id, 0 ); + ed->ud.skilltimer = timer->add( tick+status->get_speed(&ed->bl)*walk_dist, skill->castend_pos, ed->bl.id, 0 ); else - ed->ud.skilltimer = timer->add( tick+iStatus->get_speed(&ed->bl)*walk_dist, skill->castend_id, ed->bl.id, 0 ); + ed->ud.skilltimer = timer->add( tick+status->get_speed(&ed->bl)*walk_dist, skill->castend_id, ed->bl.id, 0 ); } return 1; @@ -589,7 +589,7 @@ int elemental_set_target( struct map_session_data *sd, struct block_list *bl ) { if( ed->bl.m != bl->m || !check_distance_bl(&ed->bl, bl, ed->db->range2) ) return 0; - if( !iStatus->check_skilluse(&ed->bl, bl, 0, 0) ) + if( !status->check_skilluse(&ed->bl, bl, 0, 0) ) return 0; if( ed->target_id == 0 ) @@ -609,7 +609,7 @@ static int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap target = va_arg(ap,struct block_list**); //If can't seek yet, not an enemy, or you can't attack it, skip. - if( (*target) == bl || !iStatus->check_skilluse(&ed->bl, bl, 0, 0) ) + if( (*target) == bl || !status->check_skilluse(&ed->bl, bl, 0, 0) ) return 0; if( battle->check_target(&ed->bl,bl,BCT_ENEMY) <= 0 ) diff --git a/src/map/guild.c b/src/map/guild.c index 8319d4524..253dbcf1c 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1371,7 +1371,7 @@ int guild_skillupack(int guild_id,uint16 skill_id,int account_id) void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { struct skill_unit_group* group = NULL; - int type = iStatus->skill2sc(skill_id); + int type = status->skill2sc(skill_id); if( !(battle_config.guild_aura&((iMap->agit_flag || iMap->agit2_flag)?2:1)) && !(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) ) return; diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 79d993ede..fb954cdec 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -143,7 +143,7 @@ int homunculus_vaporize(struct map_session_data *sd, int flag) { if (!hd || hd->homunculus.vaporize) return 0; - if (iStatus->isdead(&hd->bl)) + if (status->isdead(&hd->bl)) return 0; //Can't vaporize a dead homun. if (flag && get_percentage(hd->battle_status.hp, hd->battle_status.max_hp) < 80) @@ -364,7 +364,7 @@ int homunculus_change_class(struct homun_data *hd, short class_) { return 0; hd->homunculusDB = &homun->db[i]; hd->homunculus.class_ = class_; - iStatus->set_viewdata(&hd->bl, class_); + status->set_viewdata(&hd->bl, class_); homun->calc_skilltree(hd, 1); return 1; } @@ -743,8 +743,8 @@ bool homunculus_create(struct map_session_data *sd, struct s_homunculus *hom) { memcpy(&hd->homunculus, hom, sizeof(struct s_homunculus)); hd->exp_next = homun->exptable[hd->homunculus.level - 1]; - iStatus->set_viewdata(&hd->bl, hd->homunculus.class_); - iStatus->change_init(&hd->bl); + status->set_viewdata(&hd->bl, hd->homunculus.class_); + status->change_init(&hd->bl); unit->dataset(&hd->bl); hd->ud.dir = sd->ud.dir; @@ -911,7 +911,7 @@ bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short if (hd->homunculus.vaporize) return false; // vaporized homunculi need to be 'called' - if (!iStatus->isdead(&hd->bl)) + if (!status->isdead(&hd->bl)) return false; // already alive homun->init_timers(hd); @@ -924,7 +924,7 @@ bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short iMap->addblock(&hd->bl); clif->spawn(&hd->bl); } - iStatus->revive(&hd->bl, per, 0); + status->revive(&hd->bl, per, 0); return true; } diff --git a/src/map/map.c b/src/map/map.c index d57fc583a..1d679a79e 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -361,7 +361,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) //TODO: Perhaps some outs of bounds checking should be placed here? if (bl->type&BL_CHAR) { - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); skill->unit_move(bl,tick,2); status_change_end(bl, SC_RG_CCONFINE_M, INVALID_TIMER); @@ -1562,7 +1562,7 @@ int map_quit(struct map_session_data *sd) { if( sd->sc.count ) { //Status that are not saved... for(i=0; i < SC_MAX; i++){ - if ( iStatus->get_sc_type(i)&SC_NO_SAVE ){ + if ( status->get_sc_type(i)&SC_NO_SAVE ) { if ( !sd->sc.data[i] ) continue; switch( i ){ @@ -4927,7 +4927,7 @@ void do_final(void) homun->final(); atcommand->final_msg(); skill->final(); - iStatus->do_final_status(); + status->final(); unit->final(); bg->final(); duel->final(); @@ -5140,7 +5140,7 @@ void map_hp_symbols(void) { HPM->share(party,"party"); HPM->share(storage,"storage"); HPM->share(trade,"trade"); - HPM->share(iStatus,"iStatus"); + HPM->share(status,"status"); HPM->share(chat, "chat"); HPM->share(duel,"duel"); HPM->share(elemental,"elemental"); @@ -5399,7 +5399,7 @@ int do_init(int argc, char *argv[]) read_map_zone_db();/* read after item and skill initalization */ mob->init(); pc->do_init_pc(); - iStatus->do_init_status(); + status->init(); party->do_init_party(); guild->init(); storage->init(); diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 402c477bf..881038eb4 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -297,8 +297,7 @@ int merc_data_received(struct s_mercenary *merc, bool flag) } db = &mercenary->db[i]; - if( !sd->md ) - { + if( !sd->md ) { sd->md = md = (struct mercenary_data*)aCalloc(1,sizeof(struct mercenary_data)); md->bl.type = BL_MER; md->bl.id = npc->get_new_npc_id(); @@ -307,8 +306,8 @@ int merc_data_received(struct s_mercenary *merc, bool flag) md->master = sd; md->db = db; memcpy(&md->mercenary, merc, sizeof(struct s_mercenary)); - iStatus->set_viewdata(&md->bl, md->mercenary.class_); - iStatus->change_init(&md->bl); + status->set_viewdata(&md->bl, md->mercenary.class_); + status->change_init(&md->bl); unit->dataset(&md->bl); md->ud.dir = sd->ud.dir; diff --git a/src/map/mob.c b/src/map/mob.c index ceb00a6ce..ff949a3ff 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -134,7 +134,7 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) nd->bl.id = md->tomb_nid = npc->get_new_npc_id(); - nd->dir = md->ud.dir; + nd->dir = md->ud.dir; nd->bl.m = md->bl.m; nd->bl.x = md->bl.x; nd->bl.y = md->bl.y; @@ -156,8 +156,8 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) iMap->addnpc(nd->bl.m, nd); iMap->addblock(&nd->bl); - iStatus->set_viewdata(&nd->bl, nd->class_); - clif->spawn(&nd->bl); + status->set_viewdata(&nd->bl, nd->class_); + clif->spawn(&nd->bl); } @@ -281,8 +281,8 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) { md->spawn_timer = INVALID_TIMER; md->deletetimer = INVALID_TIMER; md->skill_idx = -1; - iStatus->set_viewdata(&md->bl, md->class_); - iStatus->change_init(&md->bl); + status->set_viewdata(&md->bl, md->class_); + status->change_init(&md->bl); unit->dataset(&md->bl); iMap->addiddb(&md->bl); @@ -410,7 +410,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target) return true; } while(0); - iStatus->change_start(target, SC_KSPROTECTED, 10000, sd->bl.id, sd->state.noks, sd->status.party_id, sd->status.guild_id, battle_config.ksprotection, 0); + status->change_start(target, SC_KSPROTECTED, 10000, sd->bl.id, sd->state.noks, sd->status.party_id, sd->status.guild_id, battle_config.ksprotection, 0); return false; } @@ -894,7 +894,7 @@ int mob_spawn (struct mob_data *md) unit->remove_map(&md->bl,CLR_RESPAWN,ALC_MARK); else if (md->spawn && md->class_ != md->spawn->class_) { md->class_ = md->spawn->class_; - iStatus->set_viewdata(&md->bl, md->class_); + status->set_viewdata(&md->bl, md->class_); md->db = mob->db(md->class_); memcpy(md->name,md->spawn->name,NAME_LENGTH); } @@ -1017,7 +1017,7 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist) if(md->target_id && !mob->can_changetarget(md, bl, status_get_mode(&md->bl))) return 0; - if(!iStatus->check_skilluse(&md->bl, bl, 0, 0)) + if(!status->check_skilluse(&md->bl, bl, 0, 0)) return 0; md->target_id = bl->id; // Since there was no disturbance, it locks on to target. @@ -1045,10 +1045,10 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap) mode= va_arg(ap,int); //If can't seek yet, not an enemy, or you can't attack it, skip. - if ((*target) == bl || !iStatus->check_skilluse(&md->bl, bl, 0, 0)) + if ((*target) == bl || !status->check_skilluse(&md->bl, bl, 0, 0)) return 0; - if ((mode&MD_TARGETWEAK) && iStatus->get_lv(bl) >= md->level-5) + if ((mode&MD_TARGETWEAK) && status->get_lv(bl) >= md->level-5) return 0; if(battle->check_target(&md->bl,bl,BCT_ENEMY)<=0) @@ -1094,8 +1094,7 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap) /*========================================== * chase target-change routine. *------------------------------------------*/ -int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap) -{ +int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap) { struct mob_data *md; struct block_list **target; @@ -1104,9 +1103,10 @@ int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap) target= va_arg(ap,struct block_list**); //If can't seek yet, not an enemy, or you can't attack it, skip. - if ((*target) == bl || - battle->check_target(&md->bl,bl,BCT_ENEMY)<=0 || - !iStatus->check_skilluse(&md->bl, bl, 0, 0)) + if( *target == bl + || battle->check_target(&md->bl,bl,BCT_ENEMY) <= 0 + || !status->check_skilluse(&md->bl, bl, 0, 0) + ) return 0; if(battle->check_range (&md->bl, bl, md->status.rhw.range)) { @@ -1128,7 +1128,7 @@ int mob_ai_sub_hard_bg_ally(struct block_list *bl,va_list ap) { md=va_arg(ap,struct mob_data *); target= va_arg(ap,struct block_list**); - if( iStatus->check_skilluse(&md->bl, bl, 0, 0) && battle->check_target(&md->bl,bl,BCT_ENEMY)<=0 ) { + if( status->check_skilluse(&md->bl, bl, 0, 0) && battle->check_target(&md->bl,bl,BCT_ENEMY)<=0 ) { (*target) = bl; } return 1; @@ -1194,7 +1194,7 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) bl=iMap->id2bl(md->master_id); - if (!bl || iStatus->isdead(bl)) { + if (!bl || status->isdead(bl)) { status_kill(&md->bl); return 1; } @@ -1254,7 +1254,7 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) if (tbl && battle->check_target(&md->bl, tbl, BCT_ENEMY) <= 0) tbl = NULL; } - if (tbl && iStatus->check_skilluse(&md->bl, tbl, 0, 0)) { + if (tbl && status->check_skilluse(&md->bl, tbl, 0, 0)) { md->target_id=tbl->id; md->min_chase=md->db->range3+distance_bl(&md->bl, tbl); if(md->min_chase>MAX_MINCHASE) @@ -1347,8 +1347,9 @@ int mob_randomwalk(struct mob_data *md,unsigned int tick) } return 0; } - speed=iStatus->get_speed(&md->bl); - for(i=c=0;i<md->ud.walkpath.path_len;i++){ // The next walk start time is calculated. + speed=status->get_speed(&md->bl); + for(i=c=0;i<md->ud.walkpath.path_len;i++) { + // The next walk start time is calculated. if(md->ud.walkpath.path[i]&1) c+=speed*MOVE_DIAGONAL_COST/MOVE_COST; else @@ -1421,17 +1422,18 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) can_move = (mode&MD_CANMOVE)&&unit->can_move(&md->bl); - if (md->target_id) - { //Check validity of current target. [Skotlex] + if (md->target_id) { + //Check validity of current target. [Skotlex] tbl = iMap->id2bl(md->target_id); - if (!tbl || tbl->m != md->bl.m || - (md->ud.attacktimer == INVALID_TIMER && !iStatus->check_skilluse(&md->bl, tbl, 0, 0)) || - (md->ud.walktimer != INVALID_TIMER && !(battle_config.mob_ai&0x1) && !check_distance_bl(&md->bl, tbl, md->min_chase)) || - ( - tbl->type == BL_PC && - ((((TBL_PC*)tbl)->state.gangsterparadise && !(mode&MD_BOSS)) || - ((TBL_PC*)tbl)->invincible_timer != INVALID_TIMER) - )) { //Unlock current target. + if (!tbl || tbl->m != md->bl.m + || (md->ud.attacktimer == INVALID_TIMER && !status->check_skilluse(&md->bl, tbl, 0, 0)) + || (md->ud.walktimer != INVALID_TIMER && !(battle_config.mob_ai&0x1) && !check_distance_bl(&md->bl, tbl, md->min_chase)) + || ( tbl->type == BL_PC + && ((((TBL_PC*)tbl)->state.gangsterparadise && !(mode&MD_BOSS)) + || ((TBL_PC*)tbl)->invincible_timer != INVALID_TIMER) + ) + ) { + //Unlock current target. if (mob->warpchase(md, tbl)) return true; //Chasing this target. mob->unlocktarget(md, tick-(battle_config.mob_ai&0x8?3000:0)); //Imediately do random walk. @@ -1464,18 +1466,19 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) { int dist; if( md->bl.m != abl->m || abl->prev == NULL - || (dist = distance_bl(&md->bl, abl)) >= MAX_MINCHASE // Attacker longer than visual area - || battle->check_target(&md->bl, abl, BCT_ENEMY) <= 0 // Attacker is not enemy of mob - || (battle_config.mob_ai&0x2 && !iStatus->check_skilluse(&md->bl, abl, 0, 0)) // Cannot normal attack back to Attacker - || (!battle->check_range(&md->bl, abl, md->status.rhw.range) // Not on Melee Range and ... - && ( // Reach check - (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || (md->sc.data[SC_SPIDERWEB] && md->sc.data[SC_SPIDERWEB]->val1) - || md->sc.data[SC_WUGBITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNS_TRAP] - || md->sc.data[SC__MANHOLE])) // Not yet confirmed if boss will teleport once it can't reach target. - || !mob->can_reach(md, abl, dist+md->db->range3, MSS_RUSH) - ) - ) ) - { // Rude attacked + || (dist = distance_bl(&md->bl, abl)) >= MAX_MINCHASE // Attacker longer than visual area + || battle->check_target(&md->bl, abl, BCT_ENEMY) <= 0 // Attacker is not enemy of mob + || (battle_config.mob_ai&0x2 && !status->check_skilluse(&md->bl, abl, 0, 0)) // Cannot normal attack back to Attacker + || (!battle->check_range(&md->bl, abl, md->status.rhw.range) // Not on Melee Range and ... + && ( // Reach check + (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || (md->sc.data[SC_SPIDERWEB] && md->sc.data[SC_SPIDERWEB]->val1) + || md->sc.data[SC_WUGBITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNS_TRAP] + || md->sc.data[SC__MANHOLE])) // Not yet confirmed if boss will teleport once it can't reach target. + || !mob->can_reach(md, abl, dist+md->db->range3, MSS_RUSH) + ) + ) + ) { + // Rude attacked if (md->state.attacked_count++ >= RUDE_ATTACKED_COUNT && !mob->skill_use(md, tick, MSC_RUDEATTACKED) && can_move && !tbl && unit->escape(&md->bl, abl, rnd()%10 +1)) @@ -1486,12 +1489,10 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) } } else - if (!(battle_config.mob_ai&0x2) && !iStatus->check_skilluse(&md->bl, abl, 0, 0)) - { + if (!(battle_config.mob_ai&0x2) && !status->check_skilluse(&md->bl, abl, 0, 0)) { //Can't attack back, but didn't invoke a rude attacked skill... - } - else - { //Attackable + } else { + //Attackable if (!tbl || dist < md->status.rhw.range || !check_distance_bl(&md->bl, tbl, dist) || battle->get_target(tbl) != md->bl.id) { //Change if the new target is closer than the actual one @@ -1897,12 +1898,11 @@ int mob_deleteslave(struct mob_data *md) return 0; } // Mob respawning through KAIZEL or NPC_REBIRTH [Skotlex] -int mob_respawn(int tid, unsigned int tick, int id, intptr_t data) -{ +int mob_respawn(int tid, unsigned int tick, int id, intptr_t data) { struct block_list *bl = iMap->id2bl(id); if(!bl) return 0; - iStatus->revive(bl, (uint8)data, 0); + status->revive(bl, (uint8)data, 0); return 1; } @@ -2168,7 +2168,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if (md->sc.data[SC_RICHMANKIM]) bonus += md->sc.data[SC_RICHMANKIM]->val2; if(sd) { - temp = iStatus->get_class(&md->bl); + temp = status->get_class(&md->bl); if(sd->sc.data[SC_MIRACLE]) i = 2; //All mobs are Star Targets else ARR_FIND(0, MAX_PC_FEELHATE, i, temp == sd->hate_mob[i] && @@ -2609,7 +2609,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { } - if(!md->spawn) //Tell iStatus->damage to remove it from memory. + if(!md->spawn) //Tell status->damage to remove it from memory. return 5; // Note: Actually, it's 4. Oh well... // MvP tomb [GreenBox] @@ -2617,7 +2617,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { mob->mvptomb_create(md, mvp_sd ? mvp_sd->status.name : NULL, time(NULL)); if( !rebirth ) { - iStatus->change_clear(&md->bl,1); + status->change_clear(&md->bl,1); mob->setdelayspawn(md); //Set respawning. } return 3; //Remove from map. @@ -2745,7 +2745,7 @@ int mob_class_change (struct mob_data *md, int class_) mob_stop_attack(md); mob_stop_walking(md, 0); unit->skillcastcancel(&md->bl, 0); - iStatus->set_viewdata(&md->bl, class_); + status->set_viewdata(&md->bl, class_); clif->class_change(&md->bl, md->vd->class_, 1); status_calc_mob(md, 1); md->ud.state.speed_changed = 1; //Speed change update. @@ -3338,7 +3338,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons strcpy(db->sprite,sd->status.name); strcpy(db->name,sd->status.name); strcpy(db->jname,sd->status.name); - db->lv=iStatus->get_lv(&sd->bl); + db->lv=status->get_lv(&sd->bl); memcpy(mstatus, &sd->base_status, sizeof(struct status_data)); mstatus->rhw.atk2= mstatus->dex + mstatus->rhw.atk + mstatus->rhw.atk2; //Max ATK mstatus->rhw.atk = mstatus->dex; //Min ATK @@ -3747,7 +3747,7 @@ bool mob_parse_dbrow(char** str) { data.bl.type = BL_MOB; data.level = db->lv; memcpy(&data.status, mstatus, sizeof(struct status_data)); - iStatus->calc_misc(&data.bl, mstatus, db->lv); + status->calc_misc(&data.bl, mstatus, db->lv); // MVP EXP Bonus: MEXP // Some new MVP's MEXP multipled by high exp-rate cause overflow. [LuzZza] diff --git a/src/map/npc.c b/src/map/npc.c index fb106d2d6..024f649d0 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2071,7 +2071,7 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short nd->subtype = WARP; npc->setcells(nd); iMap->addblock(&nd->bl); - iStatus->set_viewdata(&nd->bl, nd->class_); + status->set_viewdata(&nd->bl, nd->class_); nd->ud = &npc->base_ud; if( maplist[nd->bl.m].users ) clif->spawn(&nd->bl); @@ -2136,7 +2136,7 @@ const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* s nd->subtype = WARP; npc->setcells(nd); iMap->addblock(&nd->bl); - iStatus->set_viewdata(&nd->bl, nd->class_); + status->set_viewdata(&nd->bl, nd->class_); nd->ud = &npc->base_ud; if( maplist[nd->bl.m].users ) clif->spawn(&nd->bl); @@ -2248,7 +2248,7 @@ const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* s if( m >= 0 ) {// normal shop npc iMap->addnpc(m,nd); iMap->addblock(&nd->bl); - iStatus->set_viewdata(&nd->bl, nd->class_); + status->set_viewdata(&nd->bl, nd->class_); nd->ud = &npc->base_ud; nd->dir = dir; if( maplist[nd->bl.m].users ) @@ -2440,7 +2440,7 @@ const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* npc->setcells(nd); iMap->addblock(&nd->bl); if( class_ >= 0 ) { - iStatus->set_viewdata(&nd->bl, nd->class_); + status->set_viewdata(&nd->bl, nd->class_); if( maplist[nd->bl.m].users ) clif->spawn(&nd->bl); } @@ -2596,7 +2596,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch npc->setcells(nd); iMap->addblock(&nd->bl); if( class_ >= 0 ) { - iStatus->set_viewdata(&nd->bl, nd->class_); + status->set_viewdata(&nd->bl, nd->class_); if( maplist[nd->bl.m].users ) clif->spawn(&nd->bl); } @@ -2666,7 +2666,7 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) { wnd->subtype = WARP; npc->setcells(wnd); iMap->addblock(&wnd->bl); - iStatus->set_viewdata(&wnd->bl, wnd->class_); + status->set_viewdata(&wnd->bl, wnd->class_); wnd->ud = &npc->base_ud; if( maplist[wnd->bl.m].users ) clif->spawn(&wnd->bl); @@ -2789,8 +2789,7 @@ void npc_setdisplayname(struct npc_data* nd, const char* newname) /// /// @param nd Target npc /// @param class_ New display class -void npc_setclass(struct npc_data* nd, short class_) -{ +void npc_setclass(struct npc_data* nd, short class_) { nullpo_retv(nd); if( nd->class_ == class_ ) @@ -2799,7 +2798,7 @@ void npc_setclass(struct npc_data* nd, short class_) if( maplist[nd->bl.m].users ) clif->clearunit_area(&nd->bl, CLR_OUTSIGHT);// fade out nd->class_ = class_; - iStatus->set_viewdata(&nd->bl, class_); + status->set_viewdata(&nd->bl, class_); if( maplist[nd->bl.m].users ) clif->spawn(&nd->bl);// fade in } diff --git a/src/map/pc.c b/src/map/pc.c index 86ee7a8db..9dbb5175a 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -314,7 +314,7 @@ static int pc_check_banding( struct block_list *bl, va_list ap ) { if(pc_isdead(tsd)) return 0; - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if( bl == src ) return 0; @@ -341,12 +341,12 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { memset(b_sd, 0, sizeof(b_sd)); i = party_foreachsamemap(pc_check_banding,sd,range,&sd->bl,&c,&b_sd); - if( c < 1 ) //just recalc status no need to recalc hp - { // No more Royal Guards in Banding found. - if( (sc = iStatus->get_sc(&sd->bl)) != NULL && sc->data[SC_BANDING] ) - { + if( c < 1 ) { + //just recalc status no need to recalc hp + if( (sc = status->get_sc(&sd->bl)) != NULL && sc->data[SC_BANDING] ) { + // No more Royal Guards in Banding found. sc->data[SC_BANDING]->val2 = 0; // Reset the counter - status_calc_bl(&sd->bl, iStatus->sc2scb_flag(SC_BANDING)); + status_calc_bl(&sd->bl, status->sc2scb_flag(SC_BANDING)); } return 0; } @@ -383,13 +383,11 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { for( j = 0; j < i; j++ ) { bsd = iMap->id2sd(b_sd[j]); - if( bsd != NULL ) - { - iStatus->set_hp(&bsd->bl,hp,0); // Set hp - if( (sc = iStatus->get_sc(&bsd->bl)) != NULL && sc->data[SC_BANDING] ) - { + if( bsd != NULL ) { + status->set_hp(&bsd->bl,hp,0); // Set hp + if( (sc = status->get_sc(&bsd->bl)) != NULL && sc->data[SC_BANDING] ) { sc->data[SC_BANDING]->val2 = c; // Set the counter. It doesn't count your self. - status_calc_bl(&bsd->bl, iStatus->sc2scb_flag(SC_BANDING)); // Set atk and def. + status_calc_bl(&bsd->bl, status->sc2scb_flag(SC_BANDING)); // Set atk and def. } } } @@ -451,10 +449,10 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) { st = &sd->battle_status; if (type&1) { //Normal resurrection - st->hp = 1; //Otherwise iStatus->heal may fail if dead. - iStatus->heal(&sd->bl, bst->hp, 0, 1); + st->hp = 1; //Otherwise status->heal may fail if dead. + status->heal(&sd->bl, bst->hp, 0, 1); if( st->sp < bst->sp ) - iStatus->set_sp(&sd->bl, bst->sp, 1); + status->set_sp(&sd->bl, bst->sp, 1); } else { //Just for saving on the char-server (with values as if respawned) sd->status.hp = bst->hp; sd->status.sp = (st->sp < bst->sp) ? bst->sp : st->sp; @@ -1072,12 +1070,12 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim if( sd->status.option & OPTION_INVISIBLE && !pc->can_use_command(sd, "@hide") ) sd->status.option &=~ OPTION_INVISIBLE; - iStatus->change_init(&sd->bl); + status->change_init(&sd->bl); sd->sc.option = sd->status.option; //This is the actual option used in battle. //Set here because we need the inventory data for weapon sprite parsing. - iStatus->set_viewdata(&sd->bl, sd->status.class_); + status->set_viewdata(&sd->bl, sd->status.class_); unit->dataset(&sd->bl); sd->guild_x = -1; @@ -1204,7 +1202,7 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) return 0; } - class_ = iStatus->get_class(bl); + class_ = status->get_class(bl); if (!pcdb_checkid(class_)) { unsigned int max_hp = status_get_max_hp(bl); if ((pos == 1 && max_hp < 6000) || (pos == 2 && max_hp < 20000)) @@ -1746,7 +1744,7 @@ int pc_disguise(struct map_session_data *sd, int class_) { } else sd->disguise = class_; - iStatus->set_viewdata(&sd->bl, class_); + status->set_viewdata(&sd->bl, class_); clif->changeoption(&sd->bl); if (sd->bl.prev != NULL) { @@ -3329,7 +3327,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) int target = skill->get_inf(type2); //Support or Self (non-auto-target) skills should pick self. target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill->get_inf2(type2)&INF2_NO_TARGET_SELF)); pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), - target?-type2:type2, type3, val, 0, iStatus->current_equip_card_id); + target?-type2:type2, type3, val, 0, status->current_equip_card_id); } break; case SP_AUTOSPELL_WHENHIT: @@ -3338,7 +3336,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) int target = skill->get_inf(type2); //Support or Self (non-auto-target) skills should pick self. target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill->get_inf2(type2)&INF2_NO_TARGET_SELF)); pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), - target?-type2:type2, type3, val, BF_NORMAL|BF_SKILL, iStatus->current_equip_card_id); + target?-type2:type2, type3, val, BF_NORMAL|BF_SKILL, status->current_equip_card_id); } break; case SP_SP_DRAIN_RATE: @@ -3433,28 +3431,26 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) return 0; } -int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4,int val) -{ +int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4,int val) { nullpo_ret(sd); - switch(type){ + switch(type) { case SP_AUTOSPELL: if(sd->state.lr_flag != 2) - pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, 0, iStatus->current_equip_card_id); + pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, 0, status->current_equip_card_id); break; case SP_AUTOSPELL_WHENHIT: if(sd->state.lr_flag != 2) - pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, BF_NORMAL|BF_SKILL, iStatus->current_equip_card_id); + pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, BF_NORMAL|BF_SKILL, status->current_equip_card_id); break; case SP_AUTOSPELL_ONSKILL: - if(sd->state.lr_flag != 2) - { + if(sd->state.lr_flag != 2) { int target = skill->get_inf(type2); //Support or Self (non-auto-target) skills should pick self. target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill->get_inf2(type2)&INF2_NO_TARGET_SELF)); - pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, target?-type3:type3, type4, val, iStatus->current_equip_card_id); + pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, target?-type3:type3, type4, val, status->current_equip_card_id); } break; @@ -3475,24 +3471,23 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4 return 0; } -int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val) -{ +int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val) { nullpo_ret(sd); switch(type){ case SP_AUTOSPELL: if(sd->state.lr_flag != 2) - pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, iStatus->current_equip_card_id); + pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, status->current_equip_card_id); break; case SP_AUTOSPELL_WHENHIT: if(sd->state.lr_flag != 2) - pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, iStatus->current_equip_card_id); + pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, status->current_equip_card_id); break; case SP_AUTOSPELL_ONSKILL: if(sd->state.lr_flag != 2) - pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, (val&1?-type3:type3), (val&2?-type4:type4), type5, iStatus->current_equip_card_id); + pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, (val&1?-type3:type3), (val&2?-type4:type4), type5, status->current_equip_card_id); break; default: @@ -4386,7 +4381,7 @@ int pc_useitem(struct map_session_data *sd,int n) { //perform a skill-use check before going through. [Skotlex] //resurrection was picked as testing skill, as a non-offensive, generic skill, it will do. //FIXME: Is this really needed here? It'll be checked in unit.c after all and this prevents skill items using when silenced [Inkfish] - if( sd->inventory_data[n]->flag.delay_consume && ( sd->ud.skilltimer != INVALID_TIMER /*|| !iStatus->check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)*/ ) ) + if( sd->inventory_data[n]->flag.delay_consume && ( sd->ud.skilltimer != INVALID_TIMER /*|| !status->check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)*/ ) ) return 0; if( sd->inventory_data[n]->delay > 0 ) { @@ -4686,8 +4681,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil if(md->state.steal_flag == UCHAR_MAX || ( md->sc.opt1 && md->sc.opt1 != OPT1_BURNING && md->sc.opt1 != OPT1_CRYSTALIZE ) ) //already stolen from / status change check return 0; - sd_status= iStatus->get_status_data(&sd->bl); - md_status= iStatus->get_status_data(bl); + sd_status= status->get_status_data(&sd->bl); + md_status= status->get_status_data(bl); if( md->master_id || md_status->mode&MD_BOSS || mob_is_treasure(md) || maplist[bl->m].flag.nomobloot || // check noloot map flag [Lorky] @@ -4876,8 +4871,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y if (sd->sc.data[SC_KNOWLEDGE]) { struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE]; if (sce->timer != INVALID_TIMER) - timer->delete(sce->timer, iStatus->change_timer); - sce->timer = timer->add(timer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), iStatus->change_timer, sd->bl.id, SC_KNOWLEDGE); + timer->delete(sce->timer, status->change_timer); + sce->timer = timer->add(timer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), status->change_timer, sd->bl.id, SC_KNOWLEDGE); } status_change_end(&sd->bl, SC_PROPERTYWALK, INVALID_TIMER); status_change_end(&sd->bl, SC_CLOAKING, INVALID_TIMER); @@ -5147,12 +5142,12 @@ int pc_checkallowskill(struct map_session_data *sd) if(!sd->sc.count) return 0; - for (i = 0; i < ARRAYLENGTH(scw_list); i++) - { // Skills requiring specific weapon types + for (i = 0; i < ARRAYLENGTH(scw_list); i++) { + // Skills requiring specific weapon types if( scw_list[i] == SC_DANCING && !battle_config.dancing_weaponswitch_fix ) continue; - if(sd->sc.data[scw_list[i]] && - !pc_check_weapontype(sd,skill->get_weapontype(iStatus->sc2skill(scw_list[i])))) + if( sd->sc.data[scw_list[i]] + && !pc_check_weapontype(sd,skill->get_weapontype(status->sc2skill(scw_list[i])))) status_change_end(&sd->bl, scw_list[i], INVALID_TIMER); } @@ -5684,15 +5679,14 @@ const char* job_name(int class_) } } -int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data) -{ +int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data *sd; struct block_list *tbl; sd = iMap->id2sd(id); nullpo_ret(sd); - if (sd->followtimer != tid){ + if (sd->followtimer != tid) { ShowError("pc_follow_timer %d != %d\n",sd->followtimer,tid); sd->followtimer = INVALID_TIMER; return 0; @@ -5701,17 +5695,16 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data) sd->followtimer = INVALID_TIMER; tbl = iMap->id2bl(sd->followtarget); - if (tbl == NULL || pc_isdead(sd) || iStatus->isdead(tbl)) - { + if (tbl == NULL || pc_isdead(sd) || status->isdead(tbl)) { pc->stop_following(sd); return 0; } // either player or target is currently detached from map blocks (could be teleporting), // but still connected to this map, so we'll just increment the timer and check back later - if (sd->bl.prev != NULL && tbl->prev != NULL && - sd->ud.skilltimer == INVALID_TIMER && sd->ud.attacktimer == INVALID_TIMER && sd->ud.walktimer == INVALID_TIMER) - { + if (sd->bl.prev != NULL && tbl->prev != NULL + && sd->ud.skilltimer == INVALID_TIMER && sd->ud.attacktimer == INVALID_TIMER && sd->ud.walktimer == INVALID_TIMER + ) { if((sd->bl.m == tbl->m) && unit->can_reach_bl(&sd->bl,tbl, AREA_SIZE, 0, NULL, NULL)) { if (!check_distance_bl(&sd->bl, tbl, 5)) unit->walktobl(&sd->bl, tbl, 5, 0); @@ -5783,16 +5776,16 @@ int pc_checkbaselevelup(struct map_session_data *sd) { status_percent_heal(&sd->bl,100,100); if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { - sc_start(&sd->bl,iStatus->skill2sc(PR_KYRIE),100,1,skill->get_time(PR_KYRIE,1)); - sc_start(&sd->bl,iStatus->skill2sc(PR_IMPOSITIO),100,1,skill->get_time(PR_IMPOSITIO,1)); - sc_start(&sd->bl,iStatus->skill2sc(PR_MAGNIFICAT),100,1,skill->get_time(PR_MAGNIFICAT,1)); - sc_start(&sd->bl,iStatus->skill2sc(PR_GLORIA),100,1,skill->get_time(PR_GLORIA,1)); - sc_start(&sd->bl,iStatus->skill2sc(PR_SUFFRAGIUM),100,1,skill->get_time(PR_SUFFRAGIUM,1)); + sc_start(&sd->bl,status->skill2sc(PR_KYRIE),100,1,skill->get_time(PR_KYRIE,1)); + sc_start(&sd->bl,status->skill2sc(PR_IMPOSITIO),100,1,skill->get_time(PR_IMPOSITIO,1)); + sc_start(&sd->bl,status->skill2sc(PR_MAGNIFICAT),100,1,skill->get_time(PR_MAGNIFICAT,1)); + sc_start(&sd->bl,status->skill2sc(PR_GLORIA),100,1,skill->get_time(PR_GLORIA,1)); + sc_start(&sd->bl,status->skill2sc(PR_SUFFRAGIUM),100,1,skill->get_time(PR_SUFFRAGIUM,1)); if (sd->state.snovice_dead_flag) sd->state.snovice_dead_flag = 0; //Reenable steelbody resurrection on dead. } else if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON ) { - sc_start(&sd->bl,iStatus->skill2sc(AL_INCAGI),100,10,600000); - sc_start(&sd->bl,iStatus->skill2sc(AL_BLESSING),100,10,600000); + sc_start(&sd->bl,status->skill2sc(AL_INCAGI),100,10,600000); + sc_start(&sd->bl,status->skill2sc(AL_BLESSING),100,10,600000); } clif->misceffect(&sd->bl,0); npc->script_event(sd, NPCE_BASELVUP); //LORDALFA - LVLUPEVENT @@ -5853,14 +5846,14 @@ int pc_checkjoblevelup(struct map_session_data *sd) *------------------------------------------*/ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src) { int bonus = 0; - struct status_data *st = iStatus->get_status_data(src); + struct status_data *st = status->get_status_data(src); if (sd->expaddrace[st->race]) bonus += sd->expaddrace[st->race]; bonus += sd->expaddrace[st->mode&MD_BOSS?RC_BOSS:RC_NONBOSS]; - if (battle_config.pk_mode && - (int)(iStatus->get_lv(src) - sd->status.base_level) >= 20) + if (battle_config.pk_mode + && (int)(status->get_lv(src) - sd->status.base_level) >= 20) bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris] if (sd->sc.data[SC_CASH_PLUSEXP]) @@ -6877,8 +6870,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { } // activate Steel body if a super novice dies at 99+% exp [celest] - if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) - { + if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) { unsigned int next = pc->nextbaseexp(sd); if( next == 0 ) next = pc->thisbaseexp(sd); if( get_percentage(sd->status.base_exp,next) >= 99 ) { @@ -6888,7 +6880,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { clif->resurrection(&sd->bl, 1); if(battle_config.pc_invincible_time) pc->setinvincibletimer(sd, battle_config.pc_invincible_time); - sc_start(&sd->bl,iStatus->skill2sc(MO_STEELBODY),100,1,skill->get_time(MO_STEELBODY,1)); + sc_start(&sd->bl,status->skill2sc(MO_STEELBODY),100,1,skill->get_time(MO_STEELBODY,1)); if(map_flag_gvg2(sd->bl.m)) pc_respawn_timer(INVALID_TIMER, timer->gettick(), sd->bl.id, 0); return 0; @@ -7428,7 +7420,7 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) #endif } - return iStatus->heal(&sd->bl, hp, sp, 1); + return status->heal(&sd->bl, hp, sp, 1); } /*========================================== @@ -7560,7 +7552,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) short id; for(i = 0; i < MAX_SKILL_TREE && (id = skill_tree[class_][i].id) > 0; i++) { //Remove status specific to your current tree skills. - enum sc_type sc = iStatus->skill2sc(id); + enum sc_type sc = status->skill2sc(id); if (sc > SC_COMMON_MAX && sd->sc.data[sc]) status_change_end(&sd->bl, sc, INVALID_TIMER); } @@ -7602,7 +7594,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) if (sd->disguise != -1) pc->disguise(sd, -1); - iStatus->set_viewdata(&sd->bl, job); + status->set_viewdata(&sd->bl, job); clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris] if(sd->vd.cloth_color) clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); @@ -7697,7 +7689,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) switch(type){ case LOOK_BASE: - iStatus->set_viewdata(&sd->bl, val); + status->set_viewdata(&sd->bl, val); clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); if (sd->vd.cloth_color) @@ -7812,9 +7804,9 @@ int pc_setoption(struct map_session_data *sd,int type) else if( !(type&OPTION_MADOGEAR) && p_type&OPTION_MADOGEAR ) status_calc_pc(sd, 0); for( i = 0; i < SC_MAX; i++ ){ - if ( !sd->sc.data[i] || !iStatus->get_sc_type(i) ) + if ( !sd->sc.data[i] || !status->get_sc_type(i) ) continue; - if ( iStatus->get_sc_type(i)&SC_MADO_NO_RESET ) + if ( status->get_sc_type(i)&SC_MADO_NO_RESET ) continue; switch (i) { case SC_BERSERK: @@ -7835,7 +7827,7 @@ int pc_setoption(struct map_session_data *sd,int type) return 0; //Disguises break sprite changes if (new_look < 0) { //Restore normal look. - iStatus->set_viewdata(&sd->bl, sd->status.class_); + status->set_viewdata(&sd->bl, sd->status.class_); new_look = sd->vd.class_; } @@ -9237,8 +9229,7 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick) //Character regen. Flag is used to know which types of regen can take place. //&1: HP regen //&2: SP regen -void pc_regen (struct map_session_data *sd, unsigned int diff_tick) -{ +void pc_regen (struct map_session_data *sd, unsigned int diff_tick) { int hp = 0, sp = 0; if (sd->hp_regen.value) { @@ -9258,7 +9249,7 @@ void pc_regen (struct map_session_data *sd, unsigned int diff_tick) } if (hp > 0 || sp > 0) - iStatus->heal(&sd->bl, hp, sp, 0); + status->heal(&sd->bl, hp, sp, 0); return; } diff --git a/src/map/pc.h b/src/map/pc.h index 4b90e7fc3..d384e0145 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -672,7 +672,7 @@ enum equip_pos { #define pc_rightside_def(sd) ((sd)->battle_status.def) #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef2) #define pc_rightside_mdef(sd) ((sd)->battle_status.mdef) -#define pc_leftside_matk(sd) (iStatus->base_matk(iStatus->get_status_data(&(sd)->bl), (sd)->status.base_level)) +#define pc_leftside_matk(sd) (status->base_matk(status->get_status_data(&(sd)->bl), (sd)->status.base_level)) #define pc_rightside_matk(sd) ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk) #else #define pc_leftside_atk(sd) ((sd)->battle_status.batk + (sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk) diff --git a/src/map/pet.c b/src/map/pet.c index bb5982e7a..dd0ed1bb9 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -96,8 +96,7 @@ int pet_unlocktarget(struct pet_data *pd) /*========================================== * Pet Attack Skill [Skotlex] *------------------------------------------*/ -int pet_attackskill(struct pet_data *pd, int target_id) -{ +int pet_attackskill(struct pet_data *pd, int target_id) { if (!battle_config.pet_status_support || !pd->a_skill || (battle_config.pet_equip_required && !pd->pet.equip)) return 0; @@ -105,28 +104,27 @@ int pet_attackskill(struct pet_data *pd, int target_id) if (DIFF_TICK(pd->ud.canact_tick, timer->gettick()) > 0) return 0; - if (rnd()%100 < (pd->a_skill->rate +pd->pet.intimate*pd->a_skill->bonusrate/1000)) - { //Skotlex: Use pet's skill + if (rnd()%100 < (pd->a_skill->rate +pd->pet.intimate*pd->a_skill->bonusrate/1000)) { + //Skotlex: Use pet's skill int inf; struct block_list *bl; bl=iMap->id2bl(target_id); - if(bl == NULL || pd->bl.m != bl->m || bl->prev == NULL || iStatus->isdead(bl) || - !check_distance_bl(&pd->bl, bl, pd->db->range3)) + if( bl == NULL || pd->bl.m != bl->m || bl->prev == NULL + || status->isdead(bl) || !check_distance_bl(&pd->bl, bl, pd->db->range3)) return 0; inf = skill->get_inf(pd->a_skill->id); if (inf & INF_GROUND_SKILL) unit->skilluse_pos(&pd->bl, bl->x, bl->y, pd->a_skill->id, pd->a_skill->lv); - else //Offensive self skill? Could be stuff like GX. + else //Offensive self skill? Could be stuff like GX. unit->skilluse_id(&pd->bl,(inf&INF_SELF_SKILL?pd->bl.id:bl->id), pd->a_skill->id, pd->a_skill->lv); return 1; //Skill invoked. } return 0; } -int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) -{ +int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) { struct pet_data *pd; int rate; @@ -134,17 +132,17 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) Assert((pd->msd == 0) || (pd->msd->pd == pd)); - if(bl == NULL || bl->type != BL_MOB || bl->prev == NULL || - pd->pet.intimate < battle_config.pet_support_min_friendly || - pd->pet.hungry < 1 || - pd->pet.class_ == iStatus->get_class(bl)) + if( bl == NULL || bl->type != BL_MOB || bl->prev == NULL + || pd->pet.intimate < battle_config.pet_support_min_friendly + || pd->pet.hungry < 1 + || pd->pet.class_ == status->get_class(bl)) return 0; - if(pd->bl.m != bl->m || - !check_distance_bl(&pd->bl, bl, pd->db->range2)) + if( pd->bl.m != bl->m + || !check_distance_bl(&pd->bl, bl, pd->db->range2)) return 0; - if (!iStatus->check_skilluse(&pd->bl, bl, 0, 0)) + if (!status->check_skilluse(&pd->bl, bl, 0, 0)) return 0; if(!type) { @@ -351,7 +349,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo) pd->petDB = &pet->db[i]; pd->db = mob->db(petinfo->class_); memcpy(&pd->pet, petinfo, sizeof(struct s_pet)); - iStatus->set_viewdata(&pd->bl, petinfo->class_); + status->set_viewdata(&pd->bl, petinfo->class_); unit->dataset(&pd->bl); pd->ud.dir = sd->ud.dir; @@ -650,8 +648,7 @@ int pet_change_name_ack(struct map_session_data *sd, char* name, int flag) return 1; } -int pet_equipitem(struct map_session_data *sd,int index) -{ +int pet_equipitem(struct map_session_data *sd,int index) { struct pet_data *pd; int nameid; @@ -668,13 +665,12 @@ int pet_equipitem(struct map_session_data *sd,int index) pc->delitem(sd,index,1,0,0,LOG_TYPE_OTHER); pd->pet.equip = nameid; - iStatus->set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data. + status->set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data. clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom); - if (battle_config.pet_equip_required) - { //Skotlex: start support timers if need + if (battle_config.pet_equip_required) { + //Skotlex: start support timers if need unsigned int tick = timer->gettick(); - if (pd->s_skill && pd->s_skill->timer == INVALID_TIMER) - { + if (pd->s_skill && pd->s_skill->timer == INVALID_TIMER) { if (pd->s_skill->id) pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000, pet->skill_support_timer, sd->bl.id, 0); else @@ -687,8 +683,7 @@ int pet_equipitem(struct map_session_data *sd,int index) return 0; } -int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) -{ +int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) { struct item tmp_item; int nameid,flag; @@ -697,7 +692,7 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) nameid = pd->pet.equip; pd->pet.equip = 0; - iStatus->set_viewdata(&pd->bl, pd->pet.class_); + status->set_viewdata(&pd->bl, pd->pet.class_); clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom); memset(&tmp_item,0,sizeof(tmp_item)); tmp_item.nameid = nameid; @@ -869,9 +864,9 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, unsigned i if (pd->target_id) { target= iMap->id2bl(pd->target_id); - if (!target || pd->bl.m != target->m || iStatus->isdead(target) || - !check_distance_bl(&pd->bl, target, pd->db->range3)) - { + if (!target || pd->bl.m != target->m || status->isdead(target) + || !check_distance_bl(&pd->bl, target, pd->db->range3) + ) { target = NULL; pet->unlocktarget(pd); } @@ -1130,7 +1125,7 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data) { return 0; } - st = iStatus->get_status_data(&sd->bl); + st = status->get_status_data(&sd->bl); if(pc_isdead(sd) || (rate = get_percentage(st->sp, st->max_sp)) > pd->s_skill->sp || @@ -1143,7 +1138,7 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data) { pet_stop_attack(pd); pet_stop_walking(pd,1); clif->skill_nodamage(&pd->bl,&sd->bl,AL_HEAL,pd->s_skill->lv,1); - iStatus->heal(&sd->bl, pd->s_skill->lv,0, 0); + status->heal(&sd->bl, pd->s_skill->lv,0, 0); pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000,pet->heal_timer,sd->bl.id,0); return 0; } @@ -1166,7 +1161,7 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data) { return 0; } - st = iStatus->get_status_data(&sd->bl); + st = status->get_status_data(&sd->bl); if (DIFF_TICK(pd->ud.canact_tick, tick) > 0) { //Wait until the pet can act again. diff --git a/src/map/script.c b/src/map/script.c index d9794e3cd..b940d03e4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -332,9 +332,9 @@ static void script_reportsrc(struct script_state *st) break; default: if( bl->m >= 0 ) - ShowDebug("Source (Non-NPC type %d): name %s at %s (%d,%d)\n", bl->type, iStatus->get_name(bl), maplist[bl->m].name, bl->x, bl->y); + ShowDebug("Source (Non-NPC type %d): name %s at %s (%d,%d)\n", bl->type, status->get_name(bl), maplist[bl->m].name, bl->x, bl->y); else - ShowDebug("Source (Non-NPC type %d): name %s (invisible/not on a map)\n", bl->type, iStatus->get_name(bl)); + ShowDebug("Source (Non-NPC type %d): name %s (invisible/not on a map)\n", bl->type, status->get_name(bl)); break; } } @@ -3641,7 +3641,7 @@ void script_run_autobonus(const char *autobonus, int id, int pos) struct script_code *scriptroot = (struct script_code *)strdb_get(script->autobonus_db, autobonus); if( scriptroot ) { - iStatus->current_equip_item_index = pos; + status->current_equip_item_index = pos; script->run(scriptroot,0,id,0); } } @@ -4874,8 +4874,7 @@ BUILDIN(warpguild) /*========================================== * Force Heal a player (hp and sp) *------------------------------------------*/ -BUILDIN(heal) -{ +BUILDIN(heal) { TBL_PC *sd; int hp,sp; @@ -4884,7 +4883,7 @@ BUILDIN(heal) hp=script_getnum(st,2); sp=script_getnum(st,3); - iStatus->heal(&sd->bl, hp, sp, 1); + status->heal(&sd->bl, hp, sp, 1); return true; } /*========================================== @@ -7253,8 +7252,7 @@ BUILDIN(getequipweaponlv) * x : refine chance * 0 : false (max refine level or unequip..) *------------------------------------------*/ -BUILDIN(getequippercentrefinery) -{ +BUILDIN(getequippercentrefinery) { int i = -1,num; TBL_PC *sd; @@ -7266,7 +7264,7 @@ BUILDIN(getequippercentrefinery) if (num > 0 && num <= ARRAYLENGTH(equip)) i=pc->checkequip(sd,equip[num-1]); if(i >= 0 && sd->status.inventory[i].nameid && sd->status.inventory[i].refine < MAX_REFINE) - script_pushint(st,iStatus->get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine)); + script_pushint(st,status->get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine)); else script_pushint(st,0); @@ -7544,8 +7542,7 @@ BUILDIN(bonus) return true; } -BUILDIN(autobonus) -{ +BUILDIN(autobonus) { unsigned int dur; short rate; short atk_type = 0; @@ -7556,7 +7553,7 @@ BUILDIN(autobonus) if( sd == NULL ) return true; // no player attached - if( sd->state.autobonus&sd->status.inventory[iStatus->current_equip_item_index].equip ) + if( sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip ) return true; rate = script_getnum(st,3); @@ -7570,9 +7567,9 @@ BUILDIN(autobonus) if( script_hasdata(st,6) ) other_script = script_getstr(st,6); - if( pc->addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus), - bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[iStatus->current_equip_item_index].equip,false) ) - { + if( pc->addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus),bonus_script,rate,dur,atk_type,other_script, + sd->status.inventory[status->current_equip_item_index].equip,false) + ) { script_add_autobonus(bonus_script); if( other_script ) script_add_autobonus(other_script); @@ -7581,8 +7578,7 @@ BUILDIN(autobonus) return true; } -BUILDIN(autobonus2) -{ +BUILDIN(autobonus2) { unsigned int dur; short rate; short atk_type = 0; @@ -7593,7 +7589,7 @@ BUILDIN(autobonus2) if( sd == NULL ) return true; // no player attached - if( sd->state.autobonus&sd->status.inventory[iStatus->current_equip_item_index].equip ) + if( sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip ) return true; rate = script_getnum(st,3); @@ -7607,9 +7603,9 @@ BUILDIN(autobonus2) if( script_hasdata(st,6) ) other_script = script_getstr(st,6); - if( pc->addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2), - bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[iStatus->current_equip_item_index].equip,false) ) - { + if( pc->addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2),bonus_script,rate,dur,atk_type,other_script, + sd->status.inventory[status->current_equip_item_index].equip,false) + ) { script_add_autobonus(bonus_script); if( other_script ) script_add_autobonus(other_script); @@ -7618,8 +7614,7 @@ BUILDIN(autobonus2) return true; } -BUILDIN(autobonus3) -{ +BUILDIN(autobonus3) { unsigned int dur; short rate,atk_type; TBL_PC* sd; @@ -7629,7 +7624,7 @@ BUILDIN(autobonus3) if( sd == NULL ) return true; // no player attached - if( sd->state.autobonus&sd->status.inventory[iStatus->current_equip_item_index].equip ) + if( sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip ) return true; rate = script_getnum(st,3); @@ -7642,9 +7637,9 @@ BUILDIN(autobonus3) if( script_hasdata(st,6) ) other_script = script_getstr(st,6); - if( pc->addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3), - bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[iStatus->current_equip_item_index].equip,true) ) - { + if( pc->addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3),bonus_script,rate,dur,atk_type,other_script, + sd->status.inventory[status->current_equip_item_index].equip,true) + ) { script_add_autobonus(bonus_script); if( other_script ) script_add_autobonus(other_script); @@ -9488,8 +9483,7 @@ BUILDIN(hideonnpc) /// Starts a status effect on the target unit or on the attached player. /// /// sc_start <effect_id>,<duration>,<val1>{,<unit_id>}; -BUILDIN(sc_start) -{ +BUILDIN(sc_start) { struct block_list* bl; enum sc_type type; int tick; @@ -9504,20 +9498,20 @@ BUILDIN(sc_start) else bl = iMap->id2bl(st->rid); - if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && iStatus->sc2skill(type) != 0 ) - {// When there isn't a duration specified, try to get it from the skill_db - tick = skill->get_time(iStatus->sc2skill(type), val1); + if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status->sc2skill(type) != 0 ) { + // When there isn't a duration specified, try to get it from the skill_db + tick = skill->get_time(status->sc2skill(type), val1); } - if( script->potion_flag == 1 && script->potion_target ) - { //skill.c set the flags before running the script, this must be a potion-pitched effect. + if( script->potion_flag == 1 && script->potion_target ) { + //skill.c set the flags before running the script, this must be a potion-pitched effect. bl = iMap->id2bl(script->potion_target); tick /= 2;// Thrown potions only last half. val4 = 1;// Mark that this was a thrown sc_effect } if( bl ) - iStatus->change_start(bl, type, 10000, val1, 0, 0, val4, tick, 2); + status->change_start(bl, type, 10000, val1, 0, 0, val4, tick, 2); return true; } @@ -9525,8 +9519,7 @@ BUILDIN(sc_start) /// Starts a status effect on the target unit or on the attached player. /// /// sc_start2 <effect_id>,<duration>,<val1>,<percent chance>{,<unit_id>}; -BUILDIN(sc_start2) -{ +BUILDIN(sc_start2) { struct block_list* bl; enum sc_type type; int tick; @@ -9543,20 +9536,20 @@ BUILDIN(sc_start2) else bl = iMap->id2bl(st->rid); - if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && iStatus->sc2skill(type) != 0 ) - {// When there isn't a duration specified, try to get it from the skill_db - tick = skill->get_time(iStatus->sc2skill(type), val1); + if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status->sc2skill(type) != 0 ) { + // When there isn't a duration specified, try to get it from the skill_db + tick = skill->get_time(status->sc2skill(type), val1); } - if( script->potion_flag == 1 && script->potion_target ) - { //skill.c set the flags before running the script, this must be a potion-pitched effect. + if( script->potion_flag == 1 && script->potion_target ) { + //skill.c set the flags before running the script, this must be a potion-pitched effect. bl = iMap->id2bl(script->potion_target); tick /= 2;// Thrown potions only last half. val4 = 1;// Mark that this was a thrown sc_effect } if( bl ) - iStatus->change_start(bl, type, rate, val1, 0, 0, val4, tick, 2); + status->change_start(bl, type, rate, val1, 0, 0, val4, tick, 2); return true; } @@ -9564,8 +9557,7 @@ BUILDIN(sc_start2) /// Starts a status effect on the target unit or on the attached player. /// /// sc_start4 <effect_id>,<duration>,<val1>,<val2>,<val3>,<val4>{,<unit_id>}; -BUILDIN(sc_start4) -{ +BUILDIN(sc_start4) { struct block_list* bl; enum sc_type type; int tick; @@ -9585,19 +9577,19 @@ BUILDIN(sc_start4) else bl = iMap->id2bl(st->rid); - if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && iStatus->sc2skill(type) != 0 ) - {// When there isn't a duration specified, try to get it from the skill_db - tick = skill->get_time(iStatus->sc2skill(type), val1); + if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status->sc2skill(type) != 0 ) { + // When there isn't a duration specified, try to get it from the skill_db + tick = skill->get_time(status->sc2skill(type), val1); } - if( script->potion_flag == 1 && script->potion_target ) - { //skill.c set the flags before running the script, this must be a potion-pitched effect. + if( script->potion_flag == 1 && script->potion_target ) { + //skill.c set the flags before running the script, this must be a potion-pitched effect. bl = iMap->id2bl(script->potion_target); tick /= 2;// Thrown potions only last half. } if( bl ) - iStatus->change_start(bl, type, 10000, val1, val2, val3, val4, tick, 2); + status->change_start(bl, type, 10000, val1, val2, val3, val4, tick, 2); return true; } @@ -9605,8 +9597,7 @@ BUILDIN(sc_start4) /// Ends one or all status effects on the target unit or on the attached player. /// /// sc_end <effect_id>{,<unit_id>}; -BUILDIN(sc_end) -{ +BUILDIN(sc_end) { struct block_list* bl; int type; @@ -9622,23 +9613,19 @@ BUILDIN(sc_end) if (!bl) return true; - if (type >= 0 && type < SC_MAX) - { - struct status_change *sc = iStatus->get_sc(bl); + if (type >= 0 && type < SC_MAX) { + struct status_change *sc = status->get_sc(bl); struct status_change_entry *sce = sc ? sc->data[type] : NULL; if (!sce) return true; - - switch (type) - { + switch (type) { case SC_WEIGHTOVER50: case SC_WEIGHTOVER90: case SC_NOCHAT: case SC_PUSH_CART: return true; - default: break; } @@ -9648,7 +9635,7 @@ BUILDIN(sc_end) status_change_end(bl, (sc_type)type, INVALID_TIMER); } else - iStatus->change_clear(bl, 3); // remove all effects + status->change_clear(bl, 3); // remove all effects return true; } @@ -9656,8 +9643,7 @@ BUILDIN(sc_end) /*========================================== * @FIXME atm will return reduced tick, 0 immune, 1 no tick *------------------------------------------*/ -BUILDIN(getscrate) -{ +BUILDIN(getscrate) { struct block_list *bl; int type,rate; @@ -9669,7 +9655,7 @@ BUILDIN(getscrate) bl = iMap->id2bl(st->rid); if (bl) - rate = iStatus->get_sc_def(bl, (sc_type)type, 10000, 10000, 0); + rate = status->get_sc_def(bl, (sc_type)type, 10000, 10000, 0); script_pushint(st,rate); return true; @@ -9951,8 +9937,7 @@ BUILDIN(skillpointcount) /*========================================== * *------------------------------------------*/ -BUILDIN(changebase) -{ +BUILDIN(changebase) { TBL_PC *sd=NULL; int vclass; @@ -9974,7 +9959,7 @@ BUILDIN(changebase) } if(sd->disguise == -1 && vclass != sd->vd.class_) { - iStatus->set_viewdata(&sd->bl, vclass); + status->set_viewdata(&sd->bl, vclass); //Updated client view. Base, Weapon and Cloth Colors. clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); @@ -12357,7 +12342,7 @@ BUILDIN(recovery) for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) { if(pc_isdead(sd)) - iStatus->revive(&sd->bl, 100, 100); + status->revive(&sd->bl, 100, 100); else status_percent_heal(&sd->bl, 100, 100); clif->message(sd->fd,msg_txt(680)); @@ -13076,8 +13061,7 @@ BUILDIN(isequipped) * Check how many given inserted cards in the CURRENT * weapon - used for 2/15's cards patch [Lupus] *------------------------------------------------*/ -BUILDIN(cardscnt) -{ +BUILDIN(cardscnt) { TBL_PC *sd; int i, k, id = 1; int ret = 0; @@ -13090,7 +13074,7 @@ BUILDIN(cardscnt) if (id <= 0) continue; - index = iStatus->current_equip_item_index; //we get CURRENT WEAPON inventory index from status.c [Lupus] + index = status->current_equip_item_index; //we get CURRENT WEAPON inventory index from status.c [Lupus] if(index < 0) continue; if(!sd->inventory_data[index]) @@ -13109,7 +13093,7 @@ BUILDIN(cardscnt) } } script_pushint(st,ret); - // script_pushint(st,iStatus->current_equip_item_index); + // script_pushint(st,status->current_equip_item_index); return true; } @@ -13117,11 +13101,10 @@ BUILDIN(cardscnt) * Returns the refined number of the current item, or an * item with inventory index specified *-------------------------------------------------------*/ -BUILDIN(getrefine) -{ +BUILDIN(getrefine) { TBL_PC *sd; if ((sd = script_rid2sd(st))!= NULL) - script_pushint(st,sd->status.inventory[iStatus->current_equip_item_index].refine); + script_pushint(st,sd->status.inventory[status->current_equip_item_index].refine); else script_pushint(st,0); return true; @@ -15043,8 +15026,7 @@ BUILDIN(unitstop) { /// Makes the unit say the message /// /// unittalk <unit_id>,"<message>"; -BUILDIN(unittalk) -{ +BUILDIN(unittalk) { int unit_id; const char* message; struct block_list* bl; @@ -15053,11 +15035,10 @@ BUILDIN(unittalk) message = script_getstr(st, 3); bl = iMap->id2bl(unit_id); - if( bl != NULL ) - { + if( bl != NULL ) { struct StringBuf sbuf; StrBuf->Init(&sbuf); - StrBuf->Printf(&sbuf, "%s : %s", iStatus->get_name(bl), message); + StrBuf->Printf(&sbuf, "%s : %s", status->get_name(bl), message); clif->disp_overhead(bl, StrBuf->Value(&sbuf)); if( bl->type == BL_PC ) clif->message(((TBL_PC*)bl)->fd, StrBuf->Value(&sbuf)); @@ -15440,8 +15421,7 @@ BUILDIN(mercenary_create) return true; } -BUILDIN(mercenary_heal) -{ +BUILDIN(mercenary_heal) { struct map_session_data *sd = script_rid2sd(st); int hp, sp; @@ -15450,12 +15430,11 @@ BUILDIN(mercenary_heal) hp = script_getnum(st,2); sp = script_getnum(st,3); - iStatus->heal(&sd->md->bl, hp, sp, 0); + status->heal(&sd->md->bl, hp, sp, 0); return true; } -BUILDIN(mercenary_sc_start) -{ +BUILDIN(mercenary_sc_start) { struct map_session_data *sd = script_rid2sd(st); enum sc_type type; int tick, val1; @@ -15467,7 +15446,7 @@ BUILDIN(mercenary_sc_start) tick = script_getnum(st,3); val1 = script_getnum(st,4); - iStatus->change_start(&sd->md->bl, type, 10000, val1, 0, 0, 0, tick, 2); + status->change_start(&sd->md->bl, type, 10000, val1, 0, 0, 0, tick, 2); return true; } diff --git a/src/map/skill.c b/src/map/skill.c index 3541f9f45..8a5969345 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -373,11 +373,11 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk switch( skill_id ) { case BA_APPLEIDUN: - #ifdef RENEWAL +#ifdef RENEWAL hp = 100+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery - #else +#else // not RENEWAL hp = 30+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery - #endif +#endif // RENEWAL if( sd ) hp += 5*pc->checkskill(sd,BA_MUSICALLESSON); break; @@ -390,15 +390,15 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk default: if (skill_lv >= battle_config.max_heal_lv) return battle_config.max_heal; - #ifdef RENEWAL - /** - * Renewal Heal Formula - * Formula: ( [(Base Level + INT) / 5] ? 30 ) ? (Heal Level / 10) ? (Modifiers) + MATK - **/ - hp = (iStatus->get_lv(src) + status_get_int(src)) / 5 * 30 * skill_lv / 10; - #else - hp = ( iStatus->get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8); - #endif +#ifdef RENEWAL + /** + * Renewal Heal Formula + * Formula: ( [(Base Level + INT) / 5] ? 30 ) ? (Heal Level / 10) ? (Modifiers) + MATK + **/ + hp = (status->get_lv(src) + status_get_int(src)) / 5 * 30 * skill_lv / 10; +#else // not RENEWAL + hp = ( status->get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8); +#endif // RENEWAL if( sd && ((skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) ) hp += hp * skill2_lv * 2 / 100; else if( src->type == BL_HOM && (skill2_lv = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 ) @@ -415,7 +415,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk if( tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) ) hp += hp*skill2_lv/100; - sc = iStatus->get_sc(target); + sc = status->get_sc(target); if( sc && sc->count ) { if( sc->data[SC_CRITICALWOUND] && heal ) // Critical Wound has no effect on offensive heal. [Inkfish] hp -= hp * sc->data[SC_CRITICALWOUND]->val2/100; @@ -430,15 +430,17 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk } #ifdef RENEWAL - // MATK part of the RE heal formula [malufett] - // Note: in this part matk bonuses from items or skills are not applied + // MATK part of the RE heal formula [malufett] + // Note: in this part matk bonuses from items or skills are not applied switch( skill_id ) { - case BA_APPLEIDUN: case PR_SANCTUARY: - case NPC_EVILLAND: break; + case BA_APPLEIDUN: + case PR_SANCTUARY: + case NPC_EVILLAND: + break; default: - hp += iStatus->get_matk(src, 3); + hp += status->get_matk(src, 3); } -#endif +#endif // RENEWAL return hp; } @@ -680,8 +682,7 @@ struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill /*========================================== * *------------------------------------------*/ -int skill_additional_effect (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, unsigned int tick) -{ +int skill_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, unsigned int tick) { struct map_session_data *sd, *dstsd; struct mob_data *md, *dstmd; struct status_data *sstatus, *tstatus; @@ -703,10 +704,10 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint dstsd = BL_CAST(BL_PC, bl); dstmd = BL_CAST(BL_MOB, bl); - sc = iStatus->get_sc(src); - tsc = iStatus->get_sc(bl); - sstatus = iStatus->get_status_data(src); - tstatus = iStatus->get_status_data(bl); + sc = status->get_sc(src); + tsc = status->get_sc(bl); + sstatus = status->get_status_data(src); + tstatus = status->get_status_data(bl); if (!tsc) //skill additional effect is about adding effects to the target... //So if the target can't be inflicted with statuses, this is pointless. return 0; @@ -739,13 +740,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } type = sd->addeff[i].id; - temp = skill->get_time2(iStatus->sc2skill(type),7); + temp = skill->get_time2(status->sc2skill(type),7); if (sd->addeff[i].flag&ATF_TARGET) - iStatus->change_start(bl,type,rate,7,0,(type == SC_BURNING)?src->id:0,0,temp,0); + status->change_start(bl,type,rate,7,0,(type == SC_BURNING)?src->id:0,0,temp,0); if (sd->addeff[i].flag&ATF_SELF) - iStatus->change_start(src,type,rate,7,0,(type == SC_BURNING)?src->id:0,0,temp,0); + status->change_start(src,type,rate,7,0,(type == SC_BURNING)?src->id:0,0,temp,0); } } @@ -757,12 +758,12 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint if( skill_id != sd->addeff3[i].skill || !sd->addeff3[i].rate ) continue; type = sd->addeff3[i].id; - temp = skill->get_time2(iStatus->sc2skill(type),7); + temp = skill->get_time2(status->sc2skill(type),7); if( sd->addeff3[i].target&ATF_TARGET ) - iStatus->change_start(bl,type,sd->addeff3[i].rate,7,0,0,0,temp,0); + status->change_start(bl,type,sd->addeff3[i].rate,7,0,0,0,temp,0); if( sd->addeff3[i].target&ATF_SELF ) - iStatus->change_start(src,type,sd->addeff3[i].rate,7,0,0,0,temp,0); + status->change_start(src,type,sd->addeff3[i].rate,7,0,0,0,temp,0); } } } @@ -825,7 +826,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint struct status_change_entry *sce; // Enchant Poison gives a chance to poison attacked enemies if((sce=sc->data[SC_ENCHANTPOISON])) //Don't use sc_start since chance comes in 1/10000 rate. - iStatus->change_start(bl,SC_POISON,sce->val2, sce->val1,src->id,0,0, + status->change_start(bl,SC_POISON,sce->val2, sce->val1,src->id,0,0, skill->get_time2(AS_ENCHANTPOISON,sce->val1),0); // Enchant Deadly Poison gives a chance to deadly poison attacked enemies if((sce=sc->data[SC_EDP])) @@ -837,7 +838,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case SM_BASH: if( sd && skill_lv > 5 && pc->checkskill(sd,SM_FATALBLOW)>0 ) - iStatus->change_start(bl,SC_STUN,500*(skill_lv-5)*sd->status.base_level/50, + status->change_start(bl,SC_STUN,500*(skill_lv-5)*sd->status.base_level/50, skill_lv,0,0,0,skill->get_time2(SM_FATALBLOW,skill_lv),0); break; @@ -1006,7 +1007,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case NPC_PETRIFYATTACK: - sc_start4(bl,iStatus->skill2sc(skill_id),50+10*skill_lv, + sc_start4(bl,status->skill2sc(skill_id),50+10*skill_lv, skill_lv,0,0,skill->get_time(skill_id,skill_lv), skill->get_time2(skill_id,skill_lv)); break; @@ -1017,19 +1018,20 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case NPC_SILENCEATTACK: case NPC_STUNATTACK: case NPC_HELLPOWER: - sc_start(bl,iStatus->skill2sc(skill_id),50+10*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,status->skill2sc(skill_id),50+10*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case NPC_ACIDBREATH: case NPC_ICEBREATH: - sc_start(bl,iStatus->skill2sc(skill_id),70,skill_lv,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,status->skill2sc(skill_id),70,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case NPC_BLEEDING: sc_start2(bl,SC_BLOODING,(20*skill_lv),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)); break; case NPC_MENTALBREAKER: - { //Based on observations by Tharis, Mental Breaker should do SP damage + { + //Based on observations by Tharis, Mental Breaker should do SP damage //equal to Matk*skLevel. - rate = iStatus->get_matk(src, 2); + rate = status->get_matk(src, 2); rate*=skill_lv; status_zap(bl, 0, rate); break; @@ -1073,7 +1075,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case LK_JOINTBEAT: if (tsc->jb_flag) { - enum sc_type type = iStatus->skill2sc(skill_id); + enum sc_type type = status->skill2sc(skill_id); sc_start4(bl,type,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill->get_time2(skill_id,skill_lv)); tsc->jb_flag = 0; } @@ -1126,7 +1128,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case GS_BULLSEYE: //0.1% coma rate. if(tstatus->race == RC_BRUTE || tstatus->race == RC_DEMIHUMAN) - iStatus->change_start(bl,SC_COMA,10,skill_lv,0,src->id,0,0,0); + status->change_start(bl,SC_COMA,10,skill_lv,0,src->id,0,0,0); break; case GS_PIERCINGSHOT: sc_start2(bl,SC_BLOODING,(skill_lv*3),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)); @@ -1180,12 +1182,12 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint sc_start4(bl,SC_BURNING,100,skill_lv,0,src->id,0,skill->get_time2(skill_id,skill_lv)); break; case WL_EARTHSTRAIN: - { - // lv 1 & 2 = Strip Helm, lv 3 = Strip Armor, lv 4 = Strip Weapon and lv 5 = Strip Accessory. [malufett] - const int pos[5] = { EQP_HELM, EQP_HELM, EQP_ARMOR, EQP_WEAPON, EQP_ACC }; - skill->strip_equip(bl, pos[skill_lv], 6 * skill_lv + iStatus->get_lv(src) / 4 + status_get_dex(src) / 10, - skill_lv, skill->get_time2(skill_id,skill_lv)); - } + { + // lv 1 & 2 = Strip Helm, lv 3 = Strip Armor, lv 4 = Strip Weapon and lv 5 = Strip Accessory. [malufett] + const int pos[5] = { EQP_HELM, EQP_HELM, EQP_ARMOR, EQP_WEAPON, EQP_ACC }; + skill->strip_equip(bl, pos[skill_lv], 6 * skill_lv + status->get_lv(src) / 4 + status_get_dex(src) / 10, + skill_lv, skill->get_time2(skill_id,skill_lv)); + } break; case WL_JACKFROST: sc_start(bl,SC_FREEZE,100,skill_lv,skill->get_time(skill_id,skill_lv)); @@ -1240,7 +1242,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint sc_start(bl, SC_STUN, 30 + 8 * skill_lv, skill_lv, skill->get_time(skill_id,skill_lv)); break; case LG_PINPOINTATTACK: - rate = 30 + (((5 * (sd?pc->checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + iStatus->get_lv(src))) / 10); + rate = 30 + (((5 * (sd?pc->checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + status->get_lv(src))) / 10); switch( skill_lv ) { case 1: sc_start2(bl,SC_BLOODING,rate,skill_lv,src->id,skill->get_time(skill_id,skill_lv)); @@ -1282,7 +1284,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint sc_start(bl, SC_STUN, 100, skill_lv, 1000 + 1000 * (rnd() %3)); break; case SR_GENTLETOUCH_QUIET: // [(Skill Level x 5) + (Caster?s DEX + Caster?s Base Level) / 10] - sc_start(bl, SC_SILENCE, 5 * skill_lv + (sstatus->dex + iStatus->get_lv(src)) / 10, skill_lv, skill->get_time(skill_id, skill_lv)); + sc_start(bl, SC_SILENCE, 5 * skill_lv + (sstatus->dex + status->get_lv(src)) / 10, skill_lv, skill->get_time(skill_id, skill_lv)); break; case SR_EARTHSHAKER: sc_start(bl,SC_STUN, 25 + 5 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)); @@ -1365,7 +1367,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case EL_ROCK_CRUSHER: case EL_ROCK_CRUSHER_ATK: - sc_start(bl,iStatus->skill2sc(skill_id),50,skill_lv,skill->get_time(EL_ROCK_CRUSHER,skill_lv)); + sc_start(bl,status->skill2sc(skill_id),50,skill_lv,skill->get_time(EL_ROCK_CRUSHER,skill_lv)); break; case EL_TYPOON_MIS: sc_start(bl,SC_SILENCE,10*skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)); @@ -1397,15 +1399,14 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint src = sd?&sd->bl:src; } - if( attack_type&BF_WEAPON ) - { // Coma, Breaking Equipment - if( sd && sd->special_state.bonus_coma ) - { + if( attack_type&BF_WEAPON ) { + // Coma, Breaking Equipment + if( sd && sd->special_state.bonus_coma ) { rate = sd->weapon_coma_ele[tstatus->def_ele]; rate += sd->weapon_coma_race[tstatus->race]; rate += sd->weapon_coma_race[tstatus->mode&MD_BOSS?RC_BOSS:RC_NONBOSS]; if (rate) - iStatus->change_start(bl, SC_COMA, rate, 0, 0, src->id, 0, 0, 0); + status->change_start(bl, SC_COMA, rate, 0, 0, src->id, 0, 0, 0); } if( sd && battle_config.equip_self_break_rate ) { // Self weapon breaking @@ -1444,7 +1445,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } } - if( sd && sd->ed && sc && !iStatus->isdead(bl) && !skill_id ){ + if( sd && sd->ed && sc && !status->isdead(bl) && !skill_id ) { struct unit_data *ud = unit->bl2ud(src); if( sc->data[SC_WILD_STORM_OPTION] ) @@ -1473,8 +1474,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } // Autospell when attacking - if( sd && !iStatus->isdead(bl) && sd->autospell[0].id ) - { + if( sd && !status->isdead(bl) && sd->autospell[0].id ) { struct block_list *tbl; struct unit_data *ud; int i, skill_lv, type, notok; @@ -1712,8 +1712,7 @@ static int skill_area_temp[8]; * type of skills, so not every instance of skill->additional_effect needs a call * to this one. */ -int skill_counter_additional_effect (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, unsigned int tick) -{ +int skill_counter_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, unsigned int tick) { int rate; struct map_session_data *sd=NULL; struct map_session_data *dstsd=NULL; @@ -1726,31 +1725,30 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * sd = BL_CAST(BL_PC, src); dstsd = BL_CAST(BL_PC, bl); - if(dstsd && attack_type&BF_WEAPON) - { //Counter effects. + if(dstsd && attack_type&BF_WEAPON) { + //Counter effects. enum sc_type type; int i, time; - for(i=0; i < ARRAYLENGTH(dstsd->addeff2) && dstsd->addeff2[i].flag; i++) - { + for(i=0; i < ARRAYLENGTH(dstsd->addeff2) && dstsd->addeff2[i].flag; i++) { rate = dstsd->addeff2[i].rate; if (attack_type&BF_LONG) rate+=dstsd->addeff2[i].arrow_rate; if (!rate) continue; - if ((dstsd->addeff2[i].flag&(ATF_LONG|ATF_SHORT)) != (ATF_LONG|ATF_SHORT)) - { //Trigger has range consideration. + if ((dstsd->addeff2[i].flag&(ATF_LONG|ATF_SHORT)) != (ATF_LONG|ATF_SHORT)) { + //Trigger has range consideration. if((dstsd->addeff2[i].flag&ATF_LONG && !(attack_type&BF_LONG)) || (dstsd->addeff2[i].flag&ATF_SHORT && !(attack_type&BF_SHORT))) continue; //Range Failed. } type = dstsd->addeff2[i].id; - time = skill->get_time2(iStatus->sc2skill(type),7); + time = skill->get_time2(status->sc2skill(type),7); if (dstsd->addeff2[i].flag&ATF_TARGET) - iStatus->change_start(src,type,rate,7,0,0,0,time,0); + status->change_start(src,type,rate,7,0,0,0,time,0); - if (dstsd->addeff2[i].flag&ATF_SELF && !iStatus->isdead(bl)) - iStatus->change_start(bl,type,rate,7,0,0,0,time,0); + if (dstsd->addeff2[i].flag&ATF_SELF && !status->isdead(bl)) + status->change_start(bl,type,rate,7,0,0,0,time,0); } } @@ -1776,24 +1774,25 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * break; } - if(sd && (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && - rnd()%10000 < battle_config.sg_miracle_skill_ratio) //SG_MIRACLE [Komurka] + if( sd && (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR + && rnd()%10000 < battle_config.sg_miracle_skill_ratio) //SG_MIRACLE [Komurka] sc_start(src,SC_MIRACLE,100,1,battle_config.sg_miracle_skill_duration); - if(sd && skill_id && attack_type&BF_MAGIC && iStatus->isdead(bl) && - !(skill->get_inf(skill_id)&(INF_GROUND_SKILL|INF_SELF_SKILL)) && - (rate=pc->checkskill(sd,HW_SOULDRAIN))>0 - ){ //Soul Drain should only work on targetted spells [Skotlex] + if( sd && skill_id && attack_type&BF_MAGIC && status->isdead(bl) + && !(skill->get_inf(skill_id)&(INF_GROUND_SKILL|INF_SELF_SKILL)) + && (rate=pc->checkskill(sd,HW_SOULDRAIN)) > 0 + ) { + //Soul Drain should only work on targetted spells [Skotlex] if( pc_issit(sd) ) pc->setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex] if( skill->get_nk(skill_id)&NK_SPLASH && skill_area_temp[1] != bl->id ) ; - else{ + else { clif->skill_nodamage(src,bl,HW_SOULDRAIN,rate,1); - iStatus->heal(src, 0, iStatus->get_lv(bl)*(95+15*rate)/100, 2); + status->heal(src, 0, status->get_lv(bl)*(95+15*rate)/100, 2); } } - if( sd && iStatus->isdead(bl) ) { + if( sd && status->isdead(bl) ) { int sp = 0, hp = 0; if( attack_type&BF_WEAPON ) { sp += sd->bonus.sp_gain_value; @@ -1806,21 +1805,23 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * hp += sd->bonus.magic_hp_gain_value; if( skill_id == WZ_WATERBALL ) {//(bugreport:5303) struct status_change *sc = NULL; - if( ( sc = iStatus->get_sc(src) ) ) { - if(sc->data[SC_SOULLINK] && - sc->data[SC_SOULLINK]->val2 == SL_WIZARD && - sc->data[SC_SOULLINK]->val3 == WZ_WATERBALL) - sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check. + if( ( sc = status->get_sc(src) ) ) { + if( sc->data[SC_SOULLINK] + && sc->data[SC_SOULLINK]->val2 == SL_WIZARD + && sc->data[SC_SOULLINK]->val3 == WZ_WATERBALL + ) + sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check. } } } - if( hp || sp ) { // updated to force healing to allow healing through berserk - iStatus->heal(src, hp, sp, battle_config.show_hp_sp_gain ? 3 : 1); + if( hp || sp ) { + // updated to force healing to allow healing through berserk + status->heal(src, hp, sp, battle_config.show_hp_sp_gain ? 3 : 1); } } // Trigger counter-spells to retaliate against damage causing skills. - if(dstsd && !iStatus->isdead(bl) && dstsd->autospell2[0].id && !(skill_id && skill->get_nk(skill_id)&NK_NO_DAMAGE)) { + if(dstsd && !status->isdead(bl) && dstsd->autospell2[0].id && !(skill_id && skill->get_nk(skill_id)&NK_NO_DAMAGE)) { struct block_list *tbl; struct unit_data *ud; int i, skill_id, skill_lv, rate, type, notok; @@ -1911,7 +1912,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * } //Autobonus when attacked - if( dstsd && !iStatus->isdead(bl) && dstsd->autobonus2[0].rate && !(skill_id && skill->get_nk(skill_id)&NK_NO_DAMAGE) ) { + if( dstsd && !status->isdead(bl) && dstsd->autobonus2[0].rate && !(skill_id && skill->get_nk(skill_id)&NK_NO_DAMAGE) ) { int i; for( i = 0; i < ARRAYLENGTH(dstsd->autobonus2); i++ ) { if( rnd()%1000 >= dstsd->autobonus2[i].rate ) @@ -1938,7 +1939,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in const int where_list[4] = {EQP_WEAPON, EQP_ARMOR, EQP_SHIELD, EQP_HELM}; const enum sc_type scatk[4] = {SC_NOEQUIPWEAPON, SC_NOEQUIPARMOR, SC_NOEQUIPSHIELD, SC_NOEQUIPHELM}; const enum sc_type scdef[4] = {SC_PROTECTWEAPON, SC_PROTECTARMOR, SC_PROTECTSHIELD, SC_PROTECTHELM}; - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); int i,j; TBL_PC *sd; sd = BL_CAST(BL_PC, bl); @@ -1980,7 +1981,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in else if (rnd()%10000 >= rate) where&=~where_list[i]; else if (!sd && !(status_get_mode(bl)&MD_BOSS)) //Cause Strip effect. - sc_start(bl,scatk[i],100,0,skill->get_time(iStatus->sc2skill(scatk[i]),1)); + sc_start(bl,scatk[i],100,0,skill->get_time(status->sc2skill(scatk[i]),1)); } } if (!where) //Nothing to break. @@ -2034,7 +2035,7 @@ int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int if (rnd()%100 >= rate) return 0; - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (!sc || sc->option&OPTION_MADOGEAR ) //Mado Gear cannot be divested [Ind] return 0; @@ -2108,7 +2109,7 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in //Checks if 'bl' should reflect back a spell cast by 'src'. //type is the type of magic attack: 0: indirect (aoe), 1: direct (targetted) int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type) { - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); struct map_session_data* sd = BL_CAST(BL_PC, bl); if( sc && sc->data[SC_KYOMU] ) // Nullify reflecting ability @@ -2128,7 +2129,7 @@ int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type) if( sc->data[SC_MAGICMIRROR] && rnd()%100 < sc->data[SC_MAGICMIRROR]->val2 ) return 1; - if( sc->data[SC_KAITE] && (src->type == BL_PC || iStatus->get_lv(src) <= 80) ) + if( sc->data[SC_KAITE] && (src->type == BL_PC || status->get_lv(src) <= 80) ) {// Kaite only works against non-players if they are low-level. clif->specialeffect(bl, 438, AREA); if( --sc->data[SC_KAITE]->val2 <= 0 ) @@ -2171,20 +2172,20 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if (src != dsrc) { //When caster is not the src of attack, this is a ground skill, and as such, do the relevant target checking. [Skotlex] - if (!iStatus->check_skilluse(battle_config.skill_caster_check?src:NULL, bl, skill_id, 2)) + if (!status->check_skilluse(battle_config.skill_caster_check?src:NULL, bl, skill_id, 2)) return 0; } else if ((flag&SD_ANIMATION) && skill->get_nk(skill_id)&NK_SPLASH) { //Note that splash attacks often only check versus the targetted mob, those around the splash area normally don't get checked for being hidden/cloaked/etc. [Skotlex] - if (!iStatus->check_skilluse(src, bl, skill_id, 2)) + if (!status->check_skilluse(src, bl, skill_id, 2)) return 0; } sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, bl); - sstatus = iStatus->get_status_data(src); - tstatus = iStatus->get_status_data(bl); - sc= iStatus->get_sc(bl); + sstatus = status->get_status_data(src); + tstatus = status->get_status_data(bl); + sc = status->get_sc(bl); if (sc && !sc->count) sc = NULL; //Don't need it. // Is this check really needed? FrostNova won't hurt you if you step right where the caster is? @@ -2212,10 +2213,10 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } } - if( dmg.flag&BF_MAGIC && ( skill_id != NPC_EARTHQUAKE || (battle_config.eq_single_target_reflectable && (flag&0xFFF) == 1) ) ) - { // Earthquake on multiple targets is not counted as a target skill. [Inkfish] - if( (dmg.damage || dmg.damage2) && (type = skill->magic_reflect(src, bl, src==dsrc)) ) - { //Magic reflection, switch caster/target + if( dmg.flag&BF_MAGIC && ( skill_id != NPC_EARTHQUAKE || (battle_config.eq_single_target_reflectable && (flag&0xFFF) == 1) ) ) { + // Earthquake on multiple targets is not counted as a target skill. [Inkfish] + if( (dmg.damage || dmg.damage2) && (type = skill->magic_reflect(src, bl, src==dsrc)) ) { + //Magic reflection, switch caster/target struct block_list *tbl = bl; rmdamage = 1; bl = src; @@ -2223,7 +2224,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds dsrc = tbl; sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, bl); - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (sc && !sc->count) sc = NULL; //Don't need it. /* bugreport:2564 flag&2 disables double casting trigger */ @@ -2253,18 +2254,18 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if (s_ele == -1) // the skill takes the weapon's element s_ele = sstatus->rhw.ele; else if (s_ele == -2) //Use status element - s_ele = status_get_attack_sc_element(src,iStatus->get_sc(src)); + s_ele = status_get_attack_sc_element(src,status->get_sc(src)); else if( s_ele == -3 ) //Use random element s_ele = rnd()%ELE_MAX; dmg.damage = battle->attr_fix(bl, bl, dmg.damage, s_ele, status_get_element(bl), status_get_element_level(bl)); if( sc && sc->data[SC_ENERGYCOAT] ) { - struct status_data *st = iStatus->get_status_data(bl); + struct status_data *st = status->get_status_data(bl); int per = 100*st->sp / st->max_sp -1; //100% should be counted as the 80~99% interval per /=20; //Uses 20% SP intervals. //SP Cost: 1% + 0.5% per every 20% SP - if (!iStatus->charge(bl, 0, (10+5*per)*st->max_sp/1000)) + if (!status->charge(bl, 0, (10+5*per)*st->max_sp/1000)) status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER); //Reduction: 6% + 6% every 20% dmg.damage -= dmg.damage * (6 * (1+per)) / 100; @@ -2280,7 +2281,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds sp = sp * sc->data[SC_MAGICROD]->val2 / 100; if(skill_id == WZ_WATERBALL && skill_lv > 1) sp = sp/((skill_lv|1)*(skill_lv|1)); //Estimate SP cost of a single water-ball - iStatus->heal(bl, 0, sp, 2); + status->heal(bl, 0, sp, 2); } } @@ -2331,8 +2332,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds sce->val1 = skill_id; //Update combo-skill sce->val3 = skill_id; if( sce->timer != INVALID_TIMER ) - timer->delete(sce->timer, iStatus->change_timer); - sce->timer = timer->add(tick+sce->val4, iStatus->change_timer, src->id, SC_COMBOATTACK); + timer->delete(sce->timer, status->change_timer); + sce->timer = timer->add(tick+sce->val4, status->change_timer, src->id, SC_COMBOATTACK); break; } unit->cancel_combo(src); // Cancel combo wait @@ -2623,7 +2624,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds //Instant damage if( !sc || (!sc->data[SC_DEVOTION] && skill_id != CR_REFLECTSHIELD) ) status_fix_damage(src,bl,damage,dmg.dmotion); //Deal damage before knockback to allow stuff like firewall+storm gust combo. - if( !iStatus->isdead(bl) && additional_effects ) + if( !status->isdead(bl) && additional_effects ) skill->additional_effect(src,bl,skill_id,skill_lv,dmg.flag,dmg.dmg_lv,tick); if( damage > 0 ) //Counter status effects [Skotlex] skill->counter_additional_effect(src,bl,skill_id,skill_lv,dmg.flag,tick); @@ -2637,7 +2638,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds //Only knockback if it's still alive, otherwise a "ghost" is left behind. [Skotlex] //Reflected spells do not bounce back (bl == dsrc since it only happens for direct skills) - if (dmg.blewcount > 0 && bl!=dsrc && !iStatus->isdead(bl)) { + if (dmg.blewcount > 0 && bl!=dsrc && !status->isdead(bl)) { int8 dir = -1; // default switch(skill_id) {//direction case MG_FIREWALL: @@ -2733,7 +2734,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if(damage > 0 && !(tstatus->mode&MD_BOSS)) { if( skill_id == RG_INTIMIDATE ) { int rate = 50 + skill_lv * 5; - rate = rate + (iStatus->get_lv(src) - iStatus->get_lv(bl)); + rate = rate + (status->get_lv(src) - status->get_lv(bl)); if(rnd()%100 < rate) skill->addtimerskill(src,tick + 800,bl->id,0,0,skill_id,skill_lv,0,flag); } else if( skill_id == SC_FATALMENACE ) @@ -2761,14 +2762,15 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case RK_CRUSHSTRIKE: skill->break_equip(src,EQP_WEAPON,2000,BCT_SELF); // 20% chance to destroy the weapon. break; - case GC_VENOMPRESSURE: { - struct status_change *ssc = iStatus->get_sc(src); - if( ssc && ssc->data[SC_POISONINGWEAPON] && rnd()%100 < 70 + 5*skill_lv ) { - sc_start(bl,ssc->data[SC_POISONINGWEAPON]->val2,100,ssc->data[SC_POISONINGWEAPON]->val1,skill->get_time2(GC_POISONINGWEAPON, 1)); - status_change_end(src,SC_POISONINGWEAPON,INVALID_TIMER); - clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - } + case GC_VENOMPRESSURE: + { + struct status_change *ssc = status->get_sc(src); + if( ssc && ssc->data[SC_POISONINGWEAPON] && rnd()%100 < 70 + 5*skill_lv ) { + sc_start(bl,ssc->data[SC_POISONINGWEAPON]->val2,100,ssc->data[SC_POISONINGWEAPON]->val1,skill->get_time2(GC_POISONINGWEAPON, 1)); + status_change_end(src,SC_POISONINGWEAPON,INVALID_TIMER); + clif->skill_nodamage(src,bl,skill_id,skill_lv,1); } + } break; case WM_METALICSOUND: status_zap(bl, 0, damage*100/(100*(110-pc->checkskill(sd,WM_LESSON)*10))); @@ -2781,15 +2783,13 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds skill->onskillusage(sd, bl, skill_id, tick); } - if (!(flag&2) && - ( - skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT - ) && - (sc = iStatus->get_sc(src)) && - sc->data[SC_DOUBLECASTING] && - rnd() % 100 < sc->data[SC_DOUBLECASTING]->val2) - { -// skill->addtimerskill(src, tick + dmg.div_*dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2); + if (!(flag&2) + && (skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT) + && (sc = status->get_sc(src)) + && sc->data[SC_DOUBLECASTING] + && rnd() % 100 < sc->data[SC_DOUBLECASTING]->val2 + ) { + //skill->addtimerskill(src, tick + dmg.div_*dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2); skill->addtimerskill(src, tick + dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2); } @@ -2916,7 +2916,7 @@ int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) { skill_id = va_arg(ap,int); - if( iStatus->isdead(bl) && skill_id != AL_WARP ) + if( status->isdead(bl) && skill_id != AL_WARP ) return 0; if( skill_id == HP_BASILICA && bl->type == BL_PC ) @@ -2974,13 +2974,12 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, return 0; nullpo_ret(bl); - switch( bl->type ) - { + switch( bl->type ) { case BL_HOM: sd = ((TBL_HOM*)bl)->master; break; case BL_MER: sd = ((TBL_MER*)bl)->master; break; } - st = iStatus->get_status_data(bl); + st = status->get_status_data(bl); if( (idx = skill->get_index(skill_id)) == 0 ) return 0; @@ -3106,9 +3105,9 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { break; // Target not on Map if(src->m != target->m) break; // Different Maps - if(iStatus->isdead(src)) + if(status->isdead(src)) break; // Caster is Dead - if(iStatus->isdead(target) && skl->skill_id != RG_INTIMIDATE && skl->skill_id != WZ_WATERBALL) + if(status->isdead(target) && skl->skill_id != RG_INTIMIDATE && skl->skill_id != WZ_WATERBALL) break; switch(skl->skill_id) { @@ -3116,7 +3115,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { if (unit->warp(src,-1,-1,-1,CLR_TELEPORT) == 0) { short x,y; iMap->search_freecell(src, 0, &x, &y, 1, 1, 0); - if (target != src && !iStatus->isdead(target)) + if (target != src && !status->isdead(target)) unit->warp(target, -1, x, y, CLR_TELEPORT); } break; @@ -3136,12 +3135,12 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { break; case WZ_WATERBALL: skill->toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify - if (!iStatus->isdead(target)) + if (!status->isdead(target)) skill->attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); - if (skl->type>1 && !iStatus->isdead(target) && !iStatus->isdead(src)) { + if (skl->type>1 && !status->isdead(target) && !status->isdead(src)) { skill->addtimerskill(src,tick+125,target->id,0,0,skl->skill_id,skl->skill_lv,skl->type-1,skl->flag); } else { - struct status_change *sc = iStatus->get_sc(src); + struct status_change *sc = status->get_sc(src); if(sc) { if(sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_WIZARD && @@ -3210,7 +3209,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { break; case LG_OVERBRAND_BRANDISH: case LG_OVERBRAND_PLUSATK: - if( iStatus->check_skilluse(src, target, skl->skill_id, 1) ) + if( status->check_skilluse(src, target, skl->skill_id, 1) ) skill->attack(BF_WEAPON, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag|SD_LEVEL); else clif->skill_damage(src, target, tick, status_get_amotion(src), status_get_dmotion(target), 0, 1, skl->skill_id, skl->skill_lv, skill->get_hit(skl->skill_id)); @@ -3243,15 +3242,16 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { } break; case CH_PALMSTRIKE: - { - struct status_change* tsc = iStatus->get_sc(target); - struct status_change* sc = iStatus->get_sc(src); - if( ( tsc && tsc->option&OPTION_HIDE ) || - ( sc && sc->option&OPTION_HIDE ) ){ - skill->blown(src,target,skill->get_blewcount(skl->skill_id, skl->skill_lv), -1, 0x0 ); - break; - } + { + struct status_change* tsc = status->get_sc(target); + struct status_change* sc = status->get_sc(src); + if( (tsc && tsc->option&OPTION_HIDE) + || (sc && sc->option&OPTION_HIDE) + ) { + skill->blown(src,target,skill->get_blewcount(skl->skill_id, skl->skill_lv), -1, 0x0 ); + break; } + } default: skill->attack(skl->type,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); break; @@ -3365,8 +3365,7 @@ int skill_reveal_trap (struct block_list *bl, va_list ap) { * * *------------------------------------------*/ -int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) -{ +int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { struct map_session_data *sd = NULL; struct status_data *tstatus; struct status_change *sc; @@ -3384,23 +3383,23 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint sd = BL_CAST(BL_PC, src); - if (iStatus->isdead(bl)) + if (status->isdead(bl)) return 1; - if (skill_id && skill->get_type(skill_id) == BF_MAGIC && iStatus->isimmune(bl) == 100) { + if (skill_id && skill->get_type(skill_id) == BF_MAGIC && status->isimmune(bl) == 100) { //GTB makes all targetted magic display miss with a single bolt. - sc_type sct = iStatus->skill2sc(skill_id); + sc_type sct = status->skill2sc(skill_id); if(sct != SC_NONE) status_change_end(bl, sct, INVALID_TIMER); clif->skill_damage(src, bl, tick, status_get_amotion(src), status_get_dmotion(bl), 0, 1, skill_id, skill_lv, skill->get_hit(skill_id)); return 1; } - sc = iStatus->get_sc(src); + sc = status->get_sc(src); if (sc && !sc->count) sc = NULL; //Unneeded - tstatus = iStatus->get_status_data(bl); + tstatus = status->get_status_data(bl); iMap->freeblock_lock(); @@ -3546,7 +3545,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case 5: flag |= BREAK_NECK; break; } //TODO: is there really no cleaner way to do this? - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (sc) sc->jb_flag = flag; skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; @@ -3659,26 +3658,23 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); - if( skill_id == MO_EXTREMITYFIST ) - { + if( skill_id == MO_EXTREMITYFIST ) { mbl = src; i = 3; // for Asura(from caster) - iStatus->set_sp(src, 0, 0); + status->set_sp(src, 0, 0); status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); - #ifdef RENEWAL +#ifdef RENEWAL sc_start(src,SC_EXTREMITYFIST2,100,skill_lv,skill->get_time(skill_id,skill_lv)); - #endif - }else{ +#endif // RENEWAL + } else { status_change_end(src, SC_NJ_NEN, INVALID_TIMER); status_change_end(src, SC_HIDING, INVALID_TIMER); - iStatus->set_hp(src, - #ifdef RENEWAL - max(status_get_max_hp(src)/100, 1) - #else - 1 - #endif - , 0); +#ifdef RENEWAL + status->set_hp(src, max(status_get_max_hp(src)/100, 1), 0); +#else // not RENEWAL + status->set_hp(src, 1, 0); +#endif // RENEWAL } dir = iMap->calc_dir(src,bl->x,bl->y); if( dir > 0 && dir < 4) x = -i; @@ -3764,7 +3760,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint heal = skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, sflag); if( skill_id == NPC_VAMPIRE_GIFT && heal > 0 ) { clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1); - iStatus->heal(src,heal,0,0); + status->heal(src,heal,0,0); } } else { switch ( skill_id ) { @@ -3920,7 +3916,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case NPC_MAGICALATTACK: skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); - sc_start(src,iStatus->skill2sc(skill_id),100,skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(src,status->skill2sc(skill_id),100,skill_lv,skill->get_time(skill_id,skill_lv)); break; case HVAN_CAPRICE: //[blackhole89] @@ -3982,7 +3978,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case SL_STIN: case SL_STUN: if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) { - iStatus->change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,10); + status->change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,10); clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } @@ -4009,18 +4005,18 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint * Rune Knight **/ case RK_DRAGONBREATH_WATER: - case RK_DRAGONBREATH: { - struct status_change *tsc = NULL; - if( (tsc = iStatus->get_sc(bl)) && (tsc->data[SC_HIDING] )) { - clif->skill_nodamage(src,src,skill_id,skill_lv,1); - } else - skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); - } + case RK_DRAGONBREATH: + { + struct status_change *tsc = NULL; + if( (tsc = status->get_sc(bl)) && (tsc->data[SC_HIDING] )) { + clif->skill_nodamage(src,src,skill_id,skill_lv,1); + } else + skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); + } break; - case NPC_SELFDESTRUCTION: { struct status_change *tsc = NULL; - if( (tsc = iStatus->get_sc(bl)) && tsc->data[SC_HIDING] ) + if( (tsc = status->get_sc(bl)) && tsc->data[SC_HIDING] ) break; } case HVAN_EXPLOSION: @@ -4045,14 +4041,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case NPC_BLOODDRAIN: case NPC_ENERGYDRAIN: - { - int heal = skill->attack( (skill_id == NPC_BLOODDRAIN) ? BF_WEAPON : BF_MAGIC, - src, src, bl, skill_id, skill_lv, tick, flag); - if (heal > 0){ - clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1); - iStatus->heal(src, heal, 0, 0); - } + { + int heal = skill->attack( (skill_id == NPC_BLOODDRAIN) ? BF_WEAPON : BF_MAGIC, + src, src, bl, skill_id, skill_lv, tick, flag); + if (heal > 0){ + clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1); + status->heal(src, heal, 0, 0); } + } break; case GS_BULLSEYE: @@ -4124,9 +4120,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case GC_PHANTOMMENACE: - if( flag&1 ) - { // Only Hits Invisible Targets - struct status_change *tsc = iStatus->get_sc(bl); + if( flag&1 ) { + // Only Hits Invisible Targets + struct status_change *tsc = status->get_sc(bl); if(tsc && (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || tsc->data[SC__INVISIBILITY]) ) skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); } @@ -4136,21 +4132,20 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint skill->addtimerskill(src,tick+status_get_amotion(src),bl->id,0,0,WL_CHAINLIGHTNING_ATK,skill_lv,0,flag); break; case WL_DRAINLIFE: - { - int heal = skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); - int rate = 70 + 5 * skill_lv; + { + int heal = skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + int rate = 70 + 5 * skill_lv; - heal = heal * (5 + 5 * skill_lv) / 100; + heal = heal * (5 + 5 * skill_lv) / 100; - if( bl->type == BL_SKILL || status_get_hp(src) == status_get_max_hp(src)) // Don't absorb when caster was in full HP - heal = 0; // Don't absorb heal from Ice Walls or other skill units. + if( bl->type == BL_SKILL || status_get_hp(src) == status_get_max_hp(src)) // Don't absorb when caster was in full HP + heal = 0; // Don't absorb heal from Ice Walls or other skill units. - if( heal && rnd()%100 < rate ) - { - iStatus->heal(src, heal, 0, 0); - clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1); - } + if( heal && rnd()%100 < rate ) { + status->heal(src, heal, 0, 0); + clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1); } + } break; case WL_TETRAVORTEX: @@ -4283,7 +4278,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case RA_SENSITIVEKEEN: if( bl->type != BL_SKILL ) { // Only Hits Invisible Targets - struct status_change * tsc = iStatus->get_sc(bl); + struct status_change * tsc = status->get_sc(bl); if( tsc && tsc->option&(OPTION_HIDE|OPTION_CLOAK) ){ skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); @@ -4356,10 +4351,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case LG_OVERBRAND: - if( iStatus->check_skilluse(src, bl, skill_id, 1) ) - skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); - else - clif->skill_damage(src, bl, tick, status_get_amotion(src), status_get_dmotion(bl), 0, 1, skill_id, skill_lv, skill->get_hit(skill_id)); + if( status->check_skilluse(src, bl, skill_id, 1) ) + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); + else + clif->skill_damage(src, bl, tick, status_get_amotion(src), status_get_dmotion(bl), 0, 1, skill_id, skill_lv, skill->get_hit(skill_id)); break; case LG_OVERBRAND_BRANDISH: @@ -4409,15 +4404,15 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } break; - case SO_POISON_BUSTER: { - struct status_change *tsc = iStatus->get_sc(bl); - if( tsc && tsc->data[SC_POISON] ) { - skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); - status_change_end(bl, SC_POISON, INVALID_TIMER); - } - else if( sd ) - clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); - } + case SO_POISON_BUSTER: + { + struct status_change *tsc = status->get_sc(bl); + if( tsc && tsc->data[SC_POISON] ) { + skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + status_change_end(bl, SC_POISON, INVALID_TIMER); + } else if( sd ) + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + } break; case GN_SPORE_EXPLOSION: @@ -4482,9 +4477,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case EL_TIDAL_WEAPON: if( src->type == BL_ELEM ) { struct elemental_data *ele = BL_CAST(BL_ELEM,src); - struct status_change *sc = iStatus->get_sc(&ele->bl); - struct status_change *tsc = iStatus->get_sc(bl); - sc_type type = iStatus->skill2sc(skill_id), type2; + struct status_change *sc = status->get_sc(&ele->bl); + struct status_change *tsc = status->get_sc(bl); + sc_type type = status->skill2sc(skill_id), type2; type2 = type-1; clif->skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1); @@ -4635,7 +4630,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) do { if(!target || target->prev==NULL) break; - if(src->m != target->m || iStatus->isdead(src)) break; + if(src->m != target->m || status->isdead(src)) break; switch (ud->skill_id) { //These should become skill_castend_pos @@ -4670,7 +4665,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) } if( ud->skill_id == PR_TURNUNDEAD ) { - struct status_data *tstatus = iStatus->get_status_data(target); + struct status_data *tstatus = status->get_status_data(target); if( !battle->check_undead(tstatus->race, tstatus->def_ele) ) break; } @@ -4680,9 +4675,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) break; } - if( ud->skill_id == PR_LEXDIVINA || ud->skill_id == MER_LEXDIVINA ) - { - sc = iStatus->get_sc(target); + if( ud->skill_id == PR_LEXDIVINA || ud->skill_id == MER_LEXDIVINA ) { + sc = status->get_sc(target); if( battle->check_target(src,target, BCT_ENEMY) <= 0 && (!sc || !sc->data[SC_SILENCE]) ) { //If it's not an enemy, and not silenced, you can't use the skill on them. [Skotlex] clif->skill_nodamage (src, target, ud->skill_id, ud->skill_lv, 0); @@ -4727,16 +4721,18 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) break; } - if(inf&BCT_ENEMY && (sc = iStatus->get_sc(target)) && - sc->data[SC_FOGWALL] && - rnd() % 100 < 75) { //Fogwall makes all offensive-type targetted skills fail at 75% - if (sd) clif->skill_fail(sd, ud->skill_id, USESKILL_FAIL_LEVEL, 0); - break; + if( inf&BCT_ENEMY + && (sc = status->get_sc(target)) && sc->data[SC_FOGWALL] + && rnd() % 100 < 75 + ) { + //Fogwall makes all offensive-type targetted skills fail at 75% + if (sd) clif->skill_fail(sd, ud->skill_id, USESKILL_FAIL_LEVEL, 0); + break; } } //Avoid doing double checks for instant-cast skills. - if (tid != INVALID_TIMER && !iStatus->check_skilluse(src, target, ud->skill_id, 1)) + if (tid != INVALID_TIMER && !status->check_skilluse(src, target, ud->skill_id, 1)) break; if(md) { @@ -4803,10 +4799,9 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) break; case CR_GRANDCROSS: case NPC_GRANDDARKNESS: - if( (sc = iStatus->get_sc(src)) && sc->data[SC_NOEQUIPSHIELD] ) - { + if( (sc = status->get_sc(src)) && sc->data[SC_NOEQUIPSHIELD] ) { const struct TimerData *td = timer->get(sc->data[SC_NOEQUIPSHIELD]->timer); - if( td && td->func == iStatus->change_timer && DIFF_TICK(td->tick,timer->gettick()+skill->get_time(ud->skill_id, ud->skill_lv)) > 0 ) + if( td && td->func == status->change_timer && DIFF_TICK(td->tick,timer->gettick()+skill->get_time(ud->skill_id, ud->skill_lv)) > 0 ) break; } sc_start2(src, SC_NOEQUIPSHIELD, 100, 0, 1, skill->get_time(ud->skill_id, ud->skill_lv)); @@ -4832,12 +4827,13 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) else skill->castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); - sc = iStatus->get_sc(src); + sc = status->get_sc(src); if(sc && sc->count) { - if(sc->data[SC_SOULLINK] && - sc->data[SC_SOULLINK]->val2 == SL_WIZARD && - sc->data[SC_SOULLINK]->val3 == ud->skill_id && - ud->skill_id != WZ_WATERBALL) + if( sc->data[SC_SOULLINK] + && sc->data[SC_SOULLINK]->val2 == SL_WIZARD + && sc->data[SC_SOULLINK]->val3 == ud->skill_id + && ud->skill_id != WZ_WATERBALL + ) sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check. if( sc->data[SC_DANCING] && skill->get_inf2(ud->skill_id)&INF2_SONG_DANCE && sd ) @@ -4857,11 +4853,11 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) } while(0); //Skill failed. - if (ud->skill_id == MO_EXTREMITYFIST && sd && !(sc && sc->data[SC_FOGWALL])) - { //When Asura fails... (except when it fails from Fog of Wall) + if (ud->skill_id == MO_EXTREMITYFIST && sd && !(sc && sc->data[SC_FOGWALL])) { + //When Asura fails... (except when it fails from Fog of Wall) //Consume SP/spheres skill->consume_requirement(sd,ud->skill_id, ud->skill_lv,1); - iStatus->set_sp(src, 0, 0); + status->set_sp(src, 0, 0); sc = &sd->sc; if (sc->count) { //End states @@ -4937,10 +4933,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(bl->prev == NULL) return 1; - if(iStatus->isdead(src)) + if(status->isdead(src)) return 1; - if( src != bl && iStatus->isdead(bl) ) { + if( src != bl && status->isdead(bl) ) { /** * Skills that may be cast on dead targets **/ @@ -4955,8 +4951,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } - tstatus = iStatus->get_status_data(bl); - sstatus = iStatus->get_status_data(src); + tstatus = status->get_status_data(bl); + sstatus = status->get_status_data(src); //Check for undead skills that convert a no-damage skill into a damage one. [Skotlex] switch (skill_id) { @@ -5013,7 +5009,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RK_FIGHTINGSPIRIT: case RK_ABUNDANCE: if( sd && !pc->checkskill(sd, RK_RUNEMASTERY) ){ - if( iStatus->change_start(&sd->bl, (sc_type)(rnd()%SC_CONFUSION), 1000, 1, 0, 0, 0, skill->get_time2(skill_id,skill_lv),8) ){ + if( status->change_start(&sd->bl, (sc_type)(rnd()%SC_CONFUSION), 1000, 1, 0, 0, 0, skill->get_time2(skill_id,skill_lv),8) ){ skill->consume_requirement(sd,skill_id,skill_lv,2); iMap->freeblock_unlock(); return 0; @@ -5026,8 +5022,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui return skill->castend_pos2(src,bl->x,bl->y,skill_id,skill_lv,tick,0); } - type = iStatus->skill2sc(skill_id); - tsc = iStatus->get_sc(bl); + type = status->skill2sc(skill_id); + tsc = status->get_sc(bl); tsce = (tsc && type != -1)?tsc->data[type]:NULL; if (src!=bl && type > -1 && @@ -5051,7 +5047,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( skill_id == AB_HIGHNESSHEAL ) { heal = heal * ( 15 + 5 * skill_lv ) / 10; } - if( iStatus->isimmune(bl) || + if( status->isimmune(bl) || (dstmd && (dstmd->class_ == MOBID_EMPERIUM || mob_is_battleground(dstmd))) ) heal=0; @@ -5077,7 +5073,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif->skill_nodamage (src, bl, skill_id, heal, 1); if( tsc && tsc->data[SC_AKAITSUKI] && heal && skill_id != HLIF_HEAL ) heal = ~heal + 1; - heal_get_jobexp = iStatus->heal(bl,heal,0,0); + heal_get_jobexp = status->heal(bl,heal,0,0); if(sd && dstsd && heal > 0 && sd != dstsd && battle_config.heal_exp > 0){ heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100; @@ -5110,10 +5106,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif->updatestatus(sd,SP_BASEEXP); clif->updatestatus(sd,SP_JOBEXP); } - iStatus->set_hp(src, 1, 0); - iStatus->set_sp(src, 0, 0); + status->set_hp(src, 1, 0); + status->set_sp(src, 0, 0); break; - } else if (iStatus->isdead(bl) && flag&1) { //Revive + } else if (status->isdead(bl) && flag&1) { //Revive skill_area_temp[0]++; //Count it in, then fall-through to the Resurrection code. skill_lv = 3; //Resurrection level 3 is used } else //Invalid target, skip resurrection. @@ -5125,7 +5121,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - if (!iStatus->isdead(bl)) + if (!status->isdead(bl)) break; { int per = 0, sper = 0; @@ -5143,7 +5139,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if(dstsd && dstsd->special_state.restart_full_recover) per = sper = 100; - if (iStatus->revive(bl, per, sper)) + if (status->revive(bl, per, sper)) { clif->skill_nodamage(src,bl,ALL_RESURRECTION,skill_lv,1); //Both Redemptio and Res show this skill-animation. if(sd && dstsd && battle_config.resurrection_exp > 0) @@ -5168,12 +5164,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AL_DECAGI: case MER_DECAGI: clif->skill_nodamage (src, bl, skill_id, skill_lv, - sc_start(bl, type, (40 + skill_lv * 2 + (iStatus->get_lv(src) + sstatus->int_)/5), skill_lv, skill->get_time(skill_id,skill_lv))); + sc_start(bl, type, (40 + skill_lv * 2 + (status->get_lv(src) + sstatus->int_)/5), skill_lv, skill->get_time(skill_id,skill_lv))); break; case AL_CRUCIS: if (flag&1) - sc_start(bl,type, 23+skill_lv*4 +iStatus->get_lv(src) -iStatus->get_lv(bl), skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(bl,type, 23+skill_lv*4 +status->get_lv(src) -status->get_lv(bl), skill_lv,skill->get_time(skill_id,skill_lv)); else { iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); @@ -5247,23 +5243,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SA_FULLRECOVERY: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if (iStatus->isimmune(bl)) + if (status->isimmune(bl)) break; status_percent_heal(bl, 100, 100); break; case NPC_ALLHEAL: - { - int heal; - if( iStatus->isimmune(bl) ) - break; - heal = status_percent_heal(bl, 100, 0); - clif->skill_nodamage(NULL, bl, AL_HEAL, heal, 1); - if( dstmd ) - { // Reset Damage Logs - memset(dstmd->dmglog, 0, sizeof(dstmd->dmglog)); - dstmd->tdmg = 0; - } + { + int heal; + if( status->isimmune(bl) ) + break; + heal = status_percent_heal(bl, 100, 0); + clif->skill_nodamage(NULL, bl, AL_HEAL, heal, 1); + if( dstmd ) { + // Reset Damage Logs + memset(dstmd->dmglog, 0, sizeof(dstmd->dmglog)); + dstmd->tdmg = 0; } + } break; case SA_SUMMONMONSTER: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -5275,7 +5271,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SA_INSTANTDEATH: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - iStatus->set_hp(bl,1,0); + status->set_hp(bl,1,0); break; case SA_QUESTION: case SA_GRAVITY: @@ -5320,7 +5316,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SA_FORTUNE: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if(sd) pc->getzeny(sd,iStatus->get_lv(bl)*100,LOG_TYPE_STEAL,NULL); + if(sd) pc->getzeny(sd,status->get_lv(bl)*100,LOG_TYPE_STEAL,NULL); break; case SA_TAMINGMONSTER: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -5345,7 +5341,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case CG_MARIONETTE: { - struct status_change* sc = iStatus->get_sc(src); + struct status_change* sc = status->get_sc(src); if( sd && dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex ) {// Cannot cast on another bard/dancer-type class of the same gender as caster @@ -5694,13 +5690,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case AC_CONCENTRATION: - { - clif->skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); - iMap->foreachinrange( iStatus->change_timer_sub, src, - skill->get_splash(skill_id, skill_lv), BL_CHAR, - src,NULL,type,tick); - } + { + clif->skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); + iMap->foreachinrange( status->change_timer_sub, src, + skill->get_splash(skill_id, skill_lv), BL_CHAR, + src,NULL,type,tick); + } break; case SM_PROVOKE: @@ -5713,7 +5709,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } //TODO: How much does base level affects? Dummy value of 1% per level difference used. [Skotlex] clif->skill_nodamage(src,bl,skill_id == SM_SELFPROVOKE ? SM_PROVOKE : skill_id,skill_lv, - (i = sc_start(bl,type, skill_id == SM_SELFPROVOKE ? 100:( 50 + 3*skill_lv + iStatus->get_lv(src) - iStatus->get_lv(bl)), skill_lv, skill->get_time(skill_id,skill_lv)))); + (i = sc_start(bl,type, skill_id == SM_SELFPROVOKE ? 100:( 50 + 3*skill_lv + status->get_lv(src) - status->get_lv(bl)), skill_lv, skill->get_time(skill_id,skill_lv)))); if( !i ) { if( sd ) @@ -5750,7 +5746,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; } - if( (lv = iStatus->get_lv(src) - dstsd->status.base_level) < 0 ) + if( (lv = status->get_lv(src) - dstsd->status.base_level) < 0 ) lv = -lv; if( lv > battle_config.devotion_level_difference || // Level difference requeriments (dstsd->sc.data[type] && dstsd->sc.data[type]->val1 != src->id) || // Cannot Devote a player devoted from another source @@ -5837,7 +5833,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui i = 2 * dstmd->level; mob->target(dstmd,src,0); } - if (i) iStatus->heal(src, 0, i, 3); + if (i) status->heal(src, 0, i, 3); clif->skill_nodamage(src,bl,skill_id,skill_lv,i?1:0); break; @@ -5949,7 +5945,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui src, skill_id, skill_lv, tick, flag|i, skill->castend_damage_id); iMap->addblock(src); - iStatus->damage(src, src, sstatus->max_hp,0,0,1); + status->damage(src, src, sstatus->max_hp,0,0,1); break; case AL_ANGELUS: @@ -6019,13 +6015,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SL_KAUPE: if (sd) { if (!dstsd || !( - (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_SOULLINKER) || - (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER || - dstsd->status.char_id == sd->status.char_id || - dstsd->status.char_id == sd->status.partner_id || - dstsd->status.char_id == sd->status.child - )) { - iStatus->change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,8); + (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_SOULLINKER) + || (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER + || dstsd->status.char_id == sd->status.char_id + || dstsd->status.char_id == sd->status.partner_id + || dstsd->status.char_id == sd->status.child + ) + ) { + status->change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,8); clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } @@ -6118,15 +6115,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case DC_WINKCHARM: if( dstsd ) clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,SC_CONFUSION,30,7,skill->get_time2(skill_id,skill_lv))); - else - if( dstmd ) - { - if( iStatus->get_lv(src) > iStatus->get_lv(bl) - && (tstatus->race == RC_DEMON || tstatus->race == RC_DEMIHUMAN || tstatus->race == RC_ANGEL) - && !(tstatus->mode&MD_BOSS) ) + else if( dstmd ) { + if( status->get_lv(src) > status->get_lv(bl) + && (tstatus->race == RC_DEMON || tstatus->race == RC_DEMIHUMAN || tstatus->race == RC_ANGEL) + && !(tstatus->mode&MD_BOSS) + ) { clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start2(bl,type,70,skill_lv,src->id,skill->get_time(skill_id,skill_lv))); - else - { + } else { clif->skill_nodamage(src,bl,skill_id,skill_lv,0); if(sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } @@ -6163,7 +6158,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - if(iStatus->isimmune(bl) || !tsc) + if(status->isimmune(bl) || !tsc) break; if (sd && sd->sc.data[SC_PETROLOGY_OPTION]) @@ -6192,11 +6187,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NV_FIRSTAID: clif->skill_nodamage(src,bl,skill_id,5,1); - iStatus->heal(bl,5,0,0); + status->heal(bl,5,0,0); break; case AL_CURE: - if(iStatus->isimmune(bl)) { + if(status->isimmune(bl)) { clif->skill_nodamage(src,bl,skill_id,skill_lv,0); break; } @@ -6213,7 +6208,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case PR_STRECOVERY: - if(iStatus->isimmune(bl)) { + if(status->isimmune(bl)) { clif->skill_nodamage(src,bl,skill_id,skill_lv,0); break; } @@ -6226,10 +6221,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } //Is this equation really right? It looks so... special. if( battle->check_undead(tstatus->race,tstatus->def_ele) ) { - iStatus->change_start(bl, SC_BLIND, - 100*(100-(tstatus->int_/2+tstatus->vit/3+tstatus->luk/10)), - 1,0,0,0, - skill->get_time2(skill_id, skill_lv) * (100-(tstatus->int_+tstatus->vit)/2)/100,0); + status->change_start(bl, SC_BLIND, + 100*(100-(tstatus->int_/2+tstatus->vit/3+tstatus->luk/10)), 1,0,0,0, + skill->get_time2(skill_id, skill_lv) * (100-(tstatus->int_+tstatus->vit)/2)/100,0); } clif->skill_nodamage(src,bl,skill_id,skill_lv,1); if(dstmd) @@ -6267,10 +6261,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case MER_SCAPEGOAT: - if( mer && mer->master ) - { - iStatus->heal(&mer->master->bl, mer->battle_status.hp, 0, 2); - iStatus->damage(src, src, mer->battle_status.max_hp, 0, 0, 1); + if( mer && mer->master ) { + status->heal(&mer->master->bl, mer->battle_status.hp, 0, 2); + status->damage(src, src, mer->battle_status.max_hp, 0, 0, 1); } break; @@ -6576,7 +6569,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( tsc && tsc->data[SC_EXTREMITYFIST2] ) sp = 0; #endif - iStatus->heal(bl,(int)hp,sp,0); + status->heal(bl,(int)hp,sp,0); } break; case AM_CP_WEAPON: @@ -6644,7 +6637,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - if(iStatus->isimmune(bl) || !tsc || !tsc->count) + if(status->isimmune(bl) || !tsc || !tsc->count) break; if( sd && dstsd && !map_flag_vs(sd->bl.m) @@ -6654,12 +6647,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; } - for(i = 0; i < SC_MAX; i++) - { + for(i = 0; i < SC_MAX; i++) { if ( !tsc->data[i] ) continue; - if( SC_COMMON_MAX < i ){ - if ( iStatus->get_sc_type(i)&SC_NO_DISPELL ) + if( SC_COMMON_MAX < i ) { + if ( status->get_sc_type(i)&SC_NO_DISPELL ) continue; } switch (i) { @@ -6747,7 +6739,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sp = skill->get_sp(skill_id,skill_lv); sp = sp * tsc->data[SC_MAGICROD]->val2 / 100; if(sp < 1) sp = 1; - iStatus->heal(bl,0,sp,2); + status->heal(bl,0,sp,2); status_percent_damage(bl, src, 0, -20, false); //20% max SP damage. } else { struct unit_data *ud = unit->bl2ud(bl); @@ -6780,7 +6772,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sp = sp*(25*(skill_lv-1))/100; if(hp || sp) - iStatus->heal(src, hp, sp, 2); + status->heal(src, hp, sp, 2); } } break; @@ -7017,49 +7009,49 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case WE_MALE: - { - int hp_rate=(!skill_lv)? 0:skill_db[skill_id].hp_rate[skill_lv-1]; - int gain_hp= tstatus->max_hp*abs(hp_rate)/100; // The earned is the same % of the target HP than it costed the caster. [Skotlex] - clif->skill_nodamage(src,bl,skill_id,iStatus->heal(bl, gain_hp, 0, 0),1); - } + { + int hp_rate = (!skill_lv)? 0:skill_db[skill_id].hp_rate[skill_lv-1]; + int gain_hp = tstatus->max_hp*abs(hp_rate)/100; // The earned is the same % of the target HP than it costed the caster. [Skotlex] + clif->skill_nodamage(src,bl,skill_id,status->heal(bl, gain_hp, 0, 0),1); + } break; case WE_FEMALE: - { - int sp_rate=(!skill_lv)? 0:skill_db[skill_id].sp_rate[skill_lv-1]; - int gain_sp=tstatus->max_sp*abs(sp_rate)/100;// The earned is the same % of the target SP than it costed the caster. [Skotlex] - clif->skill_nodamage(src,bl,skill_id,iStatus->heal(bl, 0, gain_sp, 0),1); - } + { + int sp_rate = (!skill_lv)? 0:skill_db[skill_id].sp_rate[skill_lv-1]; + int gain_sp = tstatus->max_sp*abs(sp_rate)/100;// The earned is the same % of the target SP than it costed the caster. [Skotlex] + clif->skill_nodamage(src,bl,skill_id,status->heal(bl, 0, gain_sp, 0),1); + } break; // parent-baby skills case WE_BABY: - if(sd){ + if(sd) { struct map_session_data *f_sd = pc->get_father(sd); struct map_session_data *m_sd = pc->get_mother(sd); // if neither was found - if(!f_sd && !m_sd){ + if(!f_sd && !m_sd) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); iMap->freeblock_unlock(); return 0; } - iStatus->change_start(bl,SC_STUN,10000,skill_lv,0,0,0,skill->get_time2(skill_id,skill_lv),8); + status->change_start(bl,SC_STUN,10000,skill_lv,0,0,0,skill->get_time2(skill_id,skill_lv),8); if (f_sd) sc_start(&f_sd->bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); if (m_sd) sc_start(&m_sd->bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); } break; case PF_HPCONVERSION: - { - int hp, sp; - hp = sstatus->max_hp/10; - sp = hp * 10 * skill_lv / 100; - if (!iStatus->charge(src,hp,0)) { - if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - break; - } - clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); - iStatus->heal(bl,0,sp,2); + { + int hp, sp; + hp = sstatus->max_hp/10; + sp = hp * 10 * skill_lv / 100; + if (!status->charge(src,hp,0)) { + if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + break; } + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + status->heal(bl,0,sp,2); + } break; case MA_REMOVETRAP: @@ -7216,20 +7208,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } dstmd->state.soul_change_flag = 1; sp2 = sstatus->max_sp * 3 /100; - iStatus->heal(src, 0, sp2, 2); + status->heal(src, 0, sp2, 2); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; } sp1 = sstatus->sp; sp2 = tstatus->sp; - #ifdef RENEWAL - sp1 = sp1 / 2; - sp2 = sp2 / 2; - if( tsc && tsc->data[SC_EXTREMITYFIST2] ) - sp1 = tstatus->sp; - #endif - iStatus->set_sp(src, sp2, 3); - iStatus->set_sp(bl, sp1, 3); +#ifdef RENEWAL + sp1 = sp1 / 2; + sp2 = sp2 / 2; + if( tsc && tsc->data[SC_EXTREMITYFIST2] ) + sp1 = tstatus->sp; +#endif // RENEWAL + status->set_sp(src, sp2, 3); + status->set_sp(bl, sp1, 3); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -7267,7 +7259,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif->skill_nodamage(NULL,bl,AL_HEAL,hp,1); if(sp > 0) clif->skill_nodamage(NULL,bl,MG_SRECOVERY,sp,1); - iStatus->heal(bl,hp,sp,0); + status->heal(bl,hp,sp,0); } break; // Full Chemical Protection @@ -7337,13 +7329,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sc_start(bl,SC_INCMATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); break; case 2: // all buffs removed - iStatus->change_clear_buffs(bl,1); + status->change_clear_buffs(bl,1); break; case 3: // 1000 damage, random armor destroyed { status_fix_damage(src, bl, 1000, 0); clif->damage(src,bl,tick,0,0,1000,0,0,0); - if( !iStatus->isdead(bl) ) { + if( !status->isdead(bl) ) { int where[] = { EQP_ARMOR, EQP_SHIELD, EQP_HELM, EQP_SHOES, EQP_GARMENT }; skill->break_equip(bl, where[rnd()%5], 10000, BCT_ENEMY); } @@ -7353,7 +7345,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sc_start(bl,SC_INCATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); break; case 5: // 2000HP heal, random teleported - iStatus->heal(src, 2000, 0, 0); + status->heal(src, 2000, 0, 0); if( !map_flag_vs(bl->m) ) unit->warp(bl, -1,-1,-1, CLR_TELEPORT); break; @@ -7452,7 +7444,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (tsce) { if(sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - iStatus->change_start(src,SC_STUN,10000,skill_lv,0,0,0,10000,8); + status->change_start(src,SC_STUN,10000,skill_lv,0,0,0,10000,8); status_change_end(bl, SC_SWOO, INVALID_TIMER); break; } @@ -7460,7 +7452,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SL_SKE: if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - iStatus->change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,10); + status->change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,10); break; } clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); @@ -7471,42 +7463,42 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui // New guild skills [Celest] case GD_BATTLEORDER: if(flag&1) { - if (iStatus->get_guild_id(src) == iStatus->get_guild_id(bl)) + if (status->get_guild_id(src) == status->get_guild_id(bl)) sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv)); - } else if (iStatus->get_guild_id(src)) { + } else if (status->get_guild_id(src)) { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); iMap->foreachinrange(skill->area_sub, src, - skill->get_splash(skill_id, skill_lv), BL_PC, - src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, - skill->castend_nodamage_id); + skill->get_splash(skill_id, skill_lv), BL_PC, + src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, + skill->castend_nodamage_id); if (sd) guild->block_skill(sd,skill->get_time2(skill_id,skill_lv)); } break; case GD_REGENERATION: if(flag&1) { - if (iStatus->get_guild_id(src) == iStatus->get_guild_id(bl)) + if (status->get_guild_id(src) == status->get_guild_id(bl)) sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv)); - } else if (iStatus->get_guild_id(src)) { + } else if (status->get_guild_id(src)) { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); iMap->foreachinrange(skill->area_sub, src, - skill->get_splash(skill_id, skill_lv), BL_PC, - src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, - skill->castend_nodamage_id); + skill->get_splash(skill_id, skill_lv), BL_PC, + src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, + skill->castend_nodamage_id); if (sd) guild->block_skill(sd,skill->get_time2(skill_id,skill_lv)); } break; case GD_RESTORE: if(flag&1) { - if (iStatus->get_guild_id(src) == iStatus->get_guild_id(bl)) + if (status->get_guild_id(src) == status->get_guild_id(bl)) clif->skill_nodamage(src,bl,AL_HEAL,status_percent_heal(bl,90,90),1); - } else if (iStatus->get_guild_id(src)) { + } else if (status->get_guild_id(src)) { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); iMap->foreachinrange(skill->area_sub, src, - skill->get_splash(skill_id, skill_lv), BL_PC, - src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, - skill->castend_nodamage_id); + skill->get_splash(skill_id, skill_lv), BL_PC, + src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, + skill->castend_nodamage_id); if (sd) guild->block_skill(sd,skill->get_time2(skill_id,skill_lv)); } @@ -7518,7 +7510,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui int j = 0; struct guild *g; // i don't know if it actually summons in a circle, but oh well. ;P - g = sd ? sd->guild : guild->search(iStatus->get_guild_id(src)); + g = sd ? sd->guild : guild->search(status->get_guild_id(src)); if (!g) break; clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -7636,7 +7628,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //Eh? why double skill packet? clif->skill_nodamage(src,bl,AL_HEAL,i,1); clif->skill_nodamage(src,bl,skill_id,i,1); - iStatus->heal(bl, i, 0, 0); + status->heal(bl, i, 0, 0); } break; //Homun single-target support skills [orn] @@ -7741,7 +7733,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case RK_ENCHANTBLADE: clif->skill_nodamage(src,bl,skill_id,skill_lv,// formula not confirmed - sc_start2(bl,type,100,skill_lv,100+20*skill_lv/*+sstatus->int_/2+iStatus->get_lv(bl)/10*/,skill->get_time(skill_id,skill_lv))); + sc_start2(bl,type,100,skill_lv,100+20*skill_lv/*+sstatus->int_/2+status->get_lv(bl)/10*/,skill->get_time(skill_id,skill_lv))); break; case RK_DRAGONHOWLING: if( flag&1) @@ -7768,23 +7760,22 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); break; case RK_STONEHARDSKIN: - if( sd ) - { + if( sd ) { int heal = sstatus->hp / 4; // 25% HP - if( iStatus->charge(bl,heal,0) ) + if( status->charge(bl,heal,0) ) clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start2(bl,type,100,skill_lv,heal,skill->get_time(skill_id,skill_lv))); else clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; case RK_REFRESH: - { - int heal = status_get_max_hp(bl) * 25 / 100; - clif->skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); - iStatus->heal(bl,heal,0,1); - iStatus->change_clear_buffs(bl,4); - } + { + int heal = status_get_max_hp(bl) * 25 / 100; + clif->skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); + status->heal(bl,heal,0,1); + status->change_clear_buffs(bl,4); + } break; case RK_MILLENNIUMSHIELD: @@ -7829,9 +7820,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } }else if( skill_area_temp[5]&0x20 ){ i = status_get_max_hp(bl) * 25 / 100; - iStatus->change_clear_buffs(bl,4); + status->change_clear_buffs(bl,4); skill_area_temp[5] &= ~0x20; - iStatus->heal(bl,i,0,1); + status->heal(bl,i,0,1); type = SC_REFRESH; }else if( skill_area_temp[5]&0x40 ){ skill_area_temp[5] &= ~0x40; @@ -7839,7 +7830,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui }else if( skill_area_temp[5]&0x80 ){ if( dstsd ){ i = sstatus->hp / 4; - if( iStatus->charge(bl,i,0) ) + if( status->charge(bl,i,0) ) type = SC_STONEHARDSKIN; skill_area_temp[5] &= ~0x80; } @@ -7945,8 +7936,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0); break; } - if( !iStatus->charge(bl,heal,0) ) - { + if( !status->charge(bl,heal,0) ) { if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0); break; } @@ -7989,13 +7979,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( sd && tstatus && !battle->check_undead(tstatus->race, tstatus->def_ele) ) { i = skill->calc_heal(src, bl, AL_HEAL, pc->checkskill(sd, AL_HEAL), true); - if( (dstsd && pc_ismadogear(dstsd)) || iStatus->isimmune(bl)) + if( (dstsd && pc_ismadogear(dstsd)) || status->isimmune(bl)) i = 0; // Should heal by 0 or won't do anything?? in iRO it breaks the healing to members.. [malufett] clif->skill_nodamage(bl, bl, skill_id, i, 1); if( tsc && tsc->data[SC_AKAITSUKI] && i ) i = ~i + 1; - iStatus->heal(bl, i, 0, 0); + status->heal(bl, i, 0, 0); } } else if( sd ) @@ -8051,23 +8041,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case AB_CLEARANCE: - if( flag&1 || (i = skill->get_splash(skill_id, skill_lv)) < 1 ) - { //As of the behavior in official server Clearance is just a super version of Dispell skill. [Jobbie] + if( flag&1 || (i = skill->get_splash(skill_id, skill_lv)) < 1 ) { + //As of the behavior in official server Clearance is just a super version of Dispell skill. [Jobbie] clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || rnd()%100 >= 30 + 10 * skill_lv) - { + if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || rnd()%100 >= 30 + 10 * skill_lv) { if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - if(iStatus->isimmune(bl) || !tsc || !tsc->count) + if(status->isimmune(bl) || !tsc || !tsc->count) break; - for(i = 0; i < SC_MAX; i++) - { + for(i = 0; i < SC_MAX; i++) { if ( !tsc->data[i] ) continue; if( SC_COMMON_MAX > i ) - if ( iStatus->get_sc_type(i)&SC_NO_CLEARANCE ) + if ( status->get_sc_type(i)&SC_NO_CLEARANCE ) continue; switch (i) { case SC_ASSUMPTIO: @@ -8142,12 +8130,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WL_SIENNAEXECRATE: if( flag&1 ) { - if( iStatus->isimmune(bl) || !tsc ) + if( status->isimmune(bl) || !tsc ) break; if( tsc && tsc->data[SC_STONE] ) status_change_end(bl,SC_STONE,INVALID_TIMER); else - iStatus->change_start(bl,SC_STONE,10000,skill_lv,0,0,500,skill->get_time(skill_id, skill_lv),2); + status->change_start(bl,SC_STONE,10000,skill_lv,0,0,500,skill->get_time(skill_id, skill_lv),2); } else { int rate = 45 + 5 * skill_lv; if( rnd()%100 < rate ){ @@ -8174,7 +8162,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WL_READING_SB: if( sd ) { - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); for( i = SC_SPELLBOOK1; i <= SC_SPELLBOOK7; i++) if( sc && !sc->data[i] ) @@ -8256,7 +8244,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui pc->setmadogear(sd, 0); clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag); - iStatus->set_sp(src, 0, 0); + status->set_sp(src, 0, 0); } break; @@ -8284,10 +8272,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( dstsd && pc_ismadogear(dstsd) ) { heal = dstsd->status.max_hp * (3+3*skill_lv) / 100; - iStatus->heal(bl,heal,0,2); + status->heal(bl,heal,0,2); } else { heal = sd->status.max_hp * (3+3*skill_lv) / 100; - iStatus->heal(src,heal,0,2); + status->heal(src,heal,0,2); } clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); @@ -8354,8 +8342,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SC_WEAKNESS: if( !(tsc && tsc->data[type]) ) { //((rand(myDEX / 12, myDEX / 4) + myJobLevel + 10 * skLevel) + myLevel / 10) - (targetLevel / 10 + targetLUK / 10 + (targetMaxWeight - targetWeight) / 1000 + rand(targetAGI / 6, targetAGI / 3)) - int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skill_lv + (sd?sd->status.job_level:0) + iStatus->get_lv(src)/10 - - iStatus->get_lv(bl)/10 - tstatus->luk/10 - (dstsd?(dstsd->max_weight-dstsd->weight)/10000:0) - rnd_value(tstatus->agi/6,tstatus->agi/3); + int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skill_lv + (sd?sd->status.job_level:0) + status->get_lv(src)/10 + - status->get_lv(bl)/10 - tstatus->luk/10 - (dstsd?(dstsd->max_weight-dstsd->weight)/10000:0) - rnd_value(tstatus->agi/6,tstatus->agi/3); rate = cap_value(rate, skill_lv+sstatus->dex/20, 100); clif->skill_nodamage(src,bl,skill_id,0,sc_start(bl,type,rate,skill_lv,skill->get_time(skill_id,skill_lv))); } else if( sd ) @@ -8364,16 +8352,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SC_IGNORANCE: if( !(tsc && tsc->data[type]) ) { - int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skill_lv + (sd?sd->status.job_level:0) + iStatus->get_lv(src)/10 - - iStatus->get_lv(bl)/10 - tstatus->luk/10 - (dstsd?(dstsd->max_weight-dstsd->weight)/10000:0) - rnd_value(tstatus->agi/6,tstatus->agi/3); + int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skill_lv + (sd?sd->status.job_level:0) + + status->get_lv(src)/10 - status->get_lv(bl)/10 - tstatus->luk/10 + - (dstsd?(dstsd->max_weight-dstsd->weight)/10000:0) - rnd_value(tstatus->agi/6,tstatus->agi/3); rate = cap_value(rate, skill_lv+sstatus->dex/20, 100); if (clif->skill_nodamage(src,bl,skill_id,0,sc_start(bl,type,rate,skill_lv,skill->get_time(skill_id,skill_lv)))) { int sp = 200 * skill_lv; if( dstmd ) sp = dstmd->level * 2; if( status_zap(bl,0,sp) ) - iStatus->heal(src,0,sp/2,3); - } - else if( sd ) clif->skill_fail(sd,skill_id,0,0); + status->heal(src,0,sp/2,3); + } else if( sd ) + clif->skill_fail(sd,skill_id,0,0); } else if( sd ) clif->skill_fail(sd,skill_id,0,0); break; @@ -8484,16 +8473,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui val = 105 * it->refine / 10; sc_start2(bl,SC_SHIELDSPELL_REF,brate,opt,val,skill->get_time(skill_id,skill_lv)); break; - case 2: case 3: - if( rate < brate ) - { + case 2: + case 3: + if( rate < brate ) { val = sstatus->max_hp * (11 + it->refine) / 100; - iStatus->heal(bl, val, 0, 3); + status->heal(bl, val, 0, 3); } break; - /*case 3: - // Full protection. I need confirm what effect should be here. Moved to case 2 to until we got it. - break;*/ +#if 0 // TODO: I need confirm what effect should be here. Moved to case 2 to until we got it. + case 3: + // Full protection. + break; +#endif // 0 } } break; @@ -8613,17 +8604,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { int heal; - if( iStatus->isimmune(bl) ) - { + if( status->isimmune(bl) ) { clif->skill_nodamage(src,bl,skill_id,skill_lv,0); break; } heal = 120 * skill_lv + status_get_max_hp(bl) * (2 + skill_lv) / 100; - iStatus->heal(bl, heal, 0, 0); + status->heal(bl, heal, 0, 0); - if( (tsc && tsc->opt1) && (rnd()%100 < ((skill_lv * 5) + (status_get_dex(src) + iStatus->get_lv(src)) / 4) - (1 + (rnd() % 10))) ) - { + if( (tsc && tsc->opt1) && (rnd()%100 < ((skill_lv * 5) + (status_get_dex(src) + status->get_lv(src)) / 4) - (1 + (rnd() % 10))) ) { status_change_end(bl, SC_STONE, INVALID_TIMER); status_change_end(bl, SC_FREEZE, INVALID_TIMER); status_change_end(bl, SC_STUN, INVALID_TIMER); @@ -8677,7 +8666,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WM_DEADHILLHERE: if( bl->type == BL_PC ) { - if( !iStatus->isdead(bl) ) + if( !status->isdead(bl) ) break; if( rnd()%100 < 88 + 2 * skill_lv ) { @@ -8747,8 +8736,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WM_SONG_OF_MANA: case WM_DANCE_WITH_WUG: case WM_LERADS_DEW: - if( flag&1 ) { // These affect to to all party members near the caster. - struct status_change *sc = iStatus->get_sc(src); + if( flag&1 ) { + // These affect to to all party members near the caster. + struct status_change *sc = status->get_sc(src); if( sc && sc->data[type] ) { sc_start2(bl,type,100,skill_lv,sc->data[type]->val2,skill->get_time(skill_id,skill_lv)); } @@ -8874,13 +8864,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WM_LULLABY_DEEPSLEEP: if( flag&1 ){ //[(Skill Level x 4) + (Voice Lessons Skill Level x 2) + (Caster?s Base Level / 15) + (Caster?s Job Level / 5)] % - int rate = (4 * skill_lv) + ( (sd) ? pc->checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + iStatus->get_lv(src) / 15; + int rate = (4 * skill_lv) + ( (sd) ? pc->checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + status->get_lv(src) / 15; if( bl != src ) sc_start(bl,type,rate,skill_lv,skill->get_time(skill_id,skill_lv)); }else { clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, - src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill->castend_nodamage_id); + src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill->castend_nodamage_id); } break; @@ -8954,13 +8944,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui int e_hp, e_sp; if( !ed ) break; - if( !iStatus->charge(&sd->bl,s_hp,s_sp) ) { + if( !status->charge(&sd->bl,s_hp,s_sp) ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } e_hp = ed->battle_status.max_hp * 10 / 100; e_sp = ed->battle_status.max_sp * 10 / 100; - iStatus->heal(&ed->bl,e_hp,e_sp,3); + status->heal(&ed->bl,e_hp,e_sp,3); clif->skill_nodamage(src,&ed->bl,skill_id,skill_lv,1); } break; @@ -8985,7 +8975,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case GN_BLOOD_SUCKER: { - struct status_change *sc = iStatus->get_sc(src); + struct status_change *sc = status->get_sc(src); if( sc && sc->bs_counter < skill->get_maxcount( skill_id , skill_lv) ) { if( tsc && tsc->data[type] ){ @@ -9075,24 +9065,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case EL_WIND_CURTAIN: case EL_SOLID_SKIN: case EL_STONE_SHIELD: - case EL_WIND_STEP: { - struct elemental_data *ele = BL_CAST(BL_ELEM, src); - if( ele ) { - sc_type type2 = type-1; - struct status_change *sc = iStatus->get_sc(&ele->bl); - - if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { - elemental->clean_single_effect(ele, skill_id); - } else { - clif->skill_nodamage(src,src,skill_id,skill_lv,1); - clif->skill_damage(src, ( skill_id == EL_GUST || skill_id == EL_BLAST || skill_id == EL_WILD_STORM )?src:bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - if( skill_id == EL_WIND_STEP ) // There aren't teleport, just push the master away. - skill->blown(src,bl,(rnd()%skill->get_blewcount(skill_id,skill_lv))+1,rand()%8,0); - sc_start(src,type2,100,skill_lv,skill->get_time(skill_id,skill_lv)); - sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); - } + case EL_WIND_STEP: + { + struct elemental_data *ele = BL_CAST(BL_ELEM, src); + if( ele ) { + sc_type type2 = type-1; + struct status_change *sc = status->get_sc(&ele->bl); + + if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { + elemental->clean_single_effect(ele, skill_id); + } else { + clif->skill_nodamage(src,src,skill_id,skill_lv,1); + clif->skill_damage(src, ( skill_id == EL_GUST || skill_id == EL_BLAST || skill_id == EL_WILD_STORM )?src:bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + if( skill_id == EL_WIND_STEP ) // There aren't teleport, just push the master away. + skill->blown(src,bl,(rnd()%skill->get_blewcount(skill_id,skill_lv))+1,rand()%8,0); + sc_start(src,type2,100,skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); } } + } break; case EL_FIRE_MANTLE: @@ -9104,23 +9095,24 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui skill->unitsetting(src,skill_id,skill_lv,bl->x,bl->y,0); break; - case EL_WATER_SCREEN: { - struct elemental_data *ele = BL_CAST(BL_ELEM, src); - if( ele ) { - struct status_change *sc = iStatus->get_sc(&ele->bl); - sc_type type2 = type-1; + case EL_WATER_SCREEN: + { + struct elemental_data *ele = BL_CAST(BL_ELEM, src); + if( ele ) { + struct status_change *sc = status->get_sc(&ele->bl); + sc_type type2 = type-1; - clif->skill_nodamage(src,src,skill_id,skill_lv,1); - if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { - elemental->clean_single_effect(ele, skill_id); - } else { - // This not heals at the end. - clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - sc_start(src,type2,100,skill_lv,skill->get_time(skill_id,skill_lv)); - sc_start(bl,type,100,src->id,skill->get_time(skill_id,skill_lv)); - } + clif->skill_nodamage(src,src,skill_id,skill_lv,1); + if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { + elemental->clean_single_effect(ele, skill_id); + } else { + // This not heals at the end. + clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + sc_start(src,type2,100,skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(bl,type,100,src->id,skill->get_time(skill_id,skill_lv)); } } + } break; case KO_KAHU_ENTEN: @@ -9138,12 +9130,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case KO_ZANZOU: - if(sd){ + if(sd) { struct mob_data *md; - md = mob->once_spawn_sub(src, src->m, src->x, src->y, iStatus->get_name(src), 2308, "", SZ_SMALL, AI_NONE); - if( md ) - { + md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), 2308, "", SZ_SMALL, AI_NONE); + if( md ) { md->master_id = src->id; md->special_state.ai = AI_ZANZOU; if( md->deletetimer != INVALID_TIMER ) @@ -9173,14 +9164,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case KO_JYUSATSU: - if( dstsd && tsc && !tsc->data[type] && - rand()%100 < (10 * (5 * skill_lv - status_get_int(bl) / 2 + 45 + 5 * skill_lv)) ){ + if( dstsd && tsc && !tsc->data[type] + && rand()%100 < (10 * (5 * skill_lv - status_get_int(bl) / 2 + 45 + 5 * skill_lv)) + ) { clif->skill_nodamage(src, bl, skill_id, skill_lv, - iStatus->change_start(bl, type, 10000, skill_lv, 0, 0, 0, skill->get_time(skill_id, skill_lv), 1)); + status->change_start(bl, type, 10000, skill_lv, 0, 0, 0, skill->get_time(skill_id, skill_lv), 1)); status_zap(bl, tstatus->max_hp * skill_lv * 5 / 100 , 0); - if( iStatus->get_lv(bl) <= iStatus->get_lv(src) ) - iStatus->change_start(bl, SC_COMA, skill_lv, skill_lv, 0, src->id, 0, 0, 0); - }else if( sd ) + if( status->get_lv(bl) <= status->get_lv(src) ) + status->change_start(bl, SC_COMA, skill_lv, skill_lv, 0, src->id, 0, 0, 0); + } else if( sd ) clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; @@ -9248,100 +9240,102 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } break; - case MH_SILENT_BREEZE: { - struct status_change *ssc = iStatus->get_sc(src); + case MH_SILENT_BREEZE: + { + struct status_change *ssc = status->get_sc(src); struct block_list *m_bl = battle->get_master(src); - const enum sc_type scs[] = { - SC_MANDRAGORA, SC_HARMONIZE, SC_DEEP_SLEEP, SC_SIREN, SC_SLEEP, SC_CONFUSION, SC_ILLUSION - }; - int heal; - if(tsc){ - for (i = 0; i < ARRAYLENGTH(scs); i++) { - if (tsc->data[scs[i]]) status_change_end(bl, scs[i], INVALID_TIMER); - } - if (!tsc->data[SC_SILENCE]) //put inavoidable silence on target - iStatus->change_start(bl, SC_SILENCE, 100, skill_lv, 0,0,0, skill->get_time(skill_id, skill_lv),1|2|8); + const enum sc_type scs[] = { + SC_MANDRAGORA, SC_HARMONIZE, SC_DEEP_SLEEP, SC_SIREN, SC_SLEEP, SC_CONFUSION, SC_ILLUSION + }; + int heal; + if(tsc){ + for (i = 0; i < ARRAYLENGTH(scs); i++) { + if (tsc->data[scs[i]]) status_change_end(bl, scs[i], INVALID_TIMER); + } + if (!tsc->data[SC_SILENCE]) //put inavoidable silence on target + status->change_start(bl, SC_SILENCE, 100, skill_lv, 0,0,0, skill->get_time(skill_id, skill_lv),1|2|8); } heal = status_get_matk_min(src)*4; - iStatus->heal(bl, heal, 0, 7); + status->heal(bl, heal, 0, 7); //now inflict silence on everyone if(ssc && !ssc->data[SC_SILENCE]) //put inavoidable silence on homun - iStatus->change_start(src, SC_SILENCE, 100, skill_lv, 0,0,0, skill->get_time(skill_id, skill_lv),1|2|8); + status->change_start(src, SC_SILENCE, 100, skill_lv, 0,0,0, skill->get_time(skill_id, skill_lv),1|2|8); if(m_bl){ - struct status_change *msc = iStatus->get_sc(m_bl); - if(msc && !msc->data[SC_SILENCE]) //put inavoidable silence on master - iStatus->change_start(m_bl, SC_SILENCE, 100, skill_lv, 0,0,0, skill->get_time(skill_id, skill_lv),1|2|8); + struct status_change *msc = status->get_sc(m_bl); + if(msc && !msc->data[SC_SILENCE]) //put inavoidable silence on master + status->change_start(m_bl, SC_SILENCE, 100, skill_lv, 0,0,0, skill->get_time(skill_id, skill_lv),1|2|8); } - if (hd) - skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); - } - break; - case MH_OVERED_BOOST: - if (hd){ - struct block_list *s_bl = battle->get_master(src); - if(hd->homunculus.hunger>50) //reduce hunger - hd->homunculus.hunger = hd->homunculus.hunger/2; - else - hd->homunculus.hunger = min(1,hd->homunculus.hunger); - if(s_bl && s_bl->type==BL_PC){ - iStatus->set_sp(s_bl,status_get_max_sp(s_bl)/2,0); //master drain 50% sp - clif->send_homdata(((TBL_PC *)s_bl), SP_HUNGRY, hd->homunculus.hunger); //refresh hunger info - sc_start(s_bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); //gene bonus - } - sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); - skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); - } - break; - case MH_GRANITIC_ARMOR: - case MH_PYROCLASTIC: { - struct block_list *s_bl = battle->get_master(src); - if(s_bl) - sc_start2(s_bl, type, 100, skill_lv, hd->homunculus.level, skill->get_time(skill_id, skill_lv)); //start on master - sc_start2(bl, type, 100, skill_lv, hd->homunculus.level, skill->get_time(skill_id, skill_lv)); - if (hd) - skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); + if (hd) + skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); + } + break; + case MH_OVERED_BOOST: + if (hd) { + struct block_list *s_bl = battle->get_master(src); + if(hd->homunculus.hunger>50) //reduce hunger + hd->homunculus.hunger = hd->homunculus.hunger/2; + else + hd->homunculus.hunger = min(1,hd->homunculus.hunger); + if(s_bl && s_bl->type==BL_PC) { + status->set_sp(s_bl,status_get_max_sp(s_bl)/2,0); //master drain 50% sp + clif->send_homdata(((TBL_PC *)s_bl), SP_HUNGRY, hd->homunculus.hunger); //refresh hunger info + sc_start(s_bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); //gene bonus } - break; + sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); + skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); + } + break; + case MH_GRANITIC_ARMOR: + case MH_PYROCLASTIC: + { + struct block_list *s_bl = battle->get_master(src); + if(s_bl) + sc_start2(s_bl, type, 100, skill_lv, hd->homunculus.level, skill->get_time(skill_id, skill_lv)); //start on master + sc_start2(bl, type, 100, skill_lv, hd->homunculus.level, skill->get_time(skill_id, skill_lv)); + if (hd) + skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); + } + break; - case MH_LIGHT_OF_REGENE: - if(hd){ + case MH_LIGHT_OF_REGENE: + if(hd) { hd->homunculus.intimacy = 251; //change to neutral (can't be cast if < 750) if(sd) clif->send_homdata(sd, SP_INTIMATE, hd->homunculus.intimacy); //refresh intimacy info } //don't break need to start status and start block timer - case MH_MAGMA_FLOW: - case MH_PAIN_KILLER: - sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); - if (hd) - skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); - break; - case MH_SUMMON_LEGION: - { - int summons[5] = {1004, 1303, 1303, 1994, 1994}; - int qty[5] = {3 , 3 , 4 , 4 , 5}; - struct mob_data *md; - int i, dummy = 0; + case MH_MAGMA_FLOW: + case MH_PAIN_KILLER: + sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); + if (hd) + skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); + break; + case MH_SUMMON_LEGION: + { + int summons[5] = {1004, 1303, 1303, 1994, 1994}; + int qty[5] = {3 , 3 , 4 , 4 , 5}; + struct mob_data *md; + int i, dummy = 0; - i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,hd->bl.m, BL_MOB, hd->bl.id, summons[skill_lv-1], skill_id, &dummy); - if(i >= qty[skill_lv-1]) - break; - - for(i=0; i<qty[skill_lv - 1]; i++){ //easy way - md = mob->once_spawn_sub(src, src->m, src->x, src->y, iStatus->get_name(src), summons[skill_lv - 1], "", SZ_SMALL, AI_ATTACK); - if (md) { - md->master_id = src->id; - if (md->deletetimer != INVALID_TIMER) - timer->delete(md->deletetimer, mob->timer_delete); - md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, md->bl.id, 0); - mob->spawn(md); //Now it is ready for spawning. - sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_CANATTACK|MD_AGGRESSIVE, 0, 60000); - } - } - if (hd) - skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); - } + i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,hd->bl.m, BL_MOB, hd->bl.id, summons[skill_lv-1], skill_id, &dummy); + if(i >= qty[skill_lv-1]) break; + + for(i=0; i<qty[skill_lv - 1]; i++){ //easy way + md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), summons[skill_lv - 1], "", SZ_SMALL, AI_ATTACK); + if (md) { + md->master_id = src->id; + if (md->deletetimer != INVALID_TIMER) + timer->delete(md->deletetimer, mob->timer_delete); + md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, md->bl.id, 0); + mob->spawn(md); //Now it is ready for spawning. + sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_CANATTACK|MD_AGGRESSIVE, 0, 60000); + } + } + if (hd) + skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); + } + break; default: ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skill_id); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -9349,8 +9343,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui return 1; } - if(skill_id != SR_CURSEDCIRCLE){ - struct status_change *sc = iStatus->get_sc(src); + if(skill_id != SR_CURSEDCIRCLE) { + struct status_change *sc = status->get_sc(src); if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] )//Should only remove after the skill had been casted. status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER); } @@ -9411,7 +9405,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) ud->skilltimer = INVALID_TIMER; do { - if( iStatus->isdead(src) ) + if( status->isdead(src) ) break; if( !(src->type&battle_config.skill_reiteration) && @@ -9445,9 +9439,9 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) } } - if(tid != INVALID_TIMER) - { //Avoid double checks on instant cast skills. [Skotlex] - if (!iStatus->check_skilluse(src, NULL, ud->skill_id, 1)) + if(tid != INVALID_TIMER) { + //Avoid double checks on instant cast skills. [Skotlex] + if (!status->check_skilluse(src, NULL, ud->skill_id, 1)) break; if(battle_config.skill_add_range && !check_distance_blxy(src, ud->skillx, ud->skilly, skill->get_range2(src,ud->skill_id,ud->skill_lv)+battle_config.skill_add_range)) { @@ -9693,13 +9687,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui nullpo_ret(src); - if(iStatus->isdead(src)) + if(status->isdead(src)) return 0; sd = BL_CAST(BL_PC, src); - sc = iStatus->get_sc(src); - type = iStatus->skill2sc(skill_id); + sc = status->get_sc(src); + type = status->skill2sc(skill_id); sce = (sc && type != -1)?sc->data[type]:NULL; switch (skill_id) { //Skill effect. @@ -9744,7 +9738,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case HT_DETECTING: i = skill->get_splash(skill_id, skill_lv); - iMap->foreachinarea( iStatus->change_timer_sub, + iMap->foreachinarea( status->change_timer_sub, src->m, x-i, y-i, x+i,y+i,BL_CHAR, src,NULL,SC_SIGHT,tick); if(battle_config.traps_setting&1) @@ -9988,7 +9982,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui struct mob_data *md; // Correct info, don't change any of this! [celest] - md = mob->once_spawn_sub(src, src->m, x, y, iStatus->get_name(src), class_, "", SZ_SMALL, AI_NONE); + md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), class_, "", SZ_SMALL, AI_NONE); if (md) { md->master_id = src->id; md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA; @@ -10110,18 +10104,15 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; case PA_GOSPEL: - if (sce && sce->val4 == BCT_SELF) - { + if (sce && sce->val4 == BCT_SELF) { status_change_end(src, SC_GOSPEL, INVALID_TIMER); return 0; - } - else - { + } else { sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0); if (!sg) break; if (sce) status_change_end(src, type, INVALID_TIMER); //Was under someone else's Gospel. [Skotlex] - iStatus->change_clear_buffs(src,3); + status->change_clear_buffs(src,3); sc_start4(src,type,100,skill_lv,0,sg->group_id,BCT_SELF,skill->get_time(skill_id,skill_lv)); clif->skill_poseffect(src, skill_id, skill_lv, 0, 0, tick); // PA_GOSPEL music packet } @@ -10221,9 +10212,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui int class_ = 2042; struct mob_data *md; - md = mob->once_spawn_sub(src, src->m, x, y, iStatus->get_name(src), class_, "", SZ_SMALL, AI_NONE); - if( md ) - { + md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), class_, "", SZ_SMALL, AI_NONE); + if( md ) { md->master_id = src->id; md->special_state.ai = AI_FLORA; if( md->deletetimer != INVALID_TIMER ) @@ -10274,7 +10264,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; case LG_RAYOFGENESIS: - if( iStatus->charge(src,status_get_max_hp(src)*3*skill_lv / 100,0) ) { + if( status->charge(src,status_get_max_hp(src)*3*skill_lv / 100,0) ) { i = skill->get_splash(skill_id,skill_lv); iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); @@ -10522,8 +10512,8 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ } sd = BL_CAST(BL_PC, src); - st = iStatus->get_status_data(src); - sc = iStatus->get_sc(src); // for traps, firewall and fogwall - celest + st = status->get_status_data(src); + sc = status->get_sc(src); // for traps, firewall and fogwall - celest switch( skill_id ) { case MH_STEINWAND: @@ -11003,7 +10993,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned nullpo_ret(src); nullpo_ret(bl); - if(bl->prev==NULL || !src->alive || iStatus->isdead(bl)) + if(bl->prev==NULL || !src->alive || status->isdead(bl)) return 0; nullpo_ret(sg=src->group); @@ -11013,12 +11003,12 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned return 0; //AoE skills are ineffective. [Skotlex] if( iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) ) return 0; - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (sc && sc->option&OPTION_HIDE && sg->skill_id != WZ_HEAVENDRIVE && sg->skill_id != WL_EARTHSTRAIN ) return 0; //Hidden characters are immune to AoE skills except to these. [Skotlex] - type = iStatus->skill2sc(sg->skill_id); + type = status->skill2sc(sg->skill_id); sce = (sc && type != -1)?sc->data[type]:NULL; skill_id = sg->skill_id; //In case the group is deleted, we need to return the correct skill id, still. switch (sg->unit_id) { @@ -11029,7 +11019,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned break; } else if( sc && battle->check_target(&sg->unit->bl,bl,sg->target_flag) > 0 ) { int sec = skill->get_time2(sg->skill_id,sg->skill_lv); - if( iStatus->change_start(bl,type,10000,sg->skill_lv,1,sg->group_id,0,sec,8) ) { + if( status->change_start(bl,type,10000,sg->skill_lv,1,sg->group_id,0,sec,8) ) { const struct TimerData* td = sc->data[type]?timer->get(sc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); @@ -11111,7 +11101,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned case UNT_HERMODE: if (sg->src_id!=bl->id && battle->check_target(&src->bl,bl,BCT_PARTY|BCT_GUILD) > 0) - iStatus->change_clear_buffs(bl,1); //Should dispell only allies. + status->change_clear_buffs(bl,1); //Should dispell only allies. case UNT_RICHMANKIM: case UNT_ETERNALCHAOS: case UNT_DRUMBATTLEFIELD: @@ -11142,8 +11132,8 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned else if (sce->val4 == 1) { //Readjust timers since the effect will not last long. sce->val4 = 0; - timer->delete(sce->timer, iStatus->change_timer); - sce->timer = timer->add(tick+sg->limit, iStatus->change_timer, bl->id, type); + timer->delete(sce->timer, status->change_timer); + sce->timer = timer->add(tick+sg->limit, status->change_timer, bl->id, type); } break; @@ -11217,19 +11207,19 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns nullpo_ret(src); nullpo_ret(bl); - if (bl->prev==NULL || !src->alive || iStatus->isdead(bl)) + if (bl->prev==NULL || !src->alive || status->isdead(bl)) return 0; nullpo_ret(sg=src->group); nullpo_ret(ss=iMap->id2bl(sg->src_id)); tsd = BL_CAST(BL_PC, bl); - tsc = iStatus->get_sc(bl); + tsc = status->get_sc(bl); if ( tsc && tsc->data[SC_HOVERING] ) return 0; //Under hovering characters are immune to trap and ground target skills. - tstatus = iStatus->get_status_data(bl); - type = iStatus->skill2sc(sg->skill_id); + tstatus = status->get_status_data(bl); + type = status->skill2sc(sg->skill_id); skill_id = sg->skill_id; if (sg->interval == -1) { @@ -11268,8 +11258,8 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns //Take into account these hit more times than the timer interval can handle. do skill->attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0); - while(--src->val2 && x == bl->x && y == bl->y && - ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !iStatus->isdead(bl)); + while(--src->val2 && x == bl->x && y == bl->y + && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl)); if (src->val2<=0) skill->delunit(src); @@ -11292,12 +11282,12 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns break; if( tstatus->hp >= tstatus->max_hp ) break; - if( iStatus->isimmune(bl) ) + if( status->isimmune(bl) ) heal = 0; clif->skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1); if( tsc && tsc->data[SC_AKAITSUKI] && heal ) heal = ~heal + 1; - iStatus->heal(bl, heal, 0, 0); + status->heal(bl, heal, 0, 0); if( diff >= 500 ) sg->val1--; } @@ -11307,18 +11297,18 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_EVILLAND: //Will heal demon and undead element monsters, but not players. - if ((bl->type == BL_PC) || (!battle->check_undead(tstatus->race, tstatus->def_ele) && tstatus->race!=RC_DEMON)) - { //Damage enemies + if ((bl->type == BL_PC) || (!battle->check_undead(tstatus->race, tstatus->def_ele) && tstatus->race!=RC_DEMON)) { + //Damage enemies if(battle->check_target(&src->bl,bl,BCT_ENEMY)>0) skill->attack(BF_MISC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); } else { int heal = skill->calc_heal(ss,bl,sg->skill_id,sg->skill_lv,true); if (tstatus->hp >= tstatus->max_hp) break; - if (iStatus->isimmune(bl)) + if (status->isimmune(bl)) heal = 0; clif->skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1); - iStatus->heal(bl, heal, 0, 0); + status->heal(bl, heal, 0, 0); } break; @@ -11329,8 +11319,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns break; case UNT_DUMMYSKILL: - switch (sg->skill_id) - { + switch (sg->skill_id) { case SG_SUN_WARM: //SG skills [Komurka] case SG_MOON_WARM: case SG_STAR_WARM: @@ -11339,23 +11328,20 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns const int x = bl->x, y = bl->y; //If target isn't knocked back it should hit every "interval" ms [Playtester] - do - { + do { if( bl->type == BL_PC ) status_zap(bl, 0, 15); // sp damage to players - else // mobs - if( iStatus->charge(ss, 0, 2) ) // costs 2 SP per hit - { + else if( status->charge(ss, 0, 2) ) { // mobs + // costs 2 SP per hit if( !skill->attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0) ) - iStatus->charge(ss, 0, 8); //costs additional 8 SP if miss - } - else - { //should end when out of sp. + status->charge(ss, 0, 8); //costs additional 8 SP if miss + } else { // mobs + //should end when out of sp. sg->limit = DIFF_TICK(tick,sg->tick); break; } - } while( x == bl->x && y == bl->y && - ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !iStatus->isdead(bl) ); + } while( x == bl->x && y == bl->y + && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl) ); } break; /** @@ -11402,7 +11388,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_MANHOLE: if( sg->val2 == 0 && tsc && (sg->unit_id == UNT_ANKLESNARE || bl->id != sg->src_id) ) { int sec = skill->get_time2(sg->skill_id,sg->skill_lv); - if( iStatus->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, 8) ) { + if( status->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, 8) ) { const struct TimerData* td = tsc->data[type]?timer->get(tsc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); @@ -11432,8 +11418,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( bl->id != ss->id ) { if( status_get_mode(bl)&MD_BOSS ) break; - if( iStatus->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id, sg->skill_lv), 8) ) { - + if( status->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id, sg->skill_lv), 8) ) { iMap->moveblock(bl, src->bl.x, src->bl.y, tick); clif->fixpos(bl); @@ -11446,7 +11431,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_VENOMDUST: if(tsc && !tsc->data[type]) - iStatus->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id,sg->skill_lv),0); + status->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id,sg->skill_lv),0); break; @@ -11521,7 +11506,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( tsc->data[SC_AKAITSUKI] && heal ) heal = ~heal + 1; clif->skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1); - iStatus->heal(bl, heal, 0, 0); + status->heal(bl, heal, 0, 0); break; } @@ -11538,15 +11523,14 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns int heal; int i = rnd()%13; // Positive buff count int time = skill->get_time2(sg->skill_id, sg->skill_lv); //Duration - switch (i) - { + switch (i) { case 0: // Heal 1~9999 HP heal = rnd() %9999+1; clif->skill_nodamage(ss,bl,AL_HEAL,heal,1); - iStatus->heal(bl,heal,0,0); + status->heal(bl,heal,0,0); break; case 1: // End all negative status - iStatus->change_clear_buffs(bl,2); + status->change_clear_buffs(bl,2); if (tsd) clif->gospel_info(tsd, 0x15); break; case 2: // Immunity to all status @@ -11686,7 +11670,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns } hp = tstatus->max_hp * hp / 100; sp = tstatus->max_sp * sp / 100; - iStatus->heal(bl, hp, sp, 2); + status->heal(bl, hp, sp, 2); sc_start(bl, type, 100, sg->skill_lv, (sg->interval * 3) + 100); } // Reveal hidden players every 5 seconds. @@ -11775,11 +11759,11 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns break; case UNT_FIRE_EXPANSION_SMOKE_POWDER: - sc_start(bl, iStatus->skill2sc(GN_FIRE_EXPANSION_SMOKE_POWDER), 100, sg->skill_lv, 1000); + sc_start(bl, status->skill2sc(GN_FIRE_EXPANSION_SMOKE_POWDER), 100, sg->skill_lv, 1000); break; case UNT_FIRE_EXPANSION_TEAR_GAS: - sc_start(bl, iStatus->skill2sc(GN_FIRE_EXPANSION_TEAR_GAS), 100, sg->skill_lv, 1000); + sc_start(bl, status->skill2sc(GN_FIRE_EXPANSION_TEAR_GAS), 100, sg->skill_lv, 1000); break; case UNT_HELLS_PLANT: @@ -11791,21 +11775,21 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_CLOUD_KILL: if(tsc && !tsc->data[type]) - iStatus->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id,sg->skill_lv),8); + status->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id,sg->skill_lv),8); skill->attack(skill->get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case UNT_WARMER: if( bl->type == BL_PC && !battle->check_undead(tstatus->race, tstatus->def_ele) && tstatus->race != RC_DEMON ) { int hp = 125 * sg->skill_lv; // Officially is 125 * skill_lv. - struct status_change *ssc = iStatus->get_sc(ss); + struct status_change *ssc = status->get_sc(ss); if( ssc && ssc->data[SC_HEATER_OPTION] ) hp += hp * ssc->data[SC_HEATER_OPTION]->val3 / 100; if( tstatus->hp != tstatus->max_hp ) clif->skill_nodamage(&src->bl, bl, AL_HEAL, hp, 0); if( tsc && tsc->data[SC_AKAITSUKI] && hp ) hp = ~hp + 1; - iStatus->heal(bl, hp, 0, 0); + status->heal(bl, hp, 0, 0); sc_start(bl, SC_WARMER, 100, sg->skill_lv, skill->get_time2(sg->skill_id,sg->skill_lv)); } break; @@ -11819,14 +11803,14 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if (sg->unit_id != UNT_ZEPHYR && !battle->check_undead(tstatus->race, tstatus->def_ele)) { int hp = tstatus->max_hp / 100; //+1% each 5s if ((sg->val3) % 5) { //each 5s - if (tstatus->def_ele == skill->get_ele(sg->skill_id,sg->skill_lv)){ - iStatus->heal(bl, hp, 0, 2); - } else if((sg->unit_id == UNT_FIRE_INSIGNIA && tstatus->def_ele == ELE_EARTH) - ||(sg->unit_id == UNT_WATER_INSIGNIA && tstatus->def_ele == ELE_FIRE) - ||(sg->unit_id == UNT_WIND_INSIGNIA && tstatus->def_ele == ELE_WATER) - ||(sg->unit_id == UNT_EARTH_INSIGNIA && tstatus->def_ele == ELE_WIND) - ){ - iStatus->heal(bl, -hp, 0, 0); + if (tstatus->def_ele == skill->get_ele(sg->skill_id,sg->skill_lv)) { + status->heal(bl, hp, 0, 2); + } else if( (sg->unit_id == UNT_FIRE_INSIGNIA && tstatus->def_ele == ELE_EARTH) + || (sg->unit_id == UNT_WATER_INSIGNIA && tstatus->def_ele == ELE_FIRE) + || (sg->unit_id == UNT_WIND_INSIGNIA && tstatus->def_ele == ELE_WATER) + || (sg->unit_id == UNT_EARTH_INSIGNIA && tstatus->def_ele == ELE_WIND) + ) { + status->heal(bl, -hp, 0, 0); } } sg->val3++; //timer @@ -11904,7 +11888,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_POISON_MIST: skill->attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); - iStatus->change_start(bl, SC_BLIND, rnd() % 100 > sg->skill_lv * 10, sg->skill_lv, sg->skill_id, 0, 0, skill->get_time2(sg->skill_id, sg->skill_lv), 2|8); + status->change_start(bl, SC_BLIND, rnd() % 100 > sg->skill_lv * 10, sg->skill_lv, sg->skill_id, 0, 0, skill->get_time2(sg->skill_id, sg->skill_lv), 2|8); break; } @@ -11925,12 +11909,13 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in nullpo_ret(src); nullpo_ret(bl); nullpo_ret(sg=src->group); - sc = iStatus->get_sc(bl); - type = iStatus->skill2sc(sg->skill_id); + sc = status->get_sc(bl); + type = status->skill2sc(sg->skill_id); sce = (sc && type != -1)?sc->data[type]:NULL; - if( bl->prev==NULL || - (iStatus->isdead(bl) && sg->unit_id != UNT_ANKLESNARE && sg->unit_id != UNT_SPIDERWEB) ) //Need to delete the trap if the source died. + if( bl->prev == NULL + || (status->isdead(bl) && sg->unit_id != UNT_ANKLESNARE && sg->unit_id != UNT_SPIDERWEB) + ) //Need to delete the trap if the source died. return 0; switch(sg->unit_id){ @@ -11969,17 +11954,16 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in /*========================================== * Triggered when a char steps out of a skill group (entirely) [Skotlex] *------------------------------------------*/ -static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned int tick) -{ +static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned int tick) { struct status_change *sc; struct status_change_entry *sce; enum sc_type type; - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (sc && !sc->count) sc = NULL; - type = iStatus->skill2sc(skill_id); + type = status->skill2sc(skill_id); sce = (sc && type != -1)?sc->data[type]:NULL; switch (skill_id) { @@ -12038,11 +12022,11 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i case DC_FORTUNEKISS: case DC_SERVICEFORYOU: if (sce) { - timer->delete(sce->timer, iStatus->change_timer); + timer->delete(sce->timer, status->change_timer); //NOTE: It'd be nice if we could get the skill_lv for a more accurate extra time, but alas... //not possible on our current implementation. sce->val4 = 1; //Store the fact that this is a "reduced" duration effect. - sce->timer = timer->add(tick+skill->get_time2(skill_id,1), iStatus->change_timer, bl->id, type); + sce->timer = timer->add(tick+skill->get_time2(skill_id,1), status->change_timer, bl->id, type); } break; case PF_FOGWALL: @@ -12052,8 +12036,8 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i if (bl->type == BL_PC) //Players get blind ended inmediately, others have it still for 30 secs. [Skotlex] status_change_end(bl, SC_BLIND, INVALID_TIMER); else { - timer->delete(sce->timer, iStatus->change_timer); - sce->timer = timer->add(30000+tick, iStatus->change_timer, bl->id, SC_BLIND); + timer->delete(sce->timer, status->change_timer); + sce->timer = timer->add(30000+tick, status->change_timer, bl->id, SC_BLIND); } } } @@ -12250,13 +12234,13 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16 case PR_BENEDICTIO: for (i = 0; i < c; i++) { if ((tsd = iMap->id2sd(p_sd[i])) != NULL) - iStatus->charge(&tsd->bl, 0, 10); + status->charge(&tsd->bl, 0, 10); } return c; case AB_ADORAMUS: if( c > 0 && (tsd = iMap->id2sd(p_sd[0])) != NULL ) { i = 2 * (*skill_lv); - iStatus->charge(&tsd->bl, 0, i); + status->charge(&tsd->bl, 0, i); } break; case WM_GREAT_ECHO: @@ -12404,22 +12388,51 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; switch( skill_id ) { // Turn off check. - case BS_MAXIMIZE: case NV_TRICKDEAD: case TF_HIDING: case AS_CLOAKING: case CR_AUTOGUARD: - case ML_AUTOGUARD: case CR_DEFENDER: case ML_DEFENDER: case ST_CHASEWALK: case PA_GOSPEL: - case CR_SHRINK: case TK_RUN: case GS_GATLINGFEVER: case TK_READYCOUNTER: case TK_READYDOWN: - case TK_READYSTORM: case TK_READYTURN: case SG_FUSION: case RA_WUGDASH: case KO_YAMIKUMO: - if( sc && sc->data[iStatus->skill2sc(skill_id)] ) + case BS_MAXIMIZE: + case NV_TRICKDEAD: + case TF_HIDING: + case AS_CLOAKING: + case CR_AUTOGUARD: + case ML_AUTOGUARD: + case CR_DEFENDER: + case ML_DEFENDER: + case ST_CHASEWALK: + case PA_GOSPEL: + case CR_SHRINK: + case TK_RUN: + case GS_GATLINGFEVER: + case TK_READYCOUNTER: + case TK_READYDOWN: + case TK_READYSTORM: + case TK_READYTURN: + case SG_FUSION: + case RA_WUGDASH: + case KO_YAMIKUMO: + if( sc && sc->data[status->skill2sc(skill_id)] ) return 1; } // Check the skills that can be used while mounted on a warg if( pc_isridingwug(sd) ) { switch( skill_id ) { - case HT_SKIDTRAP: case HT_LANDMINE: case HT_ANKLESNARE: case HT_SHOCKWAVE: - case HT_SANDMAN: case HT_FLASHER: case HT_FREEZINGTRAP: case HT_BLASTMINE: - case HT_CLAYMORETRAP: case HT_SPRINGTRAP: case RA_DETONATOR: case RA_CLUSTERBOMB: - case HT_TALKIEBOX: case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: - case RA_WUGDASH: case RA_WUGRIDER: case RA_WUGSTRIKE: + case HT_SKIDTRAP: + case HT_LANDMINE: + case HT_ANKLESNARE: + case HT_SHOCKWAVE: + case HT_SANDMAN: + case HT_FLASHER: + case HT_FREEZINGTRAP: + case HT_BLASTMINE: + case HT_CLAYMORETRAP: + case HT_SPRINGTRAP: + case RA_DETONATOR: + case RA_CLUSTERBOMB: + case HT_TALKIEBOX: + case RA_FIRINGTRAP: + case RA_ICEBOUNDTRAP: + case RA_WUGDASH: + case RA_WUGRIDER: + case RA_WUGSTRIKE: break; default: // in official there is no message. return 0; @@ -12428,14 +12441,19 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } if( pc_ismadogear(sd) ) { switch( skill_id ) { //None Mado skills are unusable when Mado is equipped. [Jobbie] - case BS_REPAIRWEAPON: case WS_MELTDOWN: - case BS_HAMMERFALL: case WS_CARTBOOST: - case BS_ADRENALINE: case WS_WEAPONREFINE: - case BS_WEAPONPERFECT: case WS_CARTTERMINATION: - case BS_OVERTHRUST: case WS_OVERTHRUSTMAX: - case BS_MAXIMIZE: - case BS_ADRENALINE2: - case BS_UNFAIRLYTRICK: + case BS_REPAIRWEAPON: + case WS_MELTDOWN: + case BS_HAMMERFALL: + case WS_CARTBOOST: + case BS_ADRENALINE: + case WS_WEAPONREFINE: + case BS_WEAPONPERFECT: + case WS_CARTTERMINATION: + case BS_OVERTHRUST: + case WS_OVERTHRUSTMAX: + case BS_MAXIMIZE: + case BS_ADRENALINE2: + case BS_UNFAIRLYTRICK: case BS_GREED: clif->skill_fail(sd,skill_id,USESKILL_FAIL_MADOGEAR,0); return 0; @@ -13493,12 +13511,11 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 if( !sd ) return req; - /* temporarily disabled, awaiting for kenpachi to detail this so we can make it work properly */ -#if 0 +#if 0 /* temporarily disabled, awaiting for kenpachi to detail this so we can make it work properly */ if( sd->state.abra_flag ) -#else +#else // not 0 if( sd->skillitem == skill_id ) -#endif +#endif // 0 return req; // Hocus-Pocus don't have requirements. sc = &sd->sc; @@ -13506,11 +13523,26 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 sc = NULL; switch( skill_id ) { // Turn off check. - case BS_MAXIMIZE: case NV_TRICKDEAD: case TF_HIDING: case AS_CLOAKING: case CR_AUTOGUARD: - case ML_AUTOGUARD: case CR_DEFENDER: case ML_DEFENDER: case ST_CHASEWALK: case PA_GOSPEL: - case CR_SHRINK: case TK_RUN: case GS_GATLINGFEVER: case TK_READYCOUNTER: case TK_READYDOWN: - case TK_READYSTORM: case TK_READYTURN: case SG_FUSION: case KO_YAMIKUMO: - if( sc && sc->data[iStatus->skill2sc(skill_id)] ) + case BS_MAXIMIZE: + case NV_TRICKDEAD: + case TF_HIDING: + case AS_CLOAKING: + case CR_AUTOGUARD: + case ML_AUTOGUARD: + case CR_DEFENDER: + case ML_DEFENDER: + case ST_CHASEWALK: + case PA_GOSPEL: + case CR_SHRINK: + case TK_RUN: + case GS_GATLINGFEVER: + case TK_READYCOUNTER: + case TK_READYDOWN: + case TK_READYSTORM: + case TK_READYTURN: + case SG_FUSION: + case KO_YAMIKUMO: + if( sc && sc->data[status->skill2sc(skill_id)] ) return req; } @@ -13806,9 +13838,8 @@ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { /*========================================== * Does cast-time reductions based on sc data. *------------------------------------------*/ -int skill_castfix_sc (struct block_list *bl, int time) -{ - struct status_change *sc = iStatus->get_sc(bl); +int skill_castfix_sc (struct block_list *bl, int time) { + struct status_change *sc = status->get_sc(bl); if( time < 0 ) return 0; @@ -13819,8 +13850,8 @@ int skill_castfix_sc (struct block_list *bl, int time) if (sc && sc->count) { if (sc->data[SC_SLOWCAST]) time += time * sc->data[SC_SLOWCAST]->val2 / 100; - if (sc->data[SC_NEEDLE_OF_PARALYZE]) - time += sc->data[SC_NEEDLE_OF_PARALYZE]->val3; + if (sc->data[SC_NEEDLE_OF_PARALYZE]) + time += sc->data[SC_NEEDLE_OF_PARALYZE]->val3; if (sc->data[SC_SUFFRAGIUM]) { time -= time * sc->data[SC_SUFFRAGIUM]->val2 / 100; status_change_end(bl, SC_SUFFRAGIUM, INVALID_TIMER); @@ -13835,15 +13866,14 @@ int skill_castfix_sc (struct block_list *bl, int time) if (sc->data[SC_IZAYOI]) time -= time * 50 / 100; } - time = max(time, 0); + time = max(time, 0); -// ShowInfo("Castime castfix_sc = %d\n",time); + //ShowInfo("Castime castfix_sc = %d\n",time); return time; } #ifdef RENEWAL_CAST -int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv) -{ - struct status_change *sc = iStatus->get_sc(bl); +int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv) { + struct status_change *sc = status->get_sc(bl); struct map_session_data *sd = BL_CAST(BL_PC,bl); int fixed = skill->get_fixed_cast(skill_id, skill_lv), fixcast_r = 0, varcast_r = 0, i = 0; @@ -13935,7 +13965,7 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 if( sc->data[SC_SECRAMENT] ) fixcast_r = max(fixcast_r, sc->data[SC_SECRAMENT]->val2); if( sd && ( skill_lv = pc->checkskill(sd, WL_RADIUS) ) && (skill_id >= WL_WHITEIMPRISON && skill_id < WL_FREEZE_SP) ) - fixcast_r = max(fixcast_r, (status_get_int(bl) + iStatus->get_lv(bl)) / 15 + skill_lv * 5); // [{(Caster?s INT / 15) + (Caster?s Base Level / 15) + (Radius Skill Level x 5)}] % + fixcast_r = max(fixcast_r, (status_get_int(bl) + status->get_lv(bl)) / 15 + skill_lv * 5); // [{(Caster?s INT / 15) + (Caster?s Base Level / 15) + (Radius Skill Level x 5)}] % // Fixed cast non percentage bonuses if( sc->data[SC_MANDRAGORA] ) fixed += sc->data[SC_MANDRAGORA]->val1 * 1000 / 2; @@ -13964,12 +13994,11 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 /*========================================== * Does delay reductions based on dex/agi, sc data, item bonuses, ... *------------------------------------------*/ -int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) -{ +int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { int delaynodex = skill->get_delaynodex(skill_id, skill_lv); int time = skill->get_delay(skill_id, skill_lv); struct map_session_data *sd; - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); nullpo_ret(bl); sd = BL_CAST(BL_PC, bl); @@ -14322,7 +14351,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) return; } - per = iStatus->get_refine_chance(ditem->wlv, (int)item->refine) * 10; + per = status->get_refine_chance(ditem->wlv, (int)item->refine) * 10; // Aegis leaked formula. [malufett] if( sd->status.class_ == JOB_MECHANIC_T ) @@ -14452,8 +14481,8 @@ int skill_sit_in (struct block_list *bl, va_list ap) { if(type&2 && (pc->checkskill(sd,TK_HPTIME) > 0 || pc->checkskill(sd,TK_SPTIME) > 0 )) { sd->state.rest=1; - iStatus->calc_regen(bl, &sd->battle_status, &sd->regen); - iStatus->calc_regen_rate(bl, &sd->regen, &sd->sc); + status->calc_regen(bl, &sd->battle_status, &sd->regen); + status->calc_regen_rate(bl, &sd->regen, &sd->sc); } return 0; @@ -14467,8 +14496,8 @@ int skill_sit_out (struct block_list *bl, va_list ap) { sd->state.gangsterparadise=0; if(sd->state.rest && type&2) { sd->state.rest=0; - iStatus->calc_regen(bl, &sd->battle_status, &sd->regen); - iStatus->calc_regen_rate(bl, &sd->regen, &sd->sc); + status->calc_regen(bl, &sd->battle_status, &sd->regen); + status->calc_regen_rate(bl, &sd->regen, &sd->sc); } return 0; } @@ -14527,7 +14556,7 @@ int skill_frostjoke_scream (struct block_list *bl, va_list ap) { if(!skill_lv) return 0; tick=va_arg(ap,unsigned int); - if (src == bl || iStatus->isdead(bl)) + if (src == bl || status->isdead(bl)) return 0; if (bl->type == BL_PC) { struct map_session_data *sd = (struct map_session_data *)bl; @@ -14558,13 +14587,12 @@ void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill /*========================================== * *------------------------------------------*/ -int skill_attack_area (struct block_list *bl, va_list ap) -{ +int skill_attack_area (struct block_list *bl, va_list ap) { struct block_list *src,*dsrc; int atk_type,skill_id,skill_lv,flag,type; unsigned int tick; - if(iStatus->isdead(bl)) + if(status->isdead(bl)) return 0; atk_type = va_arg(ap,int); @@ -14580,8 +14608,8 @@ int skill_attack_area (struct block_list *bl, va_list ap) if (skill_area_temp[1] == bl->id) //This is the target of the skill, do a full attack and skip target checks. return skill->attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag); - if(battle->check_target(dsrc,bl,type) <= 0 || - !iStatus->check_skilluse(NULL, bl, skill_id, 2)) + if( battle->check_target(dsrc,bl,type) <= 0 + || !status->check_skilluse(NULL, bl, skill_id, 2)) return 0; @@ -14984,7 +15012,7 @@ int skill_maelstrom_suction(struct block_list *bl, va_list ap) { int sp = su->group->skill_lv * skill_lv; if( src->type == BL_PC ) sp += ((TBL_PC*)src)->status.job_level / 5; - iStatus->heal(src, 0, sp/2, 1); + status->heal(src, 0, sp/2, 1); } } @@ -14994,13 +15022,12 @@ int skill_maelstrom_suction(struct block_list *bl, va_list ap) { /*========================================== * *------------------------------------------*/ -int skill_enchant_elemental_end (struct block_list *bl, int type) -{ +int skill_enchant_elemental_end (struct block_list *bl, int type) { struct status_change *sc; const enum sc_type scs[] = { SC_ENCHANTPOISON, SC_ASPERSIO, SC_PROPERTYFIRE, SC_PROPERTYWATER, SC_PROPERTYWIND, SC_PROPERTYGROUND, SC_PROPERTYDARK, SC_PROPERTYTELEKINESIS, SC_ENCHANTARMS, SC_EXEEDBREAK }; int i; nullpo_ret(bl); - nullpo_ret(sc= iStatus->get_sc(bl)); + nullpo_ret(sc = status->get_sc(bl)); if (!sc->count) return 0; @@ -15180,7 +15207,7 @@ int skill_delunit (struct skill_unit* su) { break; case SC_MANHOLE: // Note : Removing the unit don't remove the status (official info) if( group->val2 ) { // Someone Traped - struct status_change *tsc = iStatus->get_sc( iMap->id2bl(group->val2)); + struct status_change *tsc = status->get_sc( iMap->id2bl(group->val2)); if( tsc && tsc->data[SC__MANHOLE] ) tsc->data[SC__MANHOLE]->val4 = 0; // Remove the Unit ID } @@ -15260,26 +15287,26 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, i = MAX_SKILLUNITGROUP-1; } - group = ers_alloc(skill->unit_ers, struct skill_unit_group); - group->src_id = src->id; - group->party_id = iStatus->get_party_id(src); - group->guild_id = iStatus->get_guild_id(src); - group->bg_id = bg->team_get_id(src); - group->group_id = skill_get_new_group_id(); - group->unit = (struct skill_unit *)aCalloc(count,sizeof(struct skill_unit)); - group->unit_count = count; + group = ers_alloc(skill->unit_ers, struct skill_unit_group); + group->src_id = src->id; + group->party_id = status->get_party_id(src); + group->guild_id = status->get_guild_id(src); + group->bg_id = bg->team_get_id(src); + group->group_id = skill_get_new_group_id(); + group->unit = (struct skill_unit *)aCalloc(count,sizeof(struct skill_unit)); + group->unit_count = count; group->alive_count = 0; - group->val1 = 0; - group->val2 = 0; - group->val3 = 0; - group->skill_id = skill_id; - group->skill_lv = skill_lv; - group->unit_id = unit_id; - group->map = src->m; - group->limit = limit; - group->interval = interval; - group->tick = timer->gettick(); - group->valstr = NULL; + group->val1 = 0; + group->val2 = 0; + group->val3 = 0; + group->skill_id = skill_id; + group->skill_lv = skill_lv; + group->unit_id = unit_id; + group->map = src->m; + group->limit = limit; + group->interval = interval; + group->tick = timer->gettick(); + group->valstr = NULL; ud->skillunit[i] = group; @@ -15312,7 +15339,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin return 0; } - if( !iStatus->isdead(src) && ((TBL_PC*)src)->state.warping && !((TBL_PC*)src)->state.changemap ) { + if( !status->isdead(src) && ((TBL_PC*)src)->state.warping && !((TBL_PC*)src)->state.changemap ) { switch( group->skill_id ) { case BA_DISSONANCE: case BA_POEMBRAGI: @@ -15329,9 +15356,8 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin } } - if (skill->get_unit_flag(group->skill_id)&(UF_DANCE|UF_SONG|UF_ENSEMBLE)) - { - struct status_change* sc = iStatus->get_sc(src); + if (skill->get_unit_flag(group->skill_id)&(UF_DANCE|UF_SONG|UF_ENSEMBLE)) { + struct status_change* sc = status->get_sc(src); if (sc && sc->data[SC_DANCING]) { sc->data[SC_DANCING]->val2 = 0 ; //This prevents status_change_end attempting to redelete the group. [Skotlex] @@ -15342,7 +15368,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin // end Gospel's status change on 'src' // (needs to be done when the group is deleted by other means than skill deactivation) if (group->unit_id == UNT_GOSPEL) { - struct status_change *sc = iStatus->get_sc(src); + struct status_change *sc = status->get_sc(src); if(sc && sc->data[SC_GOSPEL]) { sc->data[SC_GOSPEL]->val3 = 0; //Remove reference to this group. [Skotlex] status_change_end(src, SC_GOSPEL, INVALID_TIMER); @@ -15353,40 +15379,40 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin case SG_SUN_WARM: case SG_MOON_WARM: case SG_STAR_WARM: - { - struct status_change *sc = NULL; - if( (sc = iStatus->get_sc(src)) != NULL && sc->data[SC_WARM] ) { - sc->data[SC_WARM]->val4 = 0; - status_change_end(src, SC_WARM, INVALID_TIMER); - } + { + struct status_change *sc = NULL; + if( (sc = status->get_sc(src)) != NULL && sc->data[SC_WARM] ) { + sc->data[SC_WARM]->val4 = 0; + status_change_end(src, SC_WARM, INVALID_TIMER); } + } break; case NC_NEUTRALBARRIER: - { - struct status_change *sc = NULL; - if( (sc = iStatus->get_sc(src)) != NULL && sc->data[SC_NEUTRALBARRIER_MASTER] ) { - sc->data[SC_NEUTRALBARRIER_MASTER]->val2 = 0; - status_change_end(src,SC_NEUTRALBARRIER_MASTER,INVALID_TIMER); - } + { + struct status_change *sc = NULL; + if( (sc = status->get_sc(src)) != NULL && sc->data[SC_NEUTRALBARRIER_MASTER] ) { + sc->data[SC_NEUTRALBARRIER_MASTER]->val2 = 0; + status_change_end(src,SC_NEUTRALBARRIER_MASTER,INVALID_TIMER); } + } break; case NC_STEALTHFIELD: - { - struct status_change *sc = NULL; - if( (sc = iStatus->get_sc(src)) != NULL && sc->data[SC_STEALTHFIELD_MASTER] ) { - sc->data[SC_STEALTHFIELD_MASTER]->val2 = 0; - status_change_end(src,SC_STEALTHFIELD_MASTER,INVALID_TIMER); - } + { + struct status_change *sc = NULL; + if( (sc = status->get_sc(src)) != NULL && sc->data[SC_STEALTHFIELD_MASTER] ) { + sc->data[SC_STEALTHFIELD_MASTER]->val2 = 0; + status_change_end(src,SC_STEALTHFIELD_MASTER,INVALID_TIMER); } + } break; case LG_BANDING: - { - struct status_change *sc = NULL; - if( (sc = iStatus->get_sc(src)) && sc->data[SC_BANDING] ) { - sc->data[SC_BANDING]->val4 = 0; - status_change_end(src,SC_BANDING,INVALID_TIMER); - } + { + struct status_change *sc = NULL; + if( (sc = status->get_sc(src)) && sc->data[SC_BANDING] ) { + sc->data[SC_BANDING]->val4 = 0; + status_change_end(src,SC_BANDING,INVALID_TIMER); } + } break; } @@ -15631,7 +15657,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { { struct block_list *src = iMap->id2bl(group->src_id); struct status_change *sc; - if( !src || (sc = iStatus->get_sc(src)) == NULL || !sc->data[SC_BANDING] ) { + if( !src || (sc = status->get_sc(src)) == NULL || !sc->data[SC_BANDING] ) { skill->delunit(su); break; } @@ -16018,7 +16044,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, struct item_data* data; nullpo_ret(sd); - st = iStatus->get_status_data(&sd->bl); + st = status->get_status_data(&sd->bl); if( sd->skill_id_old == skill_id ) skill_lv = sd->skill_lv_old; @@ -16663,7 +16689,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) { } void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) { - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); // non-offensive and non-magic skills do not affect the status if (skill->get_nk(skill_id)&NK_NO_DAMAGE || !(skill->get_type(skill_id)&BF_MAGIC)) @@ -16674,7 +16700,7 @@ void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) { status_change_end(bl, SC_MAGICPOWER, INVALID_TIMER); } else { sc->data[SC_MAGICPOWER]->val4 = 1; - status_calc_bl(bl, iStatus->sc2scb_flag(SC_MAGICPOWER)); + status_calc_bl(bl, status->sc2scb_flag(SC_MAGICPOWER)); #ifndef RENEWAL if(bl->type == BL_PC){// update current display. clif->updatestatus(((TBL_PC *)bl),SP_MATK1); @@ -16729,7 +16755,7 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { nullpo_ret(sd); - sc = iStatus->get_sc(&sd->bl); + sc = status->get_sc(&sd->bl); status_change_end(&sd->bl, SC_STOP, INVALID_TIMER); for(i=SC_SPELLBOOK1; i <= SC_SPELLBOOK7; i++) if( sc && !sc->data[i] ) break; @@ -17466,7 +17492,7 @@ void skill_init_unit_layout (void) { int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) { int inf = 0; - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); if( !sc || !bl || !skill_id ) return 0; // Can do it diff --git a/src/map/status.c b/src/map/status.c index 46f732e81..501448cc7 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1086,45 +1086,44 @@ static inline void status_cpy(struct status_data* a, const struct status_data* b memcpy((void*)&a->max_hp, (const void*)&b->max_hp, sizeof(struct status_data)-(sizeof(a->hp)+sizeof(a->sp))); } -//Sets HP to given value. Flag is the flag passed to iStatus->heal in case +//Sets HP to given value. Flag is the flag passed to status->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 *st; if (hp < 1) return 0; - st = iStatus->get_status_data(bl); + st = status->get_status_data(bl); if (st == &dummy_status) return 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->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 +//Sets SP to given value. Flag is the flag passed to status->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 *st; - st = iStatus->get_status_data(bl); + st = status->get_status_data(bl); if (st == &dummy_status) return 0; 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->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) -{ +int status_charge(struct block_list* bl, int64 hp, int64 sp) { if(!(bl->type&BL_CONSUME)) return (int)(hp+sp); //Assume all was charged so there are no 'not enough' fails. - return iStatus->damage(NULL, bl, hp, sp, 0, 3); + return status->damage(NULL, bl, hp, sp, 0, 3); } //Inflicts damage on the target with the according walkdelay. @@ -1145,19 +1144,19 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, sp = 0; //Not a valid SP target. if (hp < 0) { //Assume absorbed damage. - iStatus->heal(target, -hp, 0, 1); + status->heal(target, -hp, 0, 1); hp = 0; } if (sp < 0) { - iStatus->heal(target, 0, -sp, 1); + status->heal(target, 0, -sp, 1); sp = 0; } if (target->type == BL_SKILL) return skill->unit_ondamaged((struct skill_unit *)target, src, hp, timer->gettick()); - st = iStatus->get_status_data(target); + st = status->get_status_data(target); if( st == &dummy_status ) return 0; @@ -1182,7 +1181,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, // if (!target->prev && !(flag&2)) // return 0; //Cannot damage a bl not on a map, except when "charging" hp/sp - sc = iStatus->get_sc(target); + sc = status->get_sc(target); if( hp && battle_config.invincible_nodamage && src && sc && sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] ) hp = 1; @@ -1287,9 +1286,9 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, battle_config.clear_unit_ondeath&target->type) skill->clear_unitgroup(target); - if(target->type&BL_REGEN) - { //Reset regen ticks. - struct regen_data *regen = iStatus->get_regen_data(target); + if(target->type&BL_REGEN) { + //Reset regen ticks. + struct regen_data *regen = status->get_regen_data(target); if (regen) { memset(®en->tick, 0, sizeof(regen->tick)); if (regen->sregen) @@ -1299,42 +1298,43 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, } } - if( sc && sc->data[SC_KAIZEL] && !map_flag_gvg2(target->m) ) - { //flag&8 = disable Kaizel + if( sc && sc->data[SC_KAIZEL] && !map_flag_gvg2(target->m) ) { + //flag&8 = disable Kaizel int time = skill->get_time2(SL_KAIZEL,sc->data[SC_KAIZEL]->val1); //Look for Osiris Card's bonus effect on the character and revive 100% or revive normally if ( target->type == BL_PC && BL_CAST(BL_PC,target)->special_state.restart_full_recover ) - iStatus->revive(target, 100, 100); + status->revive(target, 100, 100); else - iStatus->revive(target, sc->data[SC_KAIZEL]->val2, 0); - iStatus->change_clear(target,0); + status->revive(target, sc->data[SC_KAIZEL]->val2, 0); + status->change_clear(target,0); clif->skill_nodamage(target,target,ALL_RESURRECTION,1,1); - sc_start(target,iStatus->skill2sc(PR_KYRIE),100,10,time); + sc_start(target,status->skill2sc(PR_KYRIE),100,10,time); if( target->type == BL_MOB ) ((TBL_MOB*)target)->state.rebirth = 1; return (int)(hp+sp); } - if(target->type == BL_PC){ + if(target->type == BL_PC) { TBL_PC *sd = BL_CAST(BL_PC,target); TBL_HOM *hd = sd->hd; if(hd && hd->sc.data[SC_LIGHT_OF_REGENE]){ clif->skillcasting(&hd->bl, hd->bl.id, target->id, 0,0, MH_LIGHT_OF_REGENE, skill->get_ele(MH_LIGHT_OF_REGENE, 1), 10); //just to display usage - clif->skill_nodamage(&sd->bl, target, ALL_RESURRECTION, 1, iStatus->revive(&sd->bl,10*hd->sc.data[SC_LIGHT_OF_REGENE]->val1,0)); + clif->skill_nodamage(&sd->bl, target, ALL_RESURRECTION, 1, status->revive(&sd->bl,10*hd->sc.data[SC_LIGHT_OF_REGENE]->val1,0)); status_change_end(&sd->hd->bl,SC_LIGHT_OF_REGENE,INVALID_TIMER); return (int)(hp + sp); } } - if (target->type == BL_MOB && sc && sc->data[SC_REBIRTH] && !((TBL_MOB*) target)->state.rebirth) {// Ensure the monster has not already rebirthed before doing so. - iStatus->revive(target, sc->data[SC_REBIRTH]->val2, 0); - iStatus->change_clear(target,0); + if (target->type == BL_MOB && sc && sc->data[SC_REBIRTH] && !((TBL_MOB*) target)->state.rebirth) { + // Ensure the monster has not already rebirthed before doing so. + status->revive(target, sc->data[SC_REBIRTH]->val2, 0); + status->change_clear(target,0); ((TBL_MOB*)target)->state.rebirth = 1; return (int)(hp+sp); } - iStatus->change_clear(target,0); + status->change_clear(target,0); if(flag&4) //Delete from memory. (also invokes map removal code) unit->free(target,CLR_DEAD); @@ -1359,7 +1359,7 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) { struct status_change *sc; int hp,sp; - st = iStatus->get_status_data(bl); + st = status->get_status_data(bl); if (st == &dummy_status || !st->hp) return 0; @@ -1368,13 +1368,13 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) { hp = (int)cap_value(in_hp,INT_MIN,INT_MAX); sp = (int)cap_value(in_sp,INT_MIN,INT_MAX); - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (sc && !sc->count) sc = NULL; if (hp < 0) { if (hp == INT_MIN) hp++; //-INT_MIN == INT_MIN in some architectures! - iStatus->damage(NULL, bl, -hp, 0, 0, 1); + status->damage(NULL, bl, -hp, 0, 0, 1); hp = 0; } @@ -1392,7 +1392,7 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) { if(sp < 0) { if (sp==INT_MIN) sp++; - iStatus->damage(NULL, bl, 0, -sp, 0, 1); + status->damage(NULL, bl, 0, -sp, 0, 1); sp = 0; } @@ -1436,7 +1436,7 @@ int status_percent_change(struct block_list *src,struct block_list *target,signe struct status_data *st; unsigned int hp = 0, sp = 0; - st = iStatus->get_status_data(target); + st = status->get_status_data(target); //It's safe now [MarkZD] @@ -1470,32 +1470,32 @@ int status_percent_change(struct block_list *src,struct block_list *target,signe sp = 1; //Ugly check in case damage dealt is too much for the received args of - //iStatus->heal / iStatus->damage. [Skotlex] + //status->heal / status->damage. [Skotlex] if (hp > INT_MAX) { hp -= INT_MAX; if (flag) - iStatus->damage(src, target, INT_MAX, 0, 0, (!src||src==target?5:1)); + status->damage(src, target, INT_MAX, 0, 0, (!src||src==target?5:1)); else - iStatus->heal(target, INT_MAX, 0, 0); + status->heal(target, INT_MAX, 0, 0); } if (sp > INT_MAX) { sp -= INT_MAX; if (flag) - iStatus->damage(src, target, 0, INT_MAX, 0, (!src||src==target?5:1)); + status->damage(src, target, 0, INT_MAX, 0, (!src||src==target?5:1)); else - iStatus->heal(target, 0, INT_MAX, 0); + status->heal(target, 0, INT_MAX, 0); } if (flag) - return iStatus->damage(src, target, hp, sp, 0, (!src||src==target?5:1)); - return iStatus->heal(target, hp, sp, 0); + return status->damage(src, target, hp, sp, 0, (!src||src==target?5:1)); + return status->heal(target, hp, sp, 0); } 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; + if (!status->isdead(bl)) return 0; - st = iStatus->get_status_data(bl); + st = status->get_status_data(bl); if (st == &dummy_status) return 0; //Invalid target. @@ -1543,9 +1543,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin struct status_change *sc=NULL, *tsc; int hide_flag; - st = src ? iStatus->get_status_data(src) : &dummy_status; + st = src ? status->get_status_data(src) : &dummy_status; - if (src && src->type != BL_PC && iStatus->isdead(src)) + if (src && src->type != BL_PC && status->isdead(src)) return 0; if (!skill_id) { //Normal attack checks. @@ -1553,9 +1553,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin 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] - if (target && iStatus->isdead(target)) + if (target && status->isdead(target)) return 0; - if( src && (sc = iStatus->get_sc(src)) && sc->data[SC_COLD] && src->type != BL_MOB) + if( src && (sc = status->get_sc(src)) && sc->data[SC_COLD] && src->type != BL_MOB) return 0; } @@ -1581,13 +1581,13 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin case PA_PRESSURE: if( flag && target ) { //Gloria Avoids pretty much everything.... - tsc = iStatus->get_sc(target); + tsc = status->get_sc(target); if(tsc && tsc->option&OPTION_HIDE) return 0; } break; case GN_WALLOFTHORN: - if( target && iStatus->isdead(target) ) + if( target && status->isdead(target) ) return 0; break; case AL_TELEPORT: @@ -1602,7 +1602,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin } } - if ( src ) sc = iStatus->get_sc(src); + if ( src ) sc = status->get_sc(src); if( sc && sc->count ) { @@ -1695,7 +1695,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin ) return 0; - if( sc->data[SC__MANHOLE] || ((tsc = iStatus->get_sc(target)) && tsc->data[SC__MANHOLE]) ) { + if( sc->data[SC__MANHOLE] || ((tsc = status->get_sc(target)) && tsc->data[SC__MANHOLE]) ) { switch(skill_id) {//##TODO## make this a flag in skill_db? // Skills that can be used even under Man Hole effects. case SC_SHADOWFORM: @@ -1735,7 +1735,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin if (target == NULL || target == src) //No further checking needed. return 1; - tsc = iStatus->get_sc(target); + tsc = status->get_sc(target); if(tsc && tsc->count) { /* attacks in invincible are capped to 1 damage and handled in batte.c; allow spell break and eske for sealed shrine GDB when in INVINCIBLE state. */ @@ -1812,8 +1812,8 @@ 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 view_range; - struct status_data *st = iStatus->get_status_data(src); - struct status_change *tsc = iStatus->get_sc(target); + struct status_data *st = status->get_status_data(src); + struct status_change *tsc = status->get_sc(target); switch (src->type) { case BL_MOB: view_range = ((TBL_MOB*)src)->min_chase; @@ -1957,19 +1957,19 @@ void status_calc_misc(struct block_list *bl, struct status_data *st, int level) st->cri = st->flee2 = 0; #ifdef RENEWAL // renewal formulas - st->matk_min = st->matk_max = bl->type == BL_PC ? iStatus->base_matk(st, level) : level + st->int_; + st->matk_min = st->matk_max = bl->type == BL_PC ? status->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 +#else // not RENEWAL 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 +#endif // RENEWAL if( bl->type&battle_config.enable_critical ) st->cri += 10 + (st->luk*10/3); //(every 1 luk = +0.3 critical) @@ -2011,7 +2011,7 @@ void status_calc_misc(struct block_list *bl, struct status_data *st, int level) st->cri = 10; } if(bl->type&BL_REGEN) - iStatus->calc_regen(bl, st, iStatus->get_regen_data(bl)); + status->calc_regen(bl, st, status->get_regen_data(bl)); } //Skotlex: Calculates the initial status for the given mob @@ -2067,7 +2067,7 @@ int status_calc_mob_(struct mob_data* md, bool first) { mbl = iMap->id2bl(md->master_id); if (flag&8 && mbl) { - struct status_data *mstatus = iStatus->get_base_status(mbl); + struct status_data *mstatus = status->get_base_status(mbl); if (mstatus && battle_config.slaves_inherit_speed&(mstatus->mode&MD_CANMOVE?1:2)) mstatus->speed = mstatus->speed; @@ -2088,7 +2088,7 @@ int status_calc_mob_(struct mob_data* md, bool first) { } 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 - mstatus->max_hp = 1500 + 200*ud->skill_lv + 10*iStatus->get_lv(mbl); + mstatus->max_hp = 1500 + 200*ud->skill_lv + 10*status->get_lv(mbl); mstatus->mode|= MD_CANATTACK|MD_AGGRESSIVE; } mstatus->hp = mstatus->max_hp; @@ -2147,7 +2147,7 @@ int status_calc_mob_(struct mob_data* md, bool first) { } } - iStatus->calc_misc(&md->bl, mstatus, md->level); + status->calc_misc(&md->bl, mstatus, md->level); if(flag&4) { // Strengthen Guardians - custom value +10% / lv @@ -2229,13 +2229,13 @@ int status_calc_pet_(struct pet_data *pd, bool first) 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); + status->calc_misc(&pd->bl, &pd->status, lv); if (!first) //Not done the first time because the pet is not visible yet clif->send_petstatus(sd); } } else if (first) { - iStatus->calc_misc(&pd->bl, &pd->status, pd->db->lv); + status->calc_misc(&pd->bl, &pd->status, pd->db->lv); if (!battle_config.pet_lv_rate && pd->pet.level != pd->db->lv) pd->pet.level = pd->db->lv; } @@ -2466,7 +2466,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) { // Parse equipment. for(i=0;i<EQI_MAX-1;i++) { - iStatus->current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to iStatus->current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus] + status->current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to status->current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus] if(index < 0) continue; if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index) @@ -2601,7 +2601,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) { //Parse Cards for(i=0;i<EQI_MAX-1;i++) { - iStatus->current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to iStatus->current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus] + status->current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to status->current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus] if(index < 0) continue; if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index) @@ -2618,8 +2618,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first) { //Card script execution. if(itemdb_isspecial(sd->status.inventory[index].card[0])) continue; - for(j=0;j<MAX_SLOTS;j++){ // Uses MAX_SLOTS to support Soul Bound system [Inkfish] - iStatus->current_equip_card_id= c= sd->status.inventory[index].card[j]; + for(j=0;j<MAX_SLOTS;j++) { + // Uses MAX_SLOTS to support Soul Bound system [Inkfish] + status->current_equip_card_id= c= sd->status.inventory[index].card[j]; if(!c) continue; data = itemdb->exists(c); @@ -2749,7 +2750,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) { // ------ BASE ATTACK CALCULATION ------ - // Base batk value is set on iStatus->calc_misc + // Base batk value is set on status->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]) bstatus->batk += sd->weapon_atk[sd->status.weapon]; @@ -2842,7 +2843,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) { } // ----- MISC CALCULATION ----- - iStatus->calc_misc(&sd->bl, bstatus, sd->status.base_level); + status->calc_misc(&sd->bl, bstatus, sd->status.base_level); //Equipment modifiers for misc settings if(sd->matk_rate < 0) @@ -3156,7 +3157,7 @@ int status_calc_mercenary_(struct mercenary_data *md, bool first) { md->battle_status.sp = merc->sp; } - iStatus->calc_misc(&md->bl, mstatus, md->db->lv); + status->calc_misc(&md->bl, mstatus, md->db->lv); status_cpy(&md->battle_status, mstatus); return 0; @@ -3185,7 +3186,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first) { hstatus->mode = MD_CANMOVE|MD_CANATTACK; hstatus->speed = DEFAULT_WALK_SPEED; if (battle_config.hom_setting&0x8 && hd->master) - hstatus->speed = iStatus->get_speed(&hd->master->bl); + hstatus->speed = status->get_speed(&hd->master->bl); hstatus->hp = 1; hstatus->sp = 1; @@ -3229,7 +3230,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first) { 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, hstatus, hom->level); + status->calc_misc(&hd->bl, hstatus, hom->level); #ifdef RENEWAL hstatus->matk_max = hstatus->matk_min; @@ -3254,7 +3255,7 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) { else estatus->mode = ele->mode; - iStatus->calc_misc(&ed->bl, estatus, 0); + status->calc_misc(&ed->bl, estatus, 0); estatus->max_hp = ele->max_hp; estatus->max_sp = ele->max_sp; @@ -3271,7 +3272,7 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) { memcpy(&ed->battle_status,estatus,sizeof(struct status_data)); } else { - iStatus->calc_misc(&ed->bl, estatus, 0); + status->calc_misc(&ed->bl, estatus, 0); status_cpy(&ed->battle_status, estatus); } @@ -3306,7 +3307,7 @@ int status_calc_npc_(struct npc_data *nd, bool first) { nstatus->dex = nd->stat_point; nstatus->luk = nd->stat_point; - iStatus->calc_misc(&nd->bl, nstatus, nd->level); + status->calc_misc(&nd->bl, nstatus, nd->level); status_cpy(&nd->status, nstatus); return 0; @@ -3527,9 +3528,9 @@ 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 *bst = iStatus->get_base_status(bl); - struct status_data *st = iStatus->get_status_data(bl); - struct status_change *sc = iStatus->get_sc(bl); + const struct status_data *bst = status->get_base_status(bl); + struct status_data *st = status->get_status_data(bl); + struct status_change *sc = status->get_sc(bl); TBL_PC *sd = BL_CAST(BL_PC,bl); int temp; @@ -3606,7 +3607,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { temp += st->batk; st->batk = cap_value(temp, 0, USHRT_MAX); } - st->batk = iStatus->calc_batk(bl, sc, st->batk, true); + st->batk = status->calc_batk(bl, sc, st->batk, true); } if(flag&SCB_WATK) { @@ -3664,7 +3665,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { } if(flag&SCB_DEF) { - st->def = iStatus->calc_def(bl, sc, bst->def, true); + st->def = status->calc_def(bl, sc, bst->def, true); if( bl->type&BL_HOM ) st->def += (st->vit/5 - bst->vit/5); @@ -3676,9 +3677,9 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { && st->agi == bst->agi #endif ) - st->def2 = iStatus->calc_def2(bl, sc, bst->def2, true); + st->def2 = status->calc_def2(bl, sc, bst->def2, true); else - st->def2 = iStatus->calc_def2(bl, sc, bst->def2 + st->def2 = status->calc_def2(bl, sc, bst->def2 #ifdef RENEWAL + (int)( ((float)st->vit/2 - (float)bst->vit/2) + ((float)st->agi/5 - (float)bst->agi/5) ) #else @@ -3688,7 +3689,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { } if(flag&SCB_MDEF) { - st->mdef = iStatus->calc_mdef(bl, sc, bst->mdef, true); + st->mdef = status->calc_mdef(bl, sc, bst->mdef, true); if( bl->type&BL_HOM ) st->mdef += (st->int_/5 - bst->int_/5); @@ -3700,9 +3701,9 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { && st->dex == bst->dex #endif ) - st->mdef2 = iStatus->calc_mdef2(bl, sc, bst->mdef2, true); + st->mdef2 = status->calc_mdef2(bl, sc, bst->mdef2, true); else - st->mdef2 = iStatus->calc_mdef2(bl, sc, bst->mdef2 +(st->int_ - bst->int_) + st->mdef2 = status->calc_mdef2(bl, sc, bst->mdef2 +(st->int_ - bst->int_) #ifdef RENEWAL + (int)( ((float)st->dex/5 - (float)bst->dex/5) + ((float)st->vit/5 - (float)bst->vit/5) ) #else @@ -3725,7 +3726,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { st->speed = battle_config.max_walk_speed; if( bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((TBL_HOM*)bl)->master) - st->speed = iStatus->get_speed(&((TBL_HOM*)bl)->master->bl); + st->speed = status->get_speed(&((TBL_HOM*)bl)->master->bl); } @@ -3751,9 +3752,9 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { } if(flag&SCB_ATK_ELE) { - st->rhw.ele = iStatus->calc_attack_element(bl, sc, bst->rhw.ele); + st->rhw.ele = status->calc_attack_element(bl, sc, bst->rhw.ele); if (sd) sd->state.lr_flag = 1; - st->lhw.ele = iStatus->calc_attack_element(bl, sc, bst->lhw.ele); + st->lhw.ele = status->calc_attack_element(bl, sc, bst->lhw.ele); if (sd) sd->state.lr_flag = 0; } @@ -3815,8 +3816,8 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { } } - if(flag&SCB_MATK) { - iStatus->get_matk(bl, 0); + if(flag&SCB_MATK) { + status->get_matk(bl, 0); } if(flag&SCB_ASPD) { @@ -3892,10 +3893,10 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { } if(flag&(SCB_VIT|SCB_MAXHP|SCB_INT|SCB_MAXSP) && bl->type&BL_REGEN) - iStatus->calc_regen(bl, st, iStatus->get_regen_data(bl)); + status->calc_regen(bl, st, status->get_regen_data(bl)); if(flag&SCB_REGEN && bl->type&BL_REGEN) - iStatus->calc_regen_rate(bl, iStatus->get_regen_data(bl), sc); + status->calc_regen_rate(bl, status->get_regen_data(bl), sc); } /// Recalculates parts of an object's base status and battle status according to the specified flags. /// Also sends updates to the client wherever applicable. @@ -3911,18 +3912,18 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, bool first) { } // remember previous values - st = iStatus->get_status_data(bl); + st = status->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 ) { - case BL_PC: iStatus->calc_pc_(BL_CAST(BL_PC,bl), first); break; - case BL_MOB: iStatus->calc_mob_(BL_CAST(BL_MOB,bl), first); break; - case BL_PET: iStatus->calc_pet_(BL_CAST(BL_PET,bl), first); break; - case BL_HOM: iStatus->calc_homunculus_(BL_CAST(BL_HOM,bl), first); break; - case BL_MER: iStatus->calc_mercenary_(BL_CAST(BL_MER,bl), first); break; - case BL_ELEM: iStatus->calc_elemental_(BL_CAST(BL_ELEM,bl), first); break; - case BL_NPC: status_calc_npc_(BL_CAST(BL_NPC,bl), first); break; + case BL_PC: status->calc_pc_(BL_CAST(BL_PC,bl), first); break; + case BL_MOB: status->calc_mob_(BL_CAST(BL_MOB,bl), first); break; + case BL_PET: status->calc_pet_(BL_CAST(BL_PET,bl), first); break; + case BL_HOM: status->calc_homunculus_(BL_CAST(BL_HOM,bl), first); break; + case BL_MER: status->calc_mercenary_(BL_CAST(BL_MER,bl), first); break; + case BL_ELEM: status->calc_elemental_(BL_CAST(BL_ELEM,bl), first); break; + case BL_NPC: status_calc_npc_(BL_CAST(BL_NPC,bl), first); break; } } @@ -5831,7 +5832,7 @@ 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 *st = iStatus->get_status_data(bl); + struct status_data *st = status->get_status_data(bl); int def = st ? st->def : 0; ud = unit->bl2ud(bl); if (ud && ud->skilltimer != INVALID_TIMER) @@ -5840,11 +5841,10 @@ defType status_get_def(struct block_list *bl) { return cap_value(def, DEFTYPE_MIN, DEFTYPE_MAX); } -unsigned short status_get_speed(struct block_list *bl) -{ +unsigned short status_get_speed(struct block_list *bl) { if(bl->type==BL_NPC)//Only BL with speed data but no status_data [Skotlex] return ((struct npc_data *)bl)->speed; - return iStatus->get_status_data(bl)->speed; + return status->get_status_data(bl)->speed; } int status_get_party_id(struct block_list *bl) { @@ -5984,15 +5984,13 @@ int status_get_race2(struct block_list *bl) return 0; } -int status_isdead(struct block_list *bl) -{ +int status_isdead(struct block_list *bl) { nullpo_ret(bl); - return iStatus->get_status_data(bl)->hp == 0; + return status->get_status_data(bl)->hp == 0; } -int status_isimmune(struct block_list *bl) -{ - struct status_change *sc =iStatus->get_sc(bl); +int status_isimmune(struct block_list *bl) { + struct status_change *sc = status->get_sc(bl); if (sc && sc->data[SC_HERMODE]) return 100; @@ -6168,16 +6166,15 @@ struct status_change *status_get_sc(struct block_list *bl) { return NULL; } -void status_change_init(struct block_list *bl) -{ - struct status_change *sc = iStatus->get_sc(bl); +void status_change_init(struct block_list *bl) { + struct status_change *sc = status->get_sc(bl); nullpo_retv(sc); memset(sc, 0, sizeof (struct status_change)); } //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. +//the flag values are the same as in status->change_start. 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 @@ -6192,7 +6189,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti nullpo_ret(bl); //Status that are blocked by Golden Thief Bug card or Wand of Hermod - if (iStatus->isimmune(bl)) + if (status->isimmune(bl)) switch (type) { case SC_DEC_AGI: case SC_SILENCE: @@ -6227,8 +6224,8 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti } sd = BL_CAST(BL_PC,bl); - st = iStatus->get_status_data(bl); - sc = iStatus->get_sc(bl); + st = status->get_status_data(bl); + sc = status->get_sc(bl); if( sc && !sc->count ) sc = NULL; switch (type) { @@ -6248,7 +6245,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti break; case SC_DEEP_SLEEP: 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. + tick_def = st->int_*10 + status->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 @@ -6263,7 +6260,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti break; case SC_CURSE: //Special property: inmunity when luk is greater than level or zero - if (st->luk > iStatus->get_lv(bl) || st->luk == 0) + if (st->luk > status->get_lv(bl) || st->luk == 0) return 0; sc_def = st->luk*100; sc_def2 = st->luk*10; @@ -6288,7 +6285,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti case SC_STONESKIN: if (sd) //Duration greatly reduced for players. tick /= 15; - sc_def2 = iStatus->get_lv(bl)*20 + st->vit*25 + st->agi*10; // Lineal Reduction of Rate + sc_def2 = status->get_lv(bl)*20 + st->vit*25 + st->agi*10; // Lineal Reduction of Rate tick_def2 = 0; //No duration reduction break; case SC_MARSHOFABYSS: @@ -6300,7 +6297,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti tick_def2 = (st->vit + st->dex)*50; break; if( bl->type == BL_PC ) - tick -= (iStatus->get_lv(bl) / 5 + st->vit / 4 + st->agi / 10)*100; + tick -= (status->get_lv(bl) / 5 + st->vit / 4 + st->agi / 10)*100; else tick -= (st->vit + st->luk) / 20 * 1000; break; @@ -6325,10 +6322,10 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti tick -= 1000 * (st->agi/10); break; case SC_COLD: - tick -= (1000*(st->vit/10))+(iStatus->get_lv(bl)/50); + tick -= (1000*(st->vit/10))+(status->get_lv(bl)/50); break; case SC_SIREN: - tick -= 1000 * ((iStatus->get_lv(bl) / 10) + ((sd?sd->status.job_level:0) / 5)); + tick -= 1000 * ((status->get_lv(bl) / 10) + ((sd?sd->status.job_level:0) / 5)); tick = max(tick,10000); break; case SC_MANDRAGORA: @@ -6523,8 +6520,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val int opt_flag, calc_flag, undead_flag, val_flag = 0, tick_time = 0; nullpo_ret(bl); - sc = iStatus->get_sc(bl); - st = iStatus->get_status_data(bl); + sc = status->get_sc(bl); + st = status->get_status_data(bl); if( type <= SC_NONE || type >= SC_MAX ) { ShowError("status_change_start: invalid status change (%d)!\n", type); @@ -6534,16 +6531,15 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if( !sc ) return 0; //Unable to receive status changes - if( iStatus->isdead(bl) && type != SC_NOCHAT ) // SC_NOCHAT should work even on dead characters + if( status->isdead(bl) && type != SC_NOCHAT ) // SC_NOCHAT should work even on dead characters return 0; - if( bl->type == BL_MOB) - { + if( bl->type == BL_MOB) { struct mob_data *md = BL_CAST(BL_MOB,bl); if(md && (md->class_ == MOBID_EMPERIUM || mob_is_battleground(md)) && type != SC_SAFETYWALL && type != SC_PNEUMA) return 0; //Emperium/BG Monsters can't be afflicted by status changes - // if(md && mob_is_gvg(md) && iStatus->sc2scb_flag(type)&SCB_MAXHP) - // return 0; //prevent status addinh hp to gvg mob (like bloodylust=hp*3 etc... + //if(md && mob_is_gvg(md) && status->sc2scb_flag(type)&SCB_MAXHP) + // return 0; //prevent status addinh hp to gvg mob (like bloodylust=hp*3 etc... } if( sc->data[SC_REFRESH] ) { @@ -6597,7 +6593,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val //Adjust tick according to status resistances if( !(flag&(1|4)) ) { - tick = iStatus->get_sc_def(bl, type, rate, tick, flag); + tick = status->get_sc_def(bl, type, rate, tick, flag); if( !tick ) return 0; } @@ -6716,25 +6712,25 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val return 0; break; case SC_MODECHANGE: - { - int mode; - 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 : bst->mode; //Base mode - if (val4) mode&=~val4; //Del mode - if (val3) mode|= val3; //Add mode - if (mode == bst->mode) { //No change. - if (sc->data[type]) //Abort previous status - return status_change_end(bl, type, INVALID_TIMER); - return 0; - } + { + int mode; + struct status_data *bst = status->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 : bst->mode; //Base mode + if (val4) mode&=~val4; //Del mode + if (val3) mode|= val3; //Add mode + if (mode == bst->mode) { //No change. + if (sc->data[type]) //Abort previous status + return status_change_end(bl, type, INVALID_TIMER); + return 0; } + } break; //Strip skills, need to divest something or it fails. case SC_NOEQUIPWEAPON: @@ -7249,7 +7245,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val //Kaahi overwrites previous level regardless of existing level. //Delete timer if it exists. if (sce->val4 != INVALID_TIMER) { - timer->delete(sce->val4,iStatus->kaahi_heal_timer); + timer->delete(sce->val4,status->kaahi_heal_timer); sce->val4 = INVALID_TIMER; } break; @@ -7280,7 +7276,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val } } - vd = iStatus->get_viewdata(bl); + vd = status->get_viewdata(bl); calc_flag = StatusChangeFlagTable[type]; if(!(flag&4)) { //&4 - Do not parse val settings when loading SCs switch(type) { @@ -7292,17 +7288,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val2 = 7; // Hit-count [Celest] if( !(flag&1) && (bl->type&(BL_PC|BL_MER)) && !map_flag_gvg(bl->m) && !maplist[bl->m].flag.battleground && !val4 ) { struct map_session_data *tsd; - if( sd ) - { + if( sd ) { int i; - for( i = 0; i < 5; i++ ) - { + for( i = 0; i < 5; i++ ) { if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) ) - iStatus->change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1); + status->change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1); } - } - else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) - iStatus->change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1); + } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) + status->change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1); } //val4 signals infinite endure (if val4 == 2 it is infinite endure from Berserk) if( val4 ) @@ -7381,20 +7374,16 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_REFLECTSHIELD: val2=10+val1*3; // %Dmg reflected - if( !(flag&1) && (bl->type&(BL_PC|BL_MER)) ) - { + if( !(flag&1) && (bl->type&(BL_PC|BL_MER)) ) { struct map_session_data *tsd; - if( sd ) - { + if( sd ) { int i; - for( i = 0; i < 5; i++ ) - { + for( i = 0; i < 5; i++ ) { if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) ) - iStatus->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); + status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); } - } - else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) - iStatus->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); + } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) + status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); } break; case SC_NOEQUIPWEAPON: @@ -7635,47 +7624,40 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_AUTOGUARD: - if( !(flag&1) ) - { + if( !(flag&1) ) { struct map_session_data *tsd; int i,t; - for( i = val2 = 0; i < val1; i++) - { + for( i = val2 = 0; i < val1; i++) { t = 5-(i>>1); val2 += (t < 0)? 1:t; } - if( bl->type&(BL_PC|BL_MER) ) - { - if( sd ) - { - for( i = 0; i < 5; i++ ) - { + if( bl->type&(BL_PC|BL_MER) ) { + if( sd ) { + for( i = 0; i < 5; i++ ) { if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) ) - iStatus->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); + status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); } } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) - iStatus->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); + status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1); } } break; case SC_DEFENDER: - if (!(flag&1)) - { + if (!(flag&1)) { val2 = 5 + 15*val1; //Damage reduction val3 = 0; // unused, previously speed adjustment val4 = 250 - 50*val1; //Aspd adjustment - if (sd) - { + if (sd) { struct map_session_data *tsd; int i; - for (i = 0; i < 5; i++) - { //See if there are devoted characters, and pass the status to them. [Skotlex] + for (i = 0; i < 5; i++) { + //See if there are devoted characters, and pass the status to them. [Skotlex] if (sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i]))) - iStatus->change_start(&tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1); + status->change_start(&tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1); } } } @@ -7702,7 +7684,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_JOINTBEAT: if( val2&BREAK_NECK ) - sc_start2(bl,SC_BLOODING,100,val1,val3,skill->get_time2(iStatus->sc2skill(type),val1)); + sc_start2(bl,SC_BLOODING,100,val1,val3,skill->get_time2(status->sc2skill(type),val1)); break; case SC_BERSERK: @@ -7712,58 +7694,59 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val sc_start4(bl, SC_ENDURE, 100,10,0,0,2, tick); //HP healing is performing after the calc_status call. //Val2 holds HP penalty - if (!val4) val4 = skill->get_time2(iStatus->sc2skill(type),val1); + if (!val4) val4 = skill->get_time2(status->sc2skill(type),val1); if (!val4) val4 = 10000; //Val4 holds damage interval val3 = tick/val4; //val3 holds skill duration tick_time = val4; // [GodLesZ] tick time break; case SC_GOSPEL: - if(val4 == BCT_SELF) { // self effect + if(val4 == BCT_SELF) { + // self effect val2 = tick/10000; tick_time = 10000; // [GodLesZ] tick time - iStatus->change_clear_buffs(bl,3); //Remove buffs/debuffs + status->change_clear_buffs(bl,3); //Remove buffs/debuffs } break; case SC_MARIONETTE_MASTER: - { - int stat; - - val3 = 0; - val4 = 0; - stat = ( sd ? sd->status.str : iStatus->get_base_status(bl)->str ) / 2; val3 |= cap_value(stat,0,0xFF)<<16; - stat = ( sd ? sd->status.agi : iStatus->get_base_status(bl)->agi ) / 2; val3 |= cap_value(stat,0,0xFF)<<8; - stat = ( sd ? sd->status.vit : iStatus->get_base_status(bl)->vit ) / 2; val3 |= cap_value(stat,0,0xFF); - stat = ( sd ? sd->status.int_: iStatus->get_base_status(bl)->int_) / 2; val4 |= cap_value(stat,0,0xFF)<<16; - stat = ( sd ? sd->status.dex : iStatus->get_base_status(bl)->dex ) / 2; val4 |= cap_value(stat,0,0xFF)<<8; - stat = ( sd ? sd->status.luk : iStatus->get_base_status(bl)->luk ) / 2; val4 |= cap_value(stat,0,0xFF); - break; - } + { + int stat; + + val3 = 0; + val4 = 0; + stat = ( sd ? sd->status.str : status->get_base_status(bl)->str ) / 2; val3 |= cap_value(stat,0,0xFF)<<16; + stat = ( sd ? sd->status.agi : status->get_base_status(bl)->agi ) / 2; val3 |= cap_value(stat,0,0xFF)<<8; + stat = ( sd ? sd->status.vit : status->get_base_status(bl)->vit ) / 2; val3 |= cap_value(stat,0,0xFF); + stat = ( sd ? sd->status.int_: status->get_base_status(bl)->int_) / 2; val4 |= cap_value(stat,0,0xFF)<<16; + stat = ( sd ? sd->status.dex : status->get_base_status(bl)->dex ) / 2; val4 |= cap_value(stat,0,0xFF)<<8; + stat = ( sd ? sd->status.luk : status->get_base_status(bl)->luk ) / 2; val4 |= cap_value(stat,0,0xFF); + } + break; case SC_MARIONETTE: - { - int stat,max_stat; - // fetch caster information - struct block_list *pbl = iMap->id2bl(val1); - 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* tst = iStatus->get_status_data(bl); // battle status - - if (!psce) - return 0; + { + int stat,max_stat; + // fetch caster information + struct block_list *pbl = iMap->id2bl(val1); + struct status_change *psc = pbl ? status->get_sc(pbl) : NULL; + struct status_change_entry *psce = psc ? psc->data[SC_MARIONETTE_MASTER] : NULL; + // fetch target's stats + struct status_data* tst = status->get_status_data(bl); // battle status + + if (!psce) + return 0; - val3 = 0; - val4 = 0; - max_stat = battle_config.max_parameter; //Cap to 99 (default) - 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; - } + val3 = 0; + val4 = 0; + max_stat = battle_config.max_parameter; //Cap to 99 (default) + 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: val2 = 15*val1; //Reflect chance val3 = 3; //Reflections @@ -7789,24 +7772,24 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_DEVOTION: - { - struct block_list *d_bl; - struct status_change *d_sc; - - if( (d_bl = iMap->id2bl(val1)) && (d_sc = iStatus->get_sc(d_bl)) && d_sc->count ) { - // Inherits Status From Source - const enum sc_type types[] = { SC_AUTOGUARD, SC_DEFENDER, SC_REFLECTSHIELD, SC_ENDURE }; - enum sc_type type2; - int i = (map_flag_gvg(bl->m) || maplist[bl->m].flag.battleground)?2:3; - while( i >= 0 ) { - type2 = types[i]; - if( d_sc->data[type2] ) - sc_start(bl, type2, 100, d_sc->data[type2]->val1, skill->get_time(iStatus->sc2skill(type2),d_sc->data[type2]->val1)); - i--; - } + { + struct block_list *d_bl; + struct status_change *d_sc; + + if( (d_bl = iMap->id2bl(val1)) && (d_sc = status->get_sc(d_bl)) && d_sc->count ) { + // Inherits Status From Source + const enum sc_type types[] = { SC_AUTOGUARD, SC_DEFENDER, SC_REFLECTSHIELD, SC_ENDURE }; + enum sc_type type2; + int i = (map_flag_gvg(bl->m) || maplist[bl->m].flag.battleground)?2:3; + while( i >= 0 ) { + type2 = types[i]; + if( d_sc->data[type2] ) + sc_start(bl, type2, 100, d_sc->data[type2]->val1, skill->get_time(status->sc2skill(type2),d_sc->data[type2]->val1)); + i--; } - break; } + break; + } case SC_COMA: //Coma. Sends a char to 1HP. If val2, do not zap sp if( val3 && bl->type == BL_MOB ) { @@ -7818,21 +7801,21 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val return 1; break; case SC_RG_CCONFINE_S: - { - struct block_list *src = val2?iMap->id2bl(val2):NULL; - struct status_change *sc2 = src?iStatus->get_sc(src):NULL; - struct status_change_entry *sce2 = sc2?sc2->data[SC_RG_CCONFINE_M]:NULL; - if (src && sc2) { - if (!sce2) //Start lock on caster. - sc_start4(src,SC_RG_CCONFINE_M,100,val1,1,0,0,tick+1000); - else { //Increase count of locked enemies and refresh time. - (sce2->val2)++; - timer->delete(sce2->timer, iStatus->change_timer); - sce2->timer = timer->add(timer->gettick()+tick+1000, iStatus->change_timer, src->id, SC_RG_CCONFINE_M); - } - } else //Status failed. - return 0; - } + { + struct block_list *src = val2 ? iMap->id2bl(val2) : NULL; + struct status_change *sc2 = src ? status->get_sc(src) : NULL; + struct status_change_entry *sce2 = sc2 ? sc2->data[SC_RG_CCONFINE_M] : NULL; + if (src && sc2) { + if (!sce2) //Start lock on caster. + sc_start4(src,SC_RG_CCONFINE_M,100,val1,1,0,0,tick+1000); + else { //Increase count of locked enemies and refresh time. + (sce2->val2)++; + timer->delete(sce2->timer, status->change_timer); + sce2->timer = timer->add(timer->gettick()+tick+1000, status->change_timer, src->id, SC_RG_CCONFINE_M); + } + } else //Status failed. + return 0; + } break; case SC_KAITE: val2 = 1+val1/5; //Number of bounces: 1 + skill_lv/5 @@ -7937,13 +7920,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) + st->dex + st->luk)/2; //def increase + val2 = (status->get_lv(bl) + st->dex + st->luk)/2; //def increase break; case SC_MOON_COMFORT: - val2 = (iStatus->get_lv(bl) + st->dex + st->luk)/10; //flee increase + val2 = (status->get_lv(bl) + st->dex + st->luk)/10; //flee increase break; case SC_STAR_COMFORT: - val2 = (iStatus->get_lv(bl) + st->dex + st->luk); //Aspd increase + val2 = (status->get_lv(bl) + st->dex + st->luk); //Aspd increase break; case SC_QUAGMIRE: val2 = (sd?5:10)*val1; //Agi/Dex decrease. @@ -8189,7 +8172,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val tick_time = 4000; // [GodLesZ] tick time break; case SC_PYREXIA: - iStatus->change_start(bl,SC_BLIND,10000,val1,0,0,0,30000,11); // Blind status that last for 30 seconds + status->change_start(bl,SC_BLIND,10000,val1,0,0,0,30000,11); // Blind status that last for 30 seconds val4 = tick / 3000; tick_time = 3000; // [GodLesZ] tick time break; @@ -8402,7 +8385,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val tick_time = 3000; // [GodLesZ] tick time break; case SC_SATURDAY_NIGHT_FEVER: - if (!val4) val4 = skill->get_time2(iStatus->sc2skill(type),val1); + if (!val4) val4 = skill->get_time2(status->sc2skill(type),val1); if (!val4) val4 = 3000; val3 = tick/val4; tick_time = val4; // [GodLesZ] tick time @@ -8464,12 +8447,11 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_EXEEDBREAK: val1 *= 150; // 150 * skill_lv - if( sd && sd->inventory_data[sd->equip_index[EQI_HAND_R]] ) { // Chars. - val1 += (sd->inventory_data[sd->equip_index[EQI_HAND_R]]->weight/10 * sd->inventory_data[sd->equip_index[EQI_HAND_R]]->wlv * iStatus->get_lv(bl) / 100); + if( sd && sd->inventory_data[sd->equip_index[EQI_HAND_R]] ) { // Chars. + val1 += (sd->inventory_data[sd->equip_index[EQI_HAND_R]]->weight/10 * sd->inventory_data[sd->equip_index[EQI_HAND_R]]->wlv * status->get_lv(bl) / 100); val1 += 15 * (sd ? sd->status.job_level:50) + 100; - } - 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] + } else // Mobs + val1 += (400 * status->get_lv(bl) / 100) + (15 * (status->get_lv(bl) / 2)); // About 1138% at mob_lvl 99. Is an aproximation to a standard weapon. [pakpil] break; 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. @@ -8492,14 +8474,13 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val tick_time = 1000; // [GodLesZ] tick time break; case SC_INSPIRATION: - if( sd ) - { + if( sd ) { val2 = (40 * val1) + (3 * sd->status.job_level); // ATK bonus val3 = (sd->status.job_level / 10) * 2 + 12; // All stat bonus } val4 = tick / 1000; tick_time = 1000; // [GodLesZ] tick time - iStatus->change_clear_buffs(bl,3); //Remove buffs/debuffs + status->change_clear_buffs(bl,3); //Remove buffs/debuffs break; case SC_SPELLFIST: case SC_CURSEDCIRCLE_ATKER: @@ -8650,25 +8631,33 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val tick_time = 1000; break; case SC_ZANGETSU: - val2 = val4 = iStatus->get_lv(bl) / 3 + 20 * val1; - val3 = iStatus->get_lv(bl) / 2 + 30 * val1; + val2 = val4 = status->get_lv(bl) / 3 + 20 * val1; + val3 = status->get_lv(bl) / 2 + 30 * val1; val2 = (!(status_get_hp(bl)%2) ? val2 : -val3); val3 = (!(status_get_sp(bl)%2) ? val4 : -val3); break; case SC_GENSOU: - { - int hp = status_get_hp(bl), sp = status_get_sp(bl), lv = 5; -#define PER( a ) { if( a <= 15 )lv = 1;else if( a <= 30 )lv = 2;else if( a <= 50 )lv = 3;else if( a <= 75 )lv = 4;} - if( rand()%100 > (25 + 10 * val1) - status_get_int(bl) / 2) - return 0; +#define PER( a ) do { \ + if( a <= 15 ) lv = 1; \ + else if( a <= 30 ) lv = 2; \ + else if( a <= 50 ) lv = 3; \ + else if( a <= 75 ) lv = 4; \ +} while(0) - PER( 100 / (status_get_max_hp(bl) / hp) ); - iStatus->heal(bl, (!(hp%2) ? (6-lv) *4 / 100 : -(lv*4) / 100), 0, 1); + { + int hp = status_get_hp(bl), sp = status_get_sp(bl), lv = 5; - PER( 100 / (status_get_max_sp(bl) / sp) ); - iStatus->heal(bl, 0,(!(sp%2) ? (6-lv) *3 / 100 : -(lv*3) / 100), 1); - } + if( rand()%100 > (25 + 10 * val1) - status_get_int(bl) / 2) + return 0; + + PER( 100 / (status_get_max_hp(bl) / hp) ); + status->heal(bl, (!(hp%2) ? (6-lv) *4 / 100 : -(lv*4) / 100), 0, 1); + + PER( 100 / (status_get_max_sp(bl) / sp) ); + status->heal(bl, 0,(!(sp%2) ? (6-lv) *3 / 100 : -(lv*3) / 100), 1); + } +#undef PER break; case SC_ANGRIFFS_MODUS: val2 = 50 + 20 * val1; //atk bonus @@ -9060,7 +9049,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val //Don't trust the previous sce assignment, in case the SC ended somewhere between there and here. if((sce=sc->data[type])) {// reuse old sc if( sce->timer != INVALID_TIMER ) - timer->delete(sce->timer, iStatus->change_timer); + timer->delete(sce->timer, status->change_timer); } else {// new sc ++(sc->count); sce = sc->data[type] = ers_alloc(sc_data_ers, struct status_change_entry); @@ -9070,7 +9059,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val sce->val3 = val3; sce->val4 = val4; if (tick >= 0) - sce->timer = timer->add(timer->gettick() + tick, iStatus->change_timer, bl->id, type); + sce->timer = timer->add(timer->gettick() + tick, status->change_timer, bl->id, type); else sce->timer = INVALID_TIMER; //Infinite duration @@ -9083,8 +9072,8 @@ 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, 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 + status->heal(bl, st->max_hp, 0, 1); //Do not use percent_heal as this healing must override BERSERK's block. + status->set_sp(bl, 0, 0); //Damage all SP } sce->val2 = 5 * st->max_hp / 100; break; @@ -9177,7 +9166,7 @@ int status_change_clear(struct block_list* bl, int type) { struct status_change* sc; int i; - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (!sc || !sc->count) return 0; @@ -9187,7 +9176,7 @@ int status_change_clear(struct block_list* bl, int type) { continue; if(type == 0){ - if( iStatus->get_sc_type(i)&SC_NO_REM_DEATH ){ + if( status->get_sc_type(i)&SC_NO_REM_DEATH ) { switch (i) { case SC_ARMOR_PROPERTY://Only when its Holy or Dark that it doesn't dispell on death if( sc->data[i]->val2 != ELE_HOLY && sc->data[i]->val2 != ELE_DARK ) @@ -9215,7 +9204,7 @@ int status_change_clear(struct block_list* bl, int type) { //If for some reason status_change_end decides to still keep the status when quitting. [Skotlex] (sc->count)--; if (sc->data[i]->timer != INVALID_TIMER) - timer->delete(sc->data[i]->timer, iStatus->change_timer); + timer->delete(sc->data[i]->timer, status->change_timer); ers_free(sc_data_ers, sc->data[i]); sc->data[i] = NULL; } @@ -9248,8 +9237,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const nullpo_ret(bl); - sc = iStatus->get_sc(bl); - st = iStatus->get_status_data(bl); + sc = status->get_sc(bl); + st = status->get_status_data(bl); if(type < 0 || type >= SC_MAX || !sc || !(sce = sc->data[type])) return 0; @@ -9264,7 +9253,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const //Do not end infinite endure. return 0; if (sce->timer != INVALID_TIMER) //Could be a SC with infinite duration - timer->delete(sce->timer,iStatus->change_timer); + timer->delete(sce->timer,status->change_timer); if (sc->opt1) switch (type) { //"Ugly workaround" [Skotlex] @@ -9280,7 +9269,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const //since these SC are not affected by it, and it lets us know //if we have already delayed this attack or not. sce->val1 = 0; - sce->timer = timer->add(timer->gettick()+10, iStatus->change_timer, bl->id, type); + sce->timer = timer->add(timer->gettick()+10, status->change_timer, bl->id, type); return 1; } } @@ -9294,7 +9283,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const status_display_remove(sd,type); } - vd = iStatus->get_viewdata(bl); + vd = status->get_viewdata(bl); calc_flag = StatusChangeFlagTable[type]; switch(type) { case SC_GRANITIC_ARMOR: @@ -9302,7 +9291,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const 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); + status->damage(NULL, bl, damage,0,0,1); } break; case SC_PYROCLASTIC: @@ -9320,11 +9309,11 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if (ud->walktimer != INVALID_TIMER) unit->stop_walking(bl,1); } - if (begin_spurt && sce->val1 >= 7 && - DIFF_TICK(timer->gettick(), sce->val4) <= 1000 && - (!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0)) - ) - sc_start(bl,SC_STRUP,100,sce->val1,skill->get_time2(iStatus->sc2skill(type), sce->val1)); + if (begin_spurt && sce->val1 >= 7 + && DIFF_TICK(timer->gettick(), sce->val4) <= 1000 + && (!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0)) + ) + sc_start(bl,SC_STRUP,100,sce->val1,skill->get_time2(status->sc2skill(type), sce->val1)); } break; case SC_AUTOBERSERK: @@ -9375,14 +9364,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const break; case SC_BLADESTOP: - if(sce->val4) - { + if(sce->val4) { int tid = sce->val4; struct block_list *tbl = iMap->id2bl(tid); - struct status_change *tsc = iStatus->get_sc(tbl); + struct status_change *tsc = status->get_sc(tbl); sce->val4 = 0; - if(tbl && tsc && tsc->data[SC_BLADESTOP]) - { + if(tbl && tsc && tsc->data[SC_BLADESTOP]) { tsc->data[SC_BLADESTOP]->val4 = 0; status_change_end(tbl, SC_BLADESTOP, INVALID_TIMER); } @@ -9466,8 +9453,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const break; case SC_RG_CCONFINE_S: { - struct block_list *src = sce->val2?iMap->id2bl(sce->val2):NULL; - struct status_change *sc2 = src?iStatus->get_sc(src):NULL; + struct block_list *src = sce->val2 ? iMap->id2bl(sce->val2) : NULL; + struct status_change *sc2 = src ? status->get_sc(src) : NULL; if (src && sc2 && sc2->data[SC_RG_CCONFINE_M]) { //If status was already ended, do nothing. //Decrease count @@ -9479,9 +9466,9 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if (sce->val2 > 0) { //Caster has been unlocked... nearby chars need to be unlocked. int range = 1 - +skill->get_range2(bl, iStatus->sc2skill(type), sce->val1) + +skill->get_range2(bl, status->sc2skill(type), sce->val1) +skill->get_range2(bl, TF_BACKSLIDING, 1); //Since most people use this to escape the hold.... - iMap->foreachinarea(iStatus->change_timer_sub, + iMap->foreachinarea(status->change_timer_sub, bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,sce,type,timer->gettick()); } break; @@ -9508,12 +9495,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const break; case SC_MARIONETTE_MASTER: - case SC_MARIONETTE: /// Marionette target - if (sce->val1) - { // check for partner and end their marionette status as well + case SC_MARIONETTE: /// Marionette target + if (sce->val1) { + // check for partner and end their marionette status as well enum sc_type type2 = (type == SC_MARIONETTE_MASTER) ? SC_MARIONETTE : SC_MARIONETTE_MASTER; struct block_list *pbl = iMap->id2bl(sce->val1); - struct status_change* sc2 = pbl?iStatus->get_sc(pbl):NULL; + struct status_change* sc2 = pbl ? status->get_sc(pbl) : NULL; if (sc2 && sc2->data[type2]) { @@ -9529,7 +9516,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const status_percent_heal(bl, 100, 0); status_change_end(bl, SC__BLOODYLUST, INVALID_TIMER); } else if(st->hp > 100 && sce->val2) //If val2 is removed, no HP penalty (dispelled?) [Skotlex] - iStatus->set_hp(bl, 100, 0); + status->set_hp(bl, 100, 0); 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); @@ -9567,7 +9554,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const case SC_KAAHI: //Delete timer if it exists. if (sce->val4 != INVALID_TIMER) - timer->delete(sce->val4,iStatus->kaahi_heal_timer); + timer->delete(sce->val4,status->kaahi_heal_timer); break; case SC_JAILED: if(tid == INVALID_TIMER) @@ -9580,8 +9567,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if (tid == INVALID_TIMER) break; // "lose almost all their HP and SP" on natural expiration. - iStatus->set_hp(bl, 10, 0); - iStatus->set_sp(bl, 10, 0); + status->set_hp(bl, 10, 0); + status->set_sp(bl, 10, 0); break; case SC_AUTOTRADE: if (tid == INVALID_TIMER) @@ -9594,11 +9581,10 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const return 1; break; case SC_STOP: - if( sce->val2 ) - { + if( sce->val2 ) { struct block_list* tbl = iMap->id2bl(sce->val2); sce->val2 = 0; - if( tbl && (sc = iStatus->get_sc(tbl)) && sc->data[SC_STOP] && sc->data[SC_STOP]->val2 == bl->id ) + if( tbl && (sc = status->get_sc(tbl)) && sc->data[SC_STOP] && sc->data[SC_STOP]->val2 == bl->id ) status_change_end(tbl, SC_STOP, INVALID_TIMER); } break; @@ -9667,7 +9653,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const break; case SC_CURSEDCIRCLE_ATKER: if( sce->val2 ) // used the default area size cause there is a chance the caster could knock back and can't clear the target. - iMap->foreachinrange(iStatus->change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, timer->gettick()); + iMap->foreachinrange(status->change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, timer->gettick()); break; case SC_RAISINGDRAGON: if( sd && sce->val2 && !pc_isdead(sd) ) { @@ -9682,20 +9668,20 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const } break; case SC_CURSEDCIRCLE_TARGET: - { - struct block_list *src = iMap->id2bl(sce->val2); - struct status_change *sc = iStatus->get_sc(src); - if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] && --(sc->data[SC_CURSEDCIRCLE_ATKER]->val2) == 0 ){ - status_change_end(src, SC_CURSEDCIRCLE_ATKER, INVALID_TIMER); - clif->bladestop(bl, sce->val2, 0); - } + { + struct block_list *src = iMap->id2bl(sce->val2); + struct status_change *sc = status->get_sc(src); + if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] && --(sc->data[SC_CURSEDCIRCLE_ATKER]->val2) == 0 ){ + status_change_end(src, SC_CURSEDCIRCLE_ATKER, INVALID_TIMER); + clif->bladestop(bl, sce->val2, 0); } + } break; case SC_BLOOD_SUCKER: if( sce->val2 ){ struct block_list *src = iMap->id2bl(sce->val2); - if(src){ - struct status_change *sc = iStatus->get_sc(src); + if(src) { + struct status_change *sc = status->get_sc(src); sc->bs_counter--; } } @@ -9938,9 +9924,10 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) { struct status_data *st; int hp; - if(!((bl=iMap->id2bl(id))&& - (sc=iStatus->get_sc(bl)) && - (sce = sc->data[SC_KAAHI]))) + if(!( (bl=iMap->id2bl(id)) + && (sc=status->get_sc(bl)) + && (sce=sc->data[SC_KAAHI]) + )) return 0; if(sce->val4 != tid) { @@ -9949,8 +9936,8 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) { return 0; } - st=iStatus->get_status_data(bl); - if(!iStatus->charge(bl, 0, sce->val3)) { + st=status->get_status_data(bl); + if(!status->charge(bl, 0, sce->val3)) { sce->val4 = INVALID_TIMER; return 0; } @@ -9959,7 +9946,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) { if (hp > sce->val2) hp = sce->val2; if (hp) - iStatus->heal(bl, hp, 0, 2); + status->heal(bl, hp, 0, 2); sce->val4 = INVALID_TIMER; return 1; } @@ -9977,13 +9964,12 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { struct status_change_entry *sce; bl = iMap->id2bl(id); - if(!bl) - { + if(!bl) { ShowDebug("status_change_timer: Null pointer id: %d data: %d\n", id, data); return 0; } - sc = iStatus->get_sc(bl); - st = iStatus->get_status_data(bl); + sc = status->get_sc(bl); + st = status->get_status_data(bl); if(!(sc && (sce = sc->data[type]))) { @@ -10000,49 +9986,48 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { sd = BL_CAST(BL_PC, bl); // set the next timer of the sce (don't assume the status still exists) -#define sc_timer_next(t,f,i,d) \ +#define sc_timer_next(t,f,i,d) do { \ if( (sce=sc->data[type]) ) \ - sce->timer = timer->add(t,f,i,d); \ + sce->timer = timer->add(t,f,i,d); \ else \ - ShowError("status_change_timer: Unexpected NULL status change id: %d data: %d\n", id, data) + ShowError("status_change_timer: Unexpected NULL status change id: %d data: %d\n", id, data); \ +} while(0) - switch(type) - { + switch(type) { case SC_MAXIMIZEPOWER: case SC_CLOAKING: - if(!iStatus->charge(bl, 0, 1)) + if(!status->charge(bl, 0, 1)) break; //Not enough SP to continue. - sc_timer_next(sce->val2+tick, iStatus->change_timer, bl->id, data); + sc_timer_next(sce->val2+tick, status->change_timer, bl->id, data); return 0; case SC_CHASEWALK: - if(!iStatus->charge(bl, 0, sce->val4)) + if(!status->charge(bl, 0, sce->val4)) break; //Not enough SP to continue. if (!sc->data[SC_CHASEWALK2]) { sc_start(bl, SC_CHASEWALK2,100,1<<(sce->val1-1), - (sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_ROGUE?10:1) //SL bonus -> x10 duration - *skill->get_time2(iStatus->sc2skill(type),sce->val1)); + (sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_ROGUE?10:1) //SL bonus -> x10 duration + * skill->get_time2(status->sc2skill(type),sce->val1)); } - sc_timer_next(sce->val2+tick, iStatus->change_timer, bl->id, data); + sc_timer_next(sce->val2+tick, status->change_timer, bl->id, data); return 0; break; case SC_SKA: - if(--(sce->val2)>0){ + if(--(sce->val2)>0) { sce->val3 = rnd()%100; //Random defense. - sc_timer_next(1000+tick, iStatus->change_timer,bl->id, data); + sc_timer_next(1000+tick, status->change_timer,bl->id, data); return 0; } break; case SC_HIDING: - if(--(sce->val2)>0){ - - if(sce->val2 % sce->val4 == 0 && !iStatus->charge(bl, 0, 1)) + if(--(sce->val2)>0) { + if(sce->val2 % sce->val4 == 0 && !status->charge(bl, 0, 1)) break; //Fail if it's time to substract SP and there isn't. - sc_timer_next(1000+tick, iStatus->change_timer,bl->id, data); + sc_timer_next(1000+tick, status->change_timer,bl->id, data); return 0; } break; @@ -10051,20 +10036,20 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { case SC_RUWACH: case SC_WZ_SIGHTBLASTER: if(type == SC_WZ_SIGHTBLASTER) - iMap->foreachinrange( iStatus->change_timer_sub, bl, sce->val3, BL_CHAR|BL_SKILL, bl, sce, type, tick); + iMap->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR|BL_SKILL, bl, sce, type, tick); else - iMap->foreachinrange( iStatus->change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick); + iMap->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick); if( --(sce->val2)>0 ){ sce->val4 += 250; // use for Shadow Form 2 seconds checking. - sc_timer_next(250+tick, iStatus->change_timer, bl->id, data); + sc_timer_next(250+tick, status->change_timer, bl->id, data); return 0; } break; case SC_PROVOKE: - if(sce->val2) { //Auto-provoke (it is ended in iStatus->heal) - sc_timer_next(1000*60+tick,iStatus->change_timer, bl->id, data ); + if(sce->val2) { //Auto-provoke (it is ended in status->heal) + sc_timer_next(1000*60+tick, status->change_timer, bl->id, data ); return 0; } break; @@ -10076,14 +10061,14 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { unit->stop_attack(bl); sc->opt1 = OPT1_STONE; clif->changeoption(bl); - sc_timer_next(1000+tick,iStatus->change_timer, bl->id, data ); + sc_timer_next(1000+tick, status->change_timer, bl->id, data ); status_calc_bl(bl, StatusChangeFlagTable[type]); return 0; } if(--(sce->val3) > 0) { 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 ); + sc_timer_next(1000+tick, status->change_timer, bl->id, data ); return 0; } break; @@ -10102,7 +10087,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { iMap->freeblock_lock(); status_zap(bl, sce->val4, 0); if (sc->data[type]) { // Check if the status still last ( can be dead since then ). - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data ); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data ); } iMap->freeblock_unlock(); } @@ -10111,8 +10096,8 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { break; case SC_TENSIONRELAX: - if(st->max_hp > st->hp && --(sce->val3) > 0){ - sc_timer_next(sce->val4+tick, iStatus->change_timer, bl->id, data); + if(st->max_hp > st->hp && --(sce->val3) > 0) { + sc_timer_next(sce->val4+tick, status->change_timer, bl->id, data); return 0; } break; @@ -10142,7 +10127,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { iMap->freeblock_unlock(); break; } - sc_timer_next(10000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(10000 + tick, status->change_timer, bl->id, data); } iMap->freeblock_unlock(); return 0; @@ -10151,27 +10136,24 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { case SC_S_LIFEPOTION: case SC_L_LIFEPOTION: - if( sd && --(sce->val4) >= 0 ) - { + if( sd && --(sce->val4) >= 0 ) { // val1 < 0 = per max% | val1 > 0 = exact amount int hp = 0; 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); + status->heal(bl, hp, 0, 2); + sc_timer_next((sce->val2 * 1000) + tick, status->change_timer, bl->id, data); return 0; } break; case SC_CASH_BOSS_ALARM: - if( sd && --(sce->val4) >= 0 ) - { + if( sd && --(sce->val4) >= 0 ) { struct mob_data *boss_md = iMap->id2boss(sce->val1); - if( boss_md && sd->bl.m == boss_md->bl.m ) - { + if( boss_md && sd->bl.m == boss_md->bl.m ) { clif->bossmapinfo(sd->fd, boss_md, 1); // Update X - Y on minimap if (boss_md->bl.prev != NULL) { - sc_timer_next(5000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(5000 + tick, status->change_timer, bl->id, data); return 0; } } @@ -10223,34 +10205,32 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { s=10; break; } - if( s != 0 && sce->val3 % s == 0 ) - { + if( s != 0 && sce->val3 % s == 0 ) { if (sc->data[SC_LONGING]) sp*= 3; - if (!iStatus->charge(bl, 0, sp)) + if (!status->charge(bl, 0, sp)) break; } - sc_timer_next(1000+tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000+tick, status->change_timer, bl->id, data); return 0; } break; case SC_BERSERK: // 5% every 10 seconds [DracoRPG] - 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); + if( --( sce->val3 ) > 0 && status->charge(bl, sce->val2, 0) && st->hp > 100 ) { + sc_timer_next(sce->val4+tick, status->change_timer, bl->id, data); return 0; } break; case SC_NOCHAT: - if(sd){ + if(sd) { sd->status.manner++; clif->changestatus(sd,SP_MANNER,sd->status.manner); clif->updatestatus(sd,SP_MANNER); - if (sd->status.manner < 0) - { //Every 60 seconds your manner goes up by 1 until it gets back to 0. - sc_timer_next(60000+tick, iStatus->change_timer, bl->id, data); + if (sd->status.manner < 0) { + //Every 60 seconds your manner goes up by 1 until it gets back to 0. + sc_timer_next(60000+tick, status->change_timer, bl->id, data); return 0; } } @@ -10264,7 +10244,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { // clif->message(bl, counter); //} if((sce->val4 -= 500) > 0) { - sc_timer_next(500 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(500 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10273,46 +10253,43 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { case SC_MARIONETTE: { struct block_list *pbl = iMap->id2bl(sce->val1); - if( pbl && check_distance_bl(bl, pbl, 7) ) - { - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + if( pbl && check_distance_bl(bl, pbl, 7) ) { + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } } break; case SC_GOSPEL: - if(sce->val4 == BCT_SELF && --(sce->val2) > 0) - { + if(sce->val4 == BCT_SELF && --(sce->val2) > 0) { int hp, sp; hp = (sce->val1 > 5) ? 45 : 30; sp = (sce->val1 > 5) ? 35 : 20; - if(!iStatus->charge(bl, hp, sp)) + if(!status->charge(bl, hp, sp)) break; - sc_timer_next(10000+tick, iStatus->change_timer, bl->id, data); + sc_timer_next(10000+tick, status->change_timer, bl->id, data); return 0; } break; case SC_JAILED: - if(sce->val1 == INT_MAX || --(sce->val1) > 0) - { - sc_timer_next(60000+tick, iStatus->change_timer, bl->id,data); + if(sce->val1 == INT_MAX || --(sce->val1) > 0) { + sc_timer_next(60000+tick, status->change_timer, bl->id,data); return 0; } break; case SC_BLIND: - if(sc->data[SC_FOGWALL]) - { //Blind lasts forever while you are standing on the fog. - sc_timer_next(5000+tick, iStatus->change_timer, bl->id, data); + if(sc->data[SC_FOGWALL]) { + //Blind lasts forever while you are standing on the fog. + sc_timer_next(5000+tick, status->change_timer, bl->id, data); return 0; } break; case SC_ABUNDANCE: if(--(sce->val4) > 0) { - iStatus->heal(bl,0,60,0); - sc_timer_next(10000+tick, iStatus->change_timer, bl->id, data); + status->heal(bl,0,60,0); + sc_timer_next(10000+tick, status->change_timer, bl->id, data); } break; @@ -10322,7 +10299,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,100,0,0,0); status_fix_damage(NULL,bl,100,0); if( sc->data[type] ) { - sc_timer_next(3000+tick,iStatus->change_timer,bl->id,data); + sc_timer_next(3000+tick,status->change_timer,bl->id,data); } iMap->freeblock_unlock(); return 0; @@ -10335,9 +10312,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { 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); + status->damage(bl, bl, damage, 0, clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,damage,1,0,0), 1); if( sc->data[type] ) { - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data ); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data ); } iMap->freeblock_unlock(); return 0; @@ -10383,20 +10360,20 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { } clif->emotion(bl,E_HEH); - sc_timer_next(4000+tick,iStatus->change_timer,bl->id,data); + sc_timer_next(4000+tick,status->change_timer,bl->id,data); } return 0; } break; case SC_TOXIN: - if( --(sce->val4) > 0 ) - { //Damage is every 10 seconds including 3%sp drain. + if( --(sce->val4) > 0 ) { + //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, st->max_sp * 3 / 100, 0, 0); //cancel dmg only if cancelable + status->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 ); + sc_timer_next(10000 + tick, status->change_timer, bl->id, data ); } iMap->freeblock_unlock(); return 0; @@ -10404,28 +10381,26 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { break; case SC_OBLIVIONCURSE: - if( --(sce->val4) > 0 ) - { + if( --(sce->val4) > 0 ) { clif->emotion(bl,E_WHAT); - sc_timer_next(3000 + tick, iStatus->change_timer, bl->id, data ); + sc_timer_next(3000 + tick, status->change_timer, bl->id, data ); return 0; } break; case SC_WEAPONBLOCKING: - if( --(sce->val4) > 0 ) - { - if( !iStatus->charge(bl,0,3) ) + if( --(sce->val4) > 0 ) { + if( !status->charge(bl,0,3) ) break; - sc_timer_next(3000+tick,iStatus->change_timer,bl->id,data); + sc_timer_next(3000+tick,status->change_timer,bl->id,data); return 0; } break; case SC_CLOAKINGEXCEED: - if(!iStatus->charge(bl,0,10-sce->val1)) + if(!status->charge(bl,0,10-sce->val1)) break; - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; case SC_RENOVATIO: @@ -10433,24 +10408,23 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { int heal = st->max_hp * 3 / 100; if( sc && sc->data[SC_AKAITSUKI] && heal ) heal = ~heal + 1; - iStatus->heal(bl, heal, 0, 2); - sc_timer_next(5000 + tick, iStatus->change_timer, bl->id, data); + status->heal(bl, heal, 0, 2); + sc_timer_next(5000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_BURNING: - if( --(sce->val4) > 0 ) - { + if( --(sce->val4) > 0 ) { struct block_list *src = iMap->id2bl(sce->val3); int damage = 1000 + 3 * status_get_max_hp(bl) / 100; // Deals fixed (1000 + 3%*MaxHP) iMap->freeblock_lock(); clif->damage(bl,bl,tick,0,0,damage,1,9,0); //damage is like endure effect with no walk delay - iStatus->damage(src, bl, damage, 0, 0, 1); + status->damage(src, bl, damage, 0, 0, 1); if( sc->data[type]){ // Target still lives. [LimitLine] - sc_timer_next(3000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(3000 + tick, status->change_timer, bl->id, data); } iMap->freeblock_unlock(); return 0; @@ -10458,11 +10432,10 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { break; case SC_FEAR: - if( --(sce->val4) > 0 ) - { + if( --(sce->val4) > 0 ) { if( sce->val2 > 0 ) sce->val2--; - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10472,78 +10445,75 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { case SC_SUMMON3: case SC_SUMMON4: case SC_SUMMON5: - if( --(sce->val4) > 0 ) - { - if( !iStatus->charge(bl, 0, 1) ) + if( --(sce->val4) > 0 ) { + if( !status->charge(bl, 0, 1) ) break; - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_READING_SB: - if( !iStatus->charge(bl, 0, sce->val2) ){ + if( !status->charge(bl, 0, sce->val2) ) { int i; for(i = SC_SPELLBOOK1; i <= SC_SPELLBOOK7; i++) // Also remove stored spell as well. status_change_end(bl, (sc_type)i, INVALID_TIMER); break; } - sc_timer_next(5000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(5000 + tick, status->change_timer, bl->id, data); return 0; case SC_ELECTRICSHOCKER: 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); + status->charge(bl, 0, st->max_sp / 100 * sce->val1 ); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_CAMOUFLAGE: - if(--(sce->val4) > 0){ - iStatus->charge(bl,0,7 - sce->val1); - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + if(--(sce->val4) > 0) { + status->charge(bl,0,7 - sce->val1); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC__REPRODUCE: - if(!iStatus->charge(bl, 0, 1)) + if(!status->charge(bl, 0, 1)) break; - sc_timer_next(1000+tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000+tick, status->change_timer, bl->id, data); return 0; case SC__SHADOWFORM: - if( --(sce->val4) > 0 ) - { - if( !iStatus->charge(bl, 0, sce->val1 - (sce->val1 - 1)) ) + if( --(sce->val4) > 0 ) { + if( !status->charge(bl, 0, sce->val1 - (sce->val1 - 1)) ) break; - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC__INVISIBILITY: if( --(sce->val4) > 0 ) { - if( !iStatus->charge(bl, 0, (st->sp * 6 - sce->val1) / 100) )// 6% - skill_lv. + if( !status->charge(bl, 0, (st->sp * 6 - sce->val1) / 100) )// 6% - skill_lv. break; - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_STRIKING: - if( --(sce->val4) > 0 ) - { - if( !iStatus->charge(bl,0, sce->val1 ) ) + if( --(sce->val4) > 0 ) { + if( !status->charge(bl,0, sce->val1 ) ) break; - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_VACUUM_EXTREME: - if( --(sce->val4) > 0 ){ - sc_timer_next(100 + tick, iStatus->change_timer, bl->id, data); + if( --(sce->val4) > 0 ) { + sc_timer_next(100 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10551,26 +10521,25 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { if( --(sce->val4) > 0 ) { struct block_list *src = iMap->id2bl(sce->val2); int damage; - if( !src || (src && (iStatus->isdead(src) || src->m != bl->m || distance_bl(src, bl) >= 12)) ) + if( !src || (src && (status->isdead(src) || src->m != bl->m || distance_bl(src, bl) >= 12)) ) break; iMap->freeblock_lock(); damage = sce->val3; - iStatus->damage(src, bl, damage, 0, clif->damage(bl,bl,tick,st->amotion,st->dmotion+200,damage,1,0,0), 1); + status->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); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); } iMap->freeblock_unlock(); - iStatus->heal(src, damage*(5 + 5 * sce->val1)/100, 0, 0); // 5 + 5% per level + status->heal(src, damage*(5 + 5 * sce->val1)/100, 0, 0); // 5 + 5% per level return 0; } break; case SC_SIREN: - if( --(sce->val4) > 0 ) - { + if( --(sce->val4) > 0 ) { clif->emotion(bl,E_LV); - sc_timer_next(2000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(2000 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10578,28 +10547,26 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { case SC_DEEP_SLEEP: 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); + status->heal(bl, st->max_hp / 100, st->max_sp / 100, 2); + sc_timer_next(2000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_SIRCLEOFNATURE: - if( --(sce->val4) > 0 ) - { - if( !iStatus->charge(bl,0,sce->val2) ) + if( --(sce->val4) > 0 ) { + if( !status->charge(bl,0,sce->val2) ) break; - iStatus->heal(bl, sce->val3, 0, 1); - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + status->heal(bl, sce->val3, 0, 1); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_SONG_OF_MANA: - if( --(sce->val4) > 0 ) - { - iStatus->heal(bl,0,sce->val3,3); - sc_timer_next(3000 + tick, iStatus->change_timer, bl->id, data); + if( --(sce->val4) > 0 ) { + status->heal(bl,0,sce->val3,3); + sc_timer_next(3000 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10610,9 +10577,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { if( --(sce->val3) > 0 ) { int hp = st->hp / 100; int sp = st->sp / 100; - if( !iStatus->charge(bl, hp, sp) ) + if( !status->charge(bl, hp, sp) ) break; - sc_timer_next(sce->val4+tick, iStatus->change_timer, bl->id, data); + sc_timer_next(sce->val4+tick, status->change_timer, bl->id, data); return 0; } break; @@ -10621,39 +10588,38 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { 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, st->max_hp * 2 / 100, st->max_sp / 100); - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + status->charge(bl, st->max_hp * 2 / 100, st->max_sp / 100); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_FORCEOFVANGUARD: - if( !iStatus->charge(bl,0,20) ) + if( !status->charge(bl,0,20) ) break; - sc_timer_next(6000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(6000 + tick, status->change_timer, bl->id, data); return 0; case SC_BANDING: - if( iStatus->charge(bl, 0, 7 - sce->val1) ) - { + if( status->charge(bl, 0, 7 - sce->val1) ) { if( sd ) pc->banding(sd, sce->val1); - sc_timer_next(5000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(5000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_LG_REFLECTDAMAGE: if( --(sce->val4) > 0 ) { - if( !iStatus->charge(bl,0,sce->val3) ) + if( !status->charge(bl,0,sce->val3) ) break; - sc_timer_next(10000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(10000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_OVERHEAT_LIMITPOINT: if( --(sce->val1) > 0 ) { // Cooling - sc_timer_next(30000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(30000 + tick, status->change_timer, bl->id, data); } break; @@ -10664,7 +10630,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { iMap->freeblock_lock(); status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,tick,0,0,damage,0,0,0)); if( sc->data[type] ) { - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); } iMap->freeblock_unlock(); } @@ -10674,19 +10640,16 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { { if( --(sce->val3) <= 0 ) break; // Time out - if( sce->val2 == bl->id ) - { - if( !iStatus->charge(bl,0,14 + (3 * sce->val1)) ) + if( sce->val2 == bl->id ) { + if( !status->charge(bl,0,14 + (3 * sce->val1)) ) break; // No more SP status should end, and in the next second will end for the other affected players - } - else - { + } else { struct block_list *src = iMap->id2bl(sce->val2); struct status_change *ssc; - if( !src || (ssc = iStatus->get_sc(src)) == NULL || !ssc->data[SC_MAGNETICFIELD] ) + if( !src || (ssc = status->get_sc(src)) == NULL || !ssc->data[SC_MAGNETICFIELD] ) break; // Source no more under Magnetic Field } - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); } break; @@ -10695,19 +10658,18 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { 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; + if( !status->charge(bl,hp,sp) ) break; - sc_timer_next(1000+tick,iStatus->change_timer,bl->id, data); + sc_timer_next(1000+tick,status->change_timer,bl->id, data); return 0; } break; case SC_RAISINGDRAGON: // 1% every 5 seconds [Jobbie] - if( --(sce->val3)>0 && iStatus->charge(bl, sce->val2, 0) ) - { + if( --(sce->val3)>0 && status->charge(bl, sce->val2, 0) ) { if( !sc->data[type] ) return 0; - sc_timer_next(5000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(5000 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10720,27 +10682,26 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { case SC_WIND_STEP: case SC_STONE_SHIELD: case SC_SOLID_SKIN: - if( !iStatus->charge(bl,0,sce->val2) ){ + if( !status->charge(bl,0,sce->val2) ){ struct block_list *s_bl = battle->get_master(bl); if( s_bl ) status_change_end(s_bl,type+1,INVALID_TIMER); status_change_end(bl,type,INVALID_TIMER); break; } - sc_timer_next(2000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(2000 + tick, status->change_timer, bl->id, data); return 0; case SC_STOMACHACHE: - if( --(sce->val4) > 0 ){ - iStatus->charge(bl,0,sce->val2); // Reduce 8 every 10 seconds. - if( sd && !pc_issit(sd) ) // Force to sit every 10 seconds. - { + if( --(sce->val4) > 0 ) { + status->charge(bl,0,sce->val2); // Reduce 8 every 10 seconds. + if( sd && !pc_issit(sd) ) { // Force to sit every 10 seconds. pc_stop_walking(sd,1|4); pc_stop_attack(sd); pc_setsit(sd); clif->sitting(bl); } - sc_timer_next(10000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(10000 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10749,51 +10710,48 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { case SC_SOULCOLD: case SC_HAWKEYES: /* they only end by status_change_end */ - sc_timer_next(600000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(600000 + tick, status->change_timer, bl->id, data); return 0; case SC_MEIKYOUSISUI: 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); + status->heal(bl, st->max_hp * (sce->val1+1) / 100, st->max_sp * sce->val1 / 100, 0); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_IZAYOI: case SC_KAGEMUSYA: - if( --(sce->val2) > 0 ){ - if(!iStatus->charge(bl, 0, 1)) break; - sc_timer_next(1000+tick, iStatus->change_timer, bl->id, data); + if( --(sce->val2) > 0 ) { + if(!status->charge(bl, 0, 1)) break; + sc_timer_next(1000+tick, status->change_timer, bl->id, data); return 0; } break; case SC_ANGRIFFS_MODUS: if(--(sce->val4) > 0) { //drain hp/sp - if( !iStatus->charge(bl,100,20) ) break; - sc_timer_next(1000+tick,iStatus->change_timer,bl->id, data); + if( !status->charge(bl,100,20) ) break; + sc_timer_next(1000+tick,status->change_timer,bl->id, data); return 0; } break; case SC_FULL_THROTTLE: - if( --(sce->val4) > 0 ) - { + if( --(sce->val4) > 0 ) { status_percent_damage(bl, bl, sce->val2, 0, false); - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_KINGS_GRACE: - if( --(sce->val4) > 0 ) - { + if( --(sce->val4) > 0 ) { status_percent_heal(bl, sce->val2, 0); - sc_timer_next(1000 + tick, iStatus->change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; case SC_FRIGG_SONG: - if( --(sce->val4) > 0 ) - { - iStatus->heal(bl, sce->val3, 0, 0); - sc_timer_next(10000 + tick, iStatus->change_timer, bl->id, data); + if( --(sce->val4) > 0 ) { + status->heal(bl, sce->val3, 0, 0); + sc_timer_next(10000 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -10807,8 +10765,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { /*========================================== * Foreach iteration of repetitive status *------------------------------------------*/ -int status_change_timer_sub(struct block_list* bl, va_list ap) -{ +int status_change_timer_sub(struct block_list* bl, va_list ap) { struct status_change* tsc; struct block_list* src = va_arg(ap,struct block_list*); @@ -10816,10 +10773,10 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) enum sc_type type = (sc_type)va_arg(ap,int); //gcc: enum args get promoted to int unsigned int tick = va_arg(ap,unsigned int); - if (iStatus->isdead(bl)) + if (status->isdead(bl)) return 0; - tsc = iStatus->get_sc(bl); + tsc = status->get_sc(bl); switch( type ) { case SC_SIGHT: /* Reveal hidden ennemy on 3*3 range */ @@ -10850,11 +10807,12 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER); break; case SC_WZ_SIGHTBLASTER: - if (battle->check_target( src, bl, BCT_ENEMY ) > 0 && - iStatus->check_skilluse(src, bl, WZ_SIGHTBLASTER, 2)) - { + if (battle->check_target( src, bl, BCT_ENEMY ) > 0 + && status->check_skilluse(src, bl, WZ_SIGHTBLASTER, 2) + ) { if (sce && !(bl->type&BL_SKILL) //The hit is not counted if it's against a trap - && skill->attack(BF_MAGIC,src,src,bl,WZ_SIGHTBLASTER,1,tick,0)){ + && skill->attack(BF_MAGIC,src,src,bl,WZ_SIGHTBLASTER,1,tick,0) + ){ sce->val2 = 0; //This signals it to end. } } @@ -10876,13 +10834,13 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) return 0; } -int status_get_total_def(struct block_list *src){ return iStatus->get_status_data(src)->def2 + (short)iStatus->get_def(src); } -int status_get_total_mdef(struct block_list *src){ return iStatus->get_status_data(src)->mdef2 + (short)status_get_mdef(src); } +int status_get_total_def(struct block_list *src) { return status->get_status_data(src)->def2 + (short)status->get_def(src); } +int status_get_total_mdef(struct block_list *src) { return status->get_status_data(src)->mdef2 + (short)status_get_mdef(src); } #ifdef RENEWAL -int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int flag){ +int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int flag) { int min = 0, max = 0, dstr; float strdex_bonus, variance; - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); if ( bl->type == BL_PC && watk->atk ){ if ( flag&2 ) @@ -10938,22 +10896,19 @@ int status_get_matk(struct block_list *bl, int flag) { if( bl == NULL ) return 1; - st = iStatus->get_status_data(bl); - sc = iStatus->get_sc(bl); + st = status->get_status_data(bl); + sc = status->get_sc(bl); sd = BL_CAST(BL_PC, bl); if( flag == 2 ) // just get matk GETRANDMATK(st); -#ifndef RENEWAL - 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 +#ifdef RENEWAL /** - * RE MATK Formula (from irowiki:http://irowiki.org/wiki/MATK) - * MATK = (sMATK + wMATK + eMATK) * Multiplicative Modifiers - **/ - st->matk_min = iStatus->base_matk(st, iStatus->get_lv(bl)); + * RE MATK Formula (from irowiki:http://irowiki.org/wiki/MATK) + * MATK = (sMATK + wMATK + eMATK) * Multiplicative Modifiers + **/ + st->matk_min = status->base_matk(st, status->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 ) @@ -10964,16 +10919,19 @@ int status_get_matk(struct block_list *bl, int flag) { 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 && (st->rhw.matk + st->lhw.matk) > 0 ){ + 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 ){ - st->matk_min = st->matk_max = status_get_int(bl) + iStatus->get_lv(bl); + } else if( bl->type&BL_MOB ) { + st->matk_min = st->matk_max = status_get_int(bl) + status->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; } +#else // not RENEWAL + 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); #endif if (bl->type&BL_PC && sd->matk_rate != 100) { st->matk_max = st->matk_max * sd->matk_rate/100; @@ -11005,10 +10963,9 @@ int status_get_matk(struct block_list *bl, int flag) { * type&1 -> buffs, type&2 -> debuffs * type&4 -> especific debuffs(implemented with refresh) *------------------------------------------*/ -int status_change_clear_buffs (struct block_list* bl, int type) -{ +int status_change_clear_buffs (struct block_list* bl, int type) { int i; - struct status_change *sc= iStatus->get_sc(bl); + struct status_change *sc= status->get_sc(bl); if (!sc || !sc->count) return 0; @@ -11017,18 +10974,17 @@ int status_change_clear_buffs (struct block_list* bl, int type) for (i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++) status_change_end(bl, (sc_type)i, INVALID_TIMER); - for( i = SC_COMMON_MAX+1; i < SC_MAX; i++ ) - { - if( !sc->data[i] || !iStatus->get_sc_type(i) ) + for( i = SC_COMMON_MAX+1; i < SC_MAX; i++ ) { + if( !sc->data[i] || !status->get_sc_type(i) ) continue; - if( type&3 && !(iStatus->get_sc_type(i)&SC_BUFF) && !(iStatus->get_sc_type(i)&SC_DEBUFF) ) + if( type&3 && !(status->get_sc_type(i)&SC_BUFF) && !(status->get_sc_type(i)&SC_DEBUFF) ) continue; - if( type < 3 ){ - if( type&1 && !(iStatus->get_sc_type(i)&SC_BUFF) ) + if( type < 3 ) { + if( type&1 && !(status->get_sc_type(i)&SC_BUFF) ) continue; - if( type&2 && !(iStatus->get_sc_type(i)&SC_DEBUFF) ) + if( type&2 && !(status->get_sc_type(i)&SC_DEBUFF) ) continue; } switch (i) { @@ -11066,7 +11022,7 @@ int status_change_clear_buffs (struct block_list* bl, int type) int status_change_spread( struct block_list *src, struct block_list *bl ) { int i, flag = 0; - struct status_change *sc = iStatus->get_sc(src); + struct status_change *sc = status->get_sc(src); unsigned int tick; struct status_change_data data; @@ -11107,7 +11063,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) { case SC_PARALYSE: if( sc->data[i]->timer != INVALID_TIMER ) { const struct TimerData *td = timer->get(sc->data[i]->timer); - if (td == NULL || td->func != iStatus->change_timer || DIFF_TICK(td->tick,tick) < 0) + if (td == NULL || td->func != status->change_timer || DIFF_TICK(td->tick,tick) < 0) continue; data.tick = DIFF_TICK(td->tick,tick); } else @@ -11138,14 +11094,13 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) { break; default: continue; - break; } - if( i ){ + if( i ) { data.val1 = sc->data[i]->val1; data.val2 = sc->data[i]->val2; data.val3 = sc->data[i]->val3; data.val4 = sc->data[i]->val4; - iStatus->change_start(bl,(sc_type)i,10000,data.val1,data.val2,data.val3,data.val4,data.tick,1|2|8); + status->change_start(bl,(sc_type)i,10000,data.val1,data.val2,data.val3,data.val4,data.tick,1|2|8); flag = 1; } } @@ -11165,10 +11120,10 @@ static int status_natural_heal(struct block_list* bl, va_list args) { struct map_session_data *sd; int val,rate,bonus = 0,flag; - regen = iStatus->get_regen_data(bl); + regen = status->get_regen_data(bl); if (!regen) return 0; - st = iStatus->get_status_data(bl); - sc = iStatus->get_sc(bl); + st = status->get_status_data(bl); + sc = status->get_sc(bl); if (sc && !sc->count) sc = NULL; sd = BL_CAST(BL_PC,bl); @@ -11179,10 +11134,11 @@ static int status_natural_heal(struct block_list* bl, va_list args) { if (flag&RGN_SP && (st->sp >= st->max_sp || regen->state.block&2)) flag&=~(RGN_SP|RGN_SSP); - if (flag && ( - iStatus->isdead(bl) || - (sc && (sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || sc->data[SC__INVISIBILITY])) - )) + if (flag + && (status->isdead(bl) + || (sc && (sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || sc->data[SC__INVISIBILITY])) + ) + ) flag=0; if (sd) { @@ -11192,37 +11148,38 @@ static int status_natural_heal(struct block_list* bl, va_list args) { pc->regen(sd, natural_heal_diff_tick); } - if(flag&(RGN_SHP|RGN_SSP) && regen->ssregen && - (vd = iStatus->get_viewdata(bl)) && vd->dead_sit == 2) - { //Apply sitting regen bonus. + if (flag&(RGN_SHP|RGN_SSP) + && regen->ssregen + && (vd = status->get_viewdata(bl)) + && vd->dead_sit == 2 + ) { + //Apply sitting regen bonus. sregen = regen->ssregen; - if(flag&(RGN_SHP)) - { //Sitting HP regen + if(flag&(RGN_SHP)) { + //Sitting HP regen val = natural_heal_diff_tick * sregen->rate.hp; if (regen->state.overweight) val>>=1; //Half as fast when overweight. sregen->tick.hp += val; - while(sregen->tick.hp >= (unsigned int)battle_config.natural_heal_skill_interval) - { + while(sregen->tick.hp >= (unsigned int)battle_config.natural_heal_skill_interval) { sregen->tick.hp -= battle_config.natural_heal_skill_interval; - if(iStatus->heal(bl, sregen->hp, 0, 3) < sregen->hp) - { //Full + if(status->heal(bl, sregen->hp, 0, 3) < sregen->hp) { + //Full flag&=~(RGN_HP|RGN_SHP); break; } } } - if(flag&(RGN_SSP)) - { //Sitting SP regen + if(flag&(RGN_SSP)) { + //Sitting SP regen val = natural_heal_diff_tick * sregen->rate.sp; if (regen->state.overweight) val>>=1; //Half as fast when overweight. sregen->tick.sp += val; - while(sregen->tick.sp >= (unsigned int)battle_config.natural_heal_skill_interval) - { + while(sregen->tick.sp >= (unsigned int)battle_config.natural_heal_skill_interval) { sregen->tick.sp -= battle_config.natural_heal_skill_interval; - if(iStatus->heal(bl, 0, sregen->sp, 3) < sregen->sp) - { //Full + if(status->heal(bl, 0, sregen->sp, 3) < sregen->sp) { + //Full flag&=~(RGN_SP|RGN_SSP); break; } @@ -11235,8 +11192,7 @@ static int status_natural_heal(struct block_list* bl, va_list args) { ud = unit->bl2ud(bl); - if (flag&(RGN_HP|RGN_SHP|RGN_SSP) && ud && ud->walktimer != INVALID_TIMER) - { + if (flag&(RGN_HP|RGN_SHP|RGN_SSP) && ud && ud->walktimer != INVALID_TIMER) { flag&=~(RGN_SHP|RGN_SSP); if(!regen->state.walk) flag&=~RGN_HP; @@ -11245,9 +11201,8 @@ static int status_natural_heal(struct block_list* bl, va_list args) { if (!flag) return 0; - if (flag&(RGN_HP|RGN_SP)) - { - if(!vd) vd = iStatus->get_viewdata(bl); + if (flag&(RGN_HP|RGN_SP)) { + if(!vd) vd = status->get_viewdata(bl); if(vd && vd->dead_sit == 2) bonus++; if(regen->state.gc) @@ -11255,8 +11210,7 @@ static int status_natural_heal(struct block_list* bl, va_list args) { } //Natural Hp regen - if (flag&RGN_HP) - { + if (flag&RGN_HP) { rate = natural_heal_diff_tick*(regen->rate.hp+bonus); if (ud && ud->walktimer != INVALID_TIMER) rate/=2; @@ -11265,35 +11219,32 @@ static int status_natural_heal(struct block_list* bl, va_list args) { regen->tick.hp += rate; - if(regen->tick.hp >= (unsigned int)battle_config.natural_healhp_interval) - { + if(regen->tick.hp >= (unsigned int)battle_config.natural_healhp_interval) { val = 0; do { val += regen->hp; regen->tick.hp -= battle_config.natural_healhp_interval; } while(regen->tick.hp >= (unsigned int)battle_config.natural_healhp_interval); - if (iStatus->heal(bl, val, 0, 1) < val) + if (status->heal(bl, val, 0, 1) < val) flag&=~RGN_SHP; //full. } } //Natural SP regen - if(flag&RGN_SP) - { + if(flag&RGN_SP) { rate = natural_heal_diff_tick*(regen->rate.sp+bonus); // Homun SP regen fix (they should regen as if they were sitting (twice as fast) if(bl->type==BL_HOM) rate *=2; regen->tick.sp += rate; - if(regen->tick.sp >= (unsigned int)battle_config.natural_healsp_interval) - { + if(regen->tick.sp >= (unsigned int)battle_config.natural_healsp_interval) { val = 0; do { val += regen->sp; regen->tick.sp -= battle_config.natural_healsp_interval; } while(regen->tick.sp >= (unsigned int)battle_config.natural_healsp_interval); - if (iStatus->heal(bl, 0, val, 1) < val) + if (status->heal(bl, 0, val, 1) < val) flag&=~RGN_SSP; //full. } } @@ -11304,40 +11255,38 @@ static int status_natural_heal(struct block_list* bl, va_list args) { //Skill regen sregen = regen->sregen; - if(flag&RGN_SHP) - { //Skill HP regen + if(flag&RGN_SHP) { + //Skill HP regen sregen->tick.hp += natural_heal_diff_tick * sregen->rate.hp; - while(sregen->tick.hp >= (unsigned int)battle_config.natural_heal_skill_interval) - { + while(sregen->tick.hp >= (unsigned int)battle_config.natural_heal_skill_interval) { sregen->tick.hp -= battle_config.natural_heal_skill_interval; - if(iStatus->heal(bl, sregen->hp, 0, 3) < sregen->hp) + if(status->heal(bl, sregen->hp, 0, 3) < sregen->hp) break; //Full } } - if(flag&RGN_SSP) - { //Skill SP regen + if(flag&RGN_SSP) { + //Skill SP regen sregen->tick.sp += natural_heal_diff_tick * sregen->rate.sp; - while(sregen->tick.sp >= (unsigned int)battle_config.natural_heal_skill_interval) - { + while(sregen->tick.sp >= (unsigned int)battle_config.natural_heal_skill_interval) { val = sregen->sp; if (sd && sd->state.doridori) { val*=2; sd->state.doridori = 0; if ((rate = pc->checkskill(sd,TK_SPTIME))) - sc_start(bl,iStatus->skill2sc(TK_SPTIME), - 100,rate,skill->get_time(TK_SPTIME, rate)); - if ( - (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && - rnd()%10000 < battle_config.sg_angel_skill_ratio - ) { //Angel of the Sun/Moon/Star - clif->feel_hate_reset(sd); - pc->resethate(sd); - pc->resetfeel(sd); + sc_start(bl,status->skill2sc(TK_SPTIME), + 100,rate,skill->get_time(TK_SPTIME, rate)); + if ((sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR + &&rnd()%10000 < battle_config.sg_angel_skill_ratio + ) { + //Angel of the Sun/Moon/Star + clif->feel_hate_reset(sd); + pc->resethate(sd); + pc->resetfeel(sd); } } sregen->tick.sp -= battle_config.natural_heal_skill_interval; - if(iStatus->heal(bl, 0, val, 3) < val) + if(status->heal(bl, 0, val, 3) < val) break; //Full } } @@ -11548,22 +11497,20 @@ int status_readdb(void) /*========================================== * Status db init and destroy. *------------------------------------------*/ -int do_init_status(void) -{ - timer->add_func_list(iStatus->change_timer,"status_change_timer"); +int do_init_status(void) { + timer->add_func_list(status->change_timer,"status_change_timer"); timer->add_func_list(kaahi_heal_timer,"kaahi_heal_timer"); timer->add_func_list(status_natural_heal_timer,"status_natural_heal_timer"); initChangeTables(); initDummyData(); - iStatus->readdb(); + status->readdb(); status_calc_sigma(); natural_heal_prev_tick = timer->gettick(); sc_data_ers = ers_new(sizeof(struct status_change_entry),"status.c::sc_data_ers",ERS_OPT_NONE); timer->add_interval(natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, status_natural_heal_timer, 0, 0, NATURAL_HEAL_INTERVAL); return 0; } -void do_final_status(void) -{ +void do_final_status(void) { ers_destroy(sc_data_ers); } @@ -11573,100 +11520,100 @@ void do_final_status(void) * created by Susu *-------------------------------------*/ void status_defaults(void) { - iStatus = &iStatus_s; + status = &status_s; /* vars */ - iStatus->current_equip_item_index = 0; //Contains inventory index of an equipped item. To pass it into the EQUP_SCRIPT [Lupus] - iStatus->current_equip_card_id = 0; //To prevent card-stacking (from jA) [Skotlex] + status->current_equip_item_index = 0; //Contains inventory index of an equipped item. To pass it into the EQUP_SCRIPT [Lupus] + status->current_equip_card_id = 0; //To prevent card-stacking (from jA) [Skotlex] //we need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only //to avoid cards exploits /* funcs */ - iStatus->get_refine_chance = status_get_refine_chance; + status->get_refine_chance = status_get_refine_chance; // for looking up associated data - iStatus->skill2sc = status_skill2sc; - iStatus->sc2skill = status_sc2skill; - iStatus->sc2scb_flag = status_sc2scb_flag; - iStatus->type2relevant_bl_types = status_type2relevant_bl_types; - iStatus->get_sc_type = status_get_sc_type; + status->skill2sc = status_skill2sc; + status->sc2skill = status_sc2skill; + status->sc2scb_flag = status_sc2scb_flag; + status->type2relevant_bl_types = status_type2relevant_bl_types; + status->get_sc_type = status_get_sc_type; - iStatus->damage = status_damage; + status->damage = status_damage; //Define for standard HP/SP skill-related cost triggers (mobs require no HP/SP to use skills) - iStatus->charge = status_charge; - iStatus->percent_change = status_percent_change; + status->charge = status_charge; + status->percent_change = status_percent_change; //Used to set the hp/sp of an object to an absolute value (can't kill) - iStatus->set_hp = status_set_hp; - iStatus->set_sp = status_set_sp; - iStatus->heal = status_heal; - iStatus->revive = status_revive; - - iStatus->get_regen_data = status_get_regen_data; - iStatus->get_status_data = status_get_status_data; - iStatus->get_base_status = status_get_base_status; - iStatus->get_name = status_get_name; - iStatus->get_class = status_get_class; - iStatus->get_lv = status_get_lv; - iStatus->get_def = status_get_def; - iStatus->get_speed = status_get_speed; - iStatus->calc_attack_element = status_calc_attack_element; - iStatus->get_party_id = status_get_party_id; - iStatus->get_guild_id = status_get_guild_id; - iStatus->get_emblem_id = status_get_emblem_id; - iStatus->get_mexp = status_get_mexp; - iStatus->get_race2 = status_get_race2; - - iStatus->get_viewdata = status_get_viewdata; - iStatus->set_viewdata = status_set_viewdata; - iStatus->change_init = status_change_init; - iStatus->get_sc = status_get_sc; - - iStatus->isdead = status_isdead; - iStatus->isimmune = status_isimmune; - - iStatus->get_sc_def = status_get_sc_def; - - iStatus->change_start = status_change_start; - iStatus->change_end_ = status_change_end_; - iStatus->kaahi_heal_timer = kaahi_heal_timer; - iStatus->change_timer = status_change_timer; - iStatus->change_timer_sub = status_change_timer_sub; - iStatus->change_clear = status_change_clear; - iStatus->change_clear_buffs = status_change_clear_buffs; - - iStatus->calc_bl_ = status_calc_bl_; - iStatus->calc_mob_ = status_calc_mob_; - iStatus->calc_pet_ = status_calc_pet_; - iStatus->calc_pc_ = status_calc_pc_; - iStatus->calc_homunculus_ = status_calc_homunculus_; - iStatus->calc_mercenary_ = status_calc_mercenary_; - iStatus->calc_elemental_ = status_calc_elemental_; - - iStatus->calc_misc = status_calc_misc; - iStatus->calc_regen = status_calc_regen; - iStatus->calc_regen_rate = status_calc_regen_rate; - - iStatus->check_skilluse = status_check_skilluse; // [Skotlex] - iStatus->check_visibility = status_check_visibility; //[Skotlex] - - iStatus->change_spread = status_change_spread; - - iStatus->calc_def = status_calc_def; - iStatus->calc_def2 = status_calc_def2; - iStatus->calc_mdef = status_calc_mdef; - iStatus->calc_mdef2 = status_calc_mdef2; - iStatus->calc_batk = status_calc_batk; + status->set_hp = status_set_hp; + status->set_sp = status_set_sp; + status->heal = status_heal; + status->revive = status_revive; + + status->get_regen_data = status_get_regen_data; + status->get_status_data = status_get_status_data; + status->get_base_status = status_get_base_status; + status->get_name = status_get_name; + status->get_class = status_get_class; + status->get_lv = status_get_lv; + status->get_def = status_get_def; + status->get_speed = status_get_speed; + status->calc_attack_element = status_calc_attack_element; + status->get_party_id = status_get_party_id; + status->get_guild_id = status_get_guild_id; + status->get_emblem_id = status_get_emblem_id; + status->get_mexp = status_get_mexp; + status->get_race2 = status_get_race2; + + status->get_viewdata = status_get_viewdata; + status->set_viewdata = status_set_viewdata; + status->change_init = status_change_init; + status->get_sc = status_get_sc; + + status->isdead = status_isdead; + status->isimmune = status_isimmune; + + status->get_sc_def = status_get_sc_def; + + status->change_start = status_change_start; + status->change_end_ = status_change_end_; + status->kaahi_heal_timer = kaahi_heal_timer; + status->change_timer = status_change_timer; + status->change_timer_sub = status_change_timer_sub; + status->change_clear = status_change_clear; + status->change_clear_buffs = status_change_clear_buffs; + + status->calc_bl_ = status_calc_bl_; + status->calc_mob_ = status_calc_mob_; + status->calc_pet_ = status_calc_pet_; + status->calc_pc_ = status_calc_pc_; + status->calc_homunculus_ = status_calc_homunculus_; + status->calc_mercenary_ = status_calc_mercenary_; + status->calc_elemental_ = status_calc_elemental_; + + status->calc_misc = status_calc_misc; + status->calc_regen = status_calc_regen; + status->calc_regen_rate = status_calc_regen_rate; + + status->check_skilluse = status_check_skilluse; // [Skotlex] + status->check_visibility = status_check_visibility; //[Skotlex] + + status->change_spread = status_change_spread; + + status->calc_def = status_calc_def; + status->calc_def2 = status_calc_def2; + status->calc_mdef = status_calc_mdef; + status->calc_mdef2 = status_calc_mdef2; + status->calc_batk = status_calc_batk; #ifdef RENEWAL - iStatus->base_matk = status_base_matk; - iStatus->get_weapon_atk = status_get_weapon_atk; + status->base_matk = status_base_matk; + status->get_weapon_atk = status_get_weapon_atk; #endif - iStatus->get_total_mdef = status_get_total_mdef; - iStatus->get_total_def = status_get_total_def; + status->get_total_mdef = status_get_total_mdef; + status->get_total_def = status_get_total_def; - iStatus->get_matk = status_get_matk; + status->get_matk = status_get_matk; - iStatus->readdb = status_readdb; - iStatus->do_init_status = do_init_status; - iStatus->do_final_status = do_final_status; + status->readdb = status_readdb; + status->init = do_init_status; + status->final = do_final_status; } diff --git a/src/map/status.h b/src/map/status.h index c6da44d83..16a9be081 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1718,67 +1718,67 @@ struct status_change { //Define for standard HP damage attacks. -#define status_fix_damage(src, target, hp, walkdelay) iStatus->damage(src, target, hp, 0, walkdelay, 0) +#define status_fix_damage(src, target, hp, walkdelay) status->damage(src, target, hp, 0, walkdelay, 0) //Define for standard HP/SP damage triggers. -#define status_zap(bl, hp, sp) iStatus->damage(NULL, bl, hp, sp, 0, 1) -//Easier handling of iStatus->percent_change -#define status_percent_heal(bl, hp_rate, sp_rate) iStatus->percent_change(NULL, bl, -(hp_rate), -(sp_rate), 0) -#define status_percent_damage(src, target, hp_rate, sp_rate, kill) iStatus->percent_change(src, target, hp_rate, sp_rate, (kill)?1:2) +#define status_zap(bl, hp, sp) status->damage(NULL, bl, hp, sp, 0, 1) +//Easier handling of status->percent_change +#define status_percent_heal(bl, hp_rate, sp_rate) status->percent_change(NULL, bl, -(hp_rate), -(sp_rate), 0) +#define status_percent_damage(src, target, hp_rate, sp_rate, kill) status->percent_change(src, target, hp_rate, sp_rate, (kill)?1:2) //Instant kill with no drops/exp/etc #define status_kill(bl) status_percent_damage(NULL, bl, 100, 0, true) -#define status_get_range(bl) iStatus->get_status_data(bl)->rhw.range -#define status_get_hp(bl) iStatus->get_status_data(bl)->hp -#define status_get_max_hp(bl) iStatus->get_status_data(bl)->max_hp -#define status_get_sp(bl) iStatus->get_status_data(bl)->sp -#define status_get_max_sp(bl) iStatus->get_status_data(bl)->max_sp -#define status_get_str(bl) iStatus->get_status_data(bl)->str -#define status_get_agi(bl) iStatus->get_status_data(bl)->agi -#define status_get_vit(bl) iStatus->get_status_data(bl)->vit -#define status_get_int(bl) iStatus->get_status_data(bl)->int_ -#define status_get_dex(bl) iStatus->get_status_data(bl)->dex -#define status_get_luk(bl) iStatus->get_status_data(bl)->luk -#define status_get_hit(bl) iStatus->get_status_data(bl)->hit -#define status_get_flee(bl) iStatus->get_status_data(bl)->flee -#define status_get_mdef(bl) iStatus->get_status_data(bl)->mdef -#define status_get_flee2(bl) iStatus->get_status_data(bl)->flee2 -#define status_get_def2(bl) iStatus->get_status_data(bl)->def2 -#define status_get_mdef2(bl) iStatus->get_status_data(bl)->mdef2 -#define status_get_critical(bl) iStatus->get_status_data(bl)->cri -#define status_get_batk(bl) iStatus->get_status_data(bl)->batk -#define status_get_watk(bl) iStatus->get_status_data(bl)->rhw.atk -#define status_get_watk2(bl) iStatus->get_status_data(bl)->rhw.atk2 -#define status_get_matk_max(bl) iStatus->get_status_data(bl)->matk_max -#define status_get_matk_min(bl) iStatus->get_status_data(bl)->matk_min -#define status_get_lwatk(bl) iStatus->get_status_data(bl)->lhw.atk -#define status_get_lwatk2(bl) iStatus->get_status_data(bl)->lhw.atk2 -#define status_get_adelay(bl) iStatus->get_status_data(bl)->adelay -#define status_get_amotion(bl) iStatus->get_status_data(bl)->amotion -#define status_get_dmotion(bl) iStatus->get_status_data(bl)->dmotion -#define status_get_element(bl) iStatus->get_status_data(bl)->def_ele -#define status_get_element_level(bl) iStatus->get_status_data(bl)->ele_lv -#define status_get_attack_sc_element(bl, sc) iStatus->calc_attack_element(bl, sc, 0) -#define status_get_attack_element(bl) iStatus->get_status_data(bl)->rhw.ele -#define status_get_attack_lelement(bl) iStatus->get_status_data(bl)->lhw.ele -#define status_get_race(bl) iStatus->get_status_data(bl)->race -#define status_get_size(bl) iStatus->get_status_data(bl)->size -#define status_get_mode(bl) iStatus->get_status_data(bl)->mode +#define status_get_range(bl) status->get_status_data(bl)->rhw.range +#define status_get_hp(bl) status->get_status_data(bl)->hp +#define status_get_max_hp(bl) status->get_status_data(bl)->max_hp +#define status_get_sp(bl) status->get_status_data(bl)->sp +#define status_get_max_sp(bl) status->get_status_data(bl)->max_sp +#define status_get_str(bl) status->get_status_data(bl)->str +#define status_get_agi(bl) status->get_status_data(bl)->agi +#define status_get_vit(bl) status->get_status_data(bl)->vit +#define status_get_int(bl) status->get_status_data(bl)->int_ +#define status_get_dex(bl) status->get_status_data(bl)->dex +#define status_get_luk(bl) status->get_status_data(bl)->luk +#define status_get_hit(bl) status->get_status_data(bl)->hit +#define status_get_flee(bl) status->get_status_data(bl)->flee +#define status_get_mdef(bl) status->get_status_data(bl)->mdef +#define status_get_flee2(bl) status->get_status_data(bl)->flee2 +#define status_get_def2(bl) status->get_status_data(bl)->def2 +#define status_get_mdef2(bl) status->get_status_data(bl)->mdef2 +#define status_get_critical(bl) status->get_status_data(bl)->cri +#define status_get_batk(bl) status->get_status_data(bl)->batk +#define status_get_watk(bl) status->get_status_data(bl)->rhw.atk +#define status_get_watk2(bl) status->get_status_data(bl)->rhw.atk2 +#define status_get_matk_max(bl) status->get_status_data(bl)->matk_max +#define status_get_matk_min(bl) status->get_status_data(bl)->matk_min +#define status_get_lwatk(bl) status->get_status_data(bl)->lhw.atk +#define status_get_lwatk2(bl) status->get_status_data(bl)->lhw.atk2 +#define status_get_adelay(bl) status->get_status_data(bl)->adelay +#define status_get_amotion(bl) status->get_status_data(bl)->amotion +#define status_get_dmotion(bl) status->get_status_data(bl)->dmotion +#define status_get_element(bl) status->get_status_data(bl)->def_ele +#define status_get_element_level(bl) status->get_status_data(bl)->ele_lv +#define status_get_attack_sc_element(bl, sc) status->calc_attack_element(bl, sc, 0) +#define status_get_attack_element(bl) status->get_status_data(bl)->rhw.ele +#define status_get_attack_lelement(bl) status->get_status_data(bl)->lhw.ele +#define status_get_race(bl) status->get_status_data(bl)->race +#define status_get_size(bl) status->get_status_data(bl)->size +#define status_get_mode(bl) status->get_status_data(bl)->mode //Short version, receives rate in 1->100 range, and does not uses a flag setting. -#define sc_start(bl, type, rate, val1, tick) iStatus->change_start(bl,type,100*(rate),val1,0,0,0,tick,0) -#define sc_start2(bl, type, rate, val1, val2, tick) iStatus->change_start(bl,type,100*(rate),val1,val2,0,0,tick,0) -#define sc_start4(bl, type, rate, val1, val2, val3, val4, tick) iStatus->change_start(bl,type,100*(rate),val1,val2,val3,val4,tick,0) +#define sc_start(bl, type, rate, val1, tick) status->change_start(bl,type,100*(rate),val1,0,0,0,tick,0) +#define sc_start2(bl, type, rate, val1, val2, tick) status->change_start(bl,type,100*(rate),val1,val2,0,0,tick,0) +#define sc_start4(bl, type, rate, val1, val2, val3, val4, tick) status->change_start(bl,type,100*(rate),val1,val2,val3,val4,tick,0) -#define status_change_end(bl,type,tid) iStatus->change_end_(bl,type,tid,__FILE__,__LINE__) +#define status_change_end(bl,type,tid) status->change_end_(bl,type,tid,__FILE__,__LINE__) -#define status_calc_bl(bl, flag) iStatus->calc_bl_(bl, (enum scb_flag)(flag), false) -#define status_calc_mob(md, first) iStatus->calc_bl_(&(md)->bl, SCB_ALL, first) -#define status_calc_pet(pd, first) iStatus->calc_bl_(&(pd)->bl, SCB_ALL, first) -#define status_calc_pc(sd, first) iStatus->calc_bl_(&(sd)->bl, SCB_ALL, first) -#define status_calc_homunculus(hd, first) iStatus->calc_bl_(&(hd)->bl, SCB_ALL, first) -#define status_calc_mercenary(md, first) iStatus->calc_bl_(&(md)->bl, SCB_ALL, first) -#define status_calc_elemental(ed, first) iStatus->calc_bl_(&(ed)->bl, SCB_ALL, first) -#define status_calc_npc(nd, first) iStatus->calc_bl_(&(nd)->bl, SCB_ALL, first) +#define status_calc_bl(bl, flag) status->calc_bl_(bl, (enum scb_flag)(flag), false) +#define status_calc_mob(md, first) status->calc_bl_(&(md)->bl, SCB_ALL, first) +#define status_calc_pet(pd, first) status->calc_bl_(&(pd)->bl, SCB_ALL, first) +#define status_calc_pc(sd, first) status->calc_bl_(&(sd)->bl, SCB_ALL, first) +#define status_calc_homunculus(hd, first) status->calc_bl_(&(hd)->bl, SCB_ALL, first) +#define status_calc_mercenary(md, first) status->calc_bl_(&(md)->bl, SCB_ALL, first) +#define status_calc_elemental(ed, first) status->calc_bl_(&(ed)->bl, SCB_ALL, first) +#define status_calc_npc(nd, first) status->calc_bl_(&(nd)->bl, SCB_ALL, first) /*===================================== * Interface : status.h @@ -1878,11 +1878,11 @@ struct status_interface { int (*get_matk) (struct block_list *src, int flag); int (*readdb) (void); - int (*do_init_status) (void); - void (*do_final_status) (void); -} iStatus_s; + int (*init) (void); + void (*final) (void); +} status_s; -struct status_interface *iStatus; +struct status_interface *status; void status_defaults(void); diff --git a/src/map/unit.c b/src/map/unit.c index 4a794da09..e4ea365df 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -129,9 +129,9 @@ int unit_walktoxy_sub(struct block_list *bl) if(ud->walkpath.path_pos>=ud->walkpath.path_len) i = -1; else if(ud->walkpath.path[ud->walkpath.path_pos]&1) - i = iStatus->get_speed(bl)*MOVE_DIAGONAL_COST/MOVE_COST; + i = status->get_speed(bl)*MOVE_DIAGONAL_COST/MOVE_COST; else - i = iStatus->get_speed(bl); + i = status->get_speed(bl); if( i > 0) ud->walktimer = timer->add(timer->gettick()+i,unit->walktoxy_timer,bl->id,i); return 1; @@ -278,9 +278,9 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data) if(ud->walkpath.path_pos>=ud->walkpath.path_len) i = -1; else if(ud->walkpath.path[ud->walkpath.path_pos]&1) - i = iStatus->get_speed(bl)*14/10; + i = status->get_speed(bl)*14/10; else - i = iStatus->get_speed(bl); + i = status->get_speed(bl); if(i > 0) { ud->walktimer = timer->add(tick+i,unit->walktoxy_timer,id,i); @@ -294,7 +294,8 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data) else if (ud->target_to) { //Update target trajectory. struct block_list *tbl = iMap->id2bl(ud->target_to); - if (!tbl || !iStatus->check_visibility(bl, tbl)) { //Cancel chase. + if (!tbl || !status->check_visibility(bl, tbl)) { + //Cancel chase. ud->to_x = bl->x; ud->to_y = bl->y; if (tbl && bl->type == BL_MOB && mob->warpchase((TBL_MOB*)bl, tbl) ) @@ -376,7 +377,7 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag) ud->to_y = y; unit->set_target(ud, 0); - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (sc && sc->data[SC_CONFUSION]) //Randomize the target position iMap->random_dir(bl, &ud->to_x, &ud->to_y); @@ -451,7 +452,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int ud->state.attack_continue = flag&2?1:0; //Chase to attack. unit->set_target(ud, 0); - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); if (sc && sc->data[SC_CONFUSION]) //Randomize the target position iMap->random_dir(bl, &ud->to_x, &ud->to_y); @@ -482,9 +483,8 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int return 0; } -int unit_run(struct block_list *bl) -{ - struct status_change *sc = iStatus->get_sc(bl); +int unit_run(struct block_list *bl) { + struct status_change *sc = status->get_sc(bl); short to_x,to_y,dir_x,dir_y; int lv; int i; @@ -555,7 +555,7 @@ int unit_run(struct block_list *bl) //Exclusive function to Wug Dash state. [Jobbie/3CeAM] int unit_wugdash(struct block_list *bl, struct map_session_data *sd) { - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); short to_x,to_y,dir_x,dir_y; int lv; int i; @@ -930,7 +930,7 @@ int unit_can_move(struct block_list *bl) { nullpo_ret(bl); ud = unit->bl2ud(bl); - sc = iStatus->get_sc(bl); + sc = status->get_sc(bl); sd = BL_CAST(BL_PC, bl); if (!ud) @@ -951,45 +951,49 @@ int unit_can_move(struct block_list *bl) { return 0; //Can't move if (sc) { - if( sc->count && ( - sc->data[SC_ANKLESNARE] - || sc->data[SC_AUTOCOUNTER] - || sc->data[SC_TRICKDEAD] - || sc->data[SC_BLADESTOP] - || sc->data[SC_BLADESTOP_WAIT] - || (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF) // cannot move while gospel is in effect - || (sc->data[SC_BASILICA] && sc->data[SC_BASILICA]->val4 == bl->id) // Basilica caster cannot move - || sc->data[SC_STOP] - || sc->data[SC_RG_CCONFINE_M] - || sc->data[SC_RG_CCONFINE_S] - || sc->data[SC_GS_MADNESSCANCEL] - || (sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF) - || sc->data[SC_WHITEIMPRISON] - || sc->data[SC_ELECTRICSHOCKER] - || sc->data[SC_WUGBITE] - || sc->data[SC_THORNS_TRAP] - || sc->data[SC_MAGNETICFIELD] - || sc->data[SC__MANHOLE] - || sc->data[SC_CURSEDCIRCLE_ATKER] - || sc->data[SC_CURSEDCIRCLE_TARGET] - || (sc->data[SC_COLD] && bl->type != BL_MOB) - || sc->data[SC_NETHERWORLD] - || (sc->data[SC_CAMOUFLAGE] && sc->data[SC_CAMOUFLAGE]->val1 < 3 && !(sc->data[SC_CAMOUFLAGE]->val3&1)) - || sc->data[SC_MEIKYOUSISUI] - || sc->data[SC_KG_KAGEHUMI] - || sc->data[SC_KYOUGAKU] - || sc->data[SC_NEEDLE_OF_PARALYZE] - || sc->data[SC_VACUUM_EXTREME] - || (sc->data[SC_FEAR] && sc->data[SC_FEAR]->val2 > 0) - || (sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1) - || (sc->data[SC_DANCING] && sc->data[SC_DANCING]->val4 && ( - !sc->data[SC_LONGING] || - (sc->data[SC_DANCING]->val1&0xFFFF) == CG_MOONLIT || - (sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE - ) ) - || (sc->data[SC_CLOAKING] && //Need wall at level 1-2 - sc->data[SC_CLOAKING]->val1 < 3 && !(sc->data[SC_CLOAKING]->val4&1)) - ) ) + if( sc->count + && ( + sc->data[SC_ANKLESNARE] + || sc->data[SC_AUTOCOUNTER] + || sc->data[SC_TRICKDEAD] + || sc->data[SC_BLADESTOP] + || sc->data[SC_BLADESTOP_WAIT] + || (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF) // cannot move while gospel is in effect + || (sc->data[SC_BASILICA] && sc->data[SC_BASILICA]->val4 == bl->id) // Basilica caster cannot move + || sc->data[SC_STOP] + || sc->data[SC_RG_CCONFINE_M] + || sc->data[SC_RG_CCONFINE_S] + || sc->data[SC_GS_MADNESSCANCEL] + || (sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF) + || sc->data[SC_WHITEIMPRISON] + || sc->data[SC_ELECTRICSHOCKER] + || sc->data[SC_WUGBITE] + || sc->data[SC_THORNS_TRAP] + || sc->data[SC_MAGNETICFIELD] + || sc->data[SC__MANHOLE] + || sc->data[SC_CURSEDCIRCLE_ATKER] + || sc->data[SC_CURSEDCIRCLE_TARGET] + || (sc->data[SC_COLD] && bl->type != BL_MOB) + || sc->data[SC_NETHERWORLD] + || (sc->data[SC_CAMOUFLAGE] && sc->data[SC_CAMOUFLAGE]->val1 < 3 && !(sc->data[SC_CAMOUFLAGE]->val3&1)) + || sc->data[SC_MEIKYOUSISUI] + || sc->data[SC_KG_KAGEHUMI] + || sc->data[SC_KYOUGAKU] + || sc->data[SC_NEEDLE_OF_PARALYZE] + || sc->data[SC_VACUUM_EXTREME] + || (sc->data[SC_FEAR] && sc->data[SC_FEAR]->val2 > 0) + || (sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1) + || (sc->data[SC_CLOAKING] && sc->data[SC_CLOAKING]->val1 < 3 && !(sc->data[SC_CLOAKING]->val4&1)) //Need wall at level 1-2 + || ( + sc->data[SC_DANCING] && sc->data[SC_DANCING]->val4 + && ( + !sc->data[SC_LONGING] + || (sc->data[SC_DANCING]->val1&0xFFFF) == CG_MOONLIT + || (sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE + ) + ) + ) + ) return 0; @@ -1007,18 +1011,17 @@ int unit_can_move(struct block_list *bl) { * Resume running after a walk delay *------------------------------------------*/ -int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data) -{ +int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data) { struct unit_data *ud = (struct unit_data *)data; TBL_PC * sd = iMap->id2sd(id); if(sd && pc_isridingwug(sd)) clif->skill_nodamage(ud->bl,ud->bl,RA_WUGDASH,ud->skill_lv, - sc_start4(ud->bl,iStatus->skill2sc(RA_WUGDASH),100,ud->skill_lv,unit->getdir(ud->bl),0,0,1)); + sc_start4(ud->bl,status->skill2sc(RA_WUGDASH),100,ud->skill_lv,unit->getdir(ud->bl),0,0,1)); else clif->skill_nodamage(ud->bl,ud->bl,TK_RUN,ud->skill_lv, - sc_start4(ud->bl,iStatus->skill2sc(TK_RUN),100,ud->skill_lv,unit->getdir(ud->bl),0,0,0)); + sc_start4(ud->bl,status->skill2sc(TK_RUN),100,ud->skill_lv,unit->getdir(ud->bl),0,0,0)); if (sd) clif->walkok(sd); @@ -1074,8 +1077,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int return 1; } -int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) -{ +int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) { struct unit_data *ud; struct status_data *tstatus; struct status_change *sc; @@ -1085,14 +1087,14 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui int temp = 0, range; nullpo_ret(src); - if(iStatus->isdead(src)) + if(status->isdead(src)) return 0; //Do not continue source is dead sd = BL_CAST(BL_PC, src); ud = unit->bl2ud(src); if(ud == NULL) return 0; - sc = iStatus->get_sc(src); + sc = status->get_sc(src); if (sc && !sc->count) sc = NULL; //Unneeded @@ -1169,10 +1171,10 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if(skill->get_inf2(skill_id)&INF2_NO_TARGET_SELF && src->id == target_id) return 0; - if(!iStatus->check_skilluse(src, target, skill_id, 0)) + if(!status->check_skilluse(src, target, skill_id, 0)) return 0; - tstatus = iStatus->get_status_data(target); + tstatus = status->get_status_data(target); // Record the status of the previous skill) if(sd) { @@ -1260,7 +1262,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui case ALL_RESURRECTION: if(battle->check_undead(tstatus->race,tstatus->def_ele)) { temp = 1; - } else if (!iStatus->isdead(target)) + } else if (!status->isdead(target)) return 0; //Can't cast on non-dead characters. break; case MO_FINGEROFFENSIVE: @@ -1451,7 +1453,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui nullpo_ret(src); if (!src->prev) return 0; // not on the map - if(iStatus->isdead(src)) return 0; + if(status->isdead(src)) return 0; sd = BL_CAST(BL_PC, src); ud = unit->bl2ud(src); @@ -1460,7 +1462,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui if(ud->skilltimer != INVALID_TIMER) //Normally not needed since clif.c checks for it, but at/char/script commands don't! [Skotlex] return 0; - sc = iStatus->get_sc(src); + sc = status->get_sc(src); if (sc && !sc->count) sc = NULL; @@ -1482,7 +1484,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui } } - if (!iStatus->check_skilluse(src, NULL, skill_id, 0)) + if (!status->check_skilluse(src, NULL, skill_id, 0)) return 0; if( iMap->getcell(src->m, skill_x, skill_y, CELL_CHKWALL) ) @@ -1629,7 +1631,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous) nullpo_ret(ud = unit->bl2ud(src)); target = iMap->id2bl(target_id); - if( target==NULL || iStatus->isdead(target) ) { + if( target==NULL || status->isdead(target) ) { unit->unattackable(src); return 1; } @@ -1645,7 +1647,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous) return 0; } } - if( battle->check_target(src,target,BCT_ENEMY) <= 0 || !iStatus->check_skilluse(src, target, 0, 0) ) { + if( battle->check_target(src,target,BCT_ENEMY) <= 0 || !status->check_skilluse(src, target, 0, 0) ) { unit->unattackable(src); return 1; } @@ -1829,12 +1831,12 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick) if( src == NULL || src->prev == NULL || target==NULL || target->prev == NULL ) return 0; - if( iStatus->isdead(src) || iStatus->isdead(target) || - battle->check_target(src,target,BCT_ENEMY) <= 0 || !iStatus->check_skilluse(src, target, 0, 0) + if( status->isdead(src) || status->isdead(target) + || battle->check_target(src,target,BCT_ENEMY) <= 0 || !status->check_skilluse(src, target, 0, 0) #ifdef OFFICIAL_WALKPATH - || !path->search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) + || !path->search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) #endif - ) + ) return 0; // can't attack under these conditions if( src->m != target->m ) @@ -1862,7 +1864,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick) return 1; } - sstatus = iStatus->get_status_data(src); + sstatus = status->get_status_data(src); range = sstatus->rhw.range + 1; if( unit->is_walking(target) ) @@ -2067,12 +2069,11 @@ int unit_changeviewsize(struct block_list *bl,short size) * Returns 1 on success. 0 if it couldn't be removed or the bl was free'd * if clrtype is 1 (death), appropiate cleanup is performed. * Otherwise it is assumed bl is being warped. - * On-Kill specific stuff is not performed here, look at iStatus->damage for that. + * On-Kill specific stuff is not performed here, look at status->damage for that. *------------------------------------------*/ -int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func) -{ +int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func) { struct unit_data *ud = unit->bl2ud(bl); - struct status_change *sc = iStatus->get_sc(bl); + struct status_change *sc = status->get_sc(bl); nullpo_ret(ud); if(bl->prev == NULL) @@ -2289,7 +2290,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i /** * BL_MOB is handled by mob_dead unless the monster is not dead. **/ - if( bl->type != BL_MOB || !iStatus->isdead(bl) ) + if( bl->type != BL_MOB || !status->isdead(bl) ) clif->clearunit_area(bl,clrtype); iMap->delblock(bl); iMap->freeblock_unlock(); @@ -2341,7 +2342,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) int i; unsigned int k; - if( iStatus->isdead(bl) ) + if( status->isdead(bl) ) pc->setrestartvalue(sd,2); pc->delinvincibletimer(sd); @@ -2583,7 +2584,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) } skill->clear_unitgroup(bl); - iStatus->change_clear(bl,1); + status->change_clear(bl,1); iMap->deliddb(bl); if( bl->type != BL_PC ) //Players are handled by map_quit iMap->freeblock(bl); |