diff options
author | shennetsind <ind@henn.et> | 2013-03-02 20:16:51 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-03-02 20:16:51 -0300 |
commit | ea001385e0b98e63cfde00158fd5b7739aaa659e (patch) | |
tree | 2c1ec751af1f6349bdf045f4eebe9fea061c2cef /src | |
parent | 3654f06f8563a7ee3df6f01552bdee9902d47fd2 (diff) | |
download | hercules-ea001385e0b98e63cfde00158fd5b7739aaa659e.tar.gz hercules-ea001385e0b98e63cfde00158fd5b7739aaa659e.tar.bz2 hercules-ea001385e0b98e63cfde00158fd5b7739aaa659e.tar.xz hercules-ea001385e0b98e63cfde00158fd5b7739aaa659e.zip |
Hercules Renewal: skill.c
http://hercules.ws/board/topic/237-hercules-renewal/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 12 | ||||
-rw-r--r-- | src/map/battle.c | 284 | ||||
-rw-r--r-- | src/map/battle.h | 3 | ||||
-rw-r--r-- | src/map/chat.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 187 | ||||
-rw-r--r-- | src/map/elemental.c | 22 | ||||
-rw-r--r-- | src/map/guild.c | 8 | ||||
-rw-r--r-- | src/map/homunculus.c | 6 | ||||
-rw-r--r-- | src/map/instance.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 39 | ||||
-rw-r--r-- | src/map/mob.c | 55 | ||||
-rw-r--r-- | src/map/npc.c | 4 | ||||
-rw-r--r-- | src/map/party.c | 4 | ||||
-rw-r--r-- | src/map/pc.c | 83 | ||||
-rw-r--r-- | src/map/pet.c | 4 | ||||
-rw-r--r-- | src/map/script.c | 53 | ||||
-rw-r--r-- | src/map/skill.c | 2707 | ||||
-rw-r--r-- | src/map/skill.h | 767 | ||||
-rw-r--r-- | src/map/status.c | 132 | ||||
-rw-r--r-- | src/map/unit.c | 136 |
20 files changed, 2269 insertions, 2241 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b4233ea0b..d563ba126 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3175,7 +3175,7 @@ ACMD_FUNC(questskill) clif_displaymessage(fd, msg_txt(198)); // This skill number doesn't exist. return -1; } - if (!(skill_get_inf2(skill_id) & INF2_QUEST_SKILL)) { + if (!(skill->get_inf2(skill_id) & INF2_QUEST_SKILL)) { clif_displaymessage(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. return -1; } @@ -3219,7 +3219,7 @@ ACMD_FUNC(lostskill) clif_displaymessage(fd, msg_txt(198)); // This skill number doesn't exist. return -1; } - if (!(skill_get_inf2(skill_id) & INF2_QUEST_SKILL)) { + if (!(skill->get_inf2(skill_id) & INF2_QUEST_SKILL)) { clif_displaymessage(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. return -1; } @@ -3658,7 +3658,7 @@ ACMD_FUNC(reloadmobdb) ACMD_FUNC(reloadskilldb) { nullpo_retr(-1, sd); - skill_reload(); + skill->reload(); merc_skill_reload(); reload_elemental_skilldb(); read_mercenary_skilldb(); @@ -4236,7 +4236,7 @@ ACMD_FUNC(nuke) if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kill only lower or same GM level - skill_castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0); + skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0); clif_displaymessage(fd, msg_txt(109)); // Player has been nuked! } else { clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. @@ -5400,7 +5400,7 @@ ACMD_FUNC(skillid) { iter = db_iterator(skilldb_name2id); for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) { - idx = skill_get_index(db_data2i(data)); + idx = skill->get_index(db_data2i(data)); if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_db[idx].desc, message, skillen) == 0) { sprintf(atcmd_output, msg_txt(1164), db_data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s) clif_displaymessage(fd, atcmd_output); @@ -5459,7 +5459,7 @@ ACMD_FUNC(useskill) else bl = &sd->bl; - if (skill_get_inf(skill_id)&INF_GROUND_SKILL) + if (skill->get_inf(skill_id)&INF_GROUND_SKILL) unit_skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skill_id, skill_lv); else unit_skilluse_id(bl, pl_sd->bl.id, skill_id, skill_lv); diff --git a/src/map/battle.c b/src/map/battle.c index 33fe10cb5..572534e14 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -233,9 +233,9 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { map_freeblock_lock(); status_fix_damage(src, target, dat->damage, dat->delay); 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); + 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); + skill->counter_additional_effect(src,target,dat->skill_id,dat->skill_lv,dat->attack_type,tick); map_freeblock_unlock(); } else if( !src && dat->skill_id == CR_REFLECTSHIELD ) { /** @@ -266,9 +266,9 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, map_freeblock_lock(); status_fix_damage(src, target, damage, ddelay); // We have to seperate here between reflect damage and others [icescope] if( attack_type && !status_isdead(target) && additional_effects ) - skill_additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, gettick()); + skill->additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, gettick()); if( dmg_lv > ATK_BLOCK && attack_type ) - skill_counter_additional_effect(src, target, skill_id, skill_lv, attack_type, gettick()); + skill->counter_additional_effect(src, target, skill_id, skill_lv, attack_type, gettick()); map_freeblock_unlock(); return 0; } @@ -347,7 +347,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag int x,y; x = sg->val3 >> 16; y = sg->val3 & 0xffff; - skill_unitsetting(src,su->group->skill_id,su->group->skill_lv,x,y,1); + skill->unitsetting(src,su->group->skill_id,su->group->skill_lv,x,y,1); sg->val3 = -1; sg->limit = DIFF_TICK(gettick(),sg->tick)+300; } @@ -777,7 +777,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( skill_id == MG_NAPALMBEAT || skill_id == MG_SOULSTRIKE || skill_id == WL_SOULEXPANSION || - (skill_id && skill_get_ele(skill_id, skill_lv) == ELE_GHOST) || + (skill_id && skill->get_ele(skill_id, skill_lv) == ELE_GHOST) || (!skill_id && (status_get_status_data(src))->rhw.ele == ELE_GHOST) ){ if( skill_id == WL_SOULEXPANSION ) @@ -797,12 +797,12 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( sc->data[SC_SAFETYWALL] && (flag&(BF_SHORT|BF_MAGIC))==BF_SHORT ) { - struct skill_unit_group* group = skill_id2group(sc->data[SC_SAFETYWALL]->val3); + struct skill_unit_group* group = skill->id2group(sc->data[SC_SAFETYWALL]->val3); uint16 skill_id = sc->data[SC_SAFETYWALL]->val2; if (group) { if(skill_id == MH_STEINWAND){ if (--group->val2<=0) - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); d->dmg_lv = ATK_BLOCK; return 0; } @@ -814,11 +814,11 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if ( ( group->val2 - damage) > 0 ) { group->val2 -= damage; } else - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); return 0; #else if (--group->val2<=0) - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); d->dmg_lv = ATK_BLOCK; return 0; #endif @@ -837,7 +837,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag sc_start2(bl,SC_COMBO,100,GC_WEAPONBLOCKING,src->id,2000); return 0; } - if( (sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON && !(skill_get_nk(skill_id)&NK_NO_CARDFIX_ATK) && rnd()%100 < sce->val2 ) + if( (sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON && !(skill->get_nk(skill_id)&NK_NO_CARDFIX_ATK) && rnd()%100 < sce->val2 ) { int delay; clif_skill_nodamage(bl,bl,CR_AUTOGUARD,sce->val1,1); @@ -851,7 +851,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag unit_set_walkdelay(bl, gettick(), delay, 1); if(sc->data[SC_SHRINK] && rnd()%100<5*sce->val1) - skill_blown(bl,src,skill_get_blewcount(CR_SHRINK,1),-1,0); + skill->blown(bl,src,skill->get_blewcount(CR_SHRINK,1),-1,0); return 0; } @@ -859,7 +859,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag clif_skill_nodamage(bl, bl, RK_MILLENNIUMSHIELD, 1, 1); sce->val3 -= damage; // absorb damage d->dmg_lv = ATK_BLOCK; - sc_start(bl,SC_STUN,15,0,skill_get_time2(RK_MILLENNIUMSHIELD,sce->val1)); // There is a chance to be stuned when one shield is broken. + sc_start(bl,SC_STUN,15,0,skill->get_time2(RK_MILLENNIUMSHIELD,sce->val1)); // There is a chance to be stuned when one shield is broken. if( sce->val3 <= 0 ) { // Shield Down sce->val2--; if( sce->val2 > 0 ) { @@ -916,14 +916,14 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag } if (((sce=sc->data[SC_UTSUSEMI]) || sc->data[SC_BUNSINJYUTSU]) - && flag&BF_WEAPON && !(skill_get_nk(skill_id)&NK_NO_CARDFIX_ATK)) { + && flag&BF_WEAPON && !(skill->get_nk(skill_id)&NK_NO_CARDFIX_ATK)) { - skill_additional_effect (src, bl, skill_id, skill_lv, flag, ATK_BLOCK, gettick() ); + skill->additional_effect (src, bl, skill_id, skill_lv, flag, ATK_BLOCK, gettick() ); if( !status_isdead(src) ) - skill_counter_additional_effect( src, bl, skill_id, skill_lv, flag, gettick() ); + skill->counter_additional_effect( src, bl, skill_id, skill_lv, flag, gettick() ); if (sce) { clif_specialeffect(bl, 462, AREA); - skill_blown(src,bl,sce->val3,-1,0); + skill->blown(src,bl,sce->val3,-1,0); } //Both need to be consumed if they are active. if (sce && --(sce->val2) <= 0) @@ -1058,7 +1058,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag damage -= damage * sc->data[SC_PAIN_KILLER]->val3 / 100; } if((sce=sc->data[SC_MAGMA_FLOW]) && (rnd()%100 <= sce->val2) ){ - skill_castend_damage_id(bl,src,MH_MAGMA_FLOW,sce->val1,gettick(),0); + skill->castend_damage_id(bl,src,MH_MAGMA_FLOW,sce->val1,gettick(),0); } if( (sce = sc->data[SC_STONEHARDSKIN]) && flag&BF_WEAPON && damage > 0 ) { @@ -1066,12 +1066,12 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( src->type == BL_PC ) { TBL_PC *ssd = BL_CAST(BL_PC, src); if (ssd && ssd->status.weapon != W_BOW) - skill_break_equip(src, EQP_WEAPON, 3000, BCT_SELF); + skill->break_equip(src, EQP_WEAPON, 3000, BCT_SELF); } else - skill_break_equip(src, EQP_WEAPON, 3000, BCT_SELF); + skill->break_equip(src, EQP_WEAPON, 3000, BCT_SELF); // 30% chance to reduce monster's ATK by 25% for 10 seconds. if( src->type == BL_MOB ) - sc_start(src, SC_STRIPWEAPON, 30, 0, skill_get_time2(RK_STONEHARDSKIN, sce->val1)); + sc_start(src, SC_STRIPWEAPON, 30, 0, skill->get_time2(RK_STONEHARDSKIN, sce->val1)); if( sce->val2 <= 0 ) status_change_end(bl, SC_STONEHARDSKIN, INVALID_TIMER); } @@ -1132,7 +1132,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag 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); + pc_addspiritball(sd,skill->get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3); if (sc->data[SC_STYLE_CHANGE] && rnd()%2) { TBL_HOM *hd = BL_CAST(BL_HOM,bl); if (hd) hom_addspiritball(hd, 10); //add a sphere @@ -1191,7 +1191,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag } } 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)); + 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 ) status_change_spread(src, bl); if (sc->data[SC_STYLE_CHANGE] && rnd()%2) { @@ -1235,7 +1235,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag } if( sd ) { if( pc_ismadogear(sd) && rnd()%100 < 50 ) { - short element = skill_get_ele(skill_id, skill_lv); + short element = skill->get_ele(skill_id, skill_lv); if( !skill_id || element == -1 ) { //Take weapon's element struct status_data *sstatus = NULL; if( src->type == BL_PC && ((TBL_PC*)src)->bonus.arrow_ele ) @@ -1590,14 +1590,13 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk /*========================================== * Consumes ammo for the given skill. *------------------------------------------*/ -void battle_consume_ammo(TBL_PC*sd, int skill, int lv) -{ +void battle_consume_ammo(TBL_PC*sd, int skill_id, int lv) { int qty=1; if (!battle_config.arrow_decrement) return; if (skill) { - qty = skill_get_ammo_qty(skill, lv); + qty = skill->get_ammo_qty(skill_id, lv); if (!qty) qty = 1; } @@ -1619,7 +1618,7 @@ static int battle_range_type( return BF_LONG; } //based on used skill's range - if (skill_get_range2(src, skill_id, skill_lv) < 5) + if (skill->get_range2(src, skill_id, skill_lv) < 5) return BF_SHORT; return BF_LONG; } @@ -1661,7 +1660,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag) { unsigned int skillratio = 100; //Skill dmg modifiers. - short skill=0; + short temp=0; short s_ele, s_ele_, t_class; int i, nk; bool n_ele = false; // non-elemental @@ -1710,16 +1709,16 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Initial Values wd.type=0; //Normal attack - wd.div_=skill_id?skill_get_num(skill_id,skill_lv):1; - wd.amotion=(skill_id && skill_get_inf(skill_id)&INF_GROUND_SKILL)?0:sstatus->amotion; //Amotion should be 0 for ground skills. + wd.div_=skill_id?skill->get_num(skill_id,skill_lv):1; + wd.amotion=(skill_id && skill->get_inf(skill_id)&INF_GROUND_SKILL)?0:sstatus->amotion; //Amotion should be 0 for ground skills. if(skill_id == KN_AUTOCOUNTER) wd.amotion >>= 1; wd.dmotion=tstatus->dmotion; - wd.blewcount=skill_get_blewcount(skill_id,skill_lv); + wd.blewcount=skill->get_blewcount(skill_id,skill_lv); wd.flag = BF_WEAPON; //Initial Flag wd.flag |= (skill_id||wflag)?BF_SKILL:BF_NORMAL; // Baphomet card's splash damage is counted as a skill. [Inkfish] wd.dmg_lv=ATK_DEF; //This assumption simplifies the assignation later - nk = skill_get_nk(skill_id); + nk = skill->get_nk(skill_id); if( !skill_id && wflag ) //If flag, this is splash damage from Baphomet Card and it always hits. nk |= NK_NO_CARDFIX_ATK|NK_IGNORE_FLEE; flag.hit = nk&NK_IGNORE_FLEE?1:0; @@ -1739,7 +1738,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Set miscellaneous data that needs be filled regardless of hit/miss if( (sd && sd->state.arrow_atk) || - (!sd && ((skill_id && skill_get_ammotype(skill_id)) || sstatus->rhw.range>3)) + (!sd && ((skill_id && skill->get_ammotype(skill_id)) || sstatus->rhw.range>3)) ) flag.arrow = 1; @@ -1812,7 +1811,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } t_class = status_get_class(target); - s_ele = s_ele_ = skill_get_ele(skill_id, skill_lv); + s_ele = s_ele_ = skill->get_ele(skill_id, skill_lv); if( !skill_id || s_ele == -1 ) { //Take weapon's element s_ele = sstatus->rhw.ele; @@ -1866,13 +1865,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list { //Success chance is not added, the higher one is used [Skotlex] if( rnd()%100 < ( 5*skill_lv > sd->bonus.double_rate ? 5*skill_lv : sc && sc->data[SC_KAGEMUSYA]?sc->data[SC_KAGEMUSYA]->val1*3:sd->bonus.double_rate ) ) { - wd.div_ = skill_get_num(TF_DOUBLE,skill_lv?skill_lv:1); + wd.div_ = skill->get_num(TF_DOUBLE,skill_lv?skill_lv:1); wd.type = 0x08; } } else if( sd->weapontype1 == W_REVOLVER && (skill_lv = pc_checkskill(sd,GS_CHAINACTION)) > 0 && rnd()%100 < 5*skill_lv ) { - wd.div_ = skill_get_num(GS_CHAINACTION,skill_lv); + wd.div_ = skill->get_num(GS_CHAINACTION,skill_lv); wd.type = 0x08; } else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW @@ -2059,12 +2058,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sd ) { // Weaponry Research hidden bonus - if ((skill = pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) - hitrate += hitrate * ( 2 * skill ) / 100; + if ((temp = pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) + hitrate += hitrate * ( 2 * temp ) / 100; if( (sd->status.weapon == W_1HSWORD || sd->status.weapon == W_DAGGER) && - (skill = pc_checkskill(sd, GN_TRAINING_SWORD))>0 ) - hitrate += 3 * skill; + (temp = pc_checkskill(sd, GN_TRAINING_SWORD))>0 ) + hitrate += 3 * temp; } hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate); @@ -2176,7 +2175,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if(wflag>0) wd.damage/= wflag; else - ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); + ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill->get_name(skill_id)); } //Add any bonuses that modify the base baseatk+watk (pre-skills) @@ -2187,9 +2186,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if(flag.cri && sd->bonus.crit_atk_rate) ATK_ADDRATE(sd->bonus.crit_atk_rate); - if(sd->status.party_id && (skill=pc_checkskill(sd,TK_POWER)) > 0){ + if(sd->status.party_id && (temp=pc_checkskill(sd,TK_POWER)) > 0){ if( (i = party_foreachsamemap(party_sub_count, sd, 0)) > 1 ) // exclude the player himself [Inkfish] - ATK_ADDRATE(2*skill*i); + ATK_ADDRATE(2*temp*i); } } break; @@ -2871,7 +2870,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list skillratio += 800 + 100 * skill_lv; if( sd ) { // Still need official value [pakpil] short lv = (short)skill_lv; - skillratio += 100 * skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),0); + skillratio += 100 * skill->check_pc_partner(sd,skill_id,&lv,skill->get_splash(skill_id,skill_lv),0); } break; case WM_SOUND_OF_DESTRUCTION: @@ -3237,13 +3236,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list vit_def = def2; #endif if((battle->check_undead(sstatus->race,sstatus->def_ele) || sstatus->race==RC_DEMON) && //This bonus already doesnt work vs players - src->type == BL_MOB && (skill=pc_checkskill(tsd,AL_DP)) > 0) - vit_def += skill*(int)(3 +(tsd->status.base_level+1)*0.04); // submitted by orn - if( src->type == BL_MOB && (skill=pc_checkskill(tsd,RA_RANGERMAIN))>0 && + src->type == BL_MOB && (temp=pc_checkskill(tsd,AL_DP)) > 0) + vit_def += temp*(int)(3 +(tsd->status.base_level+1)*0.04); // submitted by orn + if( src->type == BL_MOB && (temp=pc_checkskill(tsd,RA_RANGERMAIN))>0 && (sstatus->race == RC_BRUTE || sstatus->race == RC_FISH || sstatus->race == RC_PLANT) ) - vit_def += skill*5; + vit_def += temp*5; #ifdef RENEWAL - if( skill == NJ_ISSEN ){//TODO: do better implementation if other skills(same func) are found [malufett] + if( temp == NJ_ISSEN ){//TODO: do better implementation if other skills(same func) are found [malufett] vit_def += def1; def1 = 0; } @@ -3342,10 +3341,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list skill_id != CR_GRANDCROSS) { //Add mastery damage if(skill_id != ASC_BREAKER && sd->status.weapon == W_KATAR && - (skill=pc_checkskill(sd,ASC_KATAR)) > 0) + (temp=pc_checkskill(sd,ASC_KATAR)) > 0) { //Adv Katar Mastery is does not applies to ASC_BREAKER, // but other masteries DO apply >_> - ATK_ADDRATE(10+ 2*skill); + ATK_ADDRATE(10+ 2*temp); } wd.damage = battle_addmastery(sd,target,wd.damage,0); @@ -3355,25 +3354,24 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if (sc && sc->data[SC_MIRACLE]) i = 2; //Star anger else ARR_FIND(0, MAX_PC_FEELHATE, i, t_class == sd->hate_mob[i]); - if (i < MAX_PC_FEELHATE && (skill=pc_checkskill(sd,sg_info[i].anger_id))) - { + if (i < MAX_PC_FEELHATE && (temp=pc_checkskill(sd,sg_info[i].anger_id))) { skillratio = sd->status.base_level + sstatus->dex + sstatus->luk; if (i == 2) skillratio += sstatus->str; //Star Anger - if (skill<4) - skillratio /= 12-3*skill; + if (temp<4) + skillratio /= 12-3*temp; ATK_ADDRATE(skillratio); } - if (skill_id == NJ_SYURIKEN && (skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) - ATK_ADD(3*skill); - if (skill_id == NJ_KUNAI) + if (skill_id == NJ_SYURIKEN && (temp = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) { + ATK_ADD(3*temp); + } else if (skill_id == NJ_KUNAI) ATK_ADD(60); } } //Here ends flag.hit section, the rest of the function applies to both hitting and missing attacks else if(wd.div_ < 0) //Since the attack missed... wd.div_ *= -1; - if(sd && (skill=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) - ATK_ADD(skill*2); + if(sd && (temp=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) + ATK_ADD(temp*2); if(skill_id==TF_POISON) ATK_ADD(15*skill_lv); @@ -3472,22 +3470,22 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list flag.lh=0; } else if(flag.rh && flag.lh) { //Dual-wield if (wd.damage) { - if( (skill = pc_checkskill(sd,AS_RIGHT)) ) - ATK_RATER(50 + (skill * 10)) - else if( (skill = pc_checkskill(sd,KO_RIGHT)) ) - ATK_RATER(70 + (skill * 10)) + if( (temp = pc_checkskill(sd,AS_RIGHT)) ) + ATK_RATER(50 + (temp * 10)) + else if( (temp = pc_checkskill(sd,KO_RIGHT)) ) + ATK_RATER(70 + (temp * 10)) if(wd.damage < 1) wd.damage = 1; } if (wd.damage2) { - if( (skill = pc_checkskill(sd,AS_LEFT)) ) - ATK_RATEL(30 + (skill * 10)) - else if( (skill = pc_checkskill(sd,KO_LEFT)) ) - ATK_RATEL(50 + (skill * 10)) + if( (temp = pc_checkskill(sd,AS_LEFT)) ) + ATK_RATEL(30 + (temp * 10)) + else if( (temp = pc_checkskill(sd,KO_LEFT)) ) + ATK_RATEL(50 + (temp * 10)) if(wd.damage2 < 1) wd.damage2 = 1; } } else if(sd->status.weapon == W_KATAR && !skill_id) { //Katars (offhand damage only applies to normal attacks, tested on Aegis 10.2) - skill = pc_checkskill(sd,TF_DOUBLE); - wd.damage2 = wd.damage * (1 + (skill * 2))/100; + temp = pc_checkskill(sd,TF_DOUBLE); + wd.damage2 = wd.damage * (1 + (temp * 2))/100; if(wd.damage && !wd.damage2) wd.damage2 = 1; flag.lh = 1; @@ -3614,13 +3612,13 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } //Initial Values ad.damage = 1; - ad.div_=skill_get_num(skill_id,skill_lv); - ad.amotion=skill_get_inf(skill_id)&INF_GROUND_SKILL?0:sstatus->amotion; //Amotion should be 0 for ground skills. + ad.div_=skill->get_num(skill_id,skill_lv); + ad.amotion=skill->get_inf(skill_id)&INF_GROUND_SKILL?0:sstatus->amotion; //Amotion should be 0 for ground skills. ad.dmotion=tstatus->dmotion; - ad.blewcount = skill_get_blewcount(skill_id,skill_lv); + ad.blewcount = skill->get_blewcount(skill_id,skill_lv); ad.flag=BF_MAGIC|BF_SKILL; ad.dmg_lv=ATK_DEF; - nk = skill_get_nk(skill_id); + nk = skill->get_nk(skill_id); flag.imdef = nk&NK_IGNORE_DEF?1:0; sd = BL_CAST(BL_PC, src); @@ -3629,7 +3627,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list tsc = status_get_sc(target); //Initialize variables that will be used afterwards - s_ele = skill_get_ele(skill_id, skill_lv); + s_ele = skill->get_ele(skill_id, skill_lv); if (s_ele == -1){ // pl=-1 : the skill takes the weapon's element s_ele = sstatus->rhw.ele; @@ -3700,7 +3698,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list * Arch Bishop **/ case AB_HIGHNESSHEAL: - ad.damage = skill_calc_heal(src, target, skill_id, skill_lv, false); + ad.damage = skill->calc_heal(src, target, skill_id, skill_lv, false); break; case PR_ASPERSIO: ad.damage = 40; @@ -3752,7 +3750,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if(mflag>0) ad.damage/= mflag; else - ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); + ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill->get_name(skill_id)); } switch(skill_id){ @@ -3971,7 +3969,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list int16 lv = skill_lv; int bandingBonus = 0; if( sc && sc->data[SC_BANDING] ) - bandingBonus = 200 * (sd ? skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),0) : 1); + bandingBonus = 200 * (sd ? skill->check_pc_partner(sd,skill_id,&lv,skill->get_splash(skill_id,skill_lv),0) : 1); skillratio = ((300 * skill_lv) + bandingBonus) * (sd ? sd->status.job_level : 1) / 25; } break; @@ -4162,7 +4160,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if(mflag>0) ad.damage+= (sstatus->rhw.atk2*skillratio/100)/mflag; else - ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); + ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_id, skill->get_name(skill_id)); } if(ad.damage<1) @@ -4235,7 +4233,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *------------------------------------------*/ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag) { - int skill; + int temp; short i, nk; short s_ele; @@ -4252,14 +4250,14 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * } //Some initial values - md.amotion=skill_get_inf(skill_id)&INF_GROUND_SKILL?0:sstatus->amotion; + md.amotion=skill->get_inf(skill_id)&INF_GROUND_SKILL?0:sstatus->amotion; md.dmotion=tstatus->dmotion; - md.div_=skill_get_num( skill_id,skill_lv ); - md.blewcount=skill_get_blewcount(skill_id,skill_lv); + md.div_=skill->get_num( skill_id,skill_lv ); + md.blewcount=skill->get_blewcount(skill_id,skill_lv); md.dmg_lv=ATK_DEF; md.flag=BF_MISC|BF_SKILL; - nk = skill_get_nk(skill_id); + nk = skill->get_nk(skill_id); sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); @@ -4269,7 +4267,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.blewcount += battle_blewcount_bonus(sd, skill_id); } - s_ele = skill_get_ele(skill_id, skill_lv); + s_ele = skill->get_ele(skill_id, skill_lv); if (s_ele < 0 && s_ele != -3) //Attack that takes weapon's element for misc attacks? Make it neutral [Skotlex] s_ele = ELE_NEUTRAL; else if (s_ele == -3) //Use random element @@ -4304,17 +4302,16 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * case HT_BLITZBEAT: case SN_FALCONASSAULT: //Blitz-beat Damage. - if(!sd || (skill = pc_checkskill(sd,HT_STEELCROW)) <= 0) - skill=0; - md.damage=(sstatus->dex/10+sstatus->int_/2+skill*3+40)*2; + if(!sd || (temp = pc_checkskill(sd,HT_STEELCROW)) <= 0) + temp=0; + md.damage=(sstatus->dex/10+sstatus->int_/2+temp*3+40)*2; if(mflag > 1) //Autocasted Blitz. nk|=NK_SPLASHSPLIT; - if (skill_id == SN_FALCONASSAULT) - { + if (skill_id == SN_FALCONASSAULT) { //Div fix of Blitzbeat - skill = skill_get_num(HT_BLITZBEAT, 5); - damage_div_fix(md.damage, skill); + temp = skill->get_num(HT_BLITZBEAT, 5); + damage_div_fix(md.damage, temp); //Falcon Assault Modifier md.damage=md.damage*(150+70*skill_lv)/100; @@ -4357,7 +4354,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * break; case NJ_ZENYNAGE: case KO_MUCHANAGE: - md.damage = skill_get_zeny(skill_id ,skill_lv); + md.damage = skill->get_zeny(skill_id ,skill_lv); if (!md.damage) md.damage = 2; md.damage = rand()%md.damage + md.damage / (skill_id==NJ_ZENYNAGE?1:2) ; if (is_boss(target)) @@ -4380,7 +4377,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.dmotion = 0; //No flinch animation. break; case NPC_EVILLAND: - md.damage = skill_calc_heal(src,target,skill_id,skill_lv,false); + md.damage = skill->calc_heal(src,target,skill_id,skill_lv,false); break; case RK_DRAGONBREATH: md.damage = ((status_get_hp(src) / 50) + (status_get_max_sp(src) / 4)) * skill_lv; @@ -4442,7 +4439,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if(mflag>0) md.damage/= mflag; else - ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); + ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill->get_name(skill_id)); } damage_div_fix(md.damage, md.div_); @@ -4552,7 +4549,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * return md; } /*========================================== - * Battle main entry, from skill_attack + * Battle main entry, from skill->attack *------------------------------------------*/ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int count) { @@ -4596,7 +4593,7 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int 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); + skill->blown(bl, src, skill->get_blewcount(SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1), unit_getdir(src), 0); clif_skill_damage(bl, src, 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, gettick(), status_get_amotion(src)+1000, 0, rdamage/10, 1, 0, 0); @@ -4715,7 +4712,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) { else status_fix_damage(src,bl,damage,0); clif_damage(bl,bl,tick,amotion,dmotion,damage,1,ATK_BLOCK,0); - skill_additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); + skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); map_freeblock_unlock(); } @@ -4806,7 +4803,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t clif_skillcastcancel(target); //Remove the casting bar. [Skotlex] clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS. status_change_end(target, SC_AUTOCOUNTER, INVALID_TIMER); - skill_attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skill_lv,tick,0); + skill->attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skill_lv,tick,0); return ATK_BLOCK; } } @@ -4814,7 +4811,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t if( tsc && tsc->data[SC_BLADESTOP_WAIT] && !is_boss(src) && (src->type == BL_PC || tsd == NULL || distance_bl(src, target) <= (tsd->status.weapon == W_FIST ? 1 : 2)) ) { uint16 skill_lv = tsc->data[SC_BLADESTOP_WAIT]->val1; - int duration = skill_get_time2(MO_BLADESTOP,skill_lv); + int duration = skill->get_time2(MO_BLADESTOP,skill_lv); status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER); if(sc_start4(src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration)) { //Target locked. @@ -4832,7 +4829,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t status_change_end(src, SC_SKILLRATE_UP, INVALID_TIMER); } if (rnd()%100 < triple_rate) { - if( skill_attack(BF_WEAPON,src,src,target,MO_TRIPLEATTACK,skillv,tick,0) ) + if( skill->attack(BF_WEAPON,src,src,target,MO_TRIPLEATTACK,skillv,tick,0) ) return ATK_DEF; return ATK_MISS; } @@ -4850,7 +4847,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t * We need to calculate the DMG before the hp reduction, because it can kill the source. * For futher information: bugreport:4950 **/ - ret_val = (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skill_lv,tick,0); + ret_val = (damage_lv)skill->attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skill_lv,tick,0); status_zap(src, sstatus->max_hp*9/100, 0);//Damage to self is always 9% if( ret_val == ATK_NONE ) @@ -4858,33 +4855,33 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t return ret_val; } if (sc->data[SC_MAGICALATTACK]) { - if( skill_attack(BF_MAGIC,src,src,target,NPC_MAGICALATTACK,sc->data[SC_MAGICALATTACK]->val1,tick,0) ) + if( skill->attack(BF_MAGIC,src,src,target,NPC_MAGICALATTACK,sc->data[SC_MAGICALATTACK]->val1,tick,0) ) return ATK_DEF; return ATK_MISS; } if( sc->data[SC_GT_ENERGYGAIN] ) { if( sd && rnd()%100 < 10 + 5 * sc->data[SC_GT_ENERGYGAIN]->val1) pc_addspiritball(sd, - skill_get_time(MO_CALLSPIRITS, sc->data[SC_GT_ENERGYGAIN]->val1), + skill->get_time(MO_CALLSPIRITS, sc->data[SC_GT_ENERGYGAIN]->val1), sc->data[SC_GT_ENERGYGAIN]->val1); } if( tsc && tsc->data[SC_GT_ENERGYGAIN] ) { if( tsd && rnd()%100 < 10 + 5 * tsc->data[SC_GT_ENERGYGAIN]->val1) pc_addspiritball(tsd, - skill_get_time(MO_CALLSPIRITS, tsc->data[SC_GT_ENERGYGAIN]->val1), + skill->get_time(MO_CALLSPIRITS, tsc->data[SC_GT_ENERGYGAIN]->val1), tsc->data[SC_GT_ENERGYGAIN]->val1); } if( sc && sc->data[SC_CRUSHSTRIKE] ){ uint16 skill_lv = sc->data[SC_CRUSHSTRIKE]->val1; status_change_end(src, SC_CRUSHSTRIKE, INVALID_TIMER); - if( skill_attack(BF_WEAPON,src,src,target,RK_CRUSHSTRIKE,skill_lv,tick,0) ) + if( skill->attack(BF_WEAPON,src,src,target,RK_CRUSHSTRIKE,skill_lv,tick,0) ) return ATK_DEF; return ATK_MISS; } } if(tsc && tsc->data[SC_KAAHI] && tsc->data[SC_KAAHI]->val4 == INVALID_TIMER && tstatus->hp < tstatus->max_hp) - tsc->data[SC_KAAHI]->val4 = add_timer(tick + skill_get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal. + tsc->data[SC_KAAHI]->val4 = add_timer(tick + skill->get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal. wd = battle->calc_attack(BF_WEAPON, src, target, 0, 0, flag); @@ -4912,27 +4909,26 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t battle->consume_ammo(sd, 0, 0); damage = wd.damage + wd.damage2; - if( damage > 0 && src != target ) - { - if( sc && sc->data[SC_DUPLELIGHT] && (wd.flag&BF_SHORT) && rnd()%100 <= 10+2*sc->data[SC_DUPLELIGHT]->val1 ) - { // Activates it only from melee damage + if( damage > 0 && src != target ) { + if( sc && sc->data[SC_DUPLELIGHT] && (wd.flag&BF_SHORT) && rnd()%100 <= 10+2*sc->data[SC_DUPLELIGHT]->val1 ){ + // Activates it only from melee damage uint16 skill_id; if( rnd()%2 == 1 ) skill_id = AB_DUPLELIGHT_MELEE; else skill_id = AB_DUPLELIGHT_MAGIC; - skill_attack(skill_get_type(skill_id), src, src, target, skill_id, sc->data[SC_DUPLELIGHT]->val1, tick, SD_LEVEL); + skill->attack(skill->get_type(skill_id), src, src, target, skill_id, sc->data[SC_DUPLELIGHT]->val1, tick, SD_LEVEL); } rdamage = battle->calc_return_damage(target,src, &damage, wd.flag, 0); if( rdamage > 0 ) { if( tsc && tsc->data[SC_REFLECTDAMAGE] ) { if( src != target )// Don't reflect your own damage (Grand Cross) - map_foreachinshootrange(battle_damage_area,target,skill_get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race,0); + map_foreachinshootrange(battle_damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race,0); } else { rdelay = clif_damage(src, src, tick, wd.amotion, sstatus->dmotion, rdamage, 1, 4, 0); //Use Reflect Shield to signal this kind of skill trigger. [Skotlex] - skill_additional_effect(target,src,CR_REFLECTSHIELD,1,BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); + skill->additional_effect(target,src,CR_REFLECTSHIELD,1,BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); } } } @@ -4940,11 +4936,11 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t wd.dmotion = clif_damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2); if (sd && sd->bonus.splash_range > 0 && damage > 0) - skill_castend_damage_id(src, target, 0, 1, tick, 0); + skill->castend_damage_id(src, target, 0, 1, tick, 0); if ( target->type == BL_SKILL && damage > 0 ){ TBL_SKILL *su = (TBL_SKILL*)target; if( su->group && su->group->skill_id == HT_BLASTMINE) - skill_blown(src, target, 3, -1, 0); + skill->blown(src, target, 3, -1, 0); } map_freeblock_lock(); @@ -4968,7 +4964,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t struct elemental_data *ed = ((TBL_PC*)target)->ed; if( ed ) { clif_skill_damage(&ed->bl, target, tick, status_get_amotion(src), 0, -30000, 1, EL_CIRCLE_OF_FIRE, tsc->data[SC_CIRCLE_OF_FIRE_OPTION]->val1, 6); - skill_attack(BF_MAGIC,&ed->bl,&ed->bl,src,EL_CIRCLE_OF_FIRE,tsc->data[SC_CIRCLE_OF_FIRE_OPTION]->val1,tick,wd.flag); + skill->attack(BF_MAGIC,&ed->bl,&ed->bl,src,EL_CIRCLE_OF_FIRE,tsc->data[SC_CIRCLE_OF_FIRE_OPTION]->val1,tick,wd.flag); } } else if( tsc->data[SC_WATER_SCREEN_OPTION] && tsc->data[SC_WATER_SCREEN_OPTION]->val1 ) { struct block_list *e_bl = map_id2bl(tsc->data[SC_WATER_SCREEN_OPTION]->val1); @@ -4992,18 +4988,18 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t if (i >= 50) skill_lv -= 2; else if (i >= 15) skill_lv--; if (skill_lv < 1) skill_lv = 1; - sp = skill_get_sp(skill_id,skill_lv) * 2 / 3; + sp = skill->get_sp(skill_id,skill_lv) * 2 / 3; if (status_charge(src, 0, sp)) { - switch (skill_get_casttype(skill_id)) { + switch (skill->get_casttype(skill_id)) { case CAST_GROUND: - skill_castend_pos2(src, target->x, target->y, skill_id, skill_lv, tick, flag); + skill->castend_pos2(src, target->x, target->y, skill_id, skill_lv, tick, flag); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(src, target, skill_id, skill_lv, tick, flag); + skill->castend_nodamage_id(src, target, skill_id, skill_lv, tick, flag); break; case CAST_DAMAGE: - skill_castend_damage_id(src, target, skill_id, skill_lv, tick, flag); + skill->castend_damage_id(src, target, skill_id, skill_lv, tick, flag); break; } } @@ -5017,19 +5013,19 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t if (r_skill != AL_HOLYLIGHT && r_skill != PR_MAGNUS) { int type; - if( (type = skill_get_casttype(r_skill)) == CAST_GROUND ) { + if( (type = skill->get_casttype(r_skill)) == CAST_GROUND ) { int maxcount = 0; if( !(BL_PC&battle_config.skill_reiteration) && - skill_get_unit_flag(r_skill)&UF_NOREITERATION ) + skill->get_unit_flag(r_skill)&UF_NOREITERATION ) type = -1; if( BL_PC&battle_config.skill_nofootset && - skill_get_unit_flag(r_skill)&UF_NOFOOTSET ) + skill->get_unit_flag(r_skill)&UF_NOFOOTSET ) type = -1; if( BL_PC&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(r_skill, r_lv)) > 0 + (maxcount = skill->get_maxcount(r_skill, r_lv)) > 0 ) { int v; for(v=0;v<MAX_SKILLUNITGROUP && sd->ud.skillunit[v] && maxcount;v++) { @@ -5048,22 +5044,22 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } sd->state.autocast = 1; - skill_consume_requirement(sd,r_skill,r_lv,3); + skill->consume_requirement(sd,r_skill,r_lv,3); switch( type ) { - case CAST_GROUND: - skill_castend_pos2(src, target->x, target->y, r_skill, r_lv, tick, flag); - break; - case CAST_NODAMAGE: - skill_castend_nodamage_id(src, target, r_skill, r_lv, tick, flag); - break; - case CAST_DAMAGE: - skill_castend_damage_id(src, target, r_skill, r_lv, tick, flag); - break; + case CAST_GROUND: + skill->castend_pos2(src, target->x, target->y, r_skill, r_lv, tick, flag); + break; + case CAST_NODAMAGE: + skill->castend_nodamage_id(src, target, r_skill, r_lv, tick, flag); + break; + case CAST_DAMAGE: + skill->castend_damage_id(src, target, r_skill, r_lv, tick, flag); + break; } sd->state.autocast = 0; - sd->ud.canact_tick = tick + skill_delayfix(src, r_skill, r_lv); - clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, r_skill, r_lv), 0, 0, 1); + sd->ud.canact_tick = tick + skill->delay_fix(src, r_skill, r_lv); + clif_status_change(src, SI_ACTIONDELAY, 1, skill->delay_fix(src, r_skill, r_lv), 0, 0, 1); } } @@ -5074,7 +5070,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t battle->drain(sd, target, wd.damage, wd.damage2, tstatus->race, is_boss(target)); } } - if (rdamage > 0 && !(tsc && tsc->data[SC_REFLECTDAMAGE])) { //By sending attack type "none" skill_additional_effect won't be invoked. [Skotlex] + if (rdamage > 0 && !(tsc && tsc->data[SC_REFLECTDAMAGE])) { //By sending attack type "none" skill->additional_effect won't be invoked. [Skotlex] if(tsd && src != target) battle->drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src)); battle->delay_damage(tick, wd.amotion, target, src, 0, CR_REFLECTSHIELD, 0, rdamage, ATK_DEF, rdelay, true); @@ -5090,9 +5086,9 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t struct status_change_entry *sce = tsc->data[SC_POISONREACT]; if (sstatus->def_ele == ELE_POISON) { sce->val2 = 0; - skill_attack(BF_WEAPON,target,target,src,AS_POISONREACT,sce->val1,tick,0); + skill->attack(BF_WEAPON,target,target,src,AS_POISONREACT,sce->val1,tick,0); } else { - skill_attack(BF_WEAPON,target,target,src,TF_POISON, 5, tick, 0); + skill->attack(BF_WEAPON,target,target,src,TF_POISON, 5, tick, 0); --sce->val2; } if (sce->val2 <= 0) @@ -5226,7 +5222,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f TBL_SKILL *su = (TBL_SKILL*)target; if( !su->group ) return 0; - if( skill_get_inf2(su->group->skill_id)&INF2_TRAP ) { //Only a few skills can target traps... + if( skill->get_inf2(su->group->skill_id)&INF2_TRAP ) { //Only a few skills can target traps... switch( battle->get_current_skill(src) ) { case RK_DRAGONBREATH:// it can only hit traps in pvp/gvg maps if( !map[m].flag.pvp && !map[m].flag.gvg ) @@ -5332,7 +5328,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return 0; if (su->group->src_id == target->id) { - int inf2 = skill_get_inf2(su->group->skill_id); + int inf2 = skill->get_inf2(su->group->skill_id); if (inf2&INF2_NO_TARGET_SELF) return -1; if (inf2&INF2_TARGET_SELF) diff --git a/src/map/battle.h b/src/map/battle.h index 848c9c3db..6aa6ade03 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -64,7 +64,6 @@ enum e_battle_check_target { //New definitions [Skotlex] BCT_NEUTRAL = 0x100000, }; - /** * Structures **/ @@ -469,7 +468,7 @@ struct Battle_Config { /** - * Misc Vars + * Vars **/ //attribute table extern int attr_fix_table[4][10][10]; diff --git a/src/map/chat.c b/src/map/chat.c index 282b1730e..33798d563 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -215,7 +215,7 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) unit = map_find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0); group = (unit != NULL) ? unit->group : NULL; if (group != NULL) - ext_skill_unit_onplace(unit, &sd->bl, group->tick); + skill->unit_onplace(unit, &sd->bl, group->tick); return 1; } diff --git a/src/map/clif.c b/src/map/clif.c index e89d1aba5..bfde233c5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1506,12 +1506,12 @@ int clif_homskillinfoblock(struct map_session_data *sd) if( (id = hd->homunculus.hskill[i].id) != 0 ){ j = id - HM_SKILLBASE; WFIFOW(fd,len ) = id; - WFIFOW(fd,len+2) = skill_get_inf(id); + WFIFOW(fd,len+2) = skill->get_inf(id); WFIFOW(fd,len+4) = 0; WFIFOW(fd,len+6) = hd->homunculus.hskill[j].lv; - WFIFOW(fd,len+8) = skill_get_sp(id,hd->homunculus.hskill[j].lv); - WFIFOW(fd,len+10)= skill_get_range2(&sd->hd->bl, id,hd->homunculus.hskill[j].lv); - safestrncpy((char*)WFIFOP(fd,len+12), skill_get_name(id), NAME_LENGTH); + WFIFOW(fd,len+8) = skill->get_sp(id,hd->homunculus.hskill[j].lv); + WFIFOW(fd,len+10)= skill->get_range2(&sd->hd->bl, id,hd->homunculus.hskill[j].lv); + safestrncpy((char*)WFIFOP(fd,len+12), skill->get_name(id), NAME_LENGTH); WFIFOB(fd,len+36) = (hd->homunculus.hskill[j].lv < merc_skill_tree_get_max(id, hd->homunculus.class_))?1:0; len+=37; } @@ -1536,9 +1536,9 @@ void clif_homskillup(struct map_session_data *sd, uint16 skill_id) WFIFOW(fd,0) = 0x239; WFIFOW(fd,2) = skill_id; WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; - WFIFOW(fd,6) = skill_get_sp(skill_id,hd->homunculus.hskill[idx].lv); - WFIFOW(fd,8) = skill_get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); - WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill_get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; WFIFOSET(fd,packet_len(0x239)); } @@ -4419,9 +4419,9 @@ static void clif_getareachar_skillunit(struct map_session_data *sd, struct skill WFIFOL(fd, 6)=unit->group->src_id; WFIFOW(fd,10)=unit->bl.x; WFIFOW(fd,12)=unit->bl.y; - if (battle_config.traps_setting&1 && skill_get_inf2(unit->group->skill_id)&INF2_TRAP) + if (battle_config.traps_setting&1 && skill->get_inf2(unit->group->skill_id)&INF2_TRAP) WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps. - else if (skill_get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) + else if (skill->get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps. else WFIFOB(fd,14)=unit->group->unit_id; @@ -4623,13 +4623,13 @@ void clif_skillinfoblock(struct map_session_data *sd) break; WFIFOW(fd,len) = id; - WFIFOL(fd,len+2) = skill_get_inf(id); + WFIFOL(fd,len+2) = skill->get_inf(id); WFIFOW(fd,len+6) = sd->status.skill[i].lv; - WFIFOW(fd,len+8) = skill_get_sp(id,sd->status.skill[i].lv); - WFIFOW(fd,len+10)= skill_get_range2(&sd->bl, id,sd->status.skill[i].lv); - safestrncpy((char*)WFIFOP(fd,len+12), skill_get_name(id), NAME_LENGTH); + WFIFOW(fd,len+8) = skill->get_sp(id,sd->status.skill[i].lv); + WFIFOW(fd,len+10)= skill->get_range2(&sd->bl, id,sd->status.skill[i].lv); + safestrncpy((char*)WFIFOP(fd,len+12), skill->get_name(id), NAME_LENGTH); if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) - WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill_tree_get_max(id, sd->status.class_))? 1:0; + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; else WFIFOB(fd,len+36) = 0; len += 37; @@ -4669,13 +4669,13 @@ void clif_addskill(struct map_session_data *sd, int id) WFIFOHEAD(fd, packet_len(0x111)); WFIFOW(fd,0) = 0x111; WFIFOW(fd,2) = id; - WFIFOL(fd,4) = skill_get_inf(id); + WFIFOL(fd,4) = skill->get_inf(id); WFIFOW(fd,8) = sd->status.skill[id].lv; - WFIFOW(fd,10) = skill_get_sp(id,sd->status.skill[id].lv); - WFIFOW(fd,12)= skill_get_range2(&sd->bl, id,sd->status.skill[id].lv); - safestrncpy((char*)WFIFOP(fd,14), skill_get_name(id), NAME_LENGTH); + WFIFOW(fd,10) = skill->get_sp(id,sd->status.skill[id].lv); + WFIFOW(fd,12)= skill->get_range2(&sd->bl, id,sd->status.skill[id].lv); + safestrncpy((char*)WFIFOP(fd,14), skill->get_name(id), NAME_LENGTH); if( sd->status.skill[id].flag == SKILL_FLAG_PERMANENT ) - WFIFOB(fd,38) = (sd->status.skill[id].lv < skill_tree_get_max(id, sd->status.class_))? 1:0; + WFIFOB(fd,38) = (sd->status.skill[id].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; else WFIFOB(fd,38) = 0; WFIFOSET(fd,packet_len(0x111)); @@ -4715,28 +4715,28 @@ void clif_skillup(struct map_session_data *sd,uint16 skill_id) WFIFOW(fd,0) = 0x10e; WFIFOW(fd,2) = skill_id; WFIFOW(fd,4) = sd->status.skill[skill_id].lv; - WFIFOW(fd,6) = skill_get_sp(skill_id,sd->status.skill[skill_id].lv); - WFIFOW(fd,8) = skill_get_range2(&sd->bl,skill_id,sd->status.skill[skill_id].lv); - WFIFOB(fd,10) = (sd->status.skill[skill_id].lv < skill_tree_get_max(sd->status.skill[skill_id].id, sd->status.class_)) ? 1 : 0; + WFIFOW(fd,6) = skill->get_sp(skill_id,sd->status.skill[skill_id].lv); + WFIFOW(fd,8) = skill->get_range2(&sd->bl,skill_id,sd->status.skill[skill_id].lv); + WFIFOB(fd,10) = (sd->status.skill[skill_id].lv < skill->tree_get_max(sd->status.skill[skill_id].id, sd->status.class_)) ? 1 : 0; WFIFOSET(fd,packet_len(0x10e)); } /// Updates a skill in the skill tree (ZC_SKILLINFO_UPDATE2). /// 07e1 <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <upgradable>.B -void clif_skillinfo(struct map_session_data *sd,int skill, int inf) +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) { const int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x7e1)); WFIFOW(fd,0) = 0x7e1; - WFIFOW(fd,2) = skill; - WFIFOL(fd,4) = inf?inf:skill_get_inf(skill); - WFIFOW(fd,8) = sd->status.skill[skill].lv; - WFIFOW(fd,10) = skill_get_sp(skill,sd->status.skill[skill].lv); - WFIFOW(fd,12) = skill_get_range2(&sd->bl,skill,sd->status.skill[skill].lv); - if( sd->status.skill[skill].flag == SKILL_FLAG_PERMANENT ) - WFIFOB(fd,14) = (sd->status.skill[skill].lv < skill_tree_get_max(skill, sd->status.class_))? 1:0; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = sd->status.skill[skill_id].lv; + WFIFOW(fd,10) = skill->get_sp(skill_id,sd->status.skill[skill_id].lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl,skill_id,sd->status.skill[skill_id].lv); + if( sd->status.skill[skill_id].flag == SKILL_FLAG_PERMANENT ) + WFIFOB(fd,14) = (sd->status.skill[skill_id].lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; else WFIFOB(fd,14) = 0; WFIFOSET(fd,packet_len(0x7e1)); @@ -5116,7 +5116,7 @@ void clif_skill_setunit(struct skill_unit *unit) WBUFW(buf,12)=unit->bl.y; if (unit->group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE) WBUFB(buf,14)=unit->val2&UF_SONG?UNT_DISSONANCE:UNT_UGLYDANCE; - else if (skill_get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) + else if (skill->get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) WBUFB(buf, 14) = UNT_DUMMYSKILL; // Only display the unit at center. else WBUFB(buf,14)=unit->group->unit_id; @@ -5254,7 +5254,7 @@ void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int WFIFOW(fd, 0)=0x18d; for(i=0,c=0;i<MAX_SKILL_PRODUCE_DB;i++){ - if( skill_can_produce_mix(sd,skill_produce_db[i].nameid, trigger, 1) && + if( skill->can_produce_mix(sd,skill_produce_db[i].nameid, trigger, 1) && ( ( skill_id > 0 && skill_produce_db[i].req_skill == skill_id ) || skill_id < 0 ) ){ if((view = itemdb_viewid(skill_produce_db[i].nameid)) > 0) @@ -5301,7 +5301,7 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id c = 0; for( i = 0; i < MAX_SKILL_PRODUCE_DB; i++ ) { - if( !skill_can_produce_mix(sd,skill_produce_db[i].nameid,trigger, qty) ) + if( !skill->can_produce_mix(sd,skill_produce_db[i].nameid,trigger, qty) ) continue; if( (view = itemdb_viewid(skill_produce_db[i].nameid)) > 0 ) @@ -5952,12 +5952,12 @@ void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv WFIFOHEAD(fd,packet_len(0x147)); WFIFOW(fd, 0)=0x147; WFIFOW(fd, 2)=skill_id; - WFIFOW(fd, 4)=skill_get_inf(skill_id); + WFIFOW(fd, 4)=skill->get_inf(skill_id); WFIFOW(fd, 6)=0; WFIFOW(fd, 8)=skill_lv; - WFIFOW(fd,10)=skill_get_sp(skill_id,skill_lv); - WFIFOW(fd,12)=skill_get_range2(&sd->bl, skill_id,skill_lv); - safestrncpy((char*)WFIFOP(fd,14),skill_get_name(skill_id),NAME_LENGTH); + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + safestrncpy((char*)WFIFOP(fd,14),skill->get_name(skill_id),NAME_LENGTH); WFIFOB(fd,38)=0; WFIFOSET(fd,packet_len(0x147)); } @@ -6880,7 +6880,7 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd) if( md && md->master && md->devotion_flag ) WBUFL(buf,6) = md->master->bl.id; - WBUFW(buf,26) = skill_get_range2(src, ML_DEVOTION, mercenary_checkskill(md, ML_DEVOTION)); + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary_checkskill(md, ML_DEVOTION)); } else { @@ -6891,7 +6891,7 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd) for( i = 0; i < 5; i++ ) WBUFL(buf,6+4*i) = sd->devotion[i]; - WBUFW(buf,26) = skill_get_range2(src, CR_DEVOTION, pc_checkskill(sd, CR_DEVOTION)); + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc_checkskill(sd, CR_DEVOTION)); } if( tsd ) @@ -7446,11 +7446,11 @@ void clif_guild_skillinfo(struct map_session_data* sd) int id = g->skill[i].id; int p = 6 + c*37; WFIFOW(fd,p+0) = id; - WFIFOL(fd,p+2) = skill_get_inf(id); + WFIFOL(fd,p+2) = skill->get_inf(id); WFIFOW(fd,p+6) = g->skill[i].lv; - WFIFOW(fd,p+8) = skill_get_sp(id, g->skill[i].lv); - WFIFOW(fd,p+10) = skill_get_range(id, g->skill[i].lv); - safestrncpy((char*)WFIFOP(fd,p+12), skill_get_name(id), NAME_LENGTH); + WFIFOW(fd,p+8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p+10) = skill->get_range(id, g->skill[i].lv); + safestrncpy((char*)WFIFOP(fd,p+12), skill->get_name(id), NAME_LENGTH); WFIFOB(fd,p+36)= (g->skill[i].lv < guild_skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; c++; } @@ -7647,8 +7647,8 @@ int clif_guild_skillup(struct map_session_data *sd,uint16 skill_id,int lv) WFIFOW(fd,0) = 0x10e; WFIFOW(fd,2) = skill_id; WFIFOW(fd,4) = lv; - WFIFOW(fd,6) = skill_get_sp(skill_id,lv); - WFIFOW(fd,8) = skill_get_range(skill_id,lv); + WFIFOW(fd,6) = skill->get_sp(skill_id,lv); + WFIFOW(fd,8) = skill->get_range(skill_id,lv); WFIFOB(fd,10) = 1; WFIFOSET(fd,11); return 0; @@ -9220,7 +9220,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_spawn(&sd->pd->bl); clif_send_petdata(sd,sd->pd,0,0); clif_send_petstatus(sd); -// skill_unit_move(&sd->pd->bl,gettick(),1); +// skill->unit_move(&sd->pd->bl,gettick(),1); } } @@ -9236,7 +9236,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if( battle_config.hom_setting&0x8 ) status_calc_bl(&sd->hd->bl, SCB_SPEED); //Homunc mimic their master's speed on each map change if( !(battle_config.hom_setting&0x2) ) - skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately + skill->unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately } if( sd->md ) { @@ -9285,7 +9285,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(sd->bl.m == sd->feel_map[0].m || sd->bl.m == sd->feel_map[1].m || sd->bl.m == sd->feel_map[2].m) - sc_start(&sd->bl, SC_KNOWLEDGE, 100, lv, skill_get_time(SG_KNOWLEDGE, lv)); + sc_start(&sd->bl, SC_KNOWLEDGE, 100, lv, skill->get_time(SG_KNOWLEDGE, lv)); } if(sd->pd && sd->pd->pet.intimate > 900) @@ -9405,13 +9405,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(pc_isdead(sd)) clif_clearunit_area(&sd->bl, CLR_DEAD); else { - skill_usave_trigger(sd); + skill->usave_trigger(sd); clif_changed_dir(&sd->bl, SELF); } // Trigger skill effects if you appear standing on them if(!battle_config.pc_invincible_time) - skill_unit_move(&sd->bl,gettick(),1); + skill->unit_move(&sd->bl,gettick(),1); } @@ -9890,7 +9890,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, break; pc_setsit(sd); - skill_sit(sd,1); + skill->sit(sd,1); clif_sitting(&sd->bl); break; case 0x03: // standup @@ -9900,7 +9900,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, return; } pc_setstand(sd); - skill_sit(sd,0); + skill->sit(sd,0); clif_standing(&sd->bl); break; } @@ -10670,15 +10670,13 @@ static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_sess if( !hd ) return; - if( skillnotok_hom(skill_id, hd) ) + if( skill->not_ok_hom(skill_id, hd) ) return; - if( hd->bl.id != target_id && skill_get_inf(skill_id)&INF_SELF_SKILL ) + if( hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) target_id = hd->bl.id; - if( hd->ud.skilltimer != INVALID_TIMER ) - { + if( hd->ud.skilltimer != INVALID_TIMER ) { if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; - } - else if( DIFF_TICK(tick, hd->ud.canact_tick) < 0 ) + } else if( DIFF_TICK(tick, hd->ud.canact_tick) < 0 ) return; lv = merc_hom_checkskill(hd, skill_id); @@ -10693,7 +10691,7 @@ static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_ses int lv; if( !hd ) return; - if( skillnotok_hom(skill_id, hd) ) + if( skill->not_ok_hom(skill_id, hd) ) return; if( hd->ud.skilltimer != INVALID_TIMER ) { if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; @@ -10715,15 +10713,13 @@ static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct if( !md ) return; - if( skillnotok_mercenary(skill_id, md) ) + if( skill->not_ok_mercenary(skill_id, md) ) return; - if( md->bl.id != target_id && skill_get_inf(skill_id)&INF_SELF_SKILL ) + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) target_id = md->bl.id; - if( md->ud.skilltimer != INVALID_TIMER ) - { + if( md->ud.skilltimer != INVALID_TIMER ) { if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; - } - else if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) + } else if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) return; lv = mercenary_checkskill(md, skill_id); @@ -10738,12 +10734,11 @@ static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct int lv; if( !md ) return; - if( skillnotok_mercenary(skill_id, md) ) + if( skill->not_ok_mercenary(skill_id, md) ) return; if( md->ud.skilltimer != INVALID_TIMER ) return; - if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) - { + if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) { clif_skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } @@ -10774,7 +10769,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( skill_lv < 1 ) skill_lv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex] - tmp = skill_get_inf(skill_id); + tmp = skill->get_inf(skill_id); if (tmp&INF_GROUND_SKILL || !tmp) return; //Using a ground/passive skill on a target? WRONG. @@ -10804,7 +10799,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( pc_issit(sd) ) return; - if( skillnotok(skill_id, sd) ) + if( skill->not_ok(skill_id, sd) ) return; if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) @@ -10874,7 +10869,7 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uin { unsigned int tick = gettick(); - if( !(skill_get_inf(skill_id)&INF_GROUND_SKILL) ) + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) return; //Using a target skill on the ground? WRONG. if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) { @@ -10891,7 +10886,7 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uin //Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex] sd->idletime = last_tick; - if( skillnotok(skill_id, sd) ) + if( skill->not_ok(skill_id, sd) ) return; if( skillmoreinfo != -1 ) { @@ -11004,7 +10999,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) } pc_delinvincibletimer(sd); - skill_castend_map(sd,skill_id,map_name); + skill->castend_map(sd,skill_id,map_name); } @@ -11036,8 +11031,8 @@ void clif_parse_ProduceMix(int fd,struct map_session_data *sd) clif_menuskill_clear(sd); return; } - if( skill_can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) - skill_produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); clif_menuskill_clear(sd); } @@ -11064,8 +11059,8 @@ void clif_parse_Cooking(int fd,struct map_session_data *sd) { clif_menuskill_clear(sd); return; } - if( skill_can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) - skill_produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); clif_menuskill_clear(sd); } @@ -11082,7 +11077,7 @@ void clif_parse_RepairItem(int fd, struct map_session_data *sd) clif_menuskill_clear(sd); return; } - skill_repairweapon(sd,RFIFOW(fd,2)); + skill->repairweapon(sd,RFIFOW(fd,2)); clif_menuskill_clear(sd); } @@ -11102,7 +11097,7 @@ void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) return; } idx = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); - skill_weaponrefine(sd, idx-2); + skill->weaponrefine(sd, idx-2); clif_menuskill_clear(sd); } @@ -11197,7 +11192,7 @@ void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) clif_menuskill_clear(sd); return; } - skill_identify(sd,idx-2); + skill->identify(sd,idx-2); clif_menuskill_clear(sd); } @@ -11214,19 +11209,19 @@ void clif_parse_SelectArrow(int fd,struct map_session_data *sd) } switch( sd->menuskill_id ) { case AC_MAKINGARROW: - skill_arrow_create(sd,RFIFOW(fd,2)); + skill->arrow_create(sd,RFIFOW(fd,2)); break; case SA_CREATECON: - skill_produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); break; case WL_READING_SB: - skill_spellbook(sd,RFIFOW(fd,2)); + skill->spellbook(sd,RFIFOW(fd,2)); break; case GC_POISONINGWEAPON: - skill_poisoningweapon(sd,RFIFOW(fd,2)); + skill->poisoningweapon(sd,RFIFOW(fd,2)); break; case NC_MAGICDECOY: - skill_magicdecoy(sd,RFIFOW(fd,2)); + skill->magicdecoy(sd,RFIFOW(fd,2)); break; } @@ -11240,7 +11235,7 @@ void clif_parse_AutoSpell(int fd,struct map_session_data *sd) { if (sd->menuskill_id != SA_AUTOSPELL) return; - skill_autospell(sd,RFIFOL(fd,2)); + skill->autospell(sd,RFIFOL(fd,2)); clif_menuskill_clear(sd); } @@ -12812,7 +12807,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) if( percent && ( percent%100 ) == 0 ) {// 10.0%, 20.0%, ..., 90.0% - sc_start(&sd->bl, status_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 } } @@ -14915,11 +14910,11 @@ void clif_mercenary_skillblock(struct map_session_data *sd) continue; j = id - MC_SKILLBASE; WFIFOW(fd,len) = id; - WFIFOL(fd,len+2) = skill_get_inf(id); + WFIFOL(fd,len+2) = skill->get_inf(id); WFIFOW(fd,len+6) = md->db->skill[j].lv; - WFIFOW(fd,len+8) = skill_get_sp(id, md->db->skill[j].lv); - WFIFOW(fd,len+10) = skill_get_range2(&md->bl, id, md->db->skill[j].lv); - safestrncpy((char*)WFIFOP(fd,len+12), skill_get_name(id), NAME_LENGTH); + WFIFOW(fd,len+8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len+10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + safestrncpy((char*)WFIFOP(fd,len+12), skill->get_name(id), NAME_LENGTH); WFIFOB(fd,len+36) = 0; // Skillable for Mercenary? len += 37; } @@ -15387,11 +15382,11 @@ void clif_parse_ItemListWindowSelected(int fd, struct map_session_data* sd) { switch( type ) { case 0: // Change Material - skill_changematerial(sd,n,item_list); + skill->changematerial(sd,n,item_list); break; case 1: // Level 1: Pure to Rough case 2: // Level 2: Rough to Pure - skill_elementalanalysis(sd,n,type,item_list); + skill->elementalanalysis(sd,n,type,item_list); break; } clif_menuskill_clear(sd); @@ -15993,7 +15988,7 @@ int clif_elementalconverter_list(struct map_session_data *sd) { WFIFOW(fd, 0)=0x1ad; for(i=0,c=0;i<MAX_SKILL_PRODUCE_DB;i++){ - if( skill_can_produce_mix(sd,skill_produce_db[i].nameid,23, 1) ){ + if( skill->can_produce_mix(sd,skill_produce_db[i].nameid,23, 1) ){ if((view = itemdb_viewid(skill_produce_db[i].nameid)) > 0) WFIFOW(fd,c*2+ 4)= view; else @@ -16147,7 +16142,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) { WFIFOW(fd,0) = 0x442; for( i = 0, c = 0; i < MAX_SKILL; i++ ) if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && - sd->status.skill[i].id < GS_GLITTERING && skill_get_type(sd->status.skill[i].id) == BF_MAGIC ) + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) { // Can't auto cast both Extended class and 3rd class skills. WFIFOW(fd,8+c*2) = sd->status.skill[i].id; c++; @@ -16264,7 +16259,7 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { return; } - skill_select_menu(sd,RFIFOW(fd,6)); + skill->select_menu(sd,RFIFOW(fd,6)); clif_menuskill_clear(sd); } diff --git a/src/map/elemental.c b/src/map/elemental.c index fc7d1cd36..c5b6302d5 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -422,20 +422,20 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned ed->last_thinktime = tick; // Not in skill range. - if( !battle->check_range(&ed->bl,bl,skill_get_range(skill_id,skill_lv)) ) { + if( !battle->check_range(&ed->bl,bl,skill->get_range(skill_id,skill_lv)) ) { // Try to walk to the target. - if( !unit_walktobl(&ed->bl, bl, skill_get_range(skill_id,skill_lv), 2) ) + if( !unit_walktobl(&ed->bl, bl, skill->get_range(skill_id,skill_lv), 2) ) elemental_unlocktarget(ed); else { // Walking, waiting to be in range. Client don't handle it, then we must handle it here. - int walk_dist = distance_bl(&ed->bl,bl) - skill_get_range(skill_id,skill_lv); + int walk_dist = distance_bl(&ed->bl,bl) - skill->get_range(skill_id,skill_lv); ed->ud.skill_id = skill_id; ed->ud.skill_lv = skill_lv; - if( skill_get_inf(skill_id) & INF_GROUND_SKILL ) - ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_pos, ed->bl.id, 0 ); + if( skill->get_inf(skill_id) & INF_GROUND_SKILL ) + ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill->castend_pos, ed->bl.id, 0 ); else - ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_id, ed->bl.id, 0 ); + ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill->castend_id, ed->bl.id, 0 ); } return 1; @@ -455,7 +455,7 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned } //Otherwise, just cast the skill. - if( skill_get_inf(skill_id) & INF_GROUND_SKILL ) + if( skill->get_inf(skill_id) & INF_GROUND_SKILL ) unit_skilluse_pos(&ed->bl, bl->x, bl->y, skill_id, skill_lv); else unit_skilluse_id(&ed->bl, bl->id, skill_id, skill_lv); @@ -499,7 +499,7 @@ int elemental_change_mode_ack(struct elemental_data *ed, int mode) { ed->target_id = bl->id; // Set new target ed->last_thinktime = gettick(); - if( skill_get_inf(skill_id) & INF_GROUND_SKILL ) + if( skill->get_inf(skill_id) & INF_GROUND_SKILL ) unit_skilluse_pos(&ed->bl, bl->x, bl->y, skill_id, skill_lv); else unit_skilluse_id(&ed->bl,bl->id,skill_id,skill_lv); @@ -556,18 +556,18 @@ int elemental_unlocktarget(struct elemental_data *ed) { } int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed) { - int idx = skill_get_index(skill_id); + int idx = skill->get_index(skill_id); nullpo_retr(1,ed); if (idx == 0) return 1; // invalid skill id - return skillnotok(skill_id, ed->master); + return skill->not_ok(skill_id, ed->master); } struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 skill_lv){ struct skill_condition req; - int idx = skill_get_index(skill_id); + int idx = skill->get_index(skill_id); memset(&req,0,sizeof(req)); diff --git a/src/map/guild.c b/src/map/guild.c index f6d4f5c49..68746def6 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1301,11 +1301,11 @@ void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint1 return; if( !skill_lv ) return; - if( sd->sc.data[type] && (group = skill_id2group(sd->sc.data[type]->val4)) ) { - skill_delunitgroup(group); + if( sd->sc.data[type] && (group = skill->id2group(sd->sc.data[type]->val4)) ) { + skill->del_unitgroup(group,ALC_MARK); status_change_end(&sd->bl,type,INVALID_TIMER); } - group = skill_unitsetting(&sd->bl,skill_id,skill_lv,sd->bl.x,sd->bl.y,0); + group = skill->unitsetting(&sd->bl,skill_id,skill_lv,sd->bl.x,sd->bl.y,0); if( group ) { sc_start4(&sd->bl,type,100,(battle_config.guild_aura&16)?0:skill_lv,0,0,group->group_id,600000);//duration doesn't matter these status never end with val4 } @@ -1338,7 +1338,7 @@ void guild_block_skill(struct map_session_data *sd, int time) uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL }; int i; for (i = 0; i < 4; i++) - skill_blockpc_start_(sd, skill_id[i], time , true); + skill->blockpc_start(sd, skill_id[i], time , true); } /*==================================================== diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 4dc30934d..096d595f8 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -269,7 +269,7 @@ int merc_skill_tree_get_max(int id, int b_class){ for(i=0;(skill_id=hskill_tree[b_class][i].id)>0;i++) if (id == skill_id) return hskill_tree[b_class][i].max; - return skill_get_max(id); + return skill->get_max(id); } void merc_hom_skillup(struct homun_data *hd,uint16 skill_id) @@ -424,7 +424,7 @@ int merc_hom_evolution(struct homun_data *hd) status_calc_homunculus(hd,1); if (!(battle_config.hom_setting&0x2)) - skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately + skill->unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately return 1 ; } @@ -471,7 +471,7 @@ int hom_mutate(struct homun_data *hd, int homun_id) status_calc_homunculus(hd,1); if (!(battle_config.hom_setting&0x2)) - skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately + skill->unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately return 1; } diff --git a/src/map/instance.c b/src/map/instance.c index 44a208866..76ae61147 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -275,7 +275,7 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) { map_clearflooritem(bl); break; case BL_SKILL: - skill_delunit((struct skill_unit *) bl); + skill->delunit((struct skill_unit *) bl); break; } diff --git a/src/map/map.c b/src/map/map.c index 8cd8bee95..dbe3937e8 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -366,7 +366,7 @@ int map_delblock(struct block_list* bl) /*========================================== * Moves a block a x/y target position. [Skotlex] - * Pass flag as 1 to prevent doing skill_unit_move checks + * Pass flag as 1 to prevent doing skill->unit_move checks * (which are executed by default on BL_CHAR types) *------------------------------------------*/ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) @@ -386,14 +386,14 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) if (bl->type&BL_CHAR) { sc = status_get_sc(bl); - skill_unit_move(bl,tick,2); + skill->unit_move(bl,tick,2); status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER); status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER); // status_change_end(bl, SC_BLADESTOP, INVALID_TIMER); //Won't stop when you are knocked away, go figure... status_change_end(bl, SC_TATAMIGAESHI, INVALID_TIMER); status_change_end(bl, SC_MAGICROD, INVALID_TIMER); if (sc->data[SC_PROPERTYWALK] && - sc->data[SC_PROPERTYWALK]->val3 >= skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) ) + sc->data[SC_PROPERTYWALK]->val3 >= skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) ) status_change_end(bl,SC_PROPERTYWALK,INVALID_TIMER); } else if (bl->type == BL_NPC) @@ -412,7 +412,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) if (bl->type&BL_CHAR) { - skill_unit_move(bl,tick,3); + skill->unit_move(bl,tick,3); if( bl->type == BL_PC && ((TBL_PC*)bl)->shadowform_id ) {//Shadow Form Target Moving struct block_list *d_bl; @@ -425,19 +425,19 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) if (sc && sc->count) { if (sc->data[SC_DANCING]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_DANCING]->val2), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_DANCING]->val2), bl->m, x1-x0, y1-y0); else { if (sc->data[SC_CLOAKING]) - skill_check_cloaking(bl, sc->data[SC_CLOAKING]); + skill->check_cloaking(bl, sc->data[SC_CLOAKING]); if (sc->data[SC_WARM]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_WARM]->val4), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_WARM]->val4), bl->m, x1-x0, y1-y0); if (sc->data[SC_BANDING]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_BANDING]->val4), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_BANDING]->val4), bl->m, x1-x0, y1-y0); if (sc->data[SC_NEUTRALBARRIER_MASTER]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_NEUTRALBARRIER_MASTER]->val2), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_NEUTRALBARRIER_MASTER]->val2), bl->m, x1-x0, y1-y0); else if (sc->data[SC_STEALTHFIELD_MASTER]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_STEALTHFIELD_MASTER]->val2), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_STEALTHFIELD_MASTER]->val2), bl->m, x1-x0, y1-y0); if( sc->data[SC__SHADOWFORM] ) {//Shadow Form Caster Moving struct block_list *d_bl; @@ -446,10 +446,10 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) } if (sc->data[SC_PROPERTYWALK] - && sc->data[SC_PROPERTYWALK]->val3 < skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) + && sc->data[SC_PROPERTYWALK]->val3 < skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,NULL,0) == NULL - && skill_unitsetting(bl,sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2,x0, y0,0)) { + && skill->unitsetting(bl,sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2,x0, y0,0)) { sc->data[SC_PROPERTYWALK]->val3++; } @@ -458,13 +458,13 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) /* Guild Aura Moving */ if( bl->type == BL_PC && ((TBL_PC*)bl)->state.gmaster_flag ) { if (sc->data[SC_LEADERSHIP]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_LEADERSHIP]->val4), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_LEADERSHIP]->val4), bl->m, x1-x0, y1-y0); if (sc->data[SC_GLORYWOUNDS]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_GLORYWOUNDS]->val4), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_GLORYWOUNDS]->val4), bl->m, x1-x0, y1-y0); if (sc->data[SC_SOULCOLD]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_SOULCOLD]->val4), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_SOULCOLD]->val4), bl->m, x1-x0, y1-y0); if (sc->data[SC_HAWKEYES]) - skill_unit_move_unit_group(skill_id2group(sc->data[SC_HAWKEYES]->val4), bl->m, x1-x0, y1-y0); + skill->unit_move_unit_group(skill->id2group(sc->data[SC_HAWKEYES]->val4), bl->m, x1-x0, y1-y0); } } } else @@ -3591,7 +3591,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) map_clearflooritem(bl); break; case BL_SKILL: - skill_delunit((struct skill_unit *) bl); + skill->delunit((struct skill_unit *) bl); break; } @@ -3653,7 +3653,7 @@ void do_final(void) do_final_pet(); do_final_mob(); do_final_msg(); - do_final_skill(); + skill->final(); do_final_status(); do_final_unit(); do_final_battleground(); @@ -3920,6 +3920,7 @@ int do_init(int argc, char *argv[]) } battle_defaults(); + skill_defaults(); battle->config_read(BATTLE_CONF_FILENAME); msg_config_read(MSG_CONF_NAME); @@ -3960,7 +3961,7 @@ int do_init(int argc, char *argv[]) do_init_clif(); do_init_script(); do_init_itemdb(); - do_init_skill(); + skill->init(); do_init_mob(); do_init_pc(); do_init_status(); diff --git a/src/map/mob.c b/src/map/mob.c index d723bfe0b..fa4bd5c7f 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -985,7 +985,7 @@ int mob_spawn (struct mob_data *md) map_addblock(&md->bl); if( map[md->bl.m].users ) clif_spawn(&md->bl); - skill_unit_move(&md->bl,tick,1); + skill->unit_move(&md->bl,tick,1); mobskill_use(md, tick, MSC_SPAWN); return 0; } @@ -2652,7 +2652,7 @@ void mob_revive(struct mob_data *md, unsigned int hp) if (!md->bl.prev) map_addblock(&md->bl); clif_spawn(&md->bl); - skill_unit_move(&md->bl,tick,1); + skill->unit_move(&md->bl,tick,1); mobskill_use(md, tick, MSC_SPAWN); if (battle_config.show_mob_info&3) clif_charnameack (0, &md->bl); @@ -3176,13 +3176,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) continue; //Skill requisite failed to be fulfilled. //Execute skill - if (skill_get_casttype(ms[i].skill_id) == CAST_GROUND) - { //Ground skill. + if (skill->get_casttype(ms[i].skill_id) == CAST_GROUND) {//Ground skill. short x, y; switch (ms[i].target) { case MST_RANDOM: //Pick a random enemy within skill range. bl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md), - skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv)); + skill->get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv)); break; case MST_TARGET: case MST_AROUND5: @@ -3217,7 +3216,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) } md->skill_idx = i; map_freeblock_lock(); - if( !battle->check_range(&md->bl,bl,skill_get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) || + if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) || !unit_skilluse_pos2(&md->bl, x, y,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) ) { map_freeblock_unlock(); @@ -3228,7 +3227,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) switch (ms[i].target) { case MST_RANDOM: //Pick a random enemy within skill range. bl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md), - skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv)); + skill->get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv)); break; case MST_TARGET: bl = map_id2bl(md->target_id); @@ -3255,7 +3254,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) md->skill_idx = i; map_freeblock_lock(); - if( !battle->check_range(&md->bl,bl,skill_get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) || + if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) || !unit_skilluse_id2(&md->bl, bl->id,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) ) { map_freeblock_unlock(); @@ -3390,21 +3389,21 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons for (i=0,j = MAX_SKILL_TREE-1;j>=0 && i< MAX_MOBSKILL ;j--) { skill_id = skill_tree[pc_class2idx(sd->status.class_)][j].id; if (!skill_id || sd->status.skill[skill_id].lv < 1 || - (skill_get_inf2(skill_id)&(INF2_WEDDING_SKILL|INF2_GUILD_SKILL)) || - skill_get_nocast(skill_id)&16 + (skill->get_inf2(skill_id)&(INF2_WEDDING_SKILL|INF2_GUILD_SKILL)) || + skill->get_nocast(skill_id)&16 ) continue; //Normal aggressive mob, disable skills that cannot help them fight //against players (those with flags UF_NOMOB and UF_NOPC are specific //to always aid players!) [Skotlex] if (!(flag&1) && - skill_get_unit_id(skill_id, 0) && - skill_get_unit_flag(skill_id)&(UF_NOMOB|UF_NOPC)) + skill->get_unit_id(skill_id, 0) && + skill->get_unit_flag(skill_id)&(UF_NOMOB|UF_NOPC)) continue; /** * The clone should be able to cast the skill (e.g. have the required weapon) bugreport:5299) **/ - if( !skill_check_condition_castbegin(sd,skill_id,sd->status.skill[skill_id].lv) ) + if( !skill->check_condition_castbegin(sd,skill_id,sd->status.skill[skill_id].lv) ) continue; memset (&ms[i], 0, sizeof(struct mob_skill)); @@ -3414,23 +3413,23 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons ms[i].permillage = 500*battle_config.mob_skill_rate/100; //Default chance of all skills: 5% ms[i].emotion = -1; ms[i].cancel = 0; - ms[i].casttime = skill_castfix(&sd->bl,skill_id, ms[i].skill_lv); - ms[i].delay = 5000+skill_delayfix(&sd->bl,skill_id, ms[i].skill_lv); + ms[i].casttime = skill->cast_fix(&sd->bl,skill_id, ms[i].skill_lv); + ms[i].delay = 5000+skill->delay_fix(&sd->bl,skill_id, ms[i].skill_lv); - inf = skill_get_inf(skill_id); + inf = skill->get_inf(skill_id); if (inf&INF_ATTACK_SKILL) { ms[i].target = MST_TARGET; ms[i].cond1 = MSC_ALWAYS; - if (skill_get_range(skill_id, ms[i].skill_lv) > 3) + if (skill->get_range(skill_id, ms[i].skill_lv) > 3) ms[i].state = MSS_ANYTARGET; else ms[i].state = MSS_BERSERK; } else if(inf&INF_GROUND_SKILL) { - if (skill_get_inf2(skill_id)&INF2_TRAP) { //Traps! + if (skill->get_inf2(skill_id)&INF2_TRAP) { //Traps! ms[i].state = MSS_IDLE; ms[i].target = MST_AROUND2; ms[i].delay = 60000; - } else if (skill_get_unit_target(skill_id) == BCT_ENEMY) { //Target Enemy + } else if (skill->get_unit_target(skill_id) == BCT_ENEMY) { //Target Enemy ms[i].state = MSS_ANYTARGET; ms[i].target = MST_TARGET; ms[i].cond1 = MSC_ALWAYS; @@ -3440,10 +3439,10 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons ms[i].cond2 = 95; } } else if (inf&INF_SELF_SKILL) { - if (skill_get_inf2(skill_id)&INF2_NO_TARGET_SELF) { //auto-select target skill. + if (skill->get_inf2(skill_id)&INF2_NO_TARGET_SELF) { //auto-select target skill. ms[i].target = MST_TARGET; ms[i].cond1 = MSC_ALWAYS; - if (skill_get_range(skill_id, ms[i].skill_lv) > 3) { + if (skill->get_range(skill_id, ms[i].skill_lv) > 3) { ms[i].state = MSS_ANYTARGET; } else { ms[i].state = MSS_BERSERK; @@ -3454,7 +3453,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons ms[i].cond2 = 90; ms[i].permillage = 2000; //Delay: Remove the stock 5 secs and add half of the support time. - ms[i].delay += -5000 +(skill_get_time(skill_id, ms[i].skill_lv) + skill_get_time2(skill_id, ms[i].skill_lv))/2; + ms[i].delay += -5000 +(skill->get_time(skill_id, ms[i].skill_lv) + skill->get_time2(skill_id, ms[i].skill_lv))/2; if (ms[i].delay < 5000) ms[i].delay = 5000; //With a minimum of 5 secs. } @@ -3467,7 +3466,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons else if (skill_id == ALL_RESURRECTION) ms[i].cond2 = 1; //Delay: Remove the stock 5 secs and add half of the support time. - ms[i].delay += -5000 +(skill_get_time(skill_id, ms[i].skill_lv) + skill_get_time2(skill_id, ms[i].skill_lv))/2; + ms[i].delay += -5000 +(skill->get_time(skill_id, ms[i].skill_lv) + skill->get_time2(skill_id, ms[i].skill_lv))/2; if (ms[i].delay < 2000) ms[i].delay = 2000; //With a minimum of 2 secs. @@ -4348,18 +4347,16 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current) } //Check that the target condition is right for the skill type. [Skotlex] - if (skill_get_casttype(ms->skill_id) == CAST_GROUND) - { //Ground skill. - if (ms->target > MST_AROUND) - { + if (skill->get_casttype(ms->skill_id) == CAST_GROUND) {//Ground skill. + if (ms->target > MST_AROUND) { ShowWarning("mob_parse_row_mobskilldb: Wrong mob skill target for ground skill %d (%s) for %s.\n", - ms->skill_id, skill_get_name(ms->skill_id), + ms->skill_id, skill->get_name(ms->skill_id), mob_id < 0?"all mobs":mob_db_data[mob_id]->sprite); ms->target = MST_TARGET; } } else if (ms->target > MST_MASTER) { ShowWarning("mob_parse_row_mobskilldb: Wrong mob skill target 'around' for non-ground skill %d (%s) for %s.\n", - ms->skill_id, skill_get_name(ms->skill_id), + ms->skill_id, skill->get_name(ms->skill_id), mob_id < 0?"all mobs":mob_db_data[mob_id]->sprite); ms->target = MST_TARGET; } diff --git a/src/map/npc.c b/src/map/npc.c index 21859727f..e032a28a7 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3411,7 +3411,7 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con if( !(mod = strtok(NULL,"\t")) ) {/* makes mod contain only the 5th param */ ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer)); - } else if( !( skill_id = skill_name2id(w4) ) || !skill_get_unit_id( skill_name2id(w4), 0) ) { + } else if( !( skill_id = skill->name2id(w4) ) || !skill->get_unit_id( skill->name2id(w4), 0) ) { ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", w4, map[m].name, filepath, strline(buffer,start-buffer)); } else if ( atoi(mod) < 1 || atoi(mod) > USHRT_MAX ) { ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", atoi(mod), w4, map[m].name, filepath, strline(buffer,start-buffer)); @@ -3430,7 +3430,7 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con if( !(mod = strtok(NULL,"\t")) ) {/* makes mod contain only the 5th param */ ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer)); - } else if( !( skill_id = skill_name2id(w4) ) ) { + } else if( !( skill_id = skill->name2id(w4) ) ) { ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", w4, map[m].name, filepath, strline(buffer,start-buffer)); } else if ( atoi(mod) < 1 || atoi(mod) > USHRT_MAX ) { ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", atoi(mod), w4, map[m].name, filepath, strline(buffer,start-buffer)); diff --git a/src/map/party.c b/src/map/party.c index d633170bd..e4d34bb1c 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -834,7 +834,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id && pc_checkskill(p_sd,MO_TRIPLEATTACK)) { sc_start4(&p_sd->bl,SC_SKILLRATE_UP,100,MO_TRIPLEATTACK, 50+50*skill_lv, //+100/150/200% rate - 0,0,skill_get_time(SG_FRIEND, 1)); + 0,0,skill->get_time(SG_FRIEND, 1)); } break; case MO_COMBOFINISH: //Increase Counter rate of Star Gladiators @@ -843,7 +843,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id && pc_checkskill(p_sd,SG_FRIEND)) { sc_start4(&p_sd->bl,SC_SKILLRATE_UP,100,TK_COUNTER, 50+50*pc_checkskill(p_sd,SG_FRIEND), //+100/150/200% rate - 0,0,skill_get_time(SG_FRIEND, 1)); + 0,0,skill->get_time(SG_FRIEND, 1)); } break; } diff --git a/src/map/pc.c b/src/map/pc.c index ff696b76e..bdf59fce4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -119,7 +119,7 @@ static int pc_invincible_timer(int tid, unsigned int tick, int id, intptr_t data return 0; } sd->invincible_timer = INVALID_TIMER; - skill_unit_move(&sd->bl,tick,1); + skill->unit_move(&sd->bl,tick,1); return 0; } @@ -141,7 +141,7 @@ void pc_delinvincibletimer(struct map_session_data* sd) { delete_timer(sd->invincible_timer,pc_invincible_timer); sd->invincible_timer = INVALID_TIMER; - skill_unit_move(&sd->bl,gettick(),1); + skill->unit_move(&sd->bl,gettick(),1); } } @@ -284,7 +284,7 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { int i, j, hp, extra_hp = 0, tmp_qty = 0, tmp_hp; struct map_session_data *bsd; struct status_change *sc; - int range = skill_get_splash(LG_BANDING,skill_lv); + int range = skill->get_splash(LG_BANDING,skill_lv); nullpo_ret(sd); @@ -1095,7 +1095,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim /** * Check if player have any cool downs on **/ - skill_cooldown_load(sd); + skill->cooldown_load(sd); /** * Check if player have any item cooldowns on @@ -1247,18 +1247,18 @@ int pc_reg_received(struct map_session_data *sd) static int pc_calc_skillpoint(struct map_session_data* sd) { - int i,skill,inf2,skill_point=0; + int i,skill_lv,inf2,skill_point=0; nullpo_ret(sd); for(i=1;i<MAX_SKILL;i++){ - if( (skill = pc_checkskill(sd,i)) > 0) { - inf2 = skill_get_inf2(i); + if( (skill_lv = pc_checkskill(sd,i)) > 0) { + inf2 = skill->get_inf2(i); if((!(inf2&INF2_QUEST_SKILL) || battle_config.quest_skill_learn) && !(inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) //Do not count wedding/link skills. [Skotlex] ) { if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) - skill_point += skill; + skill_point += skill_lv; else if(sd->status.skill[i].flag == SKILL_FLAG_REPLACED_LV_0) skill_point += (sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0); @@ -1360,9 +1360,9 @@ int pc_calc_skilltree(struct map_session_data *sd) default: break; } - if( skill_get_inf2(i)&(INF2_NPC_SKILL|INF2_GUILD_SKILL) ) + if( skill->get_inf2(i)&(INF2_NPC_SKILL|INF2_GUILD_SKILL) ) continue; //Only skills you can't have are npc/guild ones - if( skill_get_max(i) > 0 ) + if( skill->get_max(i) > 0 ) sd->status.skill[i].id = i; } return 0; @@ -1403,7 +1403,7 @@ int pc_calc_skilltree(struct map_session_data *sd) if( f ) { int inf2; - inf2 = skill_get_inf2(id); + inf2 = skill->get_inf2(id); if(!sd->status.skill[id].lv && ( (inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) || @@ -1434,7 +1434,7 @@ int pc_calc_skilltree(struct map_session_data *sd) for( i = 0; i < MAX_SKILL_TREE && (id = skill_tree[c][i].id) > 0; i++ ) { - if( (skill_get_inf2(id)&(INF2_QUEST_SKILL|INF2_WEDDING_SKILL)) ) + if( (skill->get_inf2(id)&(INF2_QUEST_SKILL|INF2_WEDDING_SKILL)) ) continue; //Do not include Quest/Wedding skills. if( sd->status.skill[id].id == 0 ) @@ -1447,7 +1447,7 @@ int pc_calc_skilltree(struct map_session_data *sd) sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv; // Remember original level } - sd->status.skill[id].lv = skill_tree_get_max(id, sd->status.class_); + sd->status.skill[id].lv = skill->tree_get_max(id, sd->status.class_); } } @@ -1455,7 +1455,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } //Checks if you can learn a new skill after having leveled up a skill. -static void pc_check_skilltree(struct map_session_data *sd, int skill) +static void pc_check_skilltree(struct map_session_data *sd, int skill_id) { int i,id=0,flag; int c=0; @@ -1502,7 +1502,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill) if( sd->status.job_level < skill_tree[c][i].joblv ) continue; - j = skill_get_inf2(id); + j = skill->get_inf2(id); if( !sd->status.skill[id].lv && ( (j&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) || j&INF2_WEDDING_SKILL || @@ -3252,8 +3252,8 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) case SP_AUTOSPELL: 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)); + 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, current_equip_card_id); } @@ -3261,8 +3261,8 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) case SP_AUTOSPELL_WHENHIT: 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)); + 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, current_equip_card_id); } @@ -3382,8 +3382,8 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4 case SP_AUTOSPELL_ONSKILL: 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)); + 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, current_equip_card_id); } @@ -3470,7 +3470,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) } else clif_addskill(sd,id); - if( !skill_get_inf(id) ) //Only recalculate for passive skills. + if( !skill->get_inf(id) ) //Only recalculate for passive skills. status_calc_pc(sd, 0); break; case 1: //Item bonus skill. @@ -4737,7 +4737,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE]; if (sce->timer != INVALID_TIMER) delete_timer(sce->timer, status_change_timer); - sce->timer = add_timer(gettick() + skill_get_time(SG_KNOWLEDGE, sce->val1), status_change_timer, sd->bl.id, SC_KNOWLEDGE); + sce->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); @@ -4749,7 +4749,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y pc_unequipitem( sd , sd->equip_index[ i ] , 2 ); } if (battle_config.clear_unit_onwarp&BL_PC) - skill_clear_unitgroup(&sd->bl); + skill->clear_unitgroup(&sd->bl); party_send_dot_remove(sd); //minimap dot fix [Kevin] guild_send_dot_remove(sd); bg_send_dot_remove(sd); @@ -4998,7 +4998,7 @@ int pc_checkallowskill(struct map_session_data *sd) 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(status_sc2skill(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); } @@ -5629,11 +5629,11 @@ 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,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)); + 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 ) { @@ -6052,11 +6052,11 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) if( sd->status.skill_point > 0 && sd->status.skill[skill_id].id && sd->status.skill[skill_id].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex] - sd->status.skill[skill_id].lv < skill_tree_get_max(skill_id, sd->status.class_) ) + sd->status.skill[skill_id].lv < skill->tree_get_max(skill_id, sd->status.class_) ) { sd->status.skill[skill_id].lv++; sd->status.skill_point--; - if( !skill_get_inf(skill_id) ) + if( !skill->get_inf(skill_id) ) status_calc_pc(sd,0); // Only recalculate for passive skills. else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) ) pc_calc_skilltree(sd); // Required to grant all TK Ranger skills. @@ -6102,15 +6102,15 @@ int pc_allskillup(struct map_session_data *sd) case RG_SNATCHER: continue; default: - if( !(skill_get_inf2(i)&(INF2_NPC_SKILL|INF2_GUILD_SKILL)) ) - if ( ( sd->status.skill[i].lv = skill_get_max(i) ) )//Nonexistant skills should return a max of 0 anyway. + if( !(skill->get_inf2(i)&(INF2_NPC_SKILL|INF2_GUILD_SKILL)) ) + if ( ( sd->status.skill[i].lv = skill->get_max(i) ) )//Nonexistant skills should return a max of 0 anyway. sd->status.skill[i].id = i; } } } else { int inf2; for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[pc_class2idx(sd->status.class_)][i].id)>0;i++){ - inf2 = skill_get_inf2(id); + inf2 = skill->get_inf2(id); if ( (inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) || (inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) || @@ -6119,7 +6119,7 @@ int pc_allskillup(struct map_session_data *sd) continue; //Cannot be learned normally. sd->status.skill[id].id = id; - sd->status.skill[id].lv = skill_tree_get_max(id, sd->status.class_); // celest + sd->status.skill[id].lv = skill->tree_get_max(id, sd->status.class_); // celest } } status_calc_pc(sd,0); @@ -6340,7 +6340,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) lv = sd->status.skill[i].lv; if (lv < 1) continue; - inf2 = skill_get_inf2(i); + inf2 = skill->get_inf2(i); if( inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL) ) //Avoid reseting wedding/linker skills. continue; @@ -6513,10 +6513,9 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h if( !src || src == &sd->bl ) return; - if( pc_issit(sd) ) - { + if( pc_issit(sd) ) { pc_setstand(sd); - skill_sit(sd,0); + skill->sit(sd,0); } if( sd->progressbar.npc_id ) @@ -6723,7 +6722,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,status_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_gvg(sd->bl.m)) pc_respawn_timer(INVALID_TIMER, gettick(), sd->bl.id, 0); return 0; @@ -8707,7 +8706,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { if((sd->status.inventory[n].equip & EQP_ARMS) && sd->weapontype1 == 0 && sd->weapontype2 == 0 && (!sd->sc.data[SC_SEVENWIND] || sd->sc.data[SC_ASPERSIO])) //Check for seven wind (but not level seven!) - skill_enchant_elemental_end(&sd->bl,-1); + skill->enchant_elemental_end(&sd->bl,-1); if(sd->status.inventory[n].equip & EQP_ARMOR) { // On Armor Change... diff --git a/src/map/pet.c b/src/map/pet.c index cc58aff9a..5301037b8 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -118,7 +118,7 @@ int pet_attackskill(struct pet_data *pd, int target_id) !check_distance_bl(&pd->bl, bl, pd->db->range3)) return 0; - inf = skill_get_inf(pd->a_skill->id); + 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. @@ -1186,7 +1186,7 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data) pet_stop_attack(pd); pet_stop_walking(pd,1); pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0); - if (skill_get_inf(pd->s_skill->id) & INF_GROUND_SKILL) + if (skill->get_inf(pd->s_skill->id) & INF_GROUND_SKILL) unit_skilluse_pos(&pd->bl, sd->bl.x, sd->bl.y, pd->s_skill->id, pd->s_skill->lv); else unit_skilluse_id(&pd->bl, sd->bl.id, pd->s_skill->id, pd->s_skill->lv); diff --git a/src/map/script.c b/src/map/script.c index 07b2459d6..cd5a1a324 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7866,7 +7866,7 @@ BUILDIN_FUNC(bonus) case SP_FIXCASTRATE: case SP_SKILL_USE_SP: // these bonuses support skill names - val1 = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) ); + val1 = ( script_isstring(st,3) ? skill->name2id(script_getstr(st,3)) : script_getnum(st,3) ); break; default: val1 = script_getnum(st,3); @@ -7888,7 +7888,7 @@ BUILDIN_FUNC(bonus) break; case 4: if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) ) - val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name + val2 = skill->name2id(script_getstr(st,4)); // 2nd value can be skill name else val2 = script_getnum(st,4); @@ -7898,7 +7898,7 @@ BUILDIN_FUNC(bonus) break; case 5: if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) ) - val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name + val2 = skill->name2id(script_getstr(st,4)); // 2nd value can be skill name else val2 = script_getnum(st,4); @@ -8005,7 +8005,7 @@ BUILDIN_FUNC(autobonus3) rate = script_getnum(st,3); dur = script_getnum(st,4); - atk_type = ( script_isstring(st,5) ? skill_name2id(script_getstr(st,5)) : script_getnum(st,5) ); + atk_type = ( script_isstring(st,5) ? skill->name2id(script_getstr(st,5)) : script_getnum(st,5) ); bonus_script = script_getstr(st,2); if( !rate || !dur || !atk_type || !bonus_script ) return 0; @@ -8045,7 +8045,7 @@ BUILDIN_FUNC(skill) if( sd == NULL ) return 0;// no player attached, report source - id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); level = script_getnum(st,3); if( script_hasdata(st,4) ) flag = script_getnum(st,4); @@ -8074,7 +8074,7 @@ BUILDIN_FUNC(addtoskill) if( sd == NULL ) return 0;// no player attached, report source - id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); level = script_getnum(st,3); if( script_hasdata(st,4) ) flag = script_getnum(st,4); @@ -8098,7 +8098,7 @@ BUILDIN_FUNC(guildskill) if( sd == NULL ) return 0;// no player attached, report source - id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); level = script_getnum(st,3); for( i=0; i < level; i++ ) guild_skillup(sd, id); @@ -8119,7 +8119,7 @@ BUILDIN_FUNC(getskilllv) if( sd == NULL ) return 0;// no player attached, report source - id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); script_pushint(st, pc_checkskill(sd,id)); return 0; @@ -8136,7 +8136,7 @@ BUILDIN_FUNC(getgdskilllv) struct guild* g; guild_id = script_getnum(st,2); - skill_id = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) ); + skill_id = ( script_isstring(st,3) ? skill->name2id(script_getstr(st,3)) : script_getnum(st,3) ); g = guild_search(guild_id); if( g == NULL ) script_pushint(st, -1); @@ -8663,7 +8663,7 @@ BUILDIN_FUNC(itemskill) if( sd == NULL || sd->ud.skilltimer != INVALID_TIMER ) return 0; - id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); lv = script_getnum(st,3); sd->skillitem=id; @@ -9846,7 +9846,7 @@ BUILDIN_FUNC(sc_start) 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); + tick = skill->get_time(status_sc2skill(type), val1); } if( potion_flag == 1 && potion_target ) @@ -9885,7 +9885,7 @@ BUILDIN_FUNC(sc_start2) 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); + tick = skill->get_time(status_sc2skill(type), val1); } if( potion_flag == 1 && potion_target ) @@ -9927,7 +9927,7 @@ BUILDIN_FUNC(sc_start4) 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); + tick = skill->get_time(status_sc2skill(type), val1); } if( potion_flag == 1 && potion_target ) @@ -12388,7 +12388,7 @@ BUILDIN_FUNC(petskillattack) if (pd->a_skill == NULL) pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack)); - pd->a_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + pd->a_skill->id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); pd->a_skill->lv=script_getnum(st,3); pd->a_skill->div_ = 0; pd->a_skill->rate=script_getnum(st,4); @@ -12414,7 +12414,7 @@ BUILDIN_FUNC(petskillattack2) if (pd->a_skill == NULL) pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack)); - pd->a_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + pd->a_skill->id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); pd->a_skill->lv=script_getnum(st,3); pd->a_skill->div_ = script_getnum(st,4); pd->a_skill->rate=script_getnum(st,5); @@ -12449,7 +12449,7 @@ BUILDIN_FUNC(petskillsupport) } else //init memory pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support)); - pd->s_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + pd->s_skill->id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); pd->s_skill->lv=script_getnum(st,3); pd->s_skill->delay=script_getnum(st,4); pd->s_skill->hp=script_getnum(st,5); @@ -12473,7 +12473,7 @@ BUILDIN_FUNC(skilleffect) { TBL_PC *sd; - uint16 skill_id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + uint16 skill_id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); uint16 skill_lv=script_getnum(st,3); sd=script_rid2sd(st); @@ -12491,7 +12491,7 @@ BUILDIN_FUNC(npcskilleffect) { struct block_list *bl= map_id2bl(st->oid); - uint16 skill_id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + uint16 skill_id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); uint16 skill_lv=script_getnum(st,3); int x=script_getnum(st,4); int y=script_getnum(st,5); @@ -14553,7 +14553,6 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle) return 0; } - BUILDIN_FUNC(query_sql) { #ifdef BETA_THREAD_TEST if( st->state != RERUNLINE ) { @@ -15404,7 +15403,7 @@ BUILDIN_FUNC(unitskilluseid) struct block_list* bl; unit_id = script_getnum(st,2); - skill_id = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) ); + skill_id = ( script_isstring(st,3) ? skill->name2id(script_getstr(st,3)) : script_getnum(st,3) ); skill_lv = script_getnum(st,4); target_id = ( script_hasdata(st,5) ? script_getnum(st,5) : unit_id ); @@ -15429,7 +15428,7 @@ BUILDIN_FUNC(unitskillusepos) struct block_list* bl; unit_id = script_getnum(st,2); - skill_id = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) ); + skill_id = ( script_isstring(st,3) ? skill->name2id(script_getstr(st,3)) : script_getnum(st,3) ); skill_lv = script_getnum(st,4); skill_x = script_getnum(st,5); skill_y = script_getnum(st,6); @@ -15621,7 +15620,7 @@ BUILDIN_FUNC(warpportal) if( mapindex == 0 ) return 0;// map not found - group = skill_unitsetting(bl, AL_WARP, 4, spx, spy, 0); + group = skill->unitsetting(bl, AL_WARP, 4, spx, spy, 0); if( group == NULL ) return 0;// failed group->val2 = (tpx<<16) | tpy; @@ -16625,7 +16624,7 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap) case 0: tbl = map_id2bl(md->bl.id); break; case 1: tbl = map_id2bl(md->target_id); break; case 2: tbl = map_id2bl(md->master_id); break; - default:tbl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill_get_range2(&md->bl, skill_id, skill_lv)); break; + default:tbl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill->get_range2(&md->bl, skill_id, skill_lv)); break; } if( !tbl ) @@ -16634,7 +16633,7 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap) if( md->ud.skilltimer != INVALID_TIMER ) // Cancel the casting skill. unit_skillcastcancel(bl,0); - if( skill_get_casttype(skill_id) == CAST_GROUND ) + if( skill->get_casttype(skill_id) == CAST_GROUND ) unit_skilluse_pos2(&md->bl, tbl->x, tbl->y, skill_id, skill_lv, casttime, cancel); else unit_skilluse_id2(&md->bl, tbl->id, skill_id, skill_lv, casttime, cancel); @@ -16666,7 +16665,7 @@ BUILDIN_FUNC(areamobuseskill) center.y = script_getnum(st,4); range = script_getnum(st,5); mobid = script_getnum(st,6); - skill_id = ( script_isstring(st,7) ? skill_name2id(script_getstr(st,7)) : script_getnum(st,7) ); + skill_id = ( script_isstring(st,7) ? skill->name2id(script_getstr(st,7)) : script_getnum(st,7) ); if( (skill_lv = script_getnum(st,8)) > battle_config.mob_max_skilllvl ) skill_lv = battle_config.mob_max_skilllvl; @@ -17304,7 +17303,7 @@ BUILDIN_FUNC(npcskill) struct npc_data *nd; struct map_session_data *sd; - skill_id = script_isstring(st, 2) ? skill_name2id(script_getstr(st, 2)) : script_getnum(st, 2); + skill_id = script_isstring(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2); skill_level = script_getnum(st, 3); stat_point = script_getnum(st, 4); npc_level = script_getnum(st, 5); @@ -17332,7 +17331,7 @@ BUILDIN_FUNC(npcskill) status_calc_npc(nd, false); } - if (skill_get_inf(skill_id)&INF_GROUND_SKILL) { + if (skill->get_inf(skill_id)&INF_GROUND_SKILL) { unit_skilluse_pos(&nd->bl, sd->bl.x, sd->bl.y, skill_id, skill_level); } else { unit_skilluse_id(&nd->bl, sd->bl.id, skill_id, skill_level); diff --git a/src/map/skill.c b/src/map/skill.c index bb9e29be4..a8b852cc7 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -144,8 +144,7 @@ int skill_name2id(const char* name) /// Maps skill ids to skill db offsets. /// Returns the skill's array index, or 0 (Unknown Skill). -int skill_get_index( uint16 skill_id ) -{ +int skill_get_index( uint16 skill_id ) { // avoid ranges reserved for mapping guild/homun/mercenary skills if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX) || (skill_id >= HM_SKILLRANGEMIN && skill_id <= HM_SKILLRANGEMAX) @@ -170,20 +169,17 @@ int skill_get_index( uint16 skill_id ) return skill_id; } -const char* skill_get_name( uint16 skill_id ) -{ - return skill_db[skill_get_index(skill_id)].name; +const char* skill_get_name( uint16 skill_id ) { + return skill_db[skill->get_index(skill_id)].name; } -const char* skill_get_desc( uint16 skill_id ) -{ - return skill_db[skill_get_index(skill_id)].desc; +const char* skill_get_desc( uint16 skill_id ) { + return skill_db[skill->get_index(skill_id)].desc; } // out of bounds error checking [celest] -static void skill_chk(int16* skill_id, uint16 skill_lv) -{ - *skill_id = skill_get_index(*skill_id); // checks/adjusts id +static void skill_chk(int16* skill_id, uint16 skill_lv) { + *skill_id = skill->get_index(*skill_id); // checks/adjusts id if( skill_lv > MAX_SKILL_LEVEL ) *skill_id = 0; } @@ -245,7 +241,7 @@ int skill_tree_get_max(uint16 skill_id, int b_class) if( i < MAX_SKILL_TREE && skill_tree[b_class][i].id == skill_id ) return skill_tree[b_class][i].max; else - return skill_get_max(skill_id); + return skill->get_max(skill_id); } int skill_frostjoke_scream(struct block_list *bl,va_list ap); @@ -264,105 +260,101 @@ static int skill_unit_effect(struct block_list *bl,va_list ap); int enchant_eff[5] = { 10, 14, 17, 19, 20 }; int deluge_eff[5] = { 5, 9, 12, 14, 15 }; -int skill_get_casttype (uint16 skill_id) -{ - int inf = skill_get_inf(skill_id); +int skill_get_casttype (uint16 skill_id) { + int inf = skill->get_inf(skill_id); if (inf&(INF_GROUND_SKILL)) return CAST_GROUND; if (inf&INF_SUPPORT_SKILL) return CAST_NODAMAGE; if (inf&INF_SELF_SKILL) { - if(skill_get_inf2(skill_id)&INF2_NO_TARGET_SELF) + if(skill->get_inf2(skill_id)&INF2_NO_TARGET_SELF) return CAST_DAMAGE; //Combo skill. return CAST_NODAMAGE; } - if (skill_get_nk(skill_id)&NK_NO_DAMAGE) + if (skill->get_nk(skill_id)&NK_NO_DAMAGE) return CAST_NODAMAGE; return CAST_DAMAGE; } //Returns actual skill range taking into account attack range and AC_OWL [Skotlex] -int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) -{ +int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { int range; if( bl->type == BL_MOB && battle_config.mob_ai&0x400 ) return 9; //Mobs have a range of 9 regardless of skill used. - range = skill_get_range(skill_id, skill_lv); + range = skill->get_range(skill_id, skill_lv); - if( range < 0 ) - { + if( range < 0 ) { if( battle_config.use_weapon_skill_range&bl->type ) return status_get_range(bl); range *=-1; } //TODO: Find a way better than hardcoding the list of skills affected by AC_VULTURE - switch( skill_id ) - { - case AC_SHOWER: case MA_SHOWER: - case AC_DOUBLE: case MA_DOUBLE: - case HT_BLITZBEAT: - case AC_CHARGEARROW: - case MA_CHARGEARROW: - case SN_FALCONASSAULT: - case HT_POWER: - /** - * Ranger - **/ - case RA_ARROWSTORM: - case RA_AIMEDBOLT: - case RA_WUGBITE: - if( bl->type == BL_PC ) - range += pc_checkskill((TBL_PC*)bl, AC_VULTURE); - else - range += 10; //Assume level 10? - break; - // added to allow GS skills to be effected by the range of Snake Eyes [Reddozen] - case GS_RAPIDSHOWER: - case GS_PIERCINGSHOT: - case GS_FULLBUSTER: - case GS_SPREADATTACK: - case GS_GROUNDDRIFT: - if (bl->type == BL_PC) - range += pc_checkskill((TBL_PC*)bl, GS_SNAKEEYE); - else - range += 10; //Assume level 10? - break; - case NJ_KIRIKAGE: - if (bl->type == BL_PC) - range = skill_get_range(NJ_SHADOWJUMP,pc_checkskill((TBL_PC*)bl,NJ_SHADOWJUMP)); - break; - /** - * Warlock - **/ - case WL_WHITEIMPRISON: - case WL_SOULEXPANSION: - case WL_FROSTMISTY: - case WL_MARSHOFABYSS: - case WL_SIENNAEXECRATE: - case WL_DRAINLIFE: - case WL_CRIMSONROCK: - case WL_HELLINFERNO: - case WL_COMET: - case WL_CHAINLIGHTNING: - case WL_TETRAVORTEX: - case WL_RELEASE: + switch( skill_id ) { + case AC_SHOWER: case MA_SHOWER: + case AC_DOUBLE: case MA_DOUBLE: + case HT_BLITZBEAT: + case AC_CHARGEARROW: + case MA_CHARGEARROW: + case SN_FALCONASSAULT: + case HT_POWER: + /** + * Ranger + **/ + case RA_ARROWSTORM: + case RA_AIMEDBOLT: + case RA_WUGBITE: if( bl->type == BL_PC ) - range += pc_checkskill((TBL_PC*)bl, WL_RADIUS); + range += pc_checkskill((TBL_PC*)bl, AC_VULTURE); + else + range += 10; //Assume level 10? break; - /** - * Ranger Bonus - **/ - case HT_LANDMINE: - case HT_FREEZINGTRAP: - case HT_BLASTMINE: - case HT_CLAYMORETRAP: - case RA_CLUSTERBOMB: - case RA_FIRINGTRAP: - case RA_ICEBOUNDTRAP: - if( bl->type == BL_PC ) - range += (1 + pc_checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2; + // added to allow GS skills to be effected by the range of Snake Eyes [Reddozen] + case GS_RAPIDSHOWER: + case GS_PIERCINGSHOT: + case GS_FULLBUSTER: + case GS_SPREADATTACK: + case GS_GROUNDDRIFT: + if (bl->type == BL_PC) + range += pc_checkskill((TBL_PC*)bl, GS_SNAKEEYE); + else + range += 10; //Assume level 10? + break; + case NJ_KIRIKAGE: + if (bl->type == BL_PC) + range = skill->get_range(NJ_SHADOWJUMP,pc_checkskill((TBL_PC*)bl,NJ_SHADOWJUMP)); + break; + /** + * Warlock + **/ + case WL_WHITEIMPRISON: + case WL_SOULEXPANSION: + case WL_FROSTMISTY: + case WL_MARSHOFABYSS: + case WL_SIENNAEXECRATE: + case WL_DRAINLIFE: + case WL_CRIMSONROCK: + case WL_HELLINFERNO: + case WL_COMET: + case WL_CHAINLIGHTNING: + case WL_TETRAVORTEX: + case WL_RELEASE: + if( bl->type == BL_PC ) + range += pc_checkskill((TBL_PC*)bl, WL_RADIUS); + break; + /** + * Ranger Bonus + **/ + case HT_LANDMINE: + case HT_FREEZINGTRAP: + case HT_BLASTMINE: + case HT_CLAYMORETRAP: + case RA_CLUSTERBOMB: + case RA_FIRINGTRAP: + case RA_ICEBOUNDTRAP: + if( bl->type == BL_PC ) + range += (1 + pc_checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2; } if( !range && bl->type != BL_PC ) @@ -474,7 +466,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* bl) { // Never copy NPC/Wedding Skills - if (skill_get_inf2(skill_id)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL)) + if (skill->get_inf2(skill_id)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL)) return 0; // High-class skills @@ -508,7 +500,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) int16 idx,m; nullpo_retr (1, sd); m = sd->bl.m; - idx = skill_get_index(skill_id); + idx = skill->get_index(skill_id); if (idx == 0) return 1; // invalid skill id @@ -539,12 +531,13 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) **/ if( sd->skillitem == skill_id ) return 0; + /* TODO: these skill_get_nocast should be cached once instead of looking it up 5 times =_= */ // Check skill restrictions [Celest] - if( (!map_flag_vs(m) && skill_get_nocast (skill_id) & 1) || - (map[m].flag.pvp && skill_get_nocast (skill_id) & 2) || - (map_flag_gvg(m) && skill_get_nocast (skill_id) & 4) || - (map[m].flag.battleground && skill_get_nocast (skill_id) & 8) || - (map[m].flag.restricted && map[m].zone && skill_get_nocast (skill_id) & (8*map[m].zone)) ){ + if( (!map_flag_vs(m) && skill->get_nocast (skill_id) & 1) || + (map[m].flag.pvp && skill->get_nocast (skill_id) & 2) || + (map_flag_gvg(m) && skill->get_nocast (skill_id) & 4) || + (map[m].flag.battleground && skill->get_nocast (skill_id) & 8) || + (map[m].flag.restricted && map[m].zone && skill->get_nocast (skill_id) & (8*map[m].zone)) ){ clif_msg(sd, 0x536); // This skill cannot be used within this area return 1; } @@ -568,7 +561,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) clif_skill_teleportmessage(sd,0); return 1; } - return 0; // gonna be checked in 'skill_castend_nodamage_id' + return 0; // gonna be checked in 'skill->castend_nodamage_id' case WE_CALLPARTNER: case WE_CALLPARENT: case WE_CALLBABY: @@ -639,7 +632,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) int skillnotok_hom(uint16 skill_id, struct homun_data *hd) { - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); nullpo_retr(1,hd); if (idx == 0) @@ -665,12 +658,12 @@ int skillnotok_hom(uint16 skill_id, struct homun_data *hd) } //Use master's criteria. - return skillnotok(skill_id, hd->master); + return skill->not_ok(skill_id, hd->master); } int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md) { - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); nullpo_retr(1,md); if( idx == 0 ) @@ -678,7 +671,7 @@ int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md) if( md->blockskill[idx] > 0 ) return 1; - return skillnotok(skill_id, md->master); + return skill->not_ok(skill_id, md->master); } struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y) @@ -718,7 +711,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint struct status_change *sc, *tsc; enum sc_type status; - int skill; + int temp; int rate; nullpo_ret(src); @@ -772,13 +765,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } type = sd->addeff[i].id; - skill = skill_get_time2(status_sc2skill(type),7); + temp = skill->get_time2(status_sc2skill(type),7); if (sd->addeff[i].flag&ATF_TARGET) - status_change_start(bl,type,rate,7,0,0,0,skill,0); + status_change_start(bl,type,rate,7,0,0,0,temp,0); if (sd->addeff[i].flag&ATF_SELF) - status_change_start(src,type,rate,7,0,0,0,skill,0); + status_change_start(src,type,rate,7,0,0,0,temp,0); } } @@ -791,12 +784,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; - skill = skill_get_time2(status_sc2skill(type),7); + temp = skill->get_time2(status_sc2skill(type),7); if( sd->addeff3[i].target&ATF_TARGET ) - status_change_start(bl,type,sd->addeff3[i].rate,7,0,0,0,skill,0); + status_change_start(bl,type,sd->addeff3[i].rate,7,0,0,0,temp,0); if( sd->addeff3[i].target&ATF_SELF ) - status_change_start(src,type,sd->addeff3[i].rate,7,0,0,0,skill,0); + status_change_start(src,type,sd->addeff3[i].rate,7,0,0,0,temp,0); } } } @@ -812,20 +805,20 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; // If a normal attack is a skill, it's splash damage. [Inkfish] if(sd) { // Automatic trigger of Blitz Beat - if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (skill=pc_checkskill(sd,HT_BLITZBEAT))>0 && + if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=pc_checkskill(sd,HT_BLITZBEAT))>0 && rnd()%1000 <= sstatus->luk*10/3+1 ) { rate=(sd->status.job_level+9)/10; - skill_castend_damage_id(src,bl,HT_BLITZBEAT,(skill<rate)?skill:rate,tick,SD_LEVEL); + skill->castend_damage_id(src,bl,HT_BLITZBEAT,(temp<rate)?temp:rate,tick,SD_LEVEL); } // Automatic trigger of Warg Strike [Jobbie] - if( pc_iswug(sd) && (sd->status.weapon == W_BOW || sd->status.weapon == W_FIST) && (skill=pc_checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*10/3+1 ) - skill_castend_damage_id(src,bl,RA_WUGSTRIKE,skill,tick,0); + if( pc_iswug(sd) && (sd->status.weapon == W_BOW || sd->status.weapon == W_FIST) && (temp=pc_checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*10/3+1 ) + skill->castend_damage_id(src,bl,RA_WUGSTRIKE,temp,tick,0); // Gank if(dstmd && sd->status.weapon != W_BOW && - (skill=pc_checkskill(sd,RG_SNATCHER)) > 0 && - (skill*15 + 55) + pc_checkskill(sd,TF_STEAL)*10 > rnd()%1000) { + (temp=pc_checkskill(sd,RG_SNATCHER)) > 0 && + (temp*15 + 55) + pc_checkskill(sd,TF_STEAL)*10 > rnd()%1000) { if(pc_steal_item(sd,bl,pc_checkskill(sd,TF_STEAL))) - clif_skill_nodamage(src,bl,TF_STEAL,skill,1); + clif_skill_nodamage(src,bl,TF_STEAL,temp,1); else clif_skill_fail(sd,RG_SNATCHER,USESKILL_FAIL_LEVEL,0); } @@ -854,7 +847,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } } if(sc && sc->data[SC_PYROCLASTIC] && (rnd() % 1000 <= sstatus->luk * 10 / 3 + 1) ) - skill_castend_pos2(src, bl->x, bl->y, BS_HAMMERFALL,sc->data[SC_PYROCLASTIC]->val1, tick, 0); + skill->castend_pos2(src, bl->x, bl->y, BS_HAMMERFALL,sc->data[SC_PYROCLASTIC]->val1, tick, 0); } if (sc) { @@ -862,11 +855,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint // Enchant Poison gives a chance to poison attacked enemies if((sce=sc->data[SC_ENCPOISON])) //Don't use sc_start since chance comes in 1/10000 rate. status_change_start(bl,SC_POISON,sce->val2, sce->val1,src->id,0,0, - skill_get_time2(AS_ENCHANTPOISON,sce->val1),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])) sc_start4(bl,SC_DPOISON,sce->val2, sce->val1,src->id,0,0, - skill_get_time2(ASC_EDP,sce->val1)); + skill->get_time2(ASC_EDP,sce->val1)); } } break; @@ -875,12 +868,12 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint if( sd && skill_lv > 5 && pc_checkskill(sd,SM_FATALBLOW)>0 ){ //TODO: How much % per base level it actually is? sc_start(bl,SC_STUN,(5*(skill_lv-5)+(int)sd->status.base_level/10), - skill_lv,skill_get_time2(SM_FATALBLOW,skill_lv)); + skill_lv,skill->get_time2(SM_FATALBLOW,skill_lv)); } break; case MER_CRASH: - sc_start(bl,SC_STUN,(6*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(6*skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case AS_VENOMKNIFE: @@ -888,30 +881,30 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint skill_lv = pc_checkskill(sd, TF_POISON); case TF_POISON: case AS_SPLASHER: - if(!sc_start2(bl,SC_POISON,(4*skill_lv+10),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)) + if(!sc_start2(bl,SC_POISON,(4*skill_lv+10),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)) && sd && skill_id==TF_POISON ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; case AS_SONICBLOW: - sc_start(bl,SC_STUN,(2*skill_lv+10),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(2*skill_lv+10),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case WZ_FIREPILLAR: - unit_set_walkdelay(bl, tick, skill_get_time2(skill_id, skill_lv), 1); + unit_set_walkdelay(bl, tick, skill->get_time2(skill_id, skill_lv), 1); break; case MG_FROSTDIVER: #ifndef RENEWAL case WZ_FROSTNOVA: #endif - sc_start(bl,SC_FREEZE,skill_lv*3+35,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_FREEZE,skill_lv*3+35,skill_lv,skill->get_time2(skill_id,skill_lv)); break; #ifdef RENEWAL case WZ_FROSTNOVA: - sc_start(bl,SC_FREEZE,skill_lv*5+33,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_FREEZE,skill_lv*5+33,skill_lv,skill->get_time2(skill_id,skill_lv)); break; #endif @@ -920,11 +913,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint * Storm Gust counter was dropped in renewal **/ #ifdef RENEWAL - sc_start(bl,SC_FREEZE,65-(5*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_FREEZE,65-(5*skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv)); #else //Tharis pointed out that this is normal freeze chance with a base of 300% if(tsc->sg_counter >= 3 && - sc_start(bl,SC_FREEZE,300,skill_lv,skill_get_time2(skill_id,skill_lv))) + sc_start(bl,SC_FREEZE,300,skill_lv,skill->get_time2(skill_id,skill_lv))) tsc->sg_counter = 0; /** * being it only resets on success it'd keep stacking and eventually overflowing on mvps, so we reset at a high value @@ -935,25 +928,25 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case WZ_METEOR: - sc_start(bl,SC_STUN,3*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,3*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case WZ_VERMILION: - sc_start(bl,SC_BLIND,4*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,4*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case HT_FREEZINGTRAP: case MA_FREEZINGTRAP: - sc_start(bl,SC_FREEZE,(3*skill_lv+35),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_FREEZE,(3*skill_lv+35),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case HT_FLASHER: - sc_start(bl,SC_BLIND,(10*skill_lv+30),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,(10*skill_lv+30),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case HT_LANDMINE: case MA_LANDMINE: - sc_start(bl,SC_STUN,(5*skill_lv+30),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(5*skill_lv+30),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case HT_SHOCKWAVE: @@ -962,43 +955,43 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case HT_SANDMAN: case MA_SANDMAN: - sc_start(bl,SC_SLEEP,(10*skill_lv+40),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_SLEEP,(10*skill_lv+40),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case TF_SPRINKLESAND: - sc_start(bl,SC_BLIND,20,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,20,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case TF_THROWSTONE: - sc_start(bl,SC_STUN,3,skill_lv,skill_get_time(skill_id,skill_lv)); - sc_start(bl,SC_BLIND,3,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,3,skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,3,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case NPC_DARKCROSS: case CR_HOLYCROSS: - sc_start(bl,SC_BLIND,3*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,3*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case CR_GRANDCROSS: case NPC_GRANDDARKNESS: //Chance to cause blind status vs demon and undead element, but not against players if(!dstsd && (battle->check_undead(tstatus->race,tstatus->def_ele) || tstatus->race == RC_DEMON)) - sc_start(bl,SC_BLIND,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,100,skill_lv,skill->get_time2(skill_id,skill_lv)); attack_type |= BF_WEAPON; break; case AM_ACIDTERROR: - sc_start2(bl,SC_BLEEDING,(skill_lv*3),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); - if (skill_break_equip(bl, EQP_ARMOR, 100*skill_get_time(skill_id,skill_lv), BCT_ENEMY)) + sc_start2(bl,SC_BLEEDING,(skill_lv*3),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)); + if (skill->break_equip(bl, EQP_ARMOR, 100*skill->get_time(skill_id,skill_lv), BCT_ENEMY)) clif_emotion(bl,E_OMG); break; case AM_DEMONSTRATION: - skill_break_equip(bl, EQP_WEAPON, 100*skill_lv, BCT_ENEMY); + skill->break_equip(bl, EQP_WEAPON, 100*skill_lv, BCT_ENEMY); break; case CR_SHIELDCHARGE: - sc_start(bl,SC_STUN,(15+skill_lv*5),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(15+skill_lv*5),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case PA_PRESSURE: @@ -1006,45 +999,45 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case RG_RAID: - sc_start(bl,SC_STUN,(10+3*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv)); - sc_start(bl,SC_BLIND,(10+3*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(10+3*skill_lv),skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,(10+3*skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv)); #ifdef RENEWAL sc_start(bl,SC_RAID,100,7,5000); break; case RG_BACKSTAP: - sc_start(bl,SC_STUN,(5+2*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(5+2*skill_lv),skill_lv,skill->get_time(skill_id,skill_lv)); #endif break; case BA_FROSTJOKER: - sc_start(bl,SC_FREEZE,(15+5*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_FREEZE,(15+5*skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case DC_SCREAM: - sc_start(bl,SC_STUN,(25+5*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(25+5*skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case BD_LULLABY: - sc_start(bl,SC_SLEEP,15,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_SLEEP,15,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case DC_UGLYDANCE: rate = 5+5*skill_lv; - if(sd && (skill=pc_checkskill(sd,DC_DANCINGLESSON))) - rate += 5+skill; + if(sd && (temp=pc_checkskill(sd,DC_DANCINGLESSON))) + rate += 5+temp; status_zap(bl, 0, rate); break; case SL_STUN: if (tstatus->size==SZ_MEDIUM) //Only stuns mid-sized mobs. - sc_start(bl,SC_STUN,(30+10*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_STUN,(30+10*skill_lv),skill_lv,skill->get_time(skill_id,skill_lv)); break; case NPC_PETRIFYATTACK: 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)); + skill_lv,0,0,skill->get_time(skill_id,skill_lv), + skill->get_time2(skill_id,skill_lv)); break; case NPC_CURSEATTACK: case NPC_SLEEPATTACK: @@ -1053,14 +1046,14 @@ 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,status_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,status_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_BLEEDING,(20*skill_lv),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); + sc_start2(bl,SC_BLEEDING,(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 @@ -1074,45 +1067,45 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } // Equipment breaking monster skills [Celest] case NPC_WEAPONBRAKER: - skill_break_equip(bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY); + skill->break_equip(bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY); break; case NPC_ARMORBRAKE: - skill_break_equip(bl, EQP_ARMOR, 150*skill_lv, BCT_ENEMY); + skill->break_equip(bl, EQP_ARMOR, 150*skill_lv, BCT_ENEMY); break; case NPC_HELMBRAKE: - skill_break_equip(bl, EQP_HELM, 150*skill_lv, BCT_ENEMY); + skill->break_equip(bl, EQP_HELM, 150*skill_lv, BCT_ENEMY); break; case NPC_SHIELDBRAKE: - skill_break_equip(bl, EQP_SHIELD, 150*skill_lv, BCT_ENEMY); + skill->break_equip(bl, EQP_SHIELD, 150*skill_lv, BCT_ENEMY); break; case CH_TIGERFIST: - sc_start(bl,SC_STOP,(10+skill_lv*10),0,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STOP,(10+skill_lv*10),0,skill->get_time2(skill_id,skill_lv)); break; case LK_SPIRALPIERCE: case ML_SPIRALPIERCE: - sc_start(bl,SC_STOP,(15+skill_lv*5),0,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STOP,(15+skill_lv*5),0,skill->get_time2(skill_id,skill_lv)); break; case ST_REJECTSWORD: - sc_start(bl,SC_AUTOCOUNTER,(skill_lv*15),skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_AUTOCOUNTER,(skill_lv*15),skill_lv,skill->get_time(skill_id,skill_lv)); break; case PF_FOGWALL: if (src != bl && !tsc->data[SC_DELUGE]) - sc_start(bl,SC_BLIND,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case LK_HEADCRUSH: //Headcrush has chance of causing Bleeding status, except on demon and undead element if (!(battle->check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON)) - sc_start2(bl, SC_BLEEDING,50, skill_lv, src->id, skill_get_time2(skill_id,skill_lv)); + sc_start2(bl, SC_BLEEDING,50, skill_lv, src->id, skill->get_time2(skill_id,skill_lv)); break; case LK_JOINTBEAT: status = status_skill2sc(skill_id); if (tsc->jb_flag) { - sc_start4(bl,status,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill_get_time2(skill_id,skill_lv)); + sc_start4(bl,status,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill->get_time2(skill_id,skill_lv)); tsc->jb_flag = 0; } break; @@ -1120,30 +1113,30 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint //Any enemies hit by this skill will receive Stun, Darkness, or external bleeding status ailment with a 5%+5*skill_lv% chance. switch(rnd()%3) { case 0: - sc_start(bl,SC_BLIND,(5+skill_lv*5),skill_lv,skill_get_time2(skill_id,1)); + sc_start(bl,SC_BLIND,(5+skill_lv*5),skill_lv,skill->get_time2(skill_id,1)); break; case 1: - sc_start(bl,SC_STUN,(5+skill_lv*5),skill_lv,skill_get_time2(skill_id,2)); + sc_start(bl,SC_STUN,(5+skill_lv*5),skill_lv,skill->get_time2(skill_id,2)); break; default: - sc_start2(bl,SC_BLEEDING,(5+skill_lv*5),skill_lv,src->id,skill_get_time2(skill_id,3)); + sc_start2(bl,SC_BLEEDING,(5+skill_lv*5),skill_lv,src->id,skill->get_time2(skill_id,3)); } break; case HW_NAPALMVULCAN: - sc_start(bl,SC_CURSE,5*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CURSE,5*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case WS_CARTTERMINATION: // Cart termination - sc_start(bl,SC_STUN,5*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,5*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case CR_ACIDDEMONSTRATION: - skill_break_equip(bl, EQP_WEAPON|EQP_ARMOR, 100*skill_lv, BCT_ENEMY); + skill->break_equip(bl, EQP_WEAPON|EQP_ARMOR, 100*skill_lv, BCT_ENEMY); break; case TK_DOWNKICK: - sc_start(bl,SC_STUN,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case TK_JUMPKICK: @@ -1160,59 +1153,59 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case TK_TURNKICK: case MO_BALKYOUNG: //Note: attack_type is passed as BF_WEAPON for the actual target, BF_MISC for the splash-affected mobs. if(attack_type&BF_MISC) //70% base stun chance... - sc_start(bl,SC_STUN,70,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN,70,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case GS_BULLSEYE: //0.1% coma rate. if(tstatus->race == RC_BRUTE || tstatus->race == RC_DEMIHUMAN) status_change_start(bl,SC_COMA,10,skill_lv,0,src->id,0,0,0); break; case GS_PIERCINGSHOT: - sc_start2(bl,SC_BLEEDING,(skill_lv*3),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); + sc_start2(bl,SC_BLEEDING,(skill_lv*3),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)); break; case NJ_HYOUSYOURAKU: - sc_start(bl,SC_FREEZE,(10+10*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_FREEZE,(10+10*skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv)); break; case GS_FLING: - sc_start(bl,SC_FLING,100, sd?sd->spiritball_old:5,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_FLING,100, sd?sd->spiritball_old:5,skill->get_time(skill_id,skill_lv)); break; case GS_DISARM: rate = 3*skill_lv; if (sstatus->dex > tstatus->dex) rate += (sstatus->dex - tstatus->dex)/5; //TODO: Made up formula - skill_strip_equip(bl, EQP_WEAPON, rate, skill_lv, skill_get_time(skill_id,skill_lv)); + skill->strip_equip(bl, EQP_WEAPON, rate, skill_lv, skill->get_time(skill_id,skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case NPC_EVILLAND: - sc_start(bl,SC_BLIND,5*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,5*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case NPC_HELLJUDGEMENT: - sc_start(bl,SC_CURSE,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CURSE,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case NPC_CRITICALWOUND: - sc_start(bl,SC_CRITICALWOUND,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CRITICALWOUND,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case RK_HUNDREDSPEAR: if( !sd || pc_checkskill(sd,KN_SPEARBOOMERANG) == 0 ) break; // Spear Boomerang auto cast chance only works if you have mastered Spear Boomerang. rate = 10 + 3 * skill_lv; if( rnd()%100 < rate ) - skill_castend_damage_id(src,bl,KN_SPEARBOOMERANG,1,tick,0); + skill->castend_damage_id(src,bl,KN_SPEARBOOMERANG,1,tick,0); break; case RK_WINDCUTTER: - sc_start(bl,SC_FEAR,3+2*skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_FEAR,3+2*skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)); break; case RK_DRAGONBREATH: - sc_start4(bl,SC_BURNING,5+5*skill_lv,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv)); + sc_start4(bl,SC_BURNING,5+5*skill_lv,skill_lv,1000,src->id,0,skill->get_time(skill_id,skill_lv)); break; case AB_ADORAMUS: if( tsc && !tsc->data[SC_DECREASEAGI] ) //Prevent duplicate agi-down effect. - sc_start(bl, SC_ADORAMUS, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_ADORAMUS, 100, skill_lv, skill->get_time(skill_id, skill_lv)); break; case WL_CRIMSONROCK: - sc_start(bl, SC_STUN, 40, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_STUN, 40, skill_lv, skill->get_time(skill_id, skill_lv)); break; case WL_COMET: - sc_start4(bl,SC_BURNING,100,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv)); + sc_start4(bl,SC_BURNING,100,skill_lv,1000,src->id,0,skill->get_time(skill_id,skill_lv)); break; case WL_EARTHSTRAIN: { @@ -1222,22 +1215,22 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint //rate -= rate * tstatus->dex / 200; // Disabled until official resistance is found. for( i = 0; i < skill_lv; i++ ) - skill_strip_equip(bl,pos[i],rate,skill_lv,skill_get_time2(skill_id,skill_lv)); + skill->strip_equip(bl,pos[i],rate,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)); + sc_start(bl,SC_FREEZE,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; case RA_WUGBITE: - sc_start(bl, SC_BITE, (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skill_lv, (skill_get_time(skill_id,skill_lv) + (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) ); + sc_start(bl, SC_BITE, (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skill_lv, (skill->get_time(skill_id,skill_lv) + (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) ); break; case RA_SENSITIVEKEEN: if( rnd()%100 < 8 * skill_lv ) - skill_castend_damage_id(src, bl, RA_WUGBITE, sd ? pc_checkskill(sd, RA_WUGBITE):skill_lv, tick, SD_ANIMATION); + skill->castend_damage_id(src, bl, RA_WUGBITE, sd ? pc_checkskill(sd, RA_WUGBITE):skill_lv, tick, SD_ANIMATION); break; case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: - sc_start(bl, (skill_id == RA_FIRINGTRAP) ? SC_BURNING:SC_FREEZING, 40 + 10 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); + sc_start(bl, (skill_id == RA_FIRINGTRAP) ? SC_BURNING:SC_FREEZING, 40 + 10 * skill_lv, skill_lv, skill->get_time2(skill_id, skill_lv)); break; case NC_PILEBUNKER: if( rnd()%100 < 5 + 15*skill_lv ) @@ -1250,73 +1243,73 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } break; case NC_FLAMELAUNCHER: - sc_start4(bl, SC_BURNING, 50 + 10 * skill_lv, skill_lv, 1000, src->id, 0, skill_get_time2(skill_id, skill_lv)); + sc_start4(bl, SC_BURNING, 50 + 10 * skill_lv, skill_lv, 1000, src->id, 0, skill->get_time2(skill_id, skill_lv)); break; case NC_COLDSLOWER: - sc_start(bl, SC_FREEZE, 10 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); - sc_start(bl, SC_FREEZING, 20 + 10 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_FREEZE, 10 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); + sc_start(bl, SC_FREEZING, 20 + 10 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); break; case NC_POWERSWING: - sc_start(bl, SC_STUN, 5*skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_STUN, 5*skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); if( rnd()%100 < 5*skill_lv ) - skill_castend_damage_id(src, bl, NC_AXEBOOMERANG, pc_checkskill(sd, NC_AXEBOOMERANG), tick, 1); + skill->castend_damage_id(src, bl, NC_AXEBOOMERANG, pc_checkskill(sd, NC_AXEBOOMERANG), tick, 1); break; case GC_WEAPONCRUSH: - skill_castend_nodamage_id(src,bl,skill_id,skill_lv,tick,BCT_ENEMY); + skill->castend_nodamage_id(src,bl,skill_id,skill_lv,tick,BCT_ENEMY); break; case LG_SHIELDPRESS: - sc_start(bl, SC_STUN, 30 + 8 * skill_lv, skill_lv, skill_get_time(skill_id,skill_lv)); + 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 + status_get_lv(src))) / 10); switch( skill_lv ) { case 1: - sc_start2(bl,SC_BLEEDING,rate,skill_lv,src->id,skill_get_time(skill_id,skill_lv)); + sc_start2(bl,SC_BLEEDING,rate,skill_lv,src->id,skill->get_time(skill_id,skill_lv)); break; case 2: if( dstsd && dstsd->spiritball && rnd()%100 < rate ) pc_delspiritball(dstsd, dstsd->spiritball, 0); break; default: - skill_break_equip(bl,(skill_lv == 3) ? EQP_SHIELD : (skill_lv == 4) ? EQP_ARMOR : EQP_WEAPON,rate * 100,BCT_ENEMY); + skill->break_equip(bl,(skill_lv == 3) ? EQP_SHIELD : (skill_lv == 4) ? EQP_ARMOR : EQP_WEAPON,rate * 100,BCT_ENEMY); break; } break; case LG_MOONSLASHER: rate = 32 + 8 * skill_lv; - if( rnd()%100 < rate && dstsd ) // Uses skill_addtimerskill to avoid damage and setsit packet overlaping. Officially clif_setsit is received about 500 ms after damage packet. - skill_addtimerskill(src,tick+500,bl->id,0,0,skill_id,skill_lv,BF_WEAPON,0); + if( rnd()%100 < rate && dstsd ) // Uses skill->addtimerskill to avoid damage and setsit packet overlaping. Officially clif_setsit is received about 500 ms after damage packet. + skill->addtimerskill(src,tick+500,bl->id,0,0,skill_id,skill_lv,BF_WEAPON,0); else if( dstmd && !is_boss(bl) ) - sc_start(bl,SC_STOP,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_STOP,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; case LG_RAYOFGENESIS: // 50% chance to cause Blind on Undead and Demon monsters. if ( battle->check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON ) - sc_start(bl, SC_BLIND,50, skill_lv, skill_get_time(skill_id,skill_lv)); + sc_start(bl, SC_BLIND,50, skill_lv, skill->get_time(skill_id,skill_lv)); break; case LG_EARTHDRIVE: - skill_break_equip(src, EQP_SHIELD, 500, BCT_SELF); - sc_start(bl, SC_EARTHDRIVE, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + skill->break_equip(src, EQP_SHIELD, 500, BCT_SELF); + sc_start(bl, SC_EARTHDRIVE, 100, skill_lv, skill->get_time(skill_id, skill_lv)); break; case SR_DRAGONCOMBO: - sc_start(bl, SC_STUN, 1 + skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_STUN, 1 + skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); break; case SR_FALLENEMPIRE: - sc_start(bl, SC_STOP, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_STOP, 100, skill_lv, skill->get_time(skill_id, skill_lv)); break; case SR_WINDMILL: if( dstsd ) - skill_addtimerskill(src,tick+status_get_amotion(src),bl->id,0,0,skill_id,skill_lv,BF_WEAPON,0); + skill->addtimerskill(src,tick+status_get_amotion(src),bl->id,0,0,skill_id,skill_lv,BF_WEAPON,0); else if( dstmd && !is_boss(bl) ) 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 + status_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)); + sc_start(bl,SC_STUN, 25 + 5 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)); break; case SR_HOWLINGOFLION: - sc_start(bl, SC_FEAR, 5 + 5 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_FEAR, 5 + 5 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); break; case WM_SOUND_OF_DESTRUCTION: if( rnd()%100 < 5 + 5 * skill_lv ) { // Temporarly Check Until We Get the Official Formula @@ -1351,67 +1344,67 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } break; case SO_EARTHGRAVE: - sc_start2(bl, SC_BLEEDING, 5 * skill_lv, skill_lv, src->id, skill_get_time2(skill_id, skill_lv)); // Need official rate. [LimitLine] + sc_start2(bl, SC_BLEEDING, 5 * skill_lv, skill_lv, src->id, skill->get_time2(skill_id, skill_lv)); // Need official rate. [LimitLine] break; case SO_DIAMONDDUST: rate = 5 + 5 * skill_lv; if( sc && sc->data[SC_COOLER_OPTION] ) rate += rate * sc->data[SC_COOLER_OPTION]->val2 / 100; - sc_start(bl, SC_CRYSTALIZE, rate, skill_lv, skill_get_time2(skill_id, skill_lv)); + sc_start(bl, SC_CRYSTALIZE, rate, skill_lv, skill->get_time2(skill_id, skill_lv)); break; case SO_VARETYR_SPEAR: - sc_start(bl, SC_STUN, 5 + 5 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); + sc_start(bl, SC_STUN, 5 + 5 * skill_lv, skill_lv, skill->get_time2(skill_id, skill_lv)); break; case GN_SLINGITEM_RANGEMELEEATK: if( sd ) { - switch( sd->itemid ) { // Starting SCs here instead of do it in skill_additional_effect to simplify the code. + switch( sd->itemid ) { // Starting SCs here instead of do it in skill->additional_effect to simplify the code. case 13261: - sc_start(bl, SC_STUN, 100, skill_lv, skill_get_time2(GN_SLINGITEM, skill_lv)); - sc_start2(bl, SC_BLEEDING, 100, skill_lv, src->id, skill_get_time2(GN_SLINGITEM, skill_lv)); + sc_start(bl, SC_STUN, 100, skill_lv, skill->get_time2(GN_SLINGITEM, skill_lv)); + sc_start2(bl, SC_BLEEDING, 100, skill_lv, src->id, skill->get_time2(GN_SLINGITEM, skill_lv)); break; case 13262: - sc_start(bl, SC_MELON_BOMB, 100, skill_lv, skill_get_time(GN_SLINGITEM, skill_lv)); // Reduces ASPD and moviment speed + sc_start(bl, SC_MELON_BOMB, 100, skill_lv, skill->get_time(GN_SLINGITEM, skill_lv)); // Reduces ASPD and moviment speed break; case 13264: - sc_start(bl, SC_BANANA_BOMB, 100, skill_lv, skill_get_time(GN_SLINGITEM, skill_lv)); // Reduces LUK ??Needed confirm it, may be it's bugged in kRORE? - sc_start(bl, SC_BANANA_BOMB_SITDOWN, 75, skill_lv, skill_get_time(GN_SLINGITEM_RANGEMELEEATK,skill_lv)); // Sitdown for 3 seconds. + sc_start(bl, SC_BANANA_BOMB, 100, skill_lv, skill->get_time(GN_SLINGITEM, skill_lv)); // Reduces LUK ??Needed confirm it, may be it's bugged in kRORE? + sc_start(bl, SC_BANANA_BOMB_SITDOWN, 75, skill_lv, skill->get_time(GN_SLINGITEM_RANGEMELEEATK,skill_lv)); // Sitdown for 3 seconds. break; } sd->itemid = -1; } break; case GN_HELLS_PLANT_ATK: - sc_start(bl, SC_STUN, 5 + 5 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); - sc_start2(bl, SC_BLEEDING, 20 + 10 * skill_lv, skill_lv, src->id,skill_get_time2(skill_id, skill_lv)); + sc_start(bl, SC_STUN, 5 + 5 * skill_lv, skill_lv, skill->get_time2(skill_id, skill_lv)); + sc_start2(bl, SC_BLEEDING, 20 + 10 * skill_lv, skill_lv, src->id,skill->get_time2(skill_id, skill_lv)); break; case EL_WIND_SLASH: // Non confirmed rate. - sc_start2(bl, SC_BLEEDING, 25, skill_lv, src->id, skill_get_time(skill_id,skill_lv)); + sc_start2(bl, SC_BLEEDING, 25, skill_lv, src->id, skill->get_time(skill_id,skill_lv)); break; case EL_STONE_HAMMER: rate = 10 * skill_lv; - sc_start(bl, SC_STUN, rate, skill_lv, skill_get_time(skill_id,skill_lv)); + sc_start(bl, SC_STUN, rate, skill_lv, skill->get_time(skill_id,skill_lv)); break; case EL_ROCK_CRUSHER: case EL_ROCK_CRUSHER_ATK: - sc_start(bl,status_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)); + sc_start(bl,SC_SILENCE,10*skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)); break; case KO_JYUMONJIKIRI: // needs more info - sc_start(bl,SC_JYUMONJIKIRI,25,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_JYUMONJIKIRI,25,skill_lv,skill->get_time(skill_id,skill_lv)); break; case KO_MAKIBISHI: - sc_start(bl, SC_STUN, 100, skill_lv, skill_get_time2(skill_id,skill_lv)); + sc_start(bl, SC_STUN, 100, skill_lv, skill->get_time2(skill_id,skill_lv)); break; case MH_LAVA_SLIDE: - if (tsc && !tsc->data[SC_BURNING]) sc_start4(bl, SC_BURNING, 10 * skill_lv, skill_lv, 1000, src->id, 0, skill_get_time(skill_id, skill_lv)); + if (tsc && !tsc->data[SC_BURNING]) sc_start4(bl, SC_BURNING, 10 * skill_lv, skill_lv, 1000, src->id, 0, skill->get_time(skill_id, skill_lv)); break; case MH_STAHL_HORN: - sc_start(bl, SC_STUN, (20 + 4 * (skill_lv-1)), skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_STUN, (20 + 4 * (skill_lv-1)), skill_lv, skill->get_time(skill_id, skill_lv)); break; case MH_NEEDLE_OF_PARALYZE: - sc_start(bl, SC_PARALYSIS, 40 + (5*skill_lv), skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_PARALYSIS, 40 + (5*skill_lv), skill_lv, skill->get_time(skill_id, skill_lv)); break; } @@ -1444,7 +1437,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint rate += 10; } if( rate ) - skill_break_equip(src, EQP_WEAPON, rate, BCT_SELF); + skill->break_equip(src, EQP_WEAPON, rate, BCT_SELF); } if( battle_config.equip_skill_break_rate && skill_id != WS_CARTTERMINATION && skill_id != ITM_TOMAHAWK ) { // Cart Termination/Tomahawk won't trigger breaking data. Why? No idea, go ask Gravity. @@ -1455,7 +1448,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint if( sc && sc->data[SC_MELTDOWN] ) rate += sc->data[SC_MELTDOWN]->val2; if( rate ) - skill_break_equip(bl, EQP_WEAPON, rate, BCT_ENEMY); + skill->break_equip(bl, EQP_WEAPON, rate, BCT_ENEMY); // Target armor breaking rate = 0; @@ -1464,7 +1457,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint if( sc && sc->data[SC_MELTDOWN] ) rate += sc->data[SC_MELTDOWN]->val3; if( rate ) - skill_break_equip(bl, EQP_ARMOR, rate, BCT_ENEMY); + skill->break_equip(bl, EQP_ARMOR, rate, BCT_ENEMY); } } @@ -1472,21 +1465,21 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint struct unit_data *ud = unit_bl2ud(src); if( sc->data[SC_WILD_STORM_OPTION] ) - skill = sc->data[SC_WILD_STORM_OPTION]->val2; + temp = sc->data[SC_WILD_STORM_OPTION]->val2; else if( sc->data[SC_UPHEAVAL_OPTION] ) - skill = sc->data[SC_UPHEAVAL_OPTION]->val2; + temp = sc->data[SC_UPHEAVAL_OPTION]->val2; else if( sc->data[SC_TROPIC_OPTION] ) - skill = sc->data[SC_TROPIC_OPTION]->val3; + temp = sc->data[SC_TROPIC_OPTION]->val3; else if( sc->data[SC_CHILLY_AIR_OPTION] ) - skill = sc->data[SC_CHILLY_AIR_OPTION]->val3; + temp = sc->data[SC_CHILLY_AIR_OPTION]->val3; else - skill = 0; + temp = 0; - if ( rnd()%100 < 25 && skill ){ - skill_castend_damage_id(src, bl, skill, 5, tick, 0); + if ( rnd()%100 < 25 && temp ){ + skill->castend_damage_id(src, bl, temp, 5, tick, 0); if (ud) { - rate = skill_delayfix(src, skill, skill_lv); + rate = skill->delay_fix(src, temp, skill_lv); if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers ) @@ -1510,10 +1503,10 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint sd->autospell[i].flag&attack_type&BF_SKILLMASK)) continue; // one or more trigger conditions were not fulfilled - skill = (sd->autospell[i].id > 0) ? sd->autospell[i].id : -sd->autospell[i].id; + temp = (sd->autospell[i].id > 0) ? sd->autospell[i].id : -sd->autospell[i].id; sd->state.autocast = 1; - notok = skillnotok(skill, sd); + notok = skill->not_ok(temp, sd); sd->state.autocast = 0; if ( notok ) @@ -1529,26 +1522,26 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint tbl = (sd->autospell[i].id < 0) ? src : bl; - if( (type = skill_get_casttype(skill)) == CAST_GROUND ) { + if( (type = skill->get_casttype(temp)) == CAST_GROUND ) { int maxcount = 0; if( !(BL_PC&battle_config.skill_reiteration) && - skill_get_unit_flag(skill)&UF_NOREITERATION && - skill_check_unit_range(src,tbl->x,tbl->y,skill,skill_lv) + skill->get_unit_flag(temp)&UF_NOREITERATION && + skill_check_unit_range(src,tbl->x,tbl->y,temp,skill_lv) ) { continue; } if( BL_PC&battle_config.skill_nofootset && - skill_get_unit_flag(skill)&UF_NOFOOTSET && - skill_check_unit_range2(src,tbl->x,tbl->y,skill,skill_lv) + skill->get_unit_flag(temp)&UF_NOFOOTSET && + skill_check_unit_range2(src,tbl->x,tbl->y,temp,skill_lv) ) { continue; } if( BL_PC&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(skill, skill_lv)) > 0 + (maxcount = skill->get_maxcount(temp, skill_lv)) > 0 ) { int v; for(v=0;v<MAX_SKILLUNITGROUP && sd->ud.skillunit[v] && maxcount;v++) { - if(sd->ud.skillunit[v]->skill_id == skill) + if(sd->ud.skillunit[v]->skill_id == temp) maxcount--; } if( maxcount == 0 ) { @@ -1557,33 +1550,33 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } } if( battle_config.autospell_check_range && - !battle->check_range(src, tbl, skill_get_range2(src, skill,skill_lv) + (skill == RG_CLOSECONFINE?0:1)) ) + !battle->check_range(src, tbl, skill->get_range2(src, temp,skill_lv) + (temp == RG_CLOSECONFINE?0:1)) ) continue; - if (skill == AS_SONICBLOW) + if (temp == AS_SONICBLOW) pc_stop_attack(sd); //Special case, Sonic Blow autospell should stop the player attacking. - else if (skill == PF_SPIDERWEB) //Special case, due to its nature of coding. + else if (temp == PF_SPIDERWEB) //Special case, due to its nature of coding. type = CAST_GROUND; sd->state.autocast = 1; - skill_consume_requirement(sd,skill,skill_lv,1); - skill_toggle_magicpower(src, skill); + skill->consume_requirement(sd,temp,skill_lv,1); + skill_toggle_magicpower(src, temp); switch (type) { case CAST_GROUND: - skill_castend_pos2(src, tbl->x, tbl->y, skill, skill_lv, tick, 0); + skill->castend_pos2(src, tbl->x, tbl->y, temp, skill_lv, tick, 0); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(src, tbl, skill, skill_lv, tick, 0); + skill->castend_nodamage_id(src, tbl, temp, skill_lv, tick, 0); break; case CAST_DAMAGE: - skill_castend_damage_id(src, tbl, skill, skill_lv, tick, 0); + skill->castend_damage_id(src, tbl, temp, skill_lv, tick, 0); break; } sd->state.autocast = 0; //Set canact delay. [Skotlex] ud = unit_bl2ud(src); if (ud) { - rate = skill_delayfix(src, skill, skill_lv); + rate = skill->delay_fix(src, temp, skill_lv); if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers && sd ) @@ -1618,7 +1611,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint { struct mob_db *mob; int class_; - skill = 0; + temp = 0; do { do { class_ = rnd() % MAX_MOB_DB; @@ -1628,8 +1621,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint mob = mob_db(class_); } while ( (mob->status.mode&(MD_BOSS|MD_PLANT) || mob->summonper[0] <= rate) && - (skill++) < 2000); - if (skill < 2000) + (temp++) < 2000); + if (temp < 2000) mob_class_change(dstmd,class_); } @@ -1637,7 +1630,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, unsigned int tick) { - int skill, skill_lv, i, type, notok; + int temp, skill_lv, i, type, notok; struct block_list *tbl; if( sd == NULL || !skill_id ) @@ -1650,10 +1643,10 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1 if( sd->autospell3[i].lock ) continue; // autospell already being executed - skill = (sd->autospell3[i].id > 0) ? sd->autospell3[i].id : -sd->autospell3[i].id; + temp = (sd->autospell3[i].id > 0) ? sd->autospell3[i].id : -sd->autospell3[i].id; sd->state.autocast = 1; - notok = skillnotok(skill, sd); + notok = skill->not_ok(temp, sd); sd->state.autocast = 0; if ( notok ) @@ -1669,26 +1662,26 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1 tbl = (sd->autospell3[i].id < 0) ? &sd->bl : bl; - if( (type = skill_get_casttype(skill)) == CAST_GROUND ) { + if( (type = skill->get_casttype(temp)) == CAST_GROUND ) { int maxcount = 0; if( !(BL_PC&battle_config.skill_reiteration) && - skill_get_unit_flag(skill)&UF_NOREITERATION && - skill_check_unit_range(&sd->bl,tbl->x,tbl->y,skill,skill_lv) + skill->get_unit_flag(temp)&UF_NOREITERATION && + skill_check_unit_range(&sd->bl,tbl->x,tbl->y,temp,skill_lv) ) { continue; } if( BL_PC&battle_config.skill_nofootset && - skill_get_unit_flag(skill)&UF_NOFOOTSET && - skill_check_unit_range2(&sd->bl,tbl->x,tbl->y,skill,skill_lv) + skill->get_unit_flag(temp)&UF_NOFOOTSET && + skill_check_unit_range2(&sd->bl,tbl->x,tbl->y,temp,skill_lv) ) { continue; } if( BL_PC&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(skill, skill_lv)) > 0 + (maxcount = skill->get_maxcount(temp, skill_lv)) > 0 ) { int v; for(v=0;v<MAX_SKILLUNITGROUP && sd->ud.skillunit[v] && maxcount;v++) { - if(sd->ud.skillunit[v]->skill_id == skill) + if(sd->ud.skillunit[v]->skill_id == temp) maxcount--; } if( maxcount == 0 ) { @@ -1697,17 +1690,16 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1 } } if( battle_config.autospell_check_range && - !battle->check_range(&sd->bl, tbl, skill_get_range2(&sd->bl, skill,skill_lv) + (skill == RG_CLOSECONFINE?0:1)) ) + !battle->check_range(&sd->bl, tbl, skill->get_range2(&sd->bl, temp,skill_lv) + (temp == RG_CLOSECONFINE?0:1)) ) continue; sd->state.autocast = 1; sd->autospell3[i].lock = true; - skill_consume_requirement(sd,skill,skill_lv,1); - switch( type ) - { - case CAST_GROUND: skill_castend_pos2(&sd->bl, tbl->x, tbl->y, skill, skill_lv, tick, 0); break; - case CAST_NODAMAGE: skill_castend_nodamage_id(&sd->bl, tbl, skill, skill_lv, tick, 0); break; - case CAST_DAMAGE: skill_castend_damage_id(&sd->bl, tbl, skill, skill_lv, tick, 0); break; + skill->consume_requirement(sd,temp,skill_lv,1); + switch( type ) { + case CAST_GROUND: skill->castend_pos2(&sd->bl, tbl->x, tbl->y, temp, skill_lv, tick, 0); break; + case CAST_NODAMAGE: skill->castend_nodamage_id(&sd->bl, tbl, temp, skill_lv, tick, 0); break; + case CAST_DAMAGE: skill->castend_damage_id(&sd->bl, tbl, temp, skill_lv, tick, 0); break; } sd->autospell3[i].lock = false; sd->state.autocast = 0; @@ -1730,12 +1722,12 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1 return 1; } -/* Splitted off from skill_additional_effect, which is never called when the +/* Splitted off from skill->additional_effect, which is never called when the * attack skill kills the enemy. Place in this function counter status effects * when using skills (eg: Asura's sp regen penalty, or counter-status effects * from cards) that will take effect on the source, not the target. [Skotlex] * Note: Currently this function only applies to Extremity Fist and BF_WEAPON - * type of skills, so not every instance of skill_additional_effect needs a call + * 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) @@ -1770,7 +1762,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * continue; //Range Failed. } type = dstsd->addeff2[i].id; - time = skill_get_time2(status_sc2skill(type),7); + time = skill->get_time2(status_sc2skill(type),7); if (dstsd->addeff2[i].flag&ATF_TARGET) status_change_start(src,type,rate,7,0,0,0,time,0); @@ -1782,10 +1774,10 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * switch(skill_id){ case MO_EXTREMITYFIST: - sc_start(src,SC_EXTREMITYFIST,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(src,SC_EXTREMITYFIST,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case GS_FULLBUSTER: - sc_start(src,SC_BLIND,2*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(src,SC_BLIND,2*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case HFLI_SBR44: //[orn] case HVAN_EXPLOSION: @@ -1807,7 +1799,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * sc_start(src,SC_MIRACLE,100,1,battle_config.sg_miracle_skill_duration); if(sd && skill_id && attack_type&BF_MAGIC && status_isdead(bl) && - !(skill_get_inf(skill_id)&(INF_GROUND_SKILL|INF_SELF_SKILL)) && + !(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] @@ -1843,7 +1835,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * // Trigger counter-spells to retaliate against damage causing skills. if(dstsd && !status_isdead(bl) && dstsd->autospell2[0].id && - !(skill_id && skill_get_nk(skill_id)&NK_NO_DAMAGE)) + !(skill_id && skill->get_nk(skill_id)&NK_NO_DAMAGE)) { struct block_list *tbl; struct unit_data *ud; @@ -1865,7 +1857,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * rate>>=1; dstsd->state.autocast = 1; - notok = skillnotok(skill_id, dstsd); + notok = skill->not_ok(skill_id, dstsd); dstsd->state.autocast = 0; if ( notok ) @@ -1876,22 +1868,22 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * tbl = (dstsd->autospell2[i].id < 0) ? bl : src; - if( (type = skill_get_casttype(skill_id)) == CAST_GROUND ) { + if( (type = skill->get_casttype(skill_id)) == CAST_GROUND ) { int maxcount = 0; if( !(BL_PC&battle_config.skill_reiteration) && - skill_get_unit_flag(skill_id)&UF_NOREITERATION && + skill->get_unit_flag(skill_id)&UF_NOREITERATION && skill_check_unit_range(bl,tbl->x,tbl->y,skill_id,skill_lv) ) { continue; } if( BL_PC&battle_config.skill_nofootset && - skill_get_unit_flag(skill_id)&UF_NOFOOTSET && + skill->get_unit_flag(skill_id)&UF_NOFOOTSET && skill_check_unit_range2(bl,tbl->x,tbl->y,skill_id,skill_lv) ) { continue; } if( BL_PC&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(skill_id, skill_lv)) > 0 + (maxcount = skill->get_maxcount(skill_id, skill_lv)) > 0 ) { int v; for(v=0;v<MAX_SKILLUNITGROUP && dstsd->ud.skillunit[v] && maxcount;v++) { @@ -1904,27 +1896,27 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * } } - if( !battle->check_range(src, tbl, skill_get_range2(src, skill_id,skill_lv) + (skill_id == RG_CLOSECONFINE?0:1)) && battle_config.autospell_check_range ) + if( !battle->check_range(src, tbl, skill->get_range2(src, skill_id,skill_lv) + (skill_id == RG_CLOSECONFINE?0:1)) && battle_config.autospell_check_range ) continue; dstsd->state.autocast = 1; - skill_consume_requirement(dstsd,skill_id,skill_lv,1); + skill->consume_requirement(dstsd,skill_id,skill_lv,1); switch (type) { case CAST_GROUND: - skill_castend_pos2(bl, tbl->x, tbl->y, skill_id, skill_lv, tick, 0); + skill->castend_pos2(bl, tbl->x, tbl->y, skill_id, skill_lv, tick, 0); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(bl, tbl, skill_id, skill_lv, tick, 0); + skill->castend_nodamage_id(bl, tbl, skill_id, skill_lv, tick, 0); break; case CAST_DAMAGE: - skill_castend_damage_id(bl, tbl, skill_id, skill_lv, tick, 0); + skill->castend_damage_id(bl, tbl, skill_id, skill_lv, tick, 0); break; } dstsd->state.autocast = 0; //Set canact delay. [Skotlex] ud = unit_bl2ud(bl); if (ud) { - rate = skill_delayfix(bl, skill_id, skill_lv); + rate = skill->delay_fix(bl, skill_id, skill_lv); if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers && dstsd ) @@ -1935,7 +1927,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * } //Autobonus when attacked - if( dstsd && !status_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++ ) @@ -1960,8 +1952,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * - flag is a BCT_ flag to indicate which type of adjustment should be used (BCT_ENEMY/BCT_PARTY/BCT_SELF) are the valid values. --------------------------------------------------------------------------*/ -int skill_break_equip (struct block_list *bl, unsigned short where, int rate, int flag) -{ +int skill_break_equip (struct block_list *bl, unsigned short where, int rate, int flag) { const int where_list[4] = {EQP_WEAPON, EQP_ARMOR, EQP_SHIELD, EQP_HELM}; const enum sc_type scatk[4] = {SC_STRIPWEAPON, SC_STRIPARMOR, SC_STRIPSHIELD, SC_STRIPHELM}; const enum sc_type scdef[4] = {SC_CP_WEAPON, SC_CP_ARMOR, SC_CP_SHIELD, SC_CP_HELM}; @@ -2007,7 +1998,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(status_sc2skill(scatk[i]),1)); + sc_start(bl,scatk[i],100,0,skill->get_time(status_sc2skill(scatk[i]),1)); } } if (!where) //Nothing to break. @@ -2051,8 +2042,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in return where; //Return list of pieces broken. } -int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time) -{ +int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time) { struct status_change *sc; const int pos[5] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HELM, EQP_ACC}; const enum sc_type sc_atk[5] = {SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM, SC__STRIPACCESSORY}; @@ -2087,8 +2077,7 @@ static int skill_area_temp[8]; - if 'flag&0x1', position update packets must not be sent. - if 'flag&0x2', skill blown ignores players' special_state.no_knockback -------------------------------------------------------------------------*/ -int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag) -{ +int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag) { int dx = 0, dy = 0; struct skill_unit* su = NULL; @@ -2205,7 +2194,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds //When caster is not the src of attack, this is a ground skill, and as such, do the relevant target checking. [Skotlex] 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) { + } 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 (!status_check_skilluse(src, bl, skill_id, 2)) return 0; @@ -2234,7 +2223,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds struct pet_data *pd = (TBL_PET*)src; if (pd->a_skill && pd->a_skill->div_ && pd->a_skill->id == skill_id) { - int element = skill_get_ele(skill_id, skill_lv); + int element = skill->get_ele(skill_id, skill_lv); /*if (skill_id == -1) Does it ever worked? element = sstatus->rhw.ele;*/ if (element != ELE_NEUTRAL || !(battle_config.attack_attr_none&BL_PET)) @@ -2286,7 +2275,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds #endif } if(sc && sc->data[SC_MAGICROD] && src == dsrc) { - int sp = skill_get_sp(skill_id,skill_lv); + int sp = skill->get_sp(skill_id,skill_lv); dmg.damage = dmg.damage2 = 0; dmg.dmg_lv = ATK_MISS; //This will prevent skill additional effect from taking effect. [Skotlex] sp = sp * sc->data[SC_MAGICROD]->val2 / 100; @@ -2317,7 +2306,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } //Skill hit type - type=(skill_id==0)?5:skill_get_hit(skill_id); + type=(skill_id==0)?5:skill->get_hit(skill_id); if(damage < dmg.div_ //Only skills that knockback even when they miss. [Skotlex] @@ -2397,7 +2386,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case SL_STIN: case SL_STUN: if (skill_lv >= 7 && !sd->sc.data[SC_SMA]) - sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA, skill_lv)); + sc_start(src,SC_SMA,100,skill_lv,skill->get_time(SL_SMA, skill_lv)); break; case GS_FULLBUSTER: //Can't attack nor use items until skill's delay expires. [Skotlex] @@ -2518,7 +2507,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds type = 5; if( bl->type == BL_SKILL ){ TBL_SKILL *su = (TBL_SKILL*)bl; - if( su->group && skill_get_inf2(su->group->skill_id)&INF2_TRAP )// show damage on trap targets + if( su->group && skill->get_inf2(su->group->skill_id)&INF2_TRAP )// show damage on trap targets clif_skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, flag&SD_LEVEL?-1:skill_lv, 5); } dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, flag&SD_LEVEL?-1:skill_lv, type); @@ -2569,7 +2558,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds int lv; if( sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) ) { //Level dependent and limitation. - lv = min(lv,skill_get_max(copy_skill)); + lv = min(lv,skill->get_max(copy_skill)); if( tsd->reproduceskill_id && tsd->status.skill[tsd->reproduceskill_id].flag == SKILL_FLAG_PLAGIARIZED ) { tsd->status.skill[tsd->reproduceskill_id].id = 0; tsd->status.skill[tsd->reproduceskill_id].lv = 0; @@ -2609,26 +2598,26 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } } - if (dmg.dmg_lv >= ATK_MISS && (type = skill_get_walkdelay(skill_id, skill_lv)) > 0) - { //Skills with can't walk delay also stop normal attacking for that + if (dmg.dmg_lv >= ATK_MISS && (type = skill->get_walkdelay(skill_id, skill_lv)) > 0) { + //Skills with can't walk delay also stop normal attacking for that //duration when the attack connects. [Skotlex] struct unit_data *ud = unit_bl2ud(src); if (ud && DIFF_TICK(ud->attackabletime, tick + type) < 0) ud->attackabletime = tick + type; } - if( !dmg.amotion ) - { //Instant damage + if( !dmg.amotion ) { + //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( !status_isdead(bl) && additional_effects ) - skill_additional_effect(src,bl,skill_id,skill_lv,dmg.flag,dmg.dmg_lv,tick); + 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); + skill->counter_additional_effect(src,bl,skill_id,skill_lv,dmg.flag,tick); } // Hell Inferno burning status only starts if Fire part hits. if( skill_id == WL_HELLINFERNO && dmg.damage > 0 ) - sc_start4(bl,SC_BURNING,55+5*skill_lv,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv)); + sc_start4(bl,SC_BURNING,55+5*skill_lv,skill_lv,1000,src->id,0,skill->get_time(skill_id,skill_lv)); // Apply knock back chance in SC_TRIANGLESHOT skill. else if( skill_id == SC_TRIANGLESHOT && rnd()%100 > (1 + skill_lv) ) dmg.blewcount = 0; @@ -2659,35 +2648,35 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds //blown-specific handling switch( skill_id ) { case LG_OVERBRAND: - if( skill_blown(dsrc,bl,dmg.blewcount,dir,0) ) { + if( skill->blown(dsrc,bl,dmg.blewcount,dir,0) ) { short dir_x, dir_y; dir_x = dirx[(dir+4)%8]; dir_y = diry[(dir+4)%8]; if( map_getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 ) - skill_addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag ); + skill->addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag ); } else - skill_addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag ); + skill->addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag ); break; case SR_KNUCKLEARROW: - if( skill_blown(dsrc,bl,dmg.blewcount,dir,0) && !(flag&4) ) { + if( skill->blown(dsrc,bl,dmg.blewcount,dir,0) && !(flag&4) ) { short dir_x, dir_y; dir_x = dirx[(dir+4)%8]; dir_y = diry[(dir+4)%8]; if( map_getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 ) - skill_addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|4); + skill->addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|4); } break; case GN_WALLOFTHORN: unit_stop_walking(bl,1); - skill_blown(dsrc,bl,dmg.blewcount,dir, 0x2 ); + skill->blown(dsrc,bl,dmg.blewcount,dir, 0x2 ); clif_fixpos(bl); break; default: - skill_blown(dsrc,bl,dmg.blewcount,dir, 0x0 ); + skill->blown(dsrc,bl,dmg.blewcount,dir, 0x0 ); if ( !dmg.blewcount && bl->type == BL_SKILL && damage > 0 ){ TBL_SKILL *su = (TBL_SKILL*)bl; if( su->group && su->group->skill_id == HT_BLASTMINE) - skill_blown(src, bl, 3, -1, 0); + skill->blown(src, bl, 3, -1, 0); } break; } @@ -2728,9 +2717,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds int rate = 50 + skill_lv * 5; 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); + skill->addtimerskill(src,tick + 800,bl->id,0,0,skill_id,skill_lv,0,flag); } else if( skill_id == SC_FATALMENACE ) - skill_addtimerskill(src,tick + 800,bl->id,skill_area_temp[4],skill_area_temp[5],skill_id,skill_lv,0,flag); + skill->addtimerskill(src,tick + 800,bl->id,skill_area_temp[4],skill_area_temp[5],skill_id,skill_lv,0,flag); } if(skill_id == CR_GRANDCROSS || skill_id == NPC_GRANDDARKNESS) @@ -2748,7 +2737,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if( rdamage > 0 ) { if( sc && sc->data[SC_REFLECTDAMAGE] ) { if( src != bl )// Don't reflect your own damage (Grand Cross) - map_foreachinshootrange(battle->damage_area,bl,skill_get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,bl,dmg.amotion,sstatus->dmotion,rdamage,tstatus->race); + map_foreachinshootrange(battle->damage_area,bl,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,bl,dmg.amotion,sstatus->dmotion,rdamage,tstatus->race); } else { if( dmg.amotion ) battle->delay_damage(tick, dmg.amotion,bl,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,0,additional_effects); @@ -2758,7 +2747,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds //Use Reflect Shield to signal this kind of skill trigger. [Skotlex] if( tsd && src != bl ) battle->drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src)); - skill_additional_effect(bl, src, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); + skill->additional_effect(bl, src, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); } } if( damage > 0 ) { @@ -2767,12 +2756,12 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds **/ switch( skill_id ) { case RK_CRUSHSTRIKE: - skill_break_equip(src,EQP_WEAPON,2000,BCT_SELF); // 20% chance to destroy the weapon. + skill->break_equip(src,EQP_WEAPON,2000,BCT_SELF); // 20% chance to destroy the weapon. break; 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)); + 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); } @@ -2797,8 +2786,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds sc->data[SC_DOUBLECAST] && rnd() % 100 < sc->data[SC_DOUBLECAST]->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); +// 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); } map_freeblock_unlock(); @@ -2893,7 +2882,7 @@ static int skill_check_unit_range_sub (struct block_list *bl, va_list ap) case SC_DIMENSIONDOOR: case SC_BLOODYLUST: //Non stackable on themselves and traps (including venom dust which does not has the trap inf2 set) - if (skill_id != g_skill_id && !(skill_get_inf2(g_skill_id)&INF2_TRAP) && g_skill_id != AS_VENOMDUST && g_skill_id != MH_POISON_MIST) + if (skill_id != g_skill_id && !(skill->get_inf2(g_skill_id)&INF2_TRAP) && g_skill_id != AS_VENOMDUST && g_skill_id != MH_POISON_MIST) return 0; break; default: //Avoid stacking with same kind of trap. [Skotlex] @@ -2995,7 +2984,7 @@ int skill_guildaura_sub (struct map_session_data* sd, int id, int strvit, int ag * &1: finished casting the skill (invoke hp/sp/item consumption) * &2: picked menu entry (Warp Portal, Teleport and other menu based skills) *------------------------------------------*/ -static int skill_check_condition_mercenary(struct block_list *bl, int skill, int lv, int type) +static int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, int type) { struct status_data *status; struct map_session_data *sd = NULL; @@ -3014,7 +3003,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int } status = status_get_status_data(bl); - if( (idx = skill_get_index(skill)) == 0 ) + if( (idx = skill->get_index(skill_id)) == 0 ) return 0; // Requeriments @@ -3039,11 +3028,9 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int else sp += (status->max_sp * (-sp_rate)) / 100; - if( bl->type == BL_HOM ) - { // Intimacy Requeriments + if( bl->type == BL_HOM ) { // Intimacy Requeriments struct homun_data *hd = BL_CAST(BL_HOM, bl); - switch( skill ) - { + switch( skill_id ) { case HFLI_SBR44: if( hd->homunculus.intimacy <= 200 ) return 0; @@ -3055,27 +3042,22 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int } } - if( !(type&2) ) - { - if( hp > 0 && status->hp <= (unsigned int)hp ) - { - clif_skill_fail(sd, skill, USESKILL_FAIL_HP_INSUFFICIENT, 0); + if( !(type&2) ) { + if( hp > 0 && status->hp <= (unsigned int)hp ) { + clif_skill_fail(sd, skill_id, USESKILL_FAIL_HP_INSUFFICIENT, 0); return 0; } - if( sp > 0 && status->sp <= (unsigned int)sp ) - { - clif_skill_fail(sd, skill, USESKILL_FAIL_SP_INSUFFICIENT, 0); + if( sp > 0 && status->sp <= (unsigned int)sp ) { + clif_skill_fail(sd, skill_id, USESKILL_FAIL_SP_INSUFFICIENT, 0); return 0; } } if( !type ) - switch( state ) - { + switch( state ) { case ST_MOVE_ENABLE: - if( !unit_can_move(bl) ) - { - clif_skill_fail(sd, skill, USESKILL_FAIL_LEVEL, 0); + if( !unit_can_move(bl) ) { + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); return 0; } break; @@ -3091,7 +3073,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int index[i] = pc_search_inventory(sd, itemid[i]); if( index[i] < 0 || sd->status.inventory[index[i]].amount < amount[i] ) { - clif_skill_fail(sd, skill, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); return 0; } } @@ -3164,24 +3146,24 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) break; case BA_FROSTJOKER: case DC_SCREAM: - range= skill_get_splash(skl->skill_id, skl->skill_lv); + range= skill->get_splash(skl->skill_id, skl->skill_lv); map_foreachinarea(skill_frostjoke_scream,skl->map,skl->x-range,skl->y-range, skl->x+range,skl->y+range,BL_CHAR,src,skl->skill_id,skl->skill_lv,tick); break; case NPC_EARTHQUAKE: if( skl->type > 1 ) - skill_addtimerskill(src,tick+250,src->id,0,0,skl->skill_id,skl->skill_lv,skl->type-1,skl->flag); - skill_area_temp[0] = map_foreachinrange(skill_area_sub, src, skill_get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, tick, BCT_ENEMY, skill_area_sub_count); + skill->addtimerskill(src,tick+250,src->id,0,0,skl->skill_id,skl->skill_lv,skl->type-1,skl->flag); + skill_area_temp[0] = map_foreachinrange(skill_area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, tick, BCT_ENEMY, skill_area_sub_count); skill_area_temp[1] = src->id; skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub, src, skill_get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill->castend_damage_id); break; case WZ_WATERBALL: skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify if (!status_isdead(target)) - skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); + skill->attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); 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); + 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 = status_get_sc(src); if(sc) { @@ -3198,7 +3180,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) case WL_CHAINLIGHTNING_ATK: { struct block_list *nbl = NULL; // Next Target of Chain - skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); // Hit a Lightning on the current Target + skill->attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); // Hit a Lightning on the current Target skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify if( skl->type > 1 ) { // Remaining Chains Hit nbl = battle->get_enemy_area(src,target->x,target->y,2,BL_CHAR|BL_SKILL,target->id); // Search for a new Target around current one... @@ -3210,14 +3192,14 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) } if( nbl ) - skill_addtimerskill(src,tick+status_get_adelay(src),nbl->id,skl->x,0,WL_CHAINLIGHTNING_ATK,skl->skill_lv,skl->type-1,skl->flag); + skill->addtimerskill(src,tick+status_get_adelay(src),nbl->id,skl->x,0,WL_CHAINLIGHTNING_ATK,skl->skill_lv,skl->type-1,skl->flag); } break; case WL_TETRAVORTEX_FIRE: case WL_TETRAVORTEX_WATER: case WL_TETRAVORTEX_WIND: case WL_TETRAVORTEX_GROUND: - skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag|SD_ANIMATION); + skill->attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag|SD_ANIMATION); skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify if( skl->type >= 3 ) { // Final Hit @@ -3241,14 +3223,14 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) status_change_start(target, i, 10000, skl->skill_lv, (i == SC_BURNING ? 1000 : (i == SC_BLEEDING ? src->id : 0)), (i == SC_BURNING ? src->id : 0), - 0, skill_get_time(WL_TETRAVORTEX,skl->skill_lv), 0); + 0, skill->get_time(WL_TETRAVORTEX,skl->skill_lv), 0); } } } break; case WM_REVERBERATION_MELEE: case WM_REVERBERATION_MAGIC: - skill_castend_damage_id(src, target, skl->skill_id, skl->skill_lv, tick, skl->flag|SD_LEVEL); // damage should split among targets + skill->castend_damage_id(src, target, skl->skill_id, skl->skill_lv, tick, skl->flag|SD_LEVEL); // damage should split among targets break; case SC_FATALMENACE: if( src == target ) // Casters Part @@ -3265,7 +3247,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) struct map_session_data *tsd = NULL; if( (tsd = ((TBL_PC*)target)) && !pc_issit(tsd) ) { pc_setsit(tsd); - skill_sit(tsd,1); + skill->sit(tsd,1); clif_sitting(&tsd->bl); } } @@ -3273,11 +3255,11 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) case LG_OVERBRAND_BRANDISH: case LG_OVERBRAND_PLUSATK: case SR_KNUCKLEARROW: - skill_attack(BF_WEAPON, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag|SD_LEVEL); + skill->attack(BF_WEAPON, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag|SD_LEVEL); break; case GN_SPORE_EXPLOSION: - map_foreachinrange(skill_area_sub, target, skill_get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, - src, skl->skill_id, skl->skill_lv, 0, skl->flag|1|BCT_ENEMY, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, target, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, + src, skl->skill_id, skl->skill_lv, 0, skl->flag|1|BCT_ENEMY, skill->castend_damage_id); break; case CH_PALMSTRIKE: { @@ -3285,12 +3267,12 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) 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 ); + 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); + skill->attack(skl->type,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); break; } } @@ -3304,12 +3286,12 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { int x = skl->type>>16, y = skl->type&0xFFFF; if( path_search_long(NULL, src->m, src->x, src->y, x, y, CELL_CHKWALL) ) - skill_unitsetting(src,skl->skill_id,skl->skill_lv,x,y,skl->flag); + skill->unitsetting(src,skl->skill_id,skl->skill_lv,x,y,skl->flag); if( path_search_long(NULL, src->m, src->x, src->y, skl->x, skl->y, CELL_CHKWALL) ) clif_skill_poseffect(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,tick); } else if( path_search_long(NULL, src->m, src->x, src->y, skl->x, skl->y, CELL_CHKWALL) ) - skill_unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,skl->flag); + skill->unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,skl->flag); break; case GN_CRAZYWEED_ATK: { @@ -3317,7 +3299,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) map_foreachinarea(skill_cell_overlap, src->m, skl->x-i, skl->y-i, skl->x+i, skl->y+i, BL_SKILL, skl->skill_id, &dummy, src); } case WL_EARTHSTRAIN: - skill_unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,(skl->type<<16)|skl->flag); + skill->unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,(skl->type<<16)|skl->flag); break; } @@ -3384,7 +3366,7 @@ static int skill_ative_reverberation( struct block_list *bl, va_list ap) { if( bl->type != BL_SKILL ) return 0; if( su->alive && (sg = su->group) && sg->skill_id == WM_REVERBERATION ) { - map_foreachinrange(skill_trap_splash, bl, skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, gettick()); + map_foreachinrange(skill_trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, gettick()); su->limit=DIFF_TICK(gettick(),sg->tick); sg->unit_id = UNT_USED_TRAPS; } @@ -3394,7 +3376,7 @@ static int skill_ative_reverberation( struct block_list *bl, va_list ap) { static int skill_reveal_trap (struct block_list *bl, va_list ap) { TBL_SKILL *su = (TBL_SKILL*)bl; - if (su->alive && su->group && skill_get_inf2(su->group->skill_id)&INF2_TRAP) + if (su->alive && su->group && skill->get_inf2(su->group->skill_id)&INF2_TRAP) { //Reveal trap. //Change look is not good enough, the client ignores it as an actual trap still. [Skotlex] //clif_changetraplook(bl, su->group->unit_id); @@ -3430,12 +3412,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if (status_isdead(bl)) return 1; - if (skill_id && skill_get_type(skill_id) == BF_MAGIC && status_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 = 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)); + 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; } @@ -3560,7 +3542,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case KO_JYUMONJIKIRI: case KO_SETSUDAN: case KO_KAIHOU: - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; /** @@ -3573,7 +3555,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case NC_ARMSCANNON: if (sd) pc_overheat(sd,1); case RK_WINDCUTTER: - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); break; case LK_JOINTBEAT: // decide the ailment first (affects attack damage and effect) @@ -3588,25 +3570,25 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint //TODO: is there really no cleaner way to do this? sc = status_get_sc(bl); if (sc) sc->jb_flag = flag; - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case MO_COMBOFINISH: if (!(flag&1) && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_MONK) { //Becomes a splash attack when Soul Linked. map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skill_id, skill_lv),splash_target(src), + skill->get_splash(skill_id, skill_lv),splash_target(src), src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, - skill_castend_damage_id); + skill->castend_damage_id); } else - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case TK_STORMKICK: // Taekwon kicks [Dralnu] clif_skill_nodamage(src,bl,skill_id,skill_lv,1); skill_area_temp[1] = 0; - map_foreachinrange(skill_attack_area, src, - skill_get_splash(skill_id, skill_lv), splash_target(src), + map_foreachinrange(skill->attack_area, src, + skill->get_splash(skill_id, skill_lv), splash_target(src), BF_WEAPON, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY); break; @@ -3623,8 +3605,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint // cause damage and knockback if the path to target was a straight one if( path ) { - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, dist); - skill_blown(src, bl, dist, dir, 0); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, dist); + skill->blown(src, bl, dist, dir, 0); //HACK: since knockback officially defaults to the left, the client also turns to the left... therefore, // make the caster look in the direction of the target unit_setdir(src, (dir+4)%8); @@ -3642,9 +3624,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint //It won't shoot through walls since on castend there has to be a direct //line of sight between caster and target. skill_area_temp[1] = bl->id; - map_foreachinpath (skill_attack_area,src->m,src->x,src->y,bl->x,bl->y, - skill_get_splash(skill_id, skill_lv),skill_get_maxcount(skill_id,skill_lv), splash_target(src), - skill_get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY); + map_foreachinpath (skill->attack_area,src->m,src->x,src->y,bl->x,bl->y, + skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src), + skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY); break; case NPC_ACIDBREATH: @@ -3653,13 +3635,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case NPC_ICEBREATH: case NPC_THUNDERBREATH: skill_area_temp[1] = bl->id; - map_foreachinpath(skill_attack_area,src->m,src->x,src->y,bl->x,bl->y, - skill_get_splash(skill_id, skill_lv),skill_get_maxcount(skill_id,skill_lv), splash_target(src), - skill_get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY); + map_foreachinpath(skill->attack_area,src->m,src->x,src->y,bl->x,bl->y, + skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src), + skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY); break; case MO_INVESTIGATE: - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); break; @@ -3668,7 +3650,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint uint8 dir = map_calc_dir(src, bl->x, bl->y), t_dir = unit_getdir(bl); if ((!check_distance_bl(src, bl, 0) && !map_check_dir(dir, t_dir)) || bl->type == BL_SKILL) { status_change_end(src, SC_HIDING, INVALID_TIMER); - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest] unit_setdir(bl,dir); } @@ -3678,17 +3660,17 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case MO_FINGEROFFENSIVE: - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); if (battle_config.finger_offensive_type && sd) { int i; for (i = 1; i < sd->spiritball_old; i++) - skill_addtimerskill(src, tick + i * 200, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); + skill->addtimerskill(src, tick + i * 200, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); } status_change_end(src, SC_BLADESTOP, INVALID_TIMER); break; case MO_CHAINCOMBO: - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); break; @@ -3702,7 +3684,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint struct block_list *mbl = bl; short dir = 0; - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); if( skill_id == MO_EXTREMITYFIST ) { @@ -3712,7 +3694,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); #ifdef RENEWAL - sc_start(src,SC_EXTREMITYFIST2,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(src,SC_EXTREMITYFIST2,100,skill_lv,skill->get_time(skill_id,skill_lv)); #endif }else status_set_hp(src, @@ -3799,10 +3781,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint int sflag = skill_area_temp[0] & 0xFFF, heal; if( flag&SD_LEVEL ) sflag |= SD_LEVEL; // -1 will be used in packets instead of the skill level - if( skill_area_temp[1] != bl->id && !(skill_get_inf2(skill_id)&INF2_NPC_SKILL) ) + if( skill_area_temp[1] != bl->id && !(skill->get_inf2(skill_id)&INF2_NPC_SKILL) ) sflag |= SD_ANIMATION; // original target gets no animation (as well as all NPC skills) - heal = skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, sflag); + 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); status_heal(src,heal,0,0); @@ -3818,7 +3800,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; case NPC_EARTHQUAKE://FIXME: Isn't EarthQuake a ground skill after all? - skill_addtimerskill(src,tick+250,src->id,0,0,skill_id,skill_lv,2,flag|BCT_ENEMY|SD_SPLASH|1); + skill->addtimerskill(src,tick+250,src->id,0,0,skill_id,skill_lv,2,flag|BCT_ENEMY|SD_SPLASH|1); default: break; } @@ -3835,11 +3817,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint // if skill damage should be split among targets, count them //SD_LEVEL -> Forced splash damage for Auto Blitz-Beat -> count targets //special case: Venom Splasher uses a different range for searching than for splashing - if( flag&SD_LEVEL || skill_get_nk(skill_id)&NK_SPLASHSPLIT ) - skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, (skill_id == AS_SPLASHER)?1:skill_get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill_area_sub_count); + if( flag&SD_LEVEL || skill->get_nk(skill_id)&NK_SPLASHSPLIT ) + skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, (skill_id == AS_SPLASHER)?1:skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill_area_sub_count); - // recursive invocation of skill_castend_damage_id() with flag|1 - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), ( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + // recursive invocation of skill->castend_damage_id() with flag|1 + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), ( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id); } break; @@ -3847,9 +3829,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case ML_BRANDISH: //Coded apart for it needs the flag passed to the damage calculation. if (skill_area_temp[1] != bl->id) - skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag|SD_ANIMATION); + skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag|SD_ANIMATION); else - skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); break; case KN_BOWLINGBASH: @@ -3858,26 +3840,26 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if(bl->id==skill_area_temp[1]) break; //two hits for 500% - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION); - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION); } else { int i,c; - c = skill_get_blewcount(skill_id,skill_lv); + c = skill->get_blewcount(skill_id,skill_lv); // keep moving target in the direction that src is looking, square by square for(i=0;i<c;i++){ - if (!skill_blown(src,bl,1,(unit_getdir(src)+4)%8,0x1)) + if (!skill->blown(src,bl,1,(unit_getdir(src)+4)%8,0x1)) break; //Can't knockback - skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill_area_sub_count); + skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill_area_sub_count); if( skill_area_temp[0] > 1 ) break; // collision } clif_blown(bl); //Update target pos. if (i!=c) { //Splash skill_area_temp[1] = bl->id; - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id); } //Weirdo dual-hit property, two attacks for 500% - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0); - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0); } break; @@ -3885,19 +3867,19 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if(flag&1) { if (bl->id==skill_area_temp[1]) break; - if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION)) - skill_blown(src,bl,skill_area_temp[2],-1,0); + if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION)) + skill->blown(src,bl,skill_area_temp[2],-1,0); } else { int x=bl->x,y=bl->y,i,dir; dir = map_calc_dir(bl,src->x,src->y); skill_area_temp[1] = bl->id; - skill_area_temp[2] = skill_get_blewcount(skill_id,skill_lv); + skill_area_temp[2] = skill->get_blewcount(skill_id,skill_lv); // all the enemies between the caster and the target are hit, as well as the target - if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0)) - skill_blown(src,bl,skill_area_temp[2],-1,0); + if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0)) + skill->blown(src,bl,skill_area_temp[2],-1,0); for (i=0;i<4;i++) { map_foreachincell(skill_area_sub,bl->m,x,y,BL_CHAR, - src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); x += dirx[dir]; y += diry[dir]; } @@ -3907,25 +3889,25 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case TK_TURNKICK: case MO_BALKYOUNG: //Active part of the attack. Skill-attack [Skotlex] { - skill_area_temp[1] = bl->id; //NOTE: This is used in skill_castend_nodamage_id to avoid affecting the target. - if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag)) + skill_area_temp[1] = bl->id; //NOTE: This is used in skill->castend_nodamage_id to avoid affecting the target. + if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag)) map_foreachinrange(skill_area_sub,bl, - skill_get_splash(skill_id, skill_lv),BL_CHAR, + skill->get_splash(skill_id, skill_lv),BL_CHAR, src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); } break; case CH_PALMSTRIKE: // Palm Strike takes effect 1sec after casting. [Skotlex] // clif_skill_nodamage(src,bl,skill_id,skill_lv,0); //Can't make this one display the correct attack animation delay :/ clif_damage(src,bl,tick,status_get_amotion(src),0,-1,1,4,0); //Display an absorbed damage attack. - skill_addtimerskill(src, tick + (1000+status_get_amotion(src)), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); + skill->addtimerskill(src, tick + (1000+status_get_amotion(src)), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); break; case PR_TURNUNDEAD: case ALL_RESURRECTION: if (!battle->check_undead(tstatus->race, tstatus->def_ele)) break; - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case MG_SOULSTRIKE: @@ -3951,12 +3933,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case AB_DUPLELIGHT_MAGIC: case WM_METALICSOUND: case MH_ERASER_CUTTER: - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case NPC_MAGICALATTACK: - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); - sc_start(src,status_skill2sc(skill_id),100,skill_lv,skill_get_time(skill_id,skill_lv)); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + sc_start(src,status_skill2sc(skill_id),100,skill_lv,skill->get_time(skill_id,skill_lv)); break; case HVAN_CAPRICE: //[blackhole89] @@ -3970,13 +3952,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case 2: sid=MG_LIGHTNINGBOLT; break; case 3: sid=WZ_EARTHSPIKE; break; } - skill_attack(BF_MAGIC,src,src,bl,sid,skill_lv,tick,flag|SD_LEVEL); + skill->attack(BF_MAGIC,src,src,bl,sid,skill_lv,tick,flag|SD_LEVEL); } break; case WZ_WATERBALL: { int range = skill_lv / 2; - int maxlv = skill_get_max(skill_id); // learnable level + int maxlv = skill->get_max(skill_id); // learnable level int count = 0; int x, y; struct skill_unit* unit; @@ -3999,21 +3981,21 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint else if( (unit = map_find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL || (unit = map_find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL ) { count++; // skill-induced water cell - skill_delunit(unit); // consume cell + skill->delunit(unit); // consume cell } } } if( count > 1 ) // queue the remaining count - 1 timerskill Waterballs - skill_addtimerskill(src,tick+150,bl->id,0,0,skill_id,skill_lv,count-1,flag); + skill->addtimerskill(src,tick+150,bl->id,0,0,skill_id,skill_lv,count-1,flag); } - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case PR_BENEDICTIO: //Should attack undead and demons. [Skotlex] if (battle->check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON) - skill_attack(BF_MAGIC, src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(BF_MAGIC, src, src, bl, skill_id, skill_lv, tick, flag); break; case SL_SMA: @@ -4025,7 +4007,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case NPC_DARKBREATH: @@ -4039,7 +4021,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case NJ_ZENYNAGE: case GN_THORNS_TRAP: case GN_HELLS_PLANT_ATK: - skill_attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; /** * Rune Knight @@ -4049,7 +4031,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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); + skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); } break; @@ -4060,7 +4042,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } case HVAN_EXPLOSION: if (src != bl) - skill_attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; // Celest @@ -4068,12 +4050,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if (rnd()%100 < (skill_lv < 5 ? 30 + skill_lv * 10 : 70)) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if (skill_lv == 5) - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); status_percent_damage(src, bl, 0, 100, false); } else { clif_skill_nodamage(src,src,skill_id,skill_lv,1); if (skill_lv == 5) - skill_attack(BF_MAGIC,src,src,src,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,src,skill_id,skill_lv,tick,flag); status_percent_damage(src, src, 0, 100, false); } break; @@ -4081,7 +4063,7 @@ 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, + 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); @@ -4091,12 +4073,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case GS_BULLSEYE: - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case NJ_KASUMIKIRI: - if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag) > 0) - sc_start(src,SC_HIDING,100,skill_lv,skill_get_time(skill_id,skill_lv)); + if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag) > 0) + sc_start(src,SC_HIDING,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; case NJ_KIRIKAGE: if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground ) @@ -4107,26 +4089,26 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint clif_slide(src,src->x,src->y); } status_change_end(src, SC_HIDING, INVALID_TIMER); - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case RK_PHANTOMTHRUST: unit_setdir(src,map_calc_dir(src, bl->x, bl->y)); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_blown(src,bl,distance_bl(src,bl)-1,unit_getdir(src),0); + skill->blown(src,bl,distance_bl(src,bl)-1,unit_getdir(src),0); if( battle->check_target(src,bl,BCT_ENEMY) ) - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case RK_STORMBLAST: case RK_CRUSHSTRIKE: if( sd ) { if( pc_checkskill(sd,RK_RUNEMASTERY) >= ( skill_id == RK_CRUSHSTRIKE ? 7 : 3 ) ) - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); else clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } else //non-sd support - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case GC_DARKILLUSION: { @@ -4144,9 +4126,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint { clif_slide(src,bl->x+x,bl->y+y); clif_fixpos(src); // the official server send these two packts. - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); if( rnd()%100 < 4 * skill_lv ) - skill_castend_damage_id(src,bl,GC_CROSSIMPACT,skill_lv,tick,flag); + skill->castend_damage_id(src,bl,GC_CROSSIMPACT,skill_lv,tick,flag); } } @@ -4154,7 +4136,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case GC_WEAPONCRUSH: if( sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == GC_WEAPONBLOCKING ) - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); else if( sd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_GC_WEAPONBLOCKING,0); break; @@ -4164,7 +4146,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint clif_skill_fail(sd,skill_id,USESKILL_FAIL_CONDITION,0); else { - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(src,SC_ROLLINGCUTTER,INVALID_TIMER); } break; @@ -4174,16 +4156,16 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint { // 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); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); } break; case WL_CHAINLIGHTNING: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_addtimerskill(src,tick + 150,bl->id,3,0,WL_CHAINLIGHTNING_ATK,skill_lv,4+skill_lv,flag); + skill->addtimerskill(src,tick + 150,bl->id,3,0,WL_CHAINLIGHTNING_ATK,skill_lv,4+skill_lv,flag); break; case WL_DRAINLIFE: { - int heal = skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + 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; @@ -4239,7 +4221,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case WLS_WATER: subskill = WL_TETRAVORTEX_WATER; k |= 2; break; case WLS_STONE: subskill = WL_TETRAVORTEX_GROUND; k |= 8; break; } - skill_addtimerskill(src, tick + i * 200, bl->id, k, 0, subskill, skill_lv, i, flag); + skill->addtimerskill(src, tick + i * 200, bl->id, k, 0, subskill, skill_lv, i, flag); clif_skill_nodamage(src, bl, subskill, skill_lv, 1); status_change_end(src, spheres[i], INVALID_TIMER); } @@ -4247,12 +4229,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case WL_RELEASE: - if( sd ) - { + if( sd ) { int i; // Priority is to release SpellBook - if( sc && sc->data[SC_READING_SB] ) - { // SpellBook + if( sc && sc->data[SC_READING_SB] ) { // SpellBook uint16 skill_id, skill_lv, point, s = 0; int spell[SC_MAXSPELLBOOK-SC_SPELLBOOK1 + 1]; @@ -4277,42 +4257,37 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint status_change_end(src, SC_READING_SB, INVALID_TIMER); clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); - if( !skill_check_condition_castbegin(sd, skill_id, skill_lv) ) + if( !skill->check_condition_castbegin(sd, skill_id, skill_lv) ) break; - switch( skill_get_casttype(skill_id) ) - { + switch( skill->get_casttype(skill_id) ) { case CAST_GROUND: - skill_castend_pos2(src, bl->x, bl->y, skill_id, skill_lv, tick, 0); + skill->castend_pos2(src, bl->x, bl->y, skill_id, skill_lv, tick, 0); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(src, bl, skill_id, skill_lv, tick, 0); + skill->castend_nodamage_id(src, bl, skill_id, skill_lv, tick, 0); break; case CAST_DAMAGE: - skill_castend_damage_id(src, bl, skill_id, skill_lv, tick, 0); + skill->castend_damage_id(src, bl, skill_id, skill_lv, tick, 0); break; } - sd->ud.canact_tick = tick + skill_delayfix(src, skill_id, skill_lv); - clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, skill_id, skill_lv), 0, 0, 0); - } - else - { // Summon Balls + sd->ud.canact_tick = tick + skill->delay_fix(src, skill_id, skill_lv); + clif_status_change(src, SI_ACTIONDELAY, 1, skill->delay_fix(src, skill_id, skill_lv), 0, 0, 0); + } else { // Summon Balls int j = 0, k, skele; int spheres[5] = { 0, 0, 0, 0, 0 }, positions[5] = {-1,-1,-1,-1,-1 }; for( i = SC_SPHERE_1; i <= SC_SPHERE_5; i++ ) - if( sc && sc->data[i] ) - { + if( sc && sc->data[i] ) { spheres[j] = i; positions[j] = sc->data[i]->val2; sc->data[i]->val2--; // Prepares for next position j++; } - if( j == 0 ) - { // No Spheres + if( j == 0 ) { // No Spheres clif_skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON_NONE,0); break; } @@ -4320,18 +4295,16 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint // Sphere Sort for( i = 0; i <= j - 2; i++ ) for( k = i + 1; k <= j - 1; k++ ) - if( positions[i] > positions[k] ) - { + if( positions[i] > positions[k] ) { swap(positions[i],positions[k]); swap(spheres[i],spheres[k]); } if( skill_lv == 1 ) j = 1; // Limit only to one ball - for( i = 0; i < j; i++ ) - { + for( i = 0; i < j; i++ ) { skele = WL_RELEASE - 5 + sc->data[spheres[i]]->val1 - WLS_FIRE; // Convert Ball Element into Skill ATK for balls // WL_SUMMON_ATK_FIRE, WL_SUMMON_ATK_WIND, WL_SUMMON_ATK_WATER, WL_SUMMON_ATK_GROUND - skill_addtimerskill(src,tick+status_get_adelay(src)*i,bl->id,0,0,skele,sc->data[spheres[i]]->val3,BF_MAGIC,flag|SD_LEVEL); + skill->addtimerskill(src,tick+status_get_adelay(src)*i,bl->id,0,0,skele,sc->data[spheres[i]]->val3,BF_MAGIC,flag|SD_LEVEL); status_change_end(src, spheres[i], INVALID_TIMER); // Eliminate ball } clif_skill_nodamage(src,bl,skill_id,0,1); @@ -4340,14 +4313,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case WL_FROSTMISTY: // Causes Freezing status through walls. - sc_start(bl,status_skill2sc(skill_id),20+12*skill_lv+(sd ? sd->status.job_level : 50)/5,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,status_skill2sc(skill_id),20+12*skill_lv+(sd ? sd->status.job_level : 50)/5,skill_lv,skill->get_time(skill_id,skill_lv)); // Doesn't deal damage through non-shootable walls. if( path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKWALL) ) - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); break; case WL_HELLINFERNO: - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|ELE_DARK); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|ELE_DARK); break; case RA_WUGSTRIKE: if( sd && pc_isridingwug(sd) ){ @@ -4359,13 +4332,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint { clif_slide(src, bl->x+x[dir], bl->y+y[dir]); clif_fixpos(src); - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); } break; } case RA_WUGBITE: if( path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKNOREACH) ) { - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); }else if( sd && skill_id == RA_WUGBITE ) // Only RA_WUGBITE has the skill fail message. clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); @@ -4375,7 +4348,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if( bl->type != BL_SKILL ) { // Only Hits Invisible Targets 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); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); } } @@ -4384,7 +4357,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint struct skill_unit *su = BL_CAST(BL_SKILL,bl); struct skill_unit_group* sg; - if( su && (sg=su->group) && skill_get_inf2(sg->skill_id)&INF2_TRAP ) + if( su && (sg=su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP ) { if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) { @@ -4395,7 +4368,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if( item_tmp.nameid ) map_addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); } - skill_delunit(su); + skill->delunit(su); } } break; @@ -4403,25 +4376,25 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if( flag&1 ) { //TODO: Need a confirmation if the other type of hidden status is included to be scanned. [Jobbie] if( rnd()%100 < 50 ) - sc_start(bl, SC_INFRAREDSCAN, 10000, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_INFRAREDSCAN, 10000, skill_lv, skill->get_time(skill_id, skill_lv)); status_change_end(bl, SC_HIDING, INVALID_TIMER); status_change_end(bl, SC_CLOAKING, INVALID_TIMER); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); // Need confirm it. } else { - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id); clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( sd ) pc_overheat(sd,1); } break; case NC_MAGNETICFIELD: - sc_start2(bl,SC_MAGNETICFIELD,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv)); + sc_start2(bl,SC_MAGNETICFIELD,100,skill_lv,src->id,skill->get_time(skill_id,skill_lv)); break; case SC_FATALMENACE: if( flag&1 ) - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); else { short x, y; @@ -4429,31 +4402,31 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint // Destination area skill_area_temp[4] = x; skill_area_temp[5] = y; - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); - skill_addtimerskill(src,tick + 800,src->id,x,y,skill_id,skill_lv,0,flag); // To teleport Self + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id); + skill->addtimerskill(src,tick + 800,src->id,x,y,skill_id,skill_lv,0,flag); // To teleport Self clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6); } break; case LG_PINPOINTATTACK: if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground && unit_movepos(src, bl->x, bl->y, 1, 1) ) clif_slide(src,bl->x,bl->y); - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case LG_SHIELDSPELL: // flag&1: Phisycal Attack, flag&2: Magic Attack. - skill_attack((flag&1)?BF_WEAPON:BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack((flag&1)?BF_WEAPON:BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case LG_OVERBRAND: - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); break; case LG_OVERBRAND_BRANDISH: - skill_addtimerskill(src, tick + status_get_amotion(src)*8/10, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|SD_LEVEL); + skill->addtimerskill(src, tick + status_get_amotion(src)*8/10, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|SD_LEVEL); break; case SR_DRAGONCOMBO: - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case SR_KNUCKLEARROW: @@ -4463,9 +4436,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } if( flag&1 ) - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); else - skill_addtimerskill(src, tick + 300, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|SD_LEVEL|2); + skill->addtimerskill(src, tick + 300, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|SD_LEVEL|2); break; case SR_HOWLINGOFLION: @@ -4482,16 +4455,16 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint status_change_end(bl, SC_MELODYOFSINK, INVALID_TIMER); status_change_end(bl, SC_BEYONDOFWARCRY, INVALID_TIMER); status_change_end(bl, SC_UNLIMITEDHUMMINGVOICE, INVALID_TIMER); - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_ANIMATION); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_ANIMATION); break; case SR_EARTHSHAKER: if( flag&1 ) { //by default cloaking skills are remove by aoe skills so no more checking/removing except hiding and cloaking exceed. - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); status_change_end(bl, SC_HIDING, INVALID_TIMER); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); } else{ - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id); clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); } break; @@ -4499,7 +4472,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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); + 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 ) @@ -4509,10 +4482,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case GN_SPORE_EXPLOSION: if( flag&1 ) - skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); else { clif_skill_nodamage(src, bl, skill_id, 0, 1); - skill_addtimerskill(src, gettick() + skill_get_time(skill_id, skill_lv) - 1000, bl->id, 0, 0, skill_id, skill_lv, 0, 0); + skill->addtimerskill(src, gettick() + skill->get_time(skill_id, skill_lv) - 1000, bl->id, 0, 0, skill_id, skill_lv, 0, 0); } break; @@ -4522,15 +4495,15 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case EL_HURRICANE: case EL_TYPOON_MIS: if( flag&1 ) - skill_attack(skill_get_type(skill_id+1),src,src,bl,skill_id+1,skill_lv,tick,flag); + skill->attack(skill->get_type(skill_id+1),src,src,bl,skill_id+1,skill_lv,tick,flag); else { - int i = skill_get_splash(skill_id,skill_lv); + int i = skill->get_splash(skill_id,skill_lv); clif_skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1); clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rnd()%100 < 30 ) - map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); else - skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); } break; @@ -4538,22 +4511,22 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint clif_skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1); clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rnd()%100 < 50 ) - skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); else - skill_attack(BF_WEAPON,src,src,bl,EL_ROCK_CRUSHER_ATK,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,EL_ROCK_CRUSHER_ATK,skill_lv,tick,flag); break; case EL_STONE_RAIN: if( flag&1 ) - skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); else { - int i = skill_get_splash(skill_id,skill_lv); + int i = skill->get_splash(skill_id,skill_lv); clif_skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1); clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rnd()%100 < 30 ) - map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); else - skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); } break; @@ -4563,7 +4536,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case EL_STONE_HAMMER: clif_skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1); clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); break; case EL_TIDAL_WEAPON: @@ -4580,10 +4553,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint elemental_clean_single_effect(ele, skill_id); } if( rnd()%100 < 50 ) - skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); else { - sc_start(src,type2,100,skill_lv,skill_get_time(skill_id,skill_lv)); - sc_start(battle->get_master(src),type,100,ele->bl.id,skill_get_time(skill_id,skill_lv)); + sc_start(src,type2,100,skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(battle->get_master(src),type,100,ele->bl.id,skill->get_time(skill_id,skill_lv)); } clif_skill_nodamage(src,src,skill_id,skill_lv,1); } @@ -4595,15 +4568,15 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case MH_XENO_SLASHER: case MH_HEILIGE_STANGE: if(flag & 1) - skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); else { - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill->castend_damage_id); } break; case MH_STAHL_HORN: case MH_NEEDLE_OF_PARALYZE: - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); break; case MH_TINDER_BREAKER: if (unit_movepos(src, bl->x, bl->y, 1, 1)) { @@ -4614,21 +4587,21 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint #endif } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start4(bl,SC_CLOSECONFINE2,100,skill_lv,src->id,0,0,skill_get_time(skill_id,skill_lv))); - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); + sc_start4(bl,SC_CLOSECONFINE2,100,skill_lv,src->id,0,0,skill->get_time(skill_id,skill_lv))); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); break; case 0:/* no skill - basic/normal attack */ if(sd) { if (flag & 3){ if (bl->id != skill_area_temp[1]) - skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, SD_LEVEL|flag); + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, SD_LEVEL|flag); } else { skill_area_temp[1] = bl->id; map_foreachinrange(skill_area_sub, bl, sd->bonus.splash_range, BL_CHAR, src, skill_id, skill_lv, tick, flag | BCT_ENEMY | 1, - skill_castend_damage_id); + skill->castend_damage_id); flag|=1; //Set flag to 1 so ammo is not double-consumed. [Skotlex] } } @@ -4637,8 +4610,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint default: ShowWarning("skill_castend_damage_id: Unknown skill used:%d\n",skill_id); clif_skill_damage(src, bl, tick, status_get_amotion(src), tstatus->dmotion, - 0, abs(skill_get_num(skill_id, skill_lv)), - skill_id, skill_lv, skill_get_hit(skill_id)); + 0, abs(skill->get_num(skill_id, skill_lv)), + skill_id, skill_lv, skill->get_hit(skill_id)); map_freeblock_unlock(); return 1; } @@ -4658,7 +4631,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } // perform skill requirement consumption - skill_consume_requirement(sd,skill_id,skill_lv,2); + skill->consume_requirement(sd,skill_id,skill_lv,2); } return 0; @@ -4741,27 +4714,27 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } - return skill_castend_damage_id (src, bl, skill_id, skill_lv, tick, flag); + return skill->castend_damage_id (src, bl, skill_id, skill_lv, tick, flag); } break; case NPC_SMOKING: //Since it is a self skill, this one ends here rather than in damage_id. [Skotlex] - return skill_castend_damage_id (src, bl, skill_id, skill_lv, tick, flag); + return skill->castend_damage_id (src, bl, skill_id, skill_lv, tick, flag); case MH_STEINWAND: { struct block_list *s_src = battle->get_master(src); short ret = 0; if(!skill_check_unit_range(src, src->x, src->y, skill_id, skill_lv)) //prevent reiteration - ret = skill_castend_pos2(src,src->x,src->y,skill_id,skill_lv,tick,flag); //cast on homon + ret = skill->castend_pos2(src,src->x,src->y,skill_id,skill_lv,tick,flag); //cast on homon if(s_src && !skill_check_unit_range(s_src, s_src->x, s_src->y, skill_id, skill_lv)) - ret |= skill_castend_pos2(s_src,s_src->x,s_src->y,skill_id,skill_lv,tick,flag); //cast on master + ret |= skill->castend_pos2(s_src,s_src->x,s_src->y,skill_id,skill_lv,tick,flag); //cast on master if (hd) - skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); + skill->blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); return ret; } break; default: //Skill is actually ground placed. - if (src == bl && skill_get_unit_id(skill_id,0)) - return skill_castend_pos2(src,bl->x,bl->y,skill_id,skill_lv,tick,0); + if (src == bl && skill->get_unit_id(skill_id,0)) + return skill->castend_pos2(src,bl->x,bl->y,skill_id,skill_lv,tick,0); } type = status_skill2sc(skill_id); @@ -4769,8 +4742,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui tsce = (tsc && type != -1)?tsc->data[type]:NULL; if (src!=bl && type > -1 && - (i = skill_get_ele(skill_id, skill_lv)) > ELE_NEUTRAL && - skill_get_inf(skill_id) != INF_SUPPORT_SKILL && + (i = skill->get_ele(skill_id, skill_lv)) > ELE_NEUTRAL && + skill->get_inf(skill_id) != INF_SUPPORT_SKILL && battle->attr_fix(NULL, NULL, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0) return 1; //Skills that cause an status should be blocked if the target element blocks its element. @@ -4784,7 +4757,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui **/ case AB_HIGHNESSHEAL: { - int heal = skill_calc_heal(src, bl, (skill_id == AB_HIGHNESSHEAL)?AL_HEAL:skill_id, (skill_id == AB_HIGHNESSHEAL)?10:skill_lv, true); + int heal = skill->calc_heal(src, bl, (skill_id == AB_HIGHNESSHEAL)?AL_HEAL:skill_id, (skill_id == AB_HIGHNESSHEAL)?10:skill_lv, true); int heal_get_jobexp; //Highness Heal: starts at 1.5 boost + 0.5 for each level if( skill_id == AB_HIGHNESSHEAL ) { @@ -4836,9 +4809,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } skill_area_temp[0] = 0; party_foreachsamemap(skill_area_sub, - sd,skill_get_splash(skill_id, skill_lv), + sd,skill->get_splash(skill_id, skill_lv), src,skill_id,skill_lv,tick, flag|BCT_PARTY|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); if (skill_area_temp[0] == 0) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; @@ -4908,15 +4881,15 @@ 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 + (status_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 +status_get_lv(src) -status_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 { - map_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); + map_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); clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; @@ -4926,7 +4899,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( tsce ) status_change_end(bl,type, INVALID_TIMER); else - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); clif_skill_nodamage (src, bl, skill_id, skill_lv, 1); break; @@ -4940,7 +4913,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui skill_abra_db[i].req_lv > skill_lv || //Required lv for it to appear rnd()%10000 >= skill_abra_db[i].per ); - abra_skill_lv = min(skill_lv, skill_get_max(abra_skill_id)); + abra_skill_lv = min(skill_lv, skill->get_max(abra_skill_id)); clif_skill_nodamage (src, bl, skill_id, skill_lv, 1); if( sd ) @@ -4953,7 +4926,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui else {// mob-casted struct unit_data *ud = unit_bl2ud(src); - int inf = skill_get_inf(abra_skill_id); + int inf = skill->get_inf(abra_skill_id); if (!ud) break; if (inf&INF_SELF_SKILL || inf&INF_SUPPORT_SKILL) { if (src->type == BL_PET) @@ -4970,7 +4943,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if (!target_id) break; - if (skill_get_casttype(abra_skill_id) == CAST_GROUND) { + if (skill->get_casttype(abra_skill_id) == CAST_GROUND) { bl = map_id2bl(target_id); if (!bl) bl = src; unit_skilluse_pos(src, bl->x, bl->y, abra_skill_id, abra_skill_lv); @@ -4983,7 +4956,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SA_COMA: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill_get_time2(skill_id,skill_lv))); + sc_start(bl,type,100,skill_lv,skill->get_time2(skill_id,skill_lv))); break; case SA_FULLRECOVERY: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -5055,7 +5028,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SA_REVERSEORCISH: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 SA_FORTUNE: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -5079,7 +5052,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 CG_MARIONETTE: @@ -5097,8 +5070,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { if( !sc->data[SC_MARIONETTE] && !tsc->data[SC_MARIONETTE2] ) { - sc_start(src,SC_MARIONETTE,100,bl->id,skill_get_time(skill_id,skill_lv)); - sc_start(bl,SC_MARIONETTE2,100,src->id,skill_get_time(skill_id,skill_lv)); + sc_start(src,SC_MARIONETTE,100,bl->id,skill->get_time(skill_id,skill_lv)); + sc_start(bl,SC_MARIONETTE2,100,src->id,skill->get_time(skill_id,skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } else @@ -5122,7 +5095,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RG_CLOSECONFINE: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start4(bl,type,100,skill_lv,src->id,0,0,skill_get_time(skill_id,skill_lv))); + sc_start4(bl,type,100,skill_lv,src->id,0,0,skill->get_time(skill_id,skill_lv))); break; case SA_FLAMELAUNCHER: // added failure chance and chance to break weapon if turned on [Valaris] case SA_FROSTWEAPON: @@ -5147,10 +5120,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } // 100% success rate at lv4 & 5, but lasts longer at lv5 - if(!clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,(60+skill_lv*10),skill_lv, skill_get_time(skill_id,skill_lv)))) { + if(!clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,(60+skill_lv*10),skill_lv, skill->get_time(skill_id,skill_lv)))) { if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - if (skill_break_equip(bl, EQP_WEAPON, 10000, BCT_PARTY) && sd && sd != dstsd) + if (skill->break_equip(bl, EQP_WEAPON, 10000, BCT_PARTY) && sd && sd != dstsd) clif_displaymessage(sd->fd, msg_txt(669)); } break; @@ -5161,17 +5134,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 ITEM_ENCHANTARMS: clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start2(bl,type,100,skill_lv, - skill_get_ele(skill_id,skill_lv), skill_get_time(skill_id,skill_lv))); + skill->get_ele(skill_id,skill_lv), skill->get_time(skill_id,skill_lv))); break; case TK_SEVENWIND: - switch(skill_get_ele(skill_id,skill_lv)) { + switch(skill->get_ele(skill_id,skill_lv)) { case ELE_EARTH : type = SC_EARTHWEAPON; break; case ELE_WIND : type = SC_WINDWEAPON; break; case ELE_WATER : type = SC_WATERWEAPON; break; @@ -5181,30 +5154,30 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case ELE_HOLY : type = SC_ASPERSIO; break; } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); - sc_start(bl,SC_SEVENWIND,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_SEVENWIND,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; case PR_KYRIE: case MER_KYRIE: clif_skill_nodamage(bl,bl,skill_id,skill_lv, - sc_start(bl,type,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; //Passive Magnum, should had been casted on yourself. case SM_MAGNUM: case MS_MAGNUM: skill_area_temp[1] = 0; - map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id, skill_lv), BL_SKILL|BL_CHAR, - src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, src, skill->get_splash(skill_id, skill_lv), BL_SKILL|BL_CHAR, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill->castend_damage_id); clif_skill_nodamage (src,src,skill_id,skill_lv,1); // Initiate 10% of your damage becomes fire element. - sc_start4(src,SC_WATK_ELEMENT,100,3,20,0,0,skill_get_time2(skill_id, skill_lv)); + sc_start4(src,SC_WATK_ELEMENT,100,3,20,0,0,skill->get_time2(skill_id, skill_lv)); if( sd ) - skill_blockpc_start(sd, skill_id, skill_get_time(skill_id, skill_lv)); + skill->blockpc_start(sd, skill_id, skill->get_time(skill_id, skill_lv), false); else if( bl->type == BL_MER ) - skill_blockmerc_start((TBL_MER*)bl, skill_id, skill_get_time(skill_id, skill_lv)); + skill->blockmerc_start((TBL_MER*)bl, skill_id, skill->get_time(skill_id, skill_lv)); break; case TK_JUMPKICK: @@ -5213,7 +5186,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { if( unit_movepos(src, bl->x, bl->y, 1, 1) ) { - skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); clif_slide(src,bl->x,bl->y); } } @@ -5226,7 +5199,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case MER_INCAGI: case MER_BLESSING: if (dstsd != NULL && tsc->data[SC_CHANGEUNDEAD]) { - skill_attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); + skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; } case PR_SLOWPOISON: @@ -5297,7 +5270,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case GN_CARTBOOST: case KO_MEIKYOUSISUI: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 SO_STRIKING: @@ -5306,7 +5279,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui bonus += (pc_checkskill(sd, SA_FLAMELAUNCHER)+pc_checkskill(sd, SA_FROSTWEAPON)+pc_checkskill(sd, SA_LIGHTNINGLOADER)+pc_checkskill(sd, SA_SEISMICWEAPON))*5; clif_skill_nodamage( src, bl, skill_id, skill_lv, battle->check_target(src,bl,BCT_PARTY) ? - sc_start2(bl, type, 100, skill_lv, bonus, skill_get_time(skill_id,skill_lv)) : + sc_start2(bl, type, 100, skill_lv, bonus, skill->get_time(skill_id,skill_lv)) : 0 ); } @@ -5314,15 +5287,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_STOP: if( clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start2(bl,type,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv)) ) ) - sc_start2(src,type,100,skill_lv,bl->id,skill_get_time(skill_id,skill_lv)); + sc_start2(bl,type,100,skill_lv,src->id,skill->get_time(skill_id,skill_lv)) ) ) + sc_start2(src,type,100,skill_lv,bl->id,skill->get_time(skill_id,skill_lv)); break; case HP_ASSUMPTIO: if( sd && dstmd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); else clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 MG_SIGHT: case MER_SIGHT: @@ -5332,38 +5305,38 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_STONESKIN: case NPC_ANTIMAGIC: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start2(bl,type,100,skill_lv,skill_id,skill_get_time(skill_id,skill_lv))); + sc_start2(bl,type,100,skill_lv,skill_id,skill->get_time(skill_id,skill_lv))); break; case HLIF_AVOID: case HAMI_DEFENCE: - i = skill_get_time(skill_id,skill_lv); + i = skill->get_time(skill_id,skill_lv); clif_skill_nodamage(bl,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,i)); // Master clif_skill_nodamage(src,src,skill_id,skill_lv,sc_start(src,type,100,skill_lv,i)); // Homunc break; case NJ_BUNSINJYUTSU: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); status_change_end(bl, SC_NEN, INVALID_TIMER); break; /* Was modified to only affect targetted char. [Skotlex] case HP_ASSUMPTIO: if (flag&1) - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); else { map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skill_id, skill_lv), BL_PC, + skill->get_splash(skill_id, skill_lv), BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ALL|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; */ case SM_ENDURE: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); if (sd) - skill_blockpc_start (sd, skill_id, skill_get_time2(skill_id,skill_lv)); + skill->blockpc_start (sd, skill_id, skill->get_time2(skill_id,skill_lv), false); break; case AS_ENCHANTPOISON: // Prevent spamming [Valaris] @@ -5382,13 +5355,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 LK_TENSIONRELAX: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start4(bl,type,100,skill_lv,0,0,skill_get_time2(skill_id,skill_lv), - skill_get_time(skill_id,skill_lv))); + sc_start4(bl,type,100,skill_lv,0,0,skill->get_time2(skill_id,skill_lv), + skill->get_time(skill_id,skill_lv))); break; case MC_CHANGECART: @@ -5419,9 +5392,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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))); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); map_foreachinrange( status_change_timer_sub, src, - skill_get_splash(skill_id, skill_lv), BL_CHAR, + skill->get_splash(skill_id, skill_lv), BL_CHAR, src,NULL,type,tick); } break; @@ -5436,7 +5409,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 + status_get_lv(src) - status_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 ) @@ -5458,7 +5431,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( dstmd ) { dstmd->state.provoke_flag = src->id; - mob_target(dstmd, src, skill_get_range2(src,skill_id,skill_lv)); + mob_target(dstmd, src, skill->get_range2(src,skill_id,skill_lv)); } break; @@ -5509,7 +5482,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui mer->devotion_flag = 1; // Mercenary Devoting Owner clif_skill_nodamage(src, bl, skill_id, skill_lv, - sc_start4(bl, type, 100, src->id, i, skill_get_range2(src,skill_id,skill_lv),0, skill_get_time2(skill_id, skill_lv))); + sc_start4(bl, type, 100, src->id, i, skill->get_range2(src,skill_id,skill_lv),0, skill->get_time2(skill_id, skill_lv))); clif_devotion(src, NULL); } break; @@ -5520,7 +5493,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( sd->sc.data[SC_RAISINGDRAGON] ) limit += sd->sc.data[SC_RAISINGDRAGON]->val1; clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - pc_addspiritball(sd,skill_get_time(skill_id,skill_lv),limit); + pc_addspiritball(sd,skill->get_time(skill_id,skill_lv),limit); } break; @@ -5531,21 +5504,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui limit += sd->sc.data[SC_RAISINGDRAGON]->val1; clif_skill_nodamage(src,bl,skill_id,skill_lv,1); for (i = 0; i < limit; i++) - pc_addspiritball(sd,skill_get_time(skill_id,skill_lv),limit); + pc_addspiritball(sd,skill->get_time(skill_id,skill_lv),limit); } break; case MO_KITRANSLATION: if(dstsd && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER) { - pc_addspiritball(dstsd,skill_get_time(skill_id,skill_lv),5); + pc_addspiritball(dstsd,skill->get_time(skill_id,skill_lv),5); } break; case TK_TURNKICK: case MO_BALKYOUNG: //Passive part of the attack. Splash knock-back+stun. [Skotlex] if (skill_area_temp[1] != bl->id) { - skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),-1,0); - skill_additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); //Use Misc rather than weapon to signal passive pushback + skill->blown(src,bl,skill->get_blewcount(skill_id,skill_lv),-1,0); + skill->additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); //Use Misc rather than weapon to signal passive pushback } break; @@ -5587,15 +5560,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case BS_HAMMERFALL: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,SC_STUN,(20 + 10 * skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv))); + sc_start(bl,SC_STUN,(20 + 10 * skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv))); break; case RG_RAID: skill_area_temp[1] = 0; clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skill_id, skill_lv), splash_target(src), + skill->get_splash(skill_id, skill_lv), splash_target(src), src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, - skill_castend_damage_id); + skill->castend_damage_id); status_change_end(src, SC_HIDING, INVALID_TIMER); break; @@ -5610,8 +5583,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case KO_HAPPOKUNAI: skill_area_temp[1] = 0; clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - i = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), - src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + i = map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id); if( !i && ( skill_id == NC_AXETORNADO || skill_id == SR_SKYNETBLOW || skill_id == KO_HAPPOKUNAI ) ) clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; @@ -5631,12 +5604,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_HELLJUDGEMENT: case NPC_PULSESTRIKE: case LG_MOONSLASHER: - skill_castend_damage_id(src, src, skill_id, skill_lv, tick, flag); + skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag); break; case KN_BRANDISHSPEAR: case ML_BRANDISH: - skill_brandishspear(src, bl, skill_id, skill_lv, tick, flag); + skill->brandishspear(src, bl, skill_id, skill_lv, tick, flag); break; case WZ_SIGHTRASHER: @@ -5644,9 +5617,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_change_end(src, SC_SIGHT, INVALID_TIMER); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub,src, - skill_get_splash(skill_id, skill_lv),BL_CHAR|BL_SKILL, + skill->get_splash(skill_id, skill_lv),BL_CHAR|BL_SKILL, src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, - skill_castend_damage_id); + skill->castend_damage_id); break; case NJ_HYOUSYOURAKU: @@ -5654,8 +5627,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WZ_FROSTNOVA: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); skill_area_temp[1] = 0; - map_foreachinrange(skill_attack_area, src, - skill_get_splash(skill_id, skill_lv), splash_target(src), + map_foreachinrange(skill->attack_area, src, + skill->get_splash(skill_id, skill_lv), splash_target(src), BF_MAGIC, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY); break; @@ -5668,9 +5641,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src, src, skill_id, -1, 1); map_delblock(src); //Required to prevent chain-self-destructions hitting back. map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skill_id, skill_lv), splash_target(src), + skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|i, - skill_castend_damage_id); + skill->castend_damage_id); map_addblock(src); status_damage(src, src, sstatus->max_hp,0,0,1); break; @@ -5683,18 +5656,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case CASH_INCAGI: case CASH_ASSUMPTIO: if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) - clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); break; case MER_MAGNIFICAT: if( mer != NULL ) { - clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); if( mer->master && mer->master->status.party_id != 0 && !(flag&1) ) - party_foreachsamemap(skill_area_sub, mer->master, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, mer->master, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); else if( mer->master && !(flag&1) ) - clif_skill_nodamage(src, &mer->master->bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src, &mer->master->bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); } break; @@ -5704,12 +5677,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case BS_OVERTHRUST: if (sd == NULL || sd->status.party_id == 0 || (flag & 1)) { clif_skill_nodamage(bl,bl,skill_id,skill_lv, - sc_start2(bl,type,100,skill_lv,(src == bl)? 1:0,skill_get_time(skill_id,skill_lv))); + sc_start2(bl,type,100,skill_lv,(src == bl)? 1:0,skill->get_time(skill_id,skill_lv))); } else if (sd) { party_foreachsamemap(skill_area_sub, - sd,skill_get_splash(skill_id, skill_lv), + sd,skill->get_splash(skill_id, skill_lv), src,skill_id,skill_lv,tick, flag|BCT_PARTY|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); } break; @@ -5733,7 +5706,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui map_freeblock_unlock(); return 0; } - clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); break; case SL_KAITE: case SL_KAAHI: @@ -5753,7 +5726,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 SM_AUTOBERSERK: case MER_AUTOBERSERK: @@ -5777,7 +5750,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui map_freeblock_unlock(); return 0; } - clif_skill_nodamage(src,bl,skill_id,-1,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src,bl,skill_id,-1,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); break; case TK_RUN: if (tsce) @@ -5805,7 +5778,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui return 0; } case RA_CAMOUFLAGE: - i = sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + i = sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); if( i ) clif_skill_nodamage(src,bl,skill_id,( skill_id == LG_FORCEOFVANGUARD ) ? skill_lv : -1,i); else if( sd ) @@ -5822,7 +5795,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case BA_FROSTJOKER: case DC_SCREAM: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_addtimerskill(src,tick+2000,bl->id,src->x,src->y,skill_id,skill_lv,0,flag); + skill->addtimerskill(src,tick+2000,bl->id,src->x,src->y,skill_id,skill_lv,0,flag); if (md) { // custom hack to make the mob display the skill, because these skills don't show the skill use text themselves @@ -5834,19 +5807,19 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case BA_PANGVOICE: - clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,SC_CONFUSION,50,7,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,SC_CONFUSION,50,7,skill->get_time(skill_id,skill_lv))); break; 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))); + 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( 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))); + 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 { clif_skill_nodamage(src,bl,skill_id,skill_lv,0); @@ -5869,7 +5842,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(pc_steal_coin(sd,bl)) { dstmd->state.provoke_flag = src->id; - mob_target(dstmd, src, skill_get_range2(src,skill_id,skill_lv)); + mob_target(dstmd, src, skill->get_range2(src,skill_id,skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } @@ -5897,8 +5870,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; } if (sc_start4(bl,SC_STONE,(skill_lv*4+20)+brate, - skill_lv, 0, 0, skill_get_time(skill_id, skill_lv), - skill_get_time2(skill_id,skill_lv))) + skill_lv, 0, 0, skill->get_time(skill_id, skill_lv), + skill->get_time2(skill_id,skill_lv))) clif_skill_nodamage(src,bl,skill_id,skill_lv,1); else if(sd) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -5951,7 +5924,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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); + 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) @@ -6053,7 +6026,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; } if(!battle_config.duel_allow_teleport && sd->duel_group && skill_lv <= 2) { // duel restriction [LuzZza] - char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_TELEPORT)); + char output[128]; sprintf(output, msg_txt(365), skill->get_name(AL_TELEPORT)); clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel." break; } @@ -6083,7 +6056,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AL_HOLYWATER: if(sd) { - if (skill_produce_mix(sd, skill_id, 523, 0, 0, 0, 1)) + if (skill->produce_mix(sd, skill_id, 523, 0, 0, 0, 1)) clif_skill_nodamage(src,bl,skill_id,skill_lv,1); else clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -6112,7 +6085,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case ASC_CDP: if(sd) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_produce_mix(sd, skill_id, 678, 0, 0, 0, 1); //Produce a Deadly Poison Bottle. + skill->produce_mix(sd, skill_id, 678, 0, 0, 0, 1); //Produce a Deadly Poison Bottle. } break; @@ -6139,13 +6112,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //Duration in ms if( skill_id == GC_WEAPONCRUSH){ - d = skill_get_time(skill_id,skill_lv); + d = skill->get_time(skill_id,skill_lv); if(bl->type == BL_PC) d += skill_lv * 15 + (sstatus->dex - tstatus->dex); else d += skill_lv * 30 + (sstatus->dex - tstatus->dex) / 2; }else - d = skill_get_time(skill_id,skill_lv) + (sstatus->dex - tstatus->dex)*500; + d = skill->get_time(skill_id,skill_lv) + (sstatus->dex - tstatus->dex)*500; if (d < 0) d = 0; //Minimum duration 0ms @@ -6179,7 +6152,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } //Attempts to strip at rate i and duration d - if( (i = skill_strip_equip(bl, location, i, skill_lv, d)) || (skill_id != ST_FULLSTRIP && skill_id != GC_WEAPONCRUSH ) ) + if( (i = skill->strip_equip(bl, location, i, skill_lv, d)) || (skill_id != ST_FULLSTRIP && skill_id != GC_WEAPONCRUSH ) ) clif_skill_nodamage(src,bl,skill_id,skill_lv,i); //Nothing stripped. @@ -6304,14 +6277,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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 AM_TWILIGHT1: if (sd) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); //Prepare 200 White Potions. - if (!skill_produce_mix(sd, skill_id, 504, 0, 0, 0, 200)) + if (!skill->produce_mix(sd, skill_id, 504, 0, 0, 0, 200)) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; @@ -6319,7 +6292,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (sd) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); //Prepare 200 Slim White Potions. - if (!skill_produce_mix(sd, skill_id, 547, 0, 0, 0, 200)) + if (!skill->produce_mix(sd, skill_id, 547, 0, 0, 0, 200)) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; @@ -6329,22 +6302,22 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( ebottle >= 0 ) ebottle = sd->status.inventory[ebottle].amount; //check if you can produce all three, if not, then fail: - if (!skill_can_produce_mix(sd,970,-1, 100) //100 Alcohol - || !skill_can_produce_mix(sd,7136,-1, 50) //50 Acid Bottle - || !skill_can_produce_mix(sd,7135,-1, 50) //50 Flame Bottle + if (!skill->can_produce_mix(sd,970,-1, 100) //100 Alcohol + || !skill->can_produce_mix(sd,7136,-1, 50) //50 Acid Bottle + || !skill->can_produce_mix(sd,7135,-1, 50) //50 Flame Bottle || ebottle < 200 //200 empty bottle are required at total. ) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_produce_mix(sd, skill_id, 970, 0, 0, 0, 100); - skill_produce_mix(sd, skill_id, 7136, 0, 0, 0, 50); - skill_produce_mix(sd, skill_id, 7135, 0, 0, 0, 50); + skill->produce_mix(sd, skill_id, 970, 0, 0, 0, 100); + skill->produce_mix(sd, skill_id, 7136, 0, 0, 0, 50); + skill->produce_mix(sd, skill_id, 7135, 0, 0, 0, 50); } break; case SA_DISPELL: - if (flag&1 || (i = skill_get_splash(skill_id, skill_lv)) < 1) + if (flag&1 || (i = skill->get_splash(skill_id, skill_lv)) < 1) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) @@ -6442,12 +6415,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //Affect all targets on splash area. map_foreachinrange(skill_area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, - skill_castend_damage_id); + skill->castend_damage_id); break; case TF_BACKSLIDING: //This is the correct implementation as per packet logging information. [Skotlex] clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),unit_getdir(bl),0); + skill->blown(src,bl,skill->get_blewcount(skill_id,skill_lv),unit_getdir(bl),0); break; case TK_HIGHJUMP: @@ -6478,9 +6451,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src,bl,skill_id,skill_lv,1); unit_skillcastcancel(src,1); if(sd) { - int sp = skill_get_sp(sd->skill_id_old,sd->skill_lv_old); + int sp = skill->get_sp(sd->skill_id_old,sd->skill_lv_old); if( skill_id == SO_SPELLFIST ){ - sc_start4(src,type,100,skill_lv+1,skill_lv,sd->skill_id_old,sd->skill_lv_old,skill_get_time(skill_id,skill_lv)); + sc_start4(src,type,100,skill_lv+1,skill_lv,sd->skill_id_old,sd->skill_lv_old,skill->get_time(skill_id,skill_lv)); sd->skill_id_old = sd->skill_lv_old = 0; break; } @@ -6493,7 +6466,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { int sp; if(tsc && tsc->data[SC_MAGICROD]) { - sp = skill_get_sp(skill_id,skill_lv); + sp = skill->get_sp(skill_id,skill_lv); sp = sp * tsc->data[SC_MAGICROD]->val2 / 100; if(sp < 1) sp = 1; status_heal(bl,0,sp,2); @@ -6517,7 +6490,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src,bl,skill_id,skill_lv,1); unit_skillcastcancel(bl,0); - sp = skill_get_sp(bl_skill_id,bl_skill_lv); + sp = skill->get_sp(bl_skill_id,bl_skill_lv); status_zap(bl, hp, sp); if (hp && skill_lv >= 5) @@ -6535,7 +6508,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SA_MAGICROD: clif_skill_nodamage(src,src,SA_MAGICROD,skill_lv,1); - sc_start(bl,type,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 SA_AUTOSPELL: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -6570,7 +6543,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if(spellid > 0) sc_start4(src,SC_AUTOSPELL,100,skill_lv,spellid,maxlv,0, - skill_get_time(SA_AUTOSPELL,skill_lv)); + skill->get_time(SA_AUTOSPELL,skill_lv)); } break; @@ -6578,7 +6551,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(sd){ clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_greed,bl, - skill_get_splash(skill_id, skill_lv),BL_ITEM,bl); + skill->get_splash(skill_id, skill_lv),BL_ITEM,bl); } break; @@ -6600,16 +6573,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_CHANGEDARKNESS: case NPC_CHANGETELEKINESIS: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start2(bl, type, 100, skill_lv, skill_get_ele(skill_id,skill_lv), - skill_get_time(skill_id, skill_lv))); + sc_start2(bl, type, 100, skill_lv, skill->get_ele(skill_id,skill_lv), + skill->get_time(skill_id, skill_lv))); break; case NPC_CHANGEUNDEAD: //This skill should fail if target is wearing bathory/evil druid card [Brainstorm] //TO-DO This is ugly, fix it if(tstatus->def_ele==ELE_UNDEAD || tstatus->def_ele==ELE_DARK) break; clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start2(bl, type, 100, skill_lv, skill_get_ele(skill_id,skill_lv), - skill_get_time(skill_id, skill_lv))); + sc_start2(bl, type, 100, skill_lv, skill->get_ele(skill_id,skill_lv), + skill->get_time(skill_id, skill_lv))); break; case NPC_PROVOCATION: @@ -6620,7 +6593,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_KEEPING: case NPC_BARRIER: { - int skill_time = skill_get_time(skill_id,skill_lv); + int skill_time = skill->get_time(skill_id,skill_lv); struct unit_data *ud = unit_bl2ud(bl); if (clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,100,skill_lv,skill_time)) @@ -6640,13 +6613,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_DARKBLESSING: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start2(bl,type,(50+skill_lv*5),skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv))); + sc_start2(bl,type,(50+skill_lv*5),skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv))); break; case NPC_LICK: status_zap(bl, 0, 100); clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,(skill_lv*5),skill_lv,skill_get_time2(skill_id,skill_lv))); + sc_start(bl,type,(skill_lv*5),skill_lv,skill->get_time2(skill_id,skill_lv))); break; case NPC_SUICIDE: @@ -6734,26 +6707,26 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui md->db->skill[md->skill_idx].val[1], md->db->skill[md->skill_idx].val[2], md->db->skill[md->skill_idx].val[3], - skill_get_time(skill_id, skill_lv)); + skill->get_time(skill_id, skill_lv)); } break; case NPC_POWERUP: - sc_start(bl,SC_INCATKRATE,100,200,skill_get_time(skill_id, skill_lv)); + sc_start(bl,SC_INCATKRATE,100,200,skill->get_time(skill_id, skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,100,skill_get_time(skill_id, skill_lv))); + sc_start(bl,type,100,100,skill->get_time(skill_id, skill_lv))); break; case NPC_AGIUP: - sc_start(bl,SC_SPEEDUP1,100,skill_lv,skill_get_time(skill_id, skill_lv)); + sc_start(bl,SC_SPEEDUP1,100,skill_lv,skill->get_time(skill_id, skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,100,skill_get_time(skill_id, skill_lv))); + sc_start(bl,type,100,100,skill->get_time(skill_id, skill_lv))); break; case NPC_INVISIBLE: //Have val4 passed as 6 is for "infinite cloak" (do not end on attack/skill use). clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start4(bl,type,100,skill_lv,0,0,6,skill_get_time(skill_id,skill_lv))); + sc_start4(bl,type,100,skill_lv,0,0,6,skill->get_time(skill_id,skill_lv))); break; case NPC_SIEGEMODE: @@ -6787,9 +6760,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui map_freeblock_unlock(); return 0; } - 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)); + 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; @@ -6816,7 +6789,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui // Mercenaries can remove any trap // Players can only remove their own traps or traps on Vs maps. - if( su && (sg = su->group) && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill_get_inf2(sg->skill_id)&INF2_TRAP) ) + if( su && (sg = su->group) && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill->get_inf2(sg->skill_id)&INF2_TRAP) ) { clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); if( sd && !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) @@ -6853,7 +6826,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } } - skill_delunit(su); + skill->delunit(su); }else if(sd) clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); @@ -6908,9 +6881,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui return 1; } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start4(bl,type,100,skill_lv,skill_id,src->id,skill_get_time(skill_id,skill_lv),1000)); + sc_start4(bl,type,100,skill_lv,skill_id,src->id,skill->get_time(skill_id,skill_lv),1000)); #ifndef RENEWAL - if (sd) skill_blockpc_start (sd, skill_id, skill_get_time(skill_id, skill_lv)+3000); + if (sd) skill->blockpc_start (sd, skill_id, skill->get_time(skill_id, skill_lv)+3000, false); #endif break; @@ -6930,7 +6903,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //Has a 55% + skill_lv*5% success chance. if (!clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,55+5*skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)))) + sc_start(bl,type,55+5*skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)))) { if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); @@ -6947,7 +6920,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if(dstmd) - mob_target(dstmd,src,skill_get_range2(src,skill_id,skill_lv)); + mob_target(dstmd,src,skill->get_range2(src,skill_id,skill_lv)); } break; @@ -7019,7 +6992,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case CR_FULLPROTECTION: { unsigned int equip[] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP}; - int i, s = 0, skilltime = skill_get_time(skill_id,skill_lv); + int i, s = 0, skilltime = skill->get_time(skill_id,skill_lv); for (i=0 ; i<4; i++) { if( bl->type != BL_PC || ( dstsd && pc_checkequip(dstsd,equip[i]) < 0 ) ) @@ -7046,7 +7019,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui && (tsce->val1&0xFFFF) != CG_MOONLIT) //Can't use Longing for Freedom while under Moonlight Petals. [Skotlex] { clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,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; @@ -7062,7 +7035,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui map_freeblock_unlock(); return 0; } - status_zap(src,0,skill_db[skill_get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded [Inkfish] + status_zap(src,0,skill_db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded [Inkfish] do { eff = rnd() % 14; clif_specialeffect(bl, 523 + eff, AREA); @@ -7072,7 +7045,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_percent_damage(src, bl, 0, 100, false); break; case 1: // matk halved - sc_start(bl,SC_INCMATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCMATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); break; case 2: // all buffs removed status_change_clear_buffs(bl,1); @@ -7083,12 +7056,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_damage(src,bl,tick,0,0,1000,0,0,0); 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); + skill->break_equip(bl, where[rnd()%5], 10000, BCT_ENEMY); } } break; case 4: // atk halved - sc_start(bl,SC_INCATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); break; case 5: // 2000HP heal, random teleported status_heal(src, 2000, 0, 0); @@ -7104,23 +7077,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case 7: // stop freeze or stoned { enum sc_type sc[] = { SC_STOP, SC_FREEZE, SC_STONE }; - sc_start(bl,sc[rnd()%3],100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,sc[rnd()%3],100,skill_lv,skill->get_time2(skill_id,skill_lv)); } break; case 8: // curse coma and poison - sc_start(bl,SC_COMA,100,skill_lv,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_CURSE,100,skill_lv,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_POISON,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_COMA,100,skill_lv,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CURSE,100,skill_lv,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_POISON,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case 9: // confusion - sc_start(bl,SC_CONFUSION,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CONFUSION,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case 10: // 6666 damage, atk matk halved, cursed status_fix_damage(src, bl, 6666, 0); clif_damage(src,bl,tick,0,0,6666,0,0,0); - sc_start(bl,SC_INCATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_INCMATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_CURSE,skill_lv,100,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCMATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CURSE,skill_lv,100,skill->get_time2(skill_id,skill_lv)); break; case 11: // 4444 damage status_fix_damage(src, bl, 4444, 0); @@ -7130,11 +7103,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sc_start(bl,SC_STUN,100,skill_lv,5000); break; case 13: // atk,matk,hit,flee,def reduced - sc_start(bl,SC_INCATKRATE,100,-20,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_INCMATKRATE,100,-20,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_INCHITRATE,100,-20,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_INCFLEERATE,100,-20,skill_get_time2(skill_id,skill_lv)); - sc_start(bl,SC_INCDEFRATE,100,-20,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCATKRATE,100,-20,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCMATKRATE,100,-20,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCHITRATE,100,-20,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCFLEERATE,100,-20,skill->get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCDEFRATE,100,-20,skill->get_time2(skill_id,skill_lv)); break; default: break; @@ -7172,8 +7145,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //SC_SPIRIT invokes status_calc_pc for us. } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start4(bl,SC_SPIRIT,100,skill_lv,skill_id,0,0,skill_get_time(skill_id,skill_lv))); - sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA,skill_lv)); + sc_start4(bl,SC_SPIRIT,100,skill_lv,skill_id,0,0,skill->get_time(skill_id,skill_lv))); + sc_start(src,SC_SMA,100,skill_lv,skill->get_time(SL_SMA,skill_lv)); break; case SL_HIGH: if (sd && !(dstsd && (dstsd->class_&JOBL_UPPER) && !(dstsd->class_&JOBL_2) && dstsd->status.base_level < 70)) { @@ -7181,8 +7154,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; } clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start4(bl,type,100,skill_lv,skill_id,0,0,skill_get_time(skill_id,skill_lv))); - sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA,skill_lv)); + sc_start4(bl,type,100,skill_lv,skill_id,0,0,skill->get_time(skill_id,skill_lv))); + sc_start(src,SC_SMA,100,skill_lv,skill->get_time(SL_SMA,skill_lv)); break; case SL_SWOO: @@ -7200,38 +7173,38 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); if (skill_id == SL_SKE) - sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA,skill_lv)); + sc_start(src,SC_SMA,100,skill_lv,skill->get_time(SL_SMA,skill_lv)); break; // New guild skills [Celest] case GD_BATTLEORDER: if(flag&1) { 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)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv)); } else if (status_get_guild_id(src)) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skill_id, skill_lv), BL_PC, + skill->get_splash(skill_id, skill_lv), BL_PC, src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); if (sd) - guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); + guild_block_skill(sd,skill->get_time2(skill_id,skill_lv)); } break; case GD_REGENERATION: if(flag&1) { 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)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv)); } else if (status_get_guild_id(src)) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skill_id, skill_lv), BL_PC, + skill->get_splash(skill_id, skill_lv), BL_PC, src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); if (sd) - guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); + guild_block_skill(sd,skill->get_time2(skill_id,skill_lv)); } break; case GD_RESTORE: @@ -7241,11 +7214,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } else if (status_get_guild_id(src)) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skill_id, skill_lv), BL_PC, + skill->get_splash(skill_id, skill_lv), BL_PC, src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); if (sd) - guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); + guild_block_skill(sd,skill->get_time2(skill_id,skill_lv)); } break; case GD_EMERGENCYCALL: @@ -7270,7 +7243,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } if (sd) - guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); + guild_block_skill(sd,skill->get_time2(skill_id,skill_lv)); } break; @@ -7296,7 +7269,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(sd) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if(rnd()%100 < (20+10*skill_lv)) - pc_addspiritball(sd,skill_get_time(skill_id,skill_lv),10); + pc_addspiritball(sd,skill->get_time(skill_id,skill_lv),10); else if(sd->spiritball > 0) pc_delspiritball(sd,1,0); } @@ -7309,7 +7282,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui i =65 -5*distance_bl(src,bl); //Base rate if (i < 30) i = 30; clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - sc_start(bl,SC_STUN, i,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_STUN, i,skill_lv,skill->get_time2(skill_id,skill_lv)); } break; @@ -7334,7 +7307,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui x = src->x; y = src->y; if (hd) - skill_blockhomun_start(hd, skill_id, skill_get_time2(skill_id,skill_lv)); + skill->blockhomun_start(hd, skill_id, skill->get_time2(skill_id,skill_lv)); if (unit_movepos(src,bl->x,bl->y,0,0)) { clif_skill_nodamage(src,src,skill_id,skill_lv,1); // Homunc @@ -7346,7 +7319,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } //TODO: Shouldn't also players and the like switch targets? - map_foreachinrange(skill_chastle_mob_changetarget,src, + map_foreachinrange(skill->chastle_mob_changetarget,src, AREA_SIZE, BL_MOB, bl, src); } } @@ -7369,7 +7342,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui bl = map_id2bl(battle->get_target(src)); if (!bl) bl = src; - i = skill_calc_heal(src, bl, skill_id, 1+rnd()%skill_lv, true); + i = skill->calc_heal(src, bl, skill_id, 1+rnd()%skill_lv, true); //Eh? why double skill packet? clif_skill_nodamage(src,bl,AL_HEAL,i,1); clif_skill_nodamage(src,bl,skill_id,i,1); @@ -7384,9 +7357,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case MH_ANGRIFFS_MODUS: case MH_GOLDENE_FERSE: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); if (hd) - skill_blockhomun_start(hd, skill_id, skill_get_time2(skill_id,skill_lv)); + skill->blockhomun_start(hd, skill_id, skill->get_time2(skill_id,skill_lv)); break; case NPC_DRAGONFEAR: @@ -7394,7 +7367,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui const enum sc_type sc[] = { SC_STUN, SC_SILENCE, SC_CONFUSION, SC_BLEEDING }; int j; j = i = rnd()%ARRAYLENGTH(sc); - while ( !sc_start2(bl,sc[i],100,skill_lv,src->id,skill_get_time2(skill_id,i+1)) ) { + while ( !sc_start2(bl,sc[i],100,skill_lv,src->id,skill->get_time2(skill_id,i+1)) ) { i++; if ( i == ARRAYLENGTH(sc) ) i = 0; @@ -7414,14 +7387,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_SLOWCAST: case NPC_WIDEHELLDIGNITY: if (flag&1) - sc_start2(bl,type,100,skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); + sc_start2(bl,type,100,skill_lv,src->id,skill->get_time2(skill_id,skill_lv)); else { skill_area_temp[2] = 0; //For SD_PREAMBLE clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skill_id, skill_lv),BL_CHAR, + skill->get_splash(skill_id, skill_lv),BL_CHAR, src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); } break; case NPC_WIDESOULDRAIN: @@ -7431,9 +7404,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui skill_area_temp[2] = 0; //For SD_PREAMBLE clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skill_id, skill_lv),BL_CHAR, + skill->get_splash(skill_id, skill_lv),BL_CHAR, src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); } break; case ALL_PARTYFLEE: @@ -7444,10 +7417,10 @@ 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; } - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); } else - clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); break; case NPC_TALK: case ALL_WEWISH: @@ -7461,38 +7434,38 @@ 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+status_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) - sc_start(bl,type,50 + 6 * skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,50 + 6 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)); else { skill_area_temp[2] = 0; clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skill_id,skill_lv),BL_CHAR, + skill->get_splash(skill_id,skill_lv),BL_CHAR, src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); } break; case RK_IGNITIONBREAK: case LG_EARTHDRIVE: clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - i = skill_get_splash(skill_id,skill_lv); + i = skill->get_splash(skill_id,skill_lv); if( skill_id == LG_EARTHDRIVE ) { int dummy = 1; map_foreachinarea(skill_cell_overlap, src->m, src->x-i, src->y-i, src->x+i, src->y+i, BL_SKILL, LG_EARTHDRIVE, &dummy, src); } map_foreachinrange(skill_area_sub, bl,i,BL_CHAR, - src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); break; case RK_STONEHARDSKIN: if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 4 ) { int heal = sstatus->hp / 4; // 25% HP 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))); + 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); } @@ -7502,7 +7475,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { 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))); + 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); } @@ -7512,7 +7485,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 9 ) { short shields = (rnd()%100<50) ? 4 : ((rnd()%100<80) ? 3 : 2); - sc_start4(bl,type,100,skill_lv,shields,1000,0,skill_get_time(skill_id,skill_lv)); + sc_start4(bl,type,100,skill_lv,shields,1000,0,skill->get_time(skill_id,skill_lv)); clif_millenniumshield(sd,shields); clif_skill_nodamage(src,bl,skill_id,1,1); } @@ -7532,23 +7505,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui else if( skill_id == RK_CRUSHSTRIKE ) lv = 7; if( pc_checkskill(sd,RK_RUNEMASTERY) >= lv ) - clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); } break; case RK_FIGHTINGSPIRIT: if( flag&1 ) { if( src == bl ) - sc_start2(bl,type,100,skill_area_temp[5],10*(sd?pc_checkskill(sd,RK_RUNEMASTERY):10),skill_get_time(skill_id,skill_lv)); + sc_start2(bl,type,100,skill_area_temp[5],10*(sd?pc_checkskill(sd,RK_RUNEMASTERY):10),skill->get_time(skill_id,skill_lv)); else - sc_start(bl,type,100,skill_area_temp[5]/4,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_area_temp[5]/4,skill->get_time(skill_id,skill_lv)); } else if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 5 ) { if( sd->status.party_id ) { - i = party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,BCT_PARTY,skill_area_sub_count); + i = party_foreachsamemap(skill_area_sub,sd,skill->get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,BCT_PARTY,skill_area_sub_count); skill_area_temp[5] = 7 * i; // ATK - party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,flag|BCT_PARTY|1,skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub,sd,skill->get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,flag|BCT_PARTY|1,skill->castend_nodamage_id); } else - sc_start2(bl,type,100,7,5,skill_get_time(skill_id,skill_lv)); + sc_start2(bl,type,100,7,5,skill->get_time(skill_id,skill_lv)); } clif_skill_nodamage(src,bl,skill_id,1,1); break; @@ -7559,7 +7532,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { short count = 1; skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill->castend_damage_id); if( tsc && tsc->data[SC_ROLLINGCUTTER] ) { // Every time the skill is casted the status change is reseted adding a counter. count += (short)tsc->data[SC_ROLLINGCUTTER]->val1; @@ -7567,7 +7540,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui count = 10; // Max coounter status_change_end(bl, SC_ROLLINGCUTTER, INVALID_TIMER); } - sc_start(bl,SC_ROLLINGCUTTER,100,count,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_ROLLINGCUTTER,100,count,skill->get_time(skill_id,skill_lv)); clif_skill_nodamage(src,src,skill_id,skill_lv,1); } break; @@ -7576,7 +7549,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( tsc && tsc->data[SC_WEAPONBLOCKING] ) status_change_end(bl, SC_WEAPONBLOCKING, INVALID_TIMER); else - sc_start(bl,SC_WEAPONBLOCKING,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_WEAPONBLOCKING,100,skill_lv,skill->get_time(skill_id,skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; @@ -7613,8 +7586,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case GC_PHANTOMMENACE: clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - map_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_damage_id); + map_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_damage_id); break; case GC_HALLUCINATIONWALK: @@ -7629,7 +7602,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; } - clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); } break; /** @@ -7638,7 +7611,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AB_ANCILLA: if( sd ) { clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_produce_mix(sd, skill_id, ITEMID_ANCILLA, 0, 0, 0, 1); + skill->produce_mix(sd, skill_id, ITEMID_ANCILLA, 0, 0, 0, 1); } break; @@ -7649,23 +7622,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui int agi_lv = pc_checkskill(sd,AL_INCAGI) + (sd->status.job_level / 10); if( sd == NULL || sd->status.party_id == 0 || flag&1 ) clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100, - (skill_id == AB_CLEMENTIA)? bless_lv : (skill_id == AB_CANTO)? agi_lv : skill_lv, skill_get_time(skill_id,skill_lv))); + (skill_id == AB_CLEMENTIA)? bless_lv : (skill_id == AB_CANTO)? agi_lv : skill_lv, skill->get_time(skill_id,skill_lv))); else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); } break; case AB_PRAEFATIO: if( sd == NULL || sd->status.party_id == 0 || flag&1 ) - clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start4(bl, type, 100, skill_lv, 0, 0, 1, skill_get_time(skill_id, skill_lv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start4(bl, type, 100, skill_lv, 0, 0, 1, skill->get_time(skill_id, skill_lv))); else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); break; case AB_CHEAL: if( sd == NULL || sd->status.party_id == 0 || flag&1 ) { 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); + i = skill->calc_heal(src, bl, AL_HEAL, pc_checkskill(sd, AL_HEAL), true); 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] @@ -7677,16 +7650,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); break; case AB_ORATIO: if( flag&1 ) - sc_start(bl, type, 40 + 5 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, type, 40 + 5 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); else { - map_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); + map_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); clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; @@ -7705,10 +7678,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_change_end(bl, SC_CRYSTALIZE, INVALID_TIMER); }else //Success rate only applies to the curing effect and not stat bonus. Bonus status only applies to non infected targets clif_skill_nodamage(bl, bl, skill_id, skill_lv, - sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv))); + sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv))); } else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), - src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), + src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); break; case AB_LAUDARAMUS: @@ -7722,14 +7695,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_change_end(bl, SC_SILENCE, INVALID_TIMER); }else // Success rate only applies to the curing effect and not stat bonus. Bonus status only applies to non infected targets clif_skill_nodamage(bl, bl, skill_id, skill_lv, - sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv))); + sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv))); } else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), - src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), + src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); break; case AB_CLEARANCE: - if( flag&1 || (i = skill_get_splash(skill_id, skill_lv)) < 1 ) + 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) @@ -7799,13 +7772,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } break; } - map_foreachinrange(skill_area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill->castend_damage_id); break; case AB_SILENTIUM: // Should the level of Lex Divina be equivalent to the level of Silentium or should the highest level learned be used? [LimitLine] - map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id, skill_lv), BL_CHAR, - src, PR_LEXDIVINA, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR, + src, PR_LEXDIVINA, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); break; /** @@ -7813,10 +7786,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui **/ case WL_STASIS: if( flag&1 ) - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); else { - map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id, skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub,src,skill->get_splash(skill_id, skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill->castend_nodamage_id); clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; @@ -7831,10 +7804,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui else rate += 40 + 10 * skill_lv; // On Monsters, (40 + 10 * Skill Level) % if( sd ) - skill_blockpc_start(sd,skill_id,4000); + skill->blockpc_start(sd,skill_id,4000, false); if( !(tsc && tsc->data[type]) ){ - i = sc_start2(bl,type,rate,skill_lv,src->id,(src == bl)?5000:(bl->type == BL_PC)?skill_get_time(skill_id,skill_lv):skill_get_time2(skill_id, skill_lv)); + i = sc_start2(bl,type,rate,skill_lv,src->id,(src == bl)?5000:(bl->type == BL_PC)?skill->get_time(skill_id,skill_lv):skill->get_time2(skill_id, skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv,i); if( !i ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -7846,19 +7819,19 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WL_FROSTMISTY: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id); break; case WL_JACKFROST: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - map_foreachinshootrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachinshootrange(skill_area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); break; case WL_MARSHOFABYSS: // Should marsh of abyss still apply half reduction to players after the 28/10 patch? [LimitLine] clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start4(bl, type, 100, skill_lv, status_get_int(src), sd ? sd->status.job_level : 50, 0, - skill_get_time(skill_id, skill_lv))); + skill->get_time(skill_id, skill_lv))); break; case WL_SIENNAEXECRATE: @@ -7872,13 +7845,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( tsc && tsc->data[SC_STONE] ) status_change_end(bl,SC_STONE,INVALID_TIMER); else - status_change_start(bl,SC_STONE,10000,skill_lv,0,0,1000,skill_get_time(skill_id, skill_lv),2); + status_change_start(bl,SC_STONE,10000,skill_lv,0,0,1000,skill->get_time(skill_id, skill_lv),2); } else { int rate = 40 + 8 * skill_lv + ( sd? sd->status.job_level : 50 ) / 4; // IroWiki says Rate should be reduced by target stats, but currently unknown if( rnd()%100 < rate ) { // Success on First Target if( !tsc->data[SC_STONE] ) - rate = status_change_start(bl,SC_STONE,10000,skill_lv,0,0,1000,skill_get_time(skill_id, skill_lv),2); + rate = status_change_start(bl,SC_STONE,10000,skill_lv,0,0,1000,skill->get_time(skill_id, skill_lv),2); else { rate = 1; status_change_end(bl,SC_STONE,INVALID_TIMER); @@ -7886,7 +7859,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( rate ) { skill_area_temp[1] = bl->id; - map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id); } // Doesn't send failure packet if it fails on defense. } @@ -7928,7 +7901,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WL_SUMMONSTONE: element = WLS_STONE; break; } - sc_start4(src,sctype,100,element,pos,skill_lv,0,skill_get_time(skill_id,skill_lv)); + sc_start4(src,sctype,100,element,pos,skill_lv,0,skill->get_time(skill_id,skill_lv)); clif_skill_nodamage(src,bl,skill_id,0,0); } break; @@ -7955,7 +7928,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui **/ case RA_FEARBREEZE: clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv))); + clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv))); break; case RA_WUGMASTERY: @@ -7996,7 +7969,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RA_SENSITIVEKEEN: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id); break; /** * Mechanic @@ -8005,7 +7978,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NC_B_SIDESLIDE: { uint8 dir = (skill_id == NC_F_SIDESLIDE) ? (unit_getdir(src)+4)%8 : unit_getdir(src); - skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),dir,0x1); + skill->blown(src,bl,skill->get_blewcount(skill_id,skill_lv),dir,0x1); clif_slide(src,src->x,src->y); clif_fixpos(src); //Aegis sent this packet clif_skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -8017,7 +7990,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( pc_ismadogear(sd) ) 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); + skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag); status_set_sp(src, 0, 0); } break; @@ -8025,14 +7998,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NC_ANALYZE: clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); clif_skill_nodamage(src, bl, skill_id, skill_lv, - sc_start(bl,type, 30 + 12 * skill_lv,skill_lv,skill_get_time(skill_id,skill_lv))); + sc_start(bl,type, 30 + 12 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv))); if( sd ) pc_overheat(sd,1); break; case NC_MAGNETICFIELD: - if( (i = sc_start2(bl,type,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv))) ) + if( (i = sc_start2(bl,type,100,skill_lv,src->id,skill->get_time(skill_id,skill_lv))) ) { - map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill_castend_damage_id);; + map_foreachinrange(skill_area_sub,src,skill->get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill->castend_damage_id);; clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6); if (sd) pc_overheat(sd,1); } @@ -8080,7 +8053,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SC_SHADOWFORM: if( sd && dstsd && src != bl && !dstsd->shadowform_id ) { - if( clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(src,type,100,skill_lv,bl->id,4+skill_lv,0,skill_get_time(skill_id, skill_lv))) ) + if( clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(src,type,100,skill_lv,bl->id,4+skill_lv,0,skill->get_time(skill_id, skill_lv))) ) dstsd->shadowform_id = src->id; } else if( sd ) @@ -8098,13 +8071,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); status_change_end(bl, SC__INVISIBILITY, INVALID_TIMER); - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); - sc_start(bl,SC_BLIND,53 + 2 * skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,53 + 2 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)); } } else { clif_skill_nodamage(src, bl, skill_id, 0, 1); - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, - src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); } break; @@ -8118,7 +8091,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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))); + 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 ) clif_skill_fail(sd,skill_id,0,0); break; @@ -8128,7 +8101,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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)))) { + 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) ) @@ -8141,14 +8114,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case LG_TRAMPLE: clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - map_foreachinrange(skill_destroy_trap,bl,skill_get_splash(skill_id,skill_lv),BL_SKILL,tick); + map_foreachinrange(skill_destroy_trap,bl,skill->get_splash(skill_id,skill_lv),BL_SKILL,tick); break; case LG_REFLECTDAMAGE: if( tsc && tsc->data[type] ) status_change_end(bl,type,INVALID_TIMER); else - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; @@ -8181,7 +8154,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sc_start(bl,SC_SHIELDSPELL_DEF,100,opt,-1); clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rate < brate ) - map_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_damage_id); + map_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_damage_id); status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER); break; case 2: @@ -8209,14 +8182,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1); clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rate < brate ) - map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|2,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|2,skill->castend_damage_id); status_change_end(bl,SC_SHIELDSPELL_MDEF,INVALID_TIMER); break; case 2: sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1); clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rate < brate ) - map_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); + map_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); break; case 3: if( sc_start(bl,SC_SHIELDSPELL_MDEF,brate,opt,sd->bonus.shieldmdef * 30000) ) @@ -8243,7 +8216,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui switch( opt ) { case 1: val = 105 * it->refine / 10; - sc_start2(bl,SC_SHIELDSPELL_REF,brate,opt,val,skill_get_time(skill_id,skill_lv)); + sc_start2(bl,SC_SHIELDSPELL_REF,brate,opt,val,skill->get_time(skill_id,skill_lv)); break; case 2: case 3: if( rate < brate ) @@ -8265,10 +8238,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case LG_PIETY: if( flag&1 ) - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); else { skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill->castend_nodamage_id); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8281,12 +8254,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_updatestatus(sd,SP_JOBEXP); } clif_skill_nodamage(bl,src,skill_id,skill_lv, - sc_start(bl, type, 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 SR_CURSEDCIRCLE: if( flag&1 ) { if( is_boss(bl) ) break; - if( sc_start2(bl, type, 100, skill_lv, src->id, skill_get_time(skill_id, skill_lv))) { + if( sc_start2(bl, type, 100, skill_lv, src->id, skill->get_time(skill_id, skill_lv))) { if( bl->type == BL_MOB ) mob_unlocktarget((TBL_MOB*)bl,gettick()); unit_stop_attack(bl); @@ -8297,21 +8270,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } else { int count = 0; clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - count = map_forcountinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors - BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + count = map_forcountinrange(skill_area_sub, src, skill->get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors + BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); if( sd ) pc_delspiritball(sd, count, 0); clif_skill_nodamage(src, src, skill_id, skill_lv, - sc_start2(src, SC_CURSEDCIRCLE_ATKER, 100, skill_lv, count, skill_get_time(skill_id,skill_lv))); + sc_start2(src, SC_CURSEDCIRCLE_ATKER, 100, skill_lv, count, skill->get_time(skill_id,skill_lv))); } break; case SR_RAISINGDRAGON: if( sd ) { short max = 5 + skill_lv; - sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skill_lv, skill->get_time(skill_id, skill_lv)); for( i = 0; i < max; i++ ) // Don't call more than max available spheres. - pc_addspiritball(sd, skill_get_time(skill_id, skill_lv), max); - clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv,skill_get_time(skill_id, skill_lv))); + pc_addspiritball(sd, skill->get_time(skill_id, skill_lv), max); + clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv,skill->get_time(skill_id, skill_lv))); } break; @@ -8327,7 +8300,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src, bl, skill_id, skill_lv, i ? 1:0); } else { clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill->castend_nodamage_id); } break; @@ -8336,7 +8309,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; if( sd && dstsd->spiritball <= 5 ) { for(i = 0; i <= 5; i++) { - pc_addspiritball(dstsd, skill_get_time(MO_CALLSPIRITS, pc_checkskill(sd,MO_CALLSPIRITS)), i); + pc_addspiritball(dstsd, skill->get_time(MO_CALLSPIRITS, pc_checkskill(sd,MO_CALLSPIRITS)), i); pc_delspiritball(sd, sd->spiritball, 0); } } @@ -8375,15 +8348,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SR_GENTLETOUCH_CHANGE: case SR_GENTLETOUCH_REVITALIZE: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start2(bl,type,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv))); + sc_start2(bl,type,100,skill_lv,src->id,skill->get_time(skill_id,skill_lv))); break; case WA_SWING_DANCE: case WA_MOONLIT_SERENADE: if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); else if( sd ) { // Only shows effects on caster. clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); } break; @@ -8391,17 +8364,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case MI_RUSH_WINDMILL: case MI_ECHOSONG: if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) - sc_start4(bl,type,100,skill_lv,6*skill_lv,(sd?pc_checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill_get_time(skill_id,skill_lv)); + sc_start4(bl,type,100,skill_lv,6*skill_lv,(sd?pc_checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill->get_time(skill_id,skill_lv)); else if( sd ) { // Only shows effects on caster. clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); } break; case MI_HARMONIZE: if( src != bl ) - clif_skill_nodamage(src, src, skill_id, skill_lv, sc_start(src, type, 100, skill_lv, skill_get_time(skill_id,skill_lv))); - clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src, src, skill_id, skill_lv, sc_start(src, type, 100, skill_lv, skill->get_time(skill_id,skill_lv))); + clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id,skill_lv))); break; case WM_DEADHILLHERE: @@ -8428,9 +8401,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( skill_id != WM_SIRCLEOFNATURE ) flag &= ~BCT_SELF; if( flag&1 ) { - sc_start2(bl,type,(skill_id==WM_VOICEOFSIREN)?20+10*skill_lv:100,skill_lv,(skill_id==WM_VOICEOFSIREN)?src->id:0,skill_get_time(skill_id,skill_lv)); + sc_start2(bl,type,(skill_id==WM_VOICEOFSIREN)?20+10*skill_lv:100,skill_lv,(skill_id==WM_VOICEOFSIREN)?src->id:0,skill->get_time(skill_id,skill_lv)); } else { - map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, src, skill->get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8441,16 +8414,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui pc_checkskill(dstsd,CR_SHIELDCHARGE) || pc_checkskill(dstsd,CR_SHIELDBOOMERANG) || pc_checkskill(dstsd,PA_SHIELDCHAIN) || pc_checkskill(dstsd,LG_SHIELDPRESS) ) ) { - sc_start(bl,SC_GLOOMYDAY_SK,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_GLOOMYDAY_SK,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; } - sc_start(bl,type,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 WM_SATURDAY_NIGHT_FEVER: if( flag&1 ) { // Affect to all targets arround the caster and caster too. if( !(tsc && tsc->data[type]) ) - sc_start(bl, type, 100, skill_lv,skill_get_time(skill_id, skill_lv)); + sc_start(bl, type, 100, skill_lv,skill->get_time(skill_id, skill_lv)); } else if( flag&2 ) { if( src->id != bl->id && battle->check_target(src,bl,BCT_ENEMY) > 0 ) status_fix_damage(src,bl,9999,clif_damage(src,bl,tick,0,0,9999,0,0,0)); @@ -8460,14 +8433,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_fail(sd,skill_id,USESKILL_FAIL_NEED_HELPER,0); break; } - if( map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id,skill_lv), + if( map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id,skill_lv), BL_PC, src, skill_id, skill_lv, tick, BCT_ENEMY, skill_area_sub_count) > 7 ) flag |= 2; else flag |= 1; - map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF, skill->castend_nodamage_id); clif_skill_nodamage(src, bl, skill_id, skill_lv, - sc_start(src,SC_STOP,100,skill_lv,skill_get_time2(skill_id,skill_lv))); + sc_start(src,SC_STOP,100,skill_lv,skill->get_time2(skill_id,skill_lv))); if( flag&2 ) // Dealed here to prevent conflicts status_fix_damage(src,bl,9999,clif_damage(src,bl,tick,0,0,9999,0,0,0)); } @@ -8479,13 +8452,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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)); + sc_start2(bl,type,100,skill_lv,sc->data[type]->val2,skill->get_time(skill_id,skill_lv)); } } else if( sd ) { short lv = (short)skill_lv; - int count = skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),1); - if( sc_start2(bl,type,100,skill_lv,count,skill_get_time(skill_id,skill_lv)) ) - party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,flag|BCT_PARTY|1,skill_castend_nodamage_id); + int count = skill->check_pc_partner(sd,skill_id,&lv,skill->get_splash(skill_id,skill_lv),1); + if( sc_start2(bl,type,100,skill_lv,count,skill->get_time(skill_id,skill_lv)) ) + party_foreachsamemap(skill_area_sub,sd,skill->get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,flag|BCT_PARTY|1,skill->castend_nodamage_id); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } @@ -8495,11 +8468,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WM_BEYOND_OF_WARCRY: case WM_UNLIMITED_HUMMING_VOICE: if( flag&1 ) { - sc_start2(bl,type,100,skill_lv,skill_area_temp[0],skill_get_time(skill_id,skill_lv)); + sc_start2(bl,type,100,skill_lv,skill_area_temp[0],skill->get_time(skill_id,skill_lv)); } else { // These affect to all targets arround the caster. short lv = (short)skill_lv; - skill_area_temp[0] = (sd) ? skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),1) : 50; // 50% chance in non BL_PC (clones). - map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + skill_area_temp[0] = (sd) ? skill->check_pc_partner(sd,skill_id,&lv,skill->get_splash(skill_id,skill_lv),1) : 50; // 50% chance in non BL_PC (clones). + map_foreachinrange(skill_area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8520,7 +8493,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_item_skill(sd, improv_skill_id, improv_skill_lv); } else { struct unit_data *ud = unit_bl2ud(src); - int inf = skill_get_inf(improv_skill_id); + int inf = skill->get_inf(improv_skill_id); if (!ud) break; if (inf&INF_SELF_SKILL || inf&INF_SUPPORT_SKILL) { if (src->type == BL_PET) @@ -8537,7 +8510,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if (!target_id) break; - if (skill_get_casttype(improv_skill_id) == CAST_GROUND) { + if (skill->get_casttype(improv_skill_id) == CAST_GROUND) { bl = map_id2bl(target_id); if (!bl) bl = src; unit_skilluse_pos(src, bl->x, bl->y, improv_skill_id, improv_skill_lv); @@ -8596,7 +8569,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui int rate = (15 + 5 * skill_lv) + status_get_int(src)/5 + (sd ? sd->status.job_level : 0); rate -= status_get_int(bl)/6 - status_get_luk(bl)/10; clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); - sc_start2(bl, type, rate, skill_lv, 1, skill_get_time(skill_id, skill_lv)); + sc_start2(bl, type, rate, skill_lv, 1, skill->get_time(skill_id, skill_lv)); } break; @@ -8605,11 +8578,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //[(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 ) + status_get_lv(src) / 15; if( bl != src ) - sc_start(bl,type,rate,skill_lv,skill_get_time(skill_id,skill_lv)); + 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); - map_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); + map_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); } break; @@ -8618,14 +8591,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SO_SUMMON_VENTUS: case SO_SUMMON_TERA: if( sd ) { - int elemental_class = skill_get_elemental_type(skill_id,skill_lv); + int elemental_class = skill->get_elemental_type(skill_id,skill_lv); // Remove previous elemental fisrt. if( sd->ed ) elemental_delete(sd->ed,0); // Summoning the new one. - if( !elemental_create(sd,elemental_class,skill_get_time(skill_id,skill_lv)) ) { + if( !elemental_create(sd,elemental_class,skill->get_time(skill_id,skill_lv)) ) { clif_skill_fail(sd,skill_id,0,0); break; } @@ -8672,7 +8645,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui duration = 9000; break; } - skill_blockpc_start(sd, skill_id, duration); + skill->blockpc_start(sd, skill_id, duration, false); } break; @@ -8706,13 +8679,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { struct status_change *sc = status_get_sc(src); - if( sc && sc->bs_counter < skill_get_maxcount( skill_id , skill_lv) ) { + if( sc && sc->bs_counter < skill->get_maxcount( skill_id , skill_lv) ) { if( tsc && tsc->data[type] ){ (sc->bs_counter)--; status_change_end(src, type, INVALID_TIMER); // the first one cancels and the last one will take effect resetting the timer } clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); - sc_start2(bl, type, 100, skill_lv, src->id, skill_get_time(skill_id,skill_lv)); + sc_start2(bl, type, 100, skill_lv, src->id, skill->get_time(skill_id,skill_lv)); (sc->bs_counter)++; } else if( sd ) { clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); @@ -8724,11 +8697,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case GN_MANDRAGORA: if( flag&1 ) { if ( clif_skill_nodamage(bl, src, skill_id, skill_lv, - sc_start(bl, type, 25 + 10 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv))) ) + sc_start(bl, type, 25 + 10 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv))) ) status_zap(bl, 0, status_get_max_sp(bl) * (25 + 5 * skill_lv) / 100); } else - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, - src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); break; case GN_SLINGITEM: @@ -8744,9 +8717,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( itemdb_is_GNbomb(ammo_id) ) { if(battle->check_target(src,bl,BCT_ENEMY) > 0) {// Only attack if the target is an enemy. if( ammo_id == 13263 ) - map_foreachincell(skill_area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachincell(skill_area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); else - skill_attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag); + skill->attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag); } else //Otherwise, it fails, shows animation and removes items. clif_skill_fail(sd,GN_SLINGITEM_RANGEMELEEATK,0xa,0); } else if( itemdb_is_GNthrowable(ammo_id) ){ @@ -8806,9 +8779,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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)); + 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)); } } } @@ -8820,7 +8793,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case EL_POWER_OF_GAIA: clif_skill_nodamage(src,src,skill_id,skill_lv,1); clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - skill_unitsetting(src,skill_id,skill_lv,bl->x,bl->y,0); + skill->unitsetting(src,skill_id,skill_lv,bl->x,bl->y,0); break; case EL_WATER_SCREEN: { @@ -8835,8 +8808,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } 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)); + 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)); } } } @@ -8847,9 +8820,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case KO_KAZEHU_SEIRAN: case KO_DOHU_KOUKAI: if(sd) { - int ttype = skill_get_ele(skill_id, skill_lv); + int ttype = skill->get_ele(skill_id, skill_lv); clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); - pc_add_talisman(sd, skill_get_time(skill_id, skill_lv), 10, ttype); + pc_add_talisman(sd, skill->get_time(skill_id, skill_lv), 10, ttype); } break; @@ -8864,11 +8837,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui md->special_state.ai = AI_ZANZOU; if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (gettick() + skill_get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = add_timer (gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn( md ); pc_setinvincibletimer(sd,500);// unlock target lock clif_skill_nodamage(src,bl,skill_id,skill_lv,1); - skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),unit_getdir(bl),0); + skill->blown(src,bl,skill->get_blewcount(skill_id,skill_lv),unit_getdir(bl),0); } } break; @@ -8876,7 +8849,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case KO_KYOUGAKU: if( dstsd && tsc && !tsc->data[type] && rand()%100 < tstatus->int_/2 ){ clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); }else if( sd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; @@ -8885,7 +8858,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( dstsd && tsc && !tsc->data[type] && rand()%100 < ((45+5*skill_lv) + skill_lv*5 - status_get_int(bl)/2) ){//[(Base chance of success) + (Skill Level x 5) - (int / 2)]%. clif_skill_nodamage(src,bl,skill_id,skill_lv, - status_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( status_get_lv(bl) <= status_get_lv(src) ) status_change_start(bl,SC_COMA,10,skill_lv,0,src->id,0,0,0); @@ -8905,14 +8878,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (unit_movepos(src,bl->x,bl->y,0,0)) { clif_skill_nodamage(src,src,skill_id,skill_lv,1); clif_slide(src,bl->x,bl->y) ; - sc_start(src,SC_CONFUSION,80,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(src,SC_CONFUSION,80,skill_lv,skill->get_time(skill_id,skill_lv)); if (unit_movepos(bl,x,y,0,0)) { clif_skill_damage(bl,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, -1, 6); if( bl->type == BL_PC && pc_issit((TBL_PC*)bl)) clif_sitting(bl); //Avoid sitting sync problem clif_slide(bl,x,y) ; - sc_start(bl,SC_CONFUSION,80,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_CONFUSION,80,skill_lv,skill->get_time(skill_id,skill_lv)); } } } @@ -8930,7 +8903,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case KG_KYOMU: case KG_KAGEMUSYA: clif_skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; @@ -8939,8 +8912,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(tsc && ( tsc->option&(OPTION_CLOAK|OPTION_HIDE) || tsc->data[SC_CAMOUFLAGE] || tsc->data[SC__SHADOWFORM] || tsc->data[SC_MARIONETTE] || tsc->data[SC_HARMONIZE])){ - sc_start(src, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); - sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(src, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); + sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); status_change_end(bl, SC_HIDING, INVALID_TIMER); status_change_end(bl, SC_CLOAKING, INVALID_TIMER); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); @@ -8951,11 +8924,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if( skill_area_temp[2] == 1 ){ clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - sc_start(src, SC_STOP, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(src, SC_STOP, 100, skill_lv, skill->get_time(skill_id, skill_lv)); } }else{ skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_nodamage_id); } break; @@ -8971,21 +8944,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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); + 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; status_heal(bl, heal, 0, 7); //now inflict silence on everyone if(ssc && !ssc->data[SC_SILENCE]) //put inavoidable silence on homun - status_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 = 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); + 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)); + skill->blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); } break; case MH_OVERED_BOOST: @@ -8998,20 +8971,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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 + 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)); + 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)); + 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)); + skill->blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); } break; @@ -9024,9 +8997,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case MH_STYLE_CHANGE: case MH_MAGMA_FLOW: case MH_PAIN_KILLER: - sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + 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)); + skill->blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); break; case MH_SUMMON_LEGION: { @@ -9041,13 +9014,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui md->master_id = src->id; if (md->deletetimer != INVALID_TIMER) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer(gettick() + skill_get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = 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_ASSIST, 0, 60000); } } if (hd) - skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); + skill->blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); } break; default: @@ -9078,7 +9051,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } skill_onskillusage(sd, bl, skill_id, tick); // perform skill requirement consumption - skill_consume_requirement(sd,skill_id,skill_lv,2); + skill->consume_requirement(sd,skill_id,skill_lv,2); } map_freeblock_unlock(); @@ -9155,7 +9128,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) case AM_RESURRECTHOMUN: case PF_SPIDERWEB: //Find a random spot to place the skill. [Skotlex] - inf2 = skill_get_splash(ud->skill_id, ud->skill_lv); + inf2 = skill->get_splash(ud->skill_id, ud->skill_lv); ud->skillx = target->x + inf2; ud->skilly = target->y + inf2; if (inf2 && !map_random_dir(target, &ud->skillx, &ud->skilly)) { @@ -9163,12 +9136,12 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) ud->skilly = target->y; } ud->skilltimer=tid; - return skill_castend_pos(tid,tick,id,data); + return skill->castend_pos(tid,tick,id,data); case GN_WALLOFTHORN: ud->skillx = target->x; ud->skilly = target->y; ud->skilltimer = tid; - return skill_castend_pos(tid,tick,id,data); + return skill->castend_pos(tid,tick,id,data); } if(ud->skill_id == RG_BACKSTAP) { @@ -9200,8 +9173,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) } else { // Check target validity. - inf = skill_get_inf(ud->skill_id); - inf2 = skill_get_inf2(ud->skill_id); + inf = skill->get_inf(ud->skill_id); + inf2 = skill->get_inf2(ud->skill_id); if(inf&INF_ATTACK_SKILL || (inf&INF_SELF_SKILL && inf2&INF2_NO_TARGET_SELF) //Combo skills @@ -9221,7 +9194,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) inf &= ~BCT_NEUTRAL; } - if( sd && (inf2&INF2_CHORUS_SKILL) && skill_check_pc_partner(sd, ud->skill_id, &ud->skill_lv, 1, 0) < 1 ) { + if( sd && (inf2&INF2_CHORUS_SKILL) && skill->check_pc_partner(sd, ud->skill_id, &ud->skill_lv, 1, 0) < 1 ) { clif_skill_fail(sd, ud->skill_id, USESKILL_FAIL_NEED_HELPER, 0); break; } @@ -9255,22 +9228,22 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) } if(src != target && battle_config.skill_add_range && - !check_distance_bl(src, target, skill_get_range2(src,ud->skill_id,ud->skill_lv)+battle_config.skill_add_range)) + !check_distance_bl(src, target, skill->get_range2(src,ud->skill_id,ud->skill_lv)+battle_config.skill_add_range)) { if (sd) { clif_skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); if(battle_config.skill_out_range_consume) //Consume items anyway. [Skotlex] - skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,3); + skill->consume_requirement(sd,ud->skill_id,ud->skill_lv,3); } break; } if( sd ) { - if( !skill_check_condition_castend(sd, ud->skill_id, ud->skill_lv) ) + if( !skill->check_condition_castend(sd, ud->skill_id, ud->skill_lv) ) break; else - skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,1); + skill->consume_requirement(sd,ud->skill_id,ud->skill_lv,1); } #ifdef OFFICIAL_WALKPATH if( !path_search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) ) @@ -9289,8 +9262,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) if (ud->walktimer != INVALID_TIMER && ud->skill_id != TK_RUN && ud->skill_id != RA_WUGDASH) unit_stop_walking(src,1); - if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) - ud->canact_tick = tick + skill_delayfix(src, ud->skill_id, ud->skill_lv); //Tests show wings don't overwrite the delay but skill scrolls do. [Inkfish] + if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) + ud->canact_tick = tick + skill->delay_fix(src, ud->skill_id, ud->skill_lv); //Tests show wings don't overwrite the delay but skill scrolls do. [Inkfish] if (sd) { //Cooldown application int i, cooldown = skill_get_cooldown(ud->skill_id, ud->skill_lv); for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) { // Increases/Decreases cooldown of a skill by item/card bonuses. @@ -9300,31 +9273,31 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) } } if(cooldown) - skill_blockpc_start(sd, ud->skill_id, cooldown); + skill->blockpc_start(sd, ud->skill_id, cooldown, false); } if( battle_config.display_status_timers && sd ) - clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); + clif_status_change(src, SI_ACTIONDELAY, 1, skill->delay_fix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); if( sd ) { switch( ud->skill_id ) { case GS_DESPERADO: - sd->canequip_tick = tick + skill_get_time(ud->skill_id, ud->skill_lv); + sd->canequip_tick = tick + skill->get_time(ud->skill_id, ud->skill_lv); break; case CR_GRANDCROSS: case NPC_GRANDDARKNESS: if( (sc = status_get_sc(src)) && sc->data[SC_STRIPSHIELD] ) { const struct TimerData *timer = get_timer(sc->data[SC_STRIPSHIELD]->timer); - if( timer && timer->func == status_change_timer && DIFF_TICK(timer->tick,gettick()+skill_get_time(ud->skill_id, ud->skill_lv)) > 0 ) + if( timer && timer->func == status_change_timer && DIFF_TICK(timer->tick,gettick()+skill->get_time(ud->skill_id, ud->skill_lv)) > 0 ) break; } - sc_start2(src, SC_STRIPSHIELD, 100, 0, 1, skill_get_time(ud->skill_id, ud->skill_lv)); + sc_start2(src, SC_STRIPSHIELD, 100, 0, 1, skill->get_time(ud->skill_id, ud->skill_lv)); break; } } - if (skill_get_state(ud->skill_id) != ST_MOVE_ENABLE) - unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill_get_walkdelay(ud->skill_id, ud->skill_lv), 1); + if (skill->get_state(ud->skill_id) != ST_MOVE_ENABLE) + unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill->get_walkdelay(ud->skill_id, ud->skill_lv), 1); if(battle_config.skill_log && battle_config.skill_log&src->type) ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n", @@ -9337,10 +9310,10 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) if( ud->skill_id != RA_CAMOUFLAGE ) // only normal attack and auto cast skills benefit from its bonuses status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER); - if (skill_get_casttype(ud->skill_id) == CAST_NODAMAGE) - skill_castend_nodamage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); + if (skill->get_casttype(ud->skill_id) == CAST_NODAMAGE) + skill->castend_nodamage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); else - skill_castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); + skill->castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); sc = status_get_sc(src); if(sc && sc->count) { @@ -9350,8 +9323,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) ud->skill_id != WZ_WATERBALL) sc->data[SC_SPIRIT]->val3 = 0; //Clear bounced spell check. - if( sc->data[SC_DANCING] && skill_get_inf2(ud->skill_id)&INF2_SONG_DANCE && sd ) - skill_blockpc_start(sd,BD_ADAPTATION,3000); + if( sc->data[SC_DANCING] && skill->get_inf2(ud->skill_id)&INF2_SONG_DANCE && sd ) + skill->blockpc_start(sd,BD_ADAPTATION,3000, false); } if( sd && ud->skill_id != SA_ABRACADABRA && ud->skill_id != WM_RANDOMIZESPELL ) // they just set the data so leave it as it is.[Inkfish] @@ -9370,7 +9343,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) 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); + skill->consume_requirement(sd,ud->skill_id, ud->skill_lv,1); status_set_sp(src, 0, 0); sc = &sd->sc; if (sc->count) @@ -9378,7 +9351,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); #ifdef RENEWAL - sc_start(src, SC_EXTREMITYFIST2, 100, ud->skill_lv, skill_get_time(ud->skill_id, ud->skill_lv)); + sc_start(src, SC_EXTREMITYFIST2, 100, ud->skill_lv, skill->get_time(ud->skill_id, ud->skill_lv)); #endif } if (target && target->m == src->m) @@ -9401,7 +9374,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) } ud->skill_id = ud->skill_lv = ud->skilltarget = 0; - if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) + if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) ud->canact_tick = tick; //You can't place a skill failed packet here because it would be //sent in ALL cases, even cases where skill_check_condition fails @@ -9453,7 +9426,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) break; if( !(src->type&battle_config.skill_reiteration) && - skill_get_unit_flag(ud->skill_id)&UF_NOREITERATION && + skill->get_unit_flag(ud->skill_id)&UF_NOREITERATION && skill_check_unit_range(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv) ) { @@ -9461,7 +9434,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) break; } if( src->type&battle_config.skill_nofootset && - skill_get_unit_flag(ud->skill_id)&UF_NOFOOTSET && + skill->get_unit_flag(ud->skill_id)&UF_NOFOOTSET && skill_check_unit_range2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv) ) { @@ -9469,7 +9442,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) break; } if( src->type&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(ud->skill_id, ud->skill_lv)) > 0 + (maxcount = skill->get_maxcount(ud->skill_id, ud->skill_lv)) > 0 ) { int i; for(i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i] && maxcount;i++) { @@ -9488,19 +9461,19 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) 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)) { + !check_distance_blxy(src, ud->skillx, ud->skilly, skill->get_range2(src,ud->skill_id,ud->skill_lv)+battle_config.skill_add_range)) { if (sd && battle_config.skill_out_range_consume) //Consume items anyway. - skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,3); + skill->consume_requirement(sd,ud->skill_id,ud->skill_lv,3); break; } } if( sd ) { - if( ud->skill_id != AL_WARP && !skill_check_condition_castend(sd, ud->skill_id, ud->skill_lv) ) + if( ud->skill_id != AL_WARP && !skill->check_condition_castend(sd, ud->skill_id, ud->skill_lv) ) break; else - skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,1); + skill->consume_requirement(sd,ud->skill_id,ud->skill_lv,1); } if( (src->type == BL_MER || src->type == BL_HOM) && !skill_check_condition_mercenary(src, ud->skill_id, ud->skill_lv, 1) ) @@ -9519,8 +9492,8 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) if (ud->walktimer != INVALID_TIMER) unit_stop_walking(src,1); - if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) - ud->canact_tick = tick + skill_delayfix(src, ud->skill_id, ud->skill_lv); + if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) + ud->canact_tick = tick + skill->delay_fix(src, ud->skill_id, ud->skill_lv); if (sd) { //Cooldown application int i, cooldown = skill_get_cooldown(ud->skill_id, ud->skill_lv); for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) { // Increases/Decreases cooldown of a skill by item/card bonuses. @@ -9530,10 +9503,10 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) } } if(cooldown) - skill_blockpc_start(sd, ud->skill_id, cooldown); + skill->blockpc_start(sd, ud->skill_id, cooldown, false); } if( battle_config.display_status_timers && sd ) - clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); + clif_status_change(src, SI_ACTIONDELAY, 1, skill->delay_fix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); // if( sd ) // { // switch( ud->skill_id ) @@ -9543,10 +9516,10 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) // break; // } // } - unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill_get_walkdelay(ud->skill_id, ud->skill_lv), 1); + unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill->get_walkdelay(ud->skill_id, ud->skill_lv), 1); status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER);// only normal attack and auto cast skills benefit from its bonuses map_freeblock_lock(); - skill_castend_pos2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv,tick,0); + skill->castend_pos2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv,tick,0); if( sd && sd->skillitem != AL_WARP ) // Warp-Portal thru items will clear data in skill_castend_map. [Inkfish] sd->skillitem = sd->skillitemlv = 0; @@ -9561,7 +9534,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) return 1; } while(0); - if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) + if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) ud->canact_tick = tick; ud->skill_id = ud->skill_lv = 0; if(sd) @@ -9613,7 +9586,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case LG_EARTHDRIVE: break; //Effect is displayed on respective switch case. default: - if(skill_get_inf(skill_id)&INF_SELF_SKILL) + if(skill->get_inf(skill_id)&INF_SELF_SKILL) clif_skill_nodamage(src,src,skill_id,skill_lv,1); else clif_skill_poseffect(src,skill_id,skill_lv,x,y,tick); @@ -9626,27 +9599,27 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui { case PR_BENEDICTIO: skill_area_temp[1] = src->id; - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea(skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ALL|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); map_foreachinarea(skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, - skill_castend_damage_id); + skill->castend_damage_id); break; case BS_HAMMERFALL: - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea (skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|2, - skill_castend_nodamage_id); + skill->castend_nodamage_id); break; case HT_DETECTING: - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea( status_change_timer_sub, src->m, x-i, y-i, x+i,y+i,BL_CHAR, src,NULL,SC_SIGHT,tick); @@ -9656,9 +9629,9 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; case SR_RIDEINLIGHTNING: - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea(skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR, - src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id); break; case SA_VOLCANO: @@ -9670,13 +9643,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui { if (sg->limit - DIFF_TICK(gettick(), sg->tick) > 0) { - skill_unitsetting(src,skill_id,skill_lv,x,y,0); + skill->unitsetting(src,skill_id,skill_lv,x,y,0); return 0; // not to consume items } else sg->limit = 0; //Disable it. } - skill_unitsetting(src,skill_id,skill_lv,x,y,0); + skill->unitsetting(src,skill_id,skill_lv,x,y,0); break; } case MG_SAFETYWALL: @@ -9786,11 +9759,11 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case MH_XENO_SLASHER: flag|=1;//Set flag to 1 to prevent deleting ammo (it will be deleted on group-delete). case GS_GROUNDDRIFT: //Ammo should be deleted right away. - skill_unitsetting(src,skill_id,skill_lv,x,y,0); + skill->unitsetting(src,skill_id,skill_lv,x,y,0); break; case RG_GRAFFITI: /* Graffiti [Valaris] */ - skill_clear_unitgroup(src); - skill_unitsetting(src,skill_id,skill_lv,x,y,0); + skill->clear_unitgroup(src); + skill->unitsetting(src,skill_id,skill_lv,x,y,0); flag|=1; break; case HP_BASILICA: @@ -9803,32 +9776,32 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui return 1; } - skill_clear_unitgroup(src); - if( skill_unitsetting(src,skill_id,skill_lv,x,y,0) ) - sc_start4(src,type,100,skill_lv,0,0,src->id,skill_get_time(skill_id,skill_lv)); + skill->clear_unitgroup(src); + if( skill->unitsetting(src,skill_id,skill_lv,x,y,0) ) + sc_start4(src,type,100,skill_lv,0,0,src->id,skill->get_time(skill_id,skill_lv)); flag|=1; } break; case CG_HERMODE: - skill_clear_unitgroup(src); - if ((sg = skill_unitsetting(src,skill_id,skill_lv,x,y,0))) + skill->clear_unitgroup(src); + if ((sg = skill->unitsetting(src,skill_id,skill_lv,x,y,0))) sc_start4(src,SC_DANCING,100, - skill_id,0,skill_lv,sg->group_id,skill_get_time(skill_id,skill_lv)); + skill_id,0,skill_lv,sg->group_id,skill->get_time(skill_id,skill_lv)); flag|=1; break; case RG_CLEANER: // [Valaris] - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea(skill_graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL); break; case SO_WARMER: flag|= 8; case SO_CLOUD_KILL: - skill_unitsetting(src,skill_id,skill_lv,x,y,0); + skill->unitsetting(src,skill_id,skill_lv,x,y,0); break; case WZ_METEOR: { - int area = skill_get_splash(skill_id, skill_lv); + int area = skill->get_splash(skill_id, skill_lv); short tmpx = 0, tmpy = 0, x1 = 0, y1 = 0; for( i = 0; i < 2 + (skill_lv>>1); i++ ) { @@ -9840,13 +9813,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui clif_skill_poseffect(src,skill_id,skill_lv,tmpx,tmpy,tick); if( i > 0 ) - skill_addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skill_id,skill_lv,(x1<<16)|y1,0); + skill->addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skill_id,skill_lv,(x1<<16)|y1,0); x1 = tmpx; y1 = tmpy; } - skill_addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skill_id,skill_lv,-1,0); + skill->addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skill_id,skill_lv,-1,0); } break; @@ -9871,7 +9844,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui clif_skill_poseffect(src,skill_id,skill_lv,src->x,src->y,tick); #endif if (sd) - skill_blockpc_start (sd, MO_EXTREMITYFIST, 2000); + skill->blockpc_start (sd, MO_EXTREMITYFIST, 2000, false); } break; case NJ_SHADOWJUMP: @@ -9896,7 +9869,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA; if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (gettick() + skill_get_time(skill_id,skill_lv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = 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. } } @@ -9927,11 +9900,11 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui potion_sp = potion_sp * (100+i)/100; if(potion_hp > 0 || potion_sp > 0) { - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea(skill_area_sub, src->m,x-i,y-i,x+i,y+i,BL_CHAR, src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); } } else { int i = skill_lv%11 - 1; @@ -9943,17 +9916,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui potion_sp = 0; run_script(item->script,0,src->id,0); potion_flag = 0; - i = skill_get_max(CR_SLIMPITCHER)*10; + i = skill->get_max(CR_SLIMPITCHER)*10; potion_hp = potion_hp * (100+i)/100; potion_sp = potion_sp * (100+i)/100; if(potion_hp > 0 || potion_sp > 0) { - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea(skill_area_sub, src->m,x-i,y-i,x+i,y+i,BL_CHAR, src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, - skill_castend_nodamage_id); + skill->castend_nodamage_id); } } break; @@ -9962,7 +9935,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if (rnd()%100 < 80) { int dummy = 1; clif_skill_poseffect(src,skill_id,skill_lv,x,y,tick); - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea(skill_cell_overlap, src->m, x-i, y-i, x+i, y+i, BL_SKILL, HW_GANBANTEIN, &dummy, src); } else { if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -9971,8 +9944,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; case HW_GRAVITATION: - if ((sg = skill_unitsetting(src,skill_id,skill_lv,x,y,0))) - sc_start4(src,type,100,skill_lv,0,BCT_SELF,sg->group_id,skill_get_time(skill_id,skill_lv)); + if ((sg = skill->unitsetting(src,skill_id,skill_lv,x,y,0))) + sc_start4(src,type,100,skill_lv,0,BCT_SELF,sg->group_id,skill->get_time(skill_id,skill_lv)); flag|=1; break; @@ -9991,7 +9964,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui TBL_MOB* md = mob_once_spawn_sub(src, src->m, x, y, "--ja--",(skill_lv < 2 ? 1084+rnd()%2 : 1078+rnd()%6),"", SZ_SMALL, AI_NONE); int i; if (!md) break; - if ((i = skill_get_time(skill_id, skill_lv)) > 0) + if ((i = skill->get_time(skill_id, skill_lv)) > 0) { if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); @@ -10005,9 +9978,9 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case SG_SUN_WARM: case SG_MOON_WARM: case SG_STAR_WARM: - skill_clear_unitgroup(src); - if ((sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0))) - sc_start4(src,type,100,skill_lv,0,0,sg->group_id,skill_get_time(skill_id,skill_lv)); + skill->clear_unitgroup(src); + if ((sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0))) + sc_start4(src,type,100,skill_lv,0,0,sg->group_id,skill->get_time(skill_id,skill_lv)); flag|=1; break; @@ -10019,17 +9992,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui } else { - sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0); + 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] - sc_start4(src,type,100,skill_lv,0,sg->group_id,BCT_SELF,skill_get_time(skill_id,skill_lv)); + 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 } break; case NJ_TATAMIGAESHI: - if (skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) - sc_start(src,type,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + if (skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) + sc_start(src,type,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; case AM_RESURRECTHOMUN: //[orn] @@ -10048,15 +10021,15 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case NC_COLDSLOWER: case NC_ARMSCANNON: case RK_DRAGONBREATH: - i = skill_get_splash(skill_id,skill_lv); + i = skill->get_splash(skill_id,skill_lv); map_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); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); break; case SO_ARRULLO: - i = skill_get_splash(skill_id,skill_lv); + i = skill->get_splash(skill_id,skill_lv); map_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_nodamage_id); + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); break; /** * Guilotine Cross @@ -10068,16 +10041,16 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui return 0; } clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6); - skill_unitsetting(src, skill_id, skill_lv, x, y, flag); + skill->unitsetting(src, skill_id, skill_lv, x, y, flag); //status_change_end(src,SC_POISONINGWEAPON,INVALID_TIMER); // 08/31/2011 - When using poison smoke, you no longer lose the poisoning weapon effect. break; /** * Arch Bishop **/ case AB_EPICLESIS: - if( (sg = skill_unitsetting(src, skill_id, skill_lv, x, y, 0)) ) { + if( (sg = skill->unitsetting(src, skill_id, skill_lv, x, y, 0)) ) { i = sg->unit->range; - map_foreachinarea(skill_area_sub, src->m, x - i, y - i, x + i, y + i, BL_CHAR, src, ALL_RESURRECTION, 1, tick, flag|BCT_NOENEMY|1,skill_castend_nodamage_id); + map_foreachinarea(skill_area_sub, src->m, x - i, y - i, x + i, y + i, BL_CHAR, src, ALL_RESURRECTION, 1, tick, flag|BCT_NOENEMY|1,skill->castend_nodamage_id); } break; /** @@ -10088,8 +10061,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui sc->comet_x = x; sc->comet_y = y; } - i = skill_get_splash(skill_id,skill_lv); - map_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); + i = skill->get_splash(skill_id,skill_lv); + map_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); break; case WL_EARTHSTRAIN: @@ -10105,7 +10078,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case 2: sx = x - i; break; case 6: sx = x + i; break; } - skill_addtimerskill(src,gettick() + (150 * i),0,sx,sy,skill_id,skill_lv,dir,flag&2); + skill->addtimerskill(src,gettick() + (150 * i),0,sx,sy,skill_id,skill_lv,dir,flag&2); } } break; @@ -10113,8 +10086,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui * Ranger **/ case RA_DETONATOR: - i = skill_get_splash(skill_id, skill_lv); - map_foreachinarea(skill_detonator, src->m, x-i, y-i, x+i, y+i, BL_SKILL, src); + i = skill->get_splash(skill_id, skill_lv); + map_foreachinarea(skill->detonator, src->m, x-i, y-i, x+i, y+i, BL_SKILL, src); clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; /** @@ -10122,9 +10095,9 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui **/ case NC_NEUTRALBARRIER: case NC_STEALTHFIELD: - skill_clear_unitgroup(src); // To remove previous skills - cannot used combined - if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) { - sc_start2(src,skill_id == NC_NEUTRALBARRIER ? SC_NEUTRALBARRIER_MASTER : SC_STEALTHFIELD_MASTER,100,skill_lv,sg->group_id,skill_get_time(skill_id,skill_lv)); + skill->clear_unitgroup(src); // To remove previous skills - cannot used combined + if( (sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) { + sc_start2(src,skill_id == NC_NEUTRALBARRIER ? SC_NEUTRALBARRIER_MASTER : SC_STEALTHFIELD_MASTER,100,skill_lv,sg->group_id,skill->get_time(skill_id,skill_lv)); if( sd ) pc_overheat(sd,1); } break; @@ -10141,7 +10114,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui md->special_state.ai = AI_FLORA; if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (gettick() + skill_get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = add_timer (gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn( md ); } } @@ -10153,9 +10126,9 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case SC_FEINTBOMB: clif_skill_nodamage(src,src,skill_id,skill_lv,1); - skill_unitsetting(src,skill_id,skill_lv,x,y,0); // Set bomb on current Position - if( skill_blown(src,src,6,unit_getdir(src),0) ) - skill_castend_nodamage_id(src,src,TF_HIDING,1,tick,0); + skill->unitsetting(src,skill_id,skill_lv,x,y,0); // Set bomb on current Position + if( skill->blown(src,src,6,unit_getdir(src),0) ) + skill->castend_nodamage_id(src,src,TF_HIDING,1,tick,0); break; case LG_OVERBRAND: @@ -10163,18 +10136,18 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui int width;//according to data from irowiki it actually is a square for( width = 0; width < 7; width++ ) for( i = 0; i < 7; i++ ) - map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skill_lv, tick, flag|BCT_ENEMY,skill_castend_damage_id); + map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id); for( width = 0; width < 7; width++ ) for( i = 0; i < 7; i++ ) - map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY,skill_castend_damage_id); + map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id); } break; case LG_BANDING: if( sc && sc->data[SC_BANDING] ) status_change_end(src,SC_BANDING,INVALID_TIMER); - else if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) { - sc_start4(src,SC_BANDING,100,skill_lv,0,0,sg->group_id,skill_get_time(skill_id,skill_lv)); + else if( (sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) { + sc_start4(src,SC_BANDING,100,skill_lv,0,0,sg->group_id,skill->get_time(skill_id,skill_lv)); if( sd ) pc_banding(sd,skill_lv); } clif_skill_nodamage(src,src,skill_id,skill_lv,1); @@ -10182,31 +10155,31 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case LG_RAYOFGENESIS: if( status_charge(src,status_get_max_hp(src)*3*skill_lv / 100,0) ) { - i = skill_get_splash(skill_id,skill_lv); + i = skill->get_splash(skill_id,skill_lv); map_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); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); } else if( sd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL,0); break; case WM_DOMINION_IMPULSE: - i = skill_get_splash(skill_id, skill_lv); + i = skill->get_splash(skill_id, skill_lv); map_foreachinarea( skill_ative_reverberation, src->m, x-i, y-i, x+i,y+i,BL_SKILL); break; case WM_GREAT_ECHO: flag|=1; // Should counsume 1 item per skill usage. - map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, src, skill->get_splash(skill_id,skill_lv),splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->castend_damage_id); break; case GN_CRAZYWEED: { - int area = skill_get_splash(GN_CRAZYWEED_ATK, skill_lv); + int area = skill->get_splash(GN_CRAZYWEED_ATK, skill_lv); short x1 = 0, y1 = 0; for( i = 0; i < 3 + (skill_lv/2); i++ ) { x1 = x - area + rnd()%(area * 2 + 1); y1 = y - area + rnd()%(area * 2 + 1); - skill_addtimerskill(src,tick+i*150,0,x1,y1,GN_CRAZYWEED_ATK,skill_lv,-1,0); + skill->addtimerskill(src,tick+i*150,0,x1,y1,GN_CRAZYWEED_ATK,skill_lv,-1,0); } } break; @@ -10232,8 +10205,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui map_foreachinarea(skill_area_sub, src->m, ud->skillunit[i]->unit->bl.x - 3, ud->skillunit[i]->unit->bl.y - 3, ud->skillunit[i]->unit->bl.x + 3, ud->skillunit[i]->unit->bl.y + 3, BL_CHAR, - src, CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill_castend_damage_id); - skill_delunit(ud->skillunit[i]->unit); + src, CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill->castend_damage_id); + skill->delunit(ud->skillunit[i]->unit); break; default: ud->skillunit[i]->unit->val2 = skill_lv; @@ -10250,19 +10223,19 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if( sc && sc->data[type] ) status_change_end(src,type,INVALID_TIMER); clif_skill_nodamage(src, src ,skill_id, skill_lv, - sc_start2(src, type, 100, skill_id, skill_lv, skill_get_time(skill_id, skill_lv))); + sc_start2(src, type, 100, skill_id, skill_lv, skill->get_time(skill_id, skill_lv))); break; case SC_BLOODYLUST: //set in another group so instance will move if recasted flag |= 33; - skill_unitsetting(src, skill_id, skill_lv, x, y, 0); + skill->unitsetting(src, skill_id, skill_lv, x, y, 0); break; case KO_MAKIBISHI: for( i = 0; i < (skill_lv+2); i++ ) { x = src->x - 1 + rnd()%3; y = src->y - 1 + rnd()%3; - skill_unitsetting(src,skill_id,skill_lv,x,y,0); + skill->unitsetting(src,skill_id,skill_lv,x,y,0); } break; @@ -10284,7 +10257,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui } // perform skill requirement consumption - skill_consume_requirement(sd,skill_id,skill_lv,2); + skill->consume_requirement(sd,skill_id,skill_lv,2); } return 0; @@ -10321,8 +10294,8 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char sd->sc.data[SC_BASILICA] || sd->sc.data[SC_MARIONETTE] || sd->sc.data[SC_WHITEIMPRISON] || - (sd->sc.data[SC_STASIS] && skill_block_check(&sd->bl, SC_STASIS, skill_id)) || - (sd->sc.data[SC_KAGEHUMI] && skill_block_check(&sd->bl, SC_KAGEHUMI, skill_id)) || + (sd->sc.data[SC_STASIS] && skill->block_check(&sd->bl, SC_STASIS, skill_id)) || + (sd->sc.data[SC_KAGEHUMI] && skill->block_check(&sd->bl, SC_KAGEHUMI, skill_id)) || sd->sc.data[SC_OBLIVIONCURSE] || sd->sc.data[SC__MANHOLE] || (sd->sc.data[SC_ASH] && rnd()%2) //50% fail chance under ASH @@ -10371,7 +10344,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char p[2] = &sd->status.memo_point[1]; p[3] = &sd->status.memo_point[2]; - if((maxcount = skill_get_maxcount(skill_id, sd->menuskill_val)) > 0) { + if((maxcount = skill->get_maxcount(skill_id, sd->menuskill_val)) > 0) { for(i=0;i<MAX_SKILLUNITGROUP && sd->ud.skillunit[i] && maxcount;i++) { if(sd->ud.skillunit[i]->skill_id == skill_id) maxcount--; @@ -10400,16 +10373,15 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char return 0; } - if(!skill_check_condition_castend(sd, sd->menuskill_id, lv)) - { // This checks versus skill_id/skill_lv... + if(!skill->check_condition_castend(sd, sd->menuskill_id, lv)) { // This checks versus skill_id/skill_lv... skill_failed(sd); return 0; } - skill_consume_requirement(sd,sd->menuskill_id,lv,2); + skill->consume_requirement(sd,sd->menuskill_id,lv,2); sd->skillitem = sd->skillitemlv = 0; // Clear data that's skipped in 'skill_castend_pos' [Inkfish] - if((group=skill_unitsetting(&sd->bl,skill_id,lv,wx,wy,0))==NULL) { + if((group=skill->unitsetting(&sd->bl,skill_id,lv,wx,wy,0))==NULL) { skill_failed(sd); return 0; } @@ -10484,8 +10456,8 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag) if ( !(group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE) ) return false; - if( flag == prevflag ) - {// protection against attempts to read an empty backup / write to a full backup + if( flag == prevflag ) { + // protection against attempts to read an empty backup / write to a full backup ShowError("skill_dance_switch: Attempted to %s (skill_id=%d, skill_lv=%d, src_id=%d).\n", flag ? "read an empty backup" : "write to a full backup", group->skill_id, group->skill_lv, group->src_id); @@ -10493,8 +10465,7 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag) } prevflag = flag; - if( !flag ) - { //Transform + if( !flag ) { //Transform uint16 skill_id = unit->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE; // backup @@ -10508,13 +10479,11 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag) // replace group->skill_id = skill_id; group->skill_lv = 1; - group->unit_id = skill_get_unit_id(skill_id,0); - group->target_flag = skill_get_unit_target(skill_id); - group->bl_flag = skill_get_unit_bl_target(skill_id); - group->interval = skill_get_unit_interval(skill_id); - } - else - { //Restore + group->unit_id = skill->get_unit_id(skill_id,0); + group->target_flag = skill->get_unit_target(skill_id); + group->bl_flag = skill->get_unit_bl_target(skill_id); + group->interval = skill->get_unit_interval(skill_id); + } else { //Restore group->skill_id = backup.skill_id; group->skill_lv = backup.skill_lv; group->unit_id = backup.unit_id; @@ -10565,11 +10534,11 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill nullpo_retr(NULL, src); - limit = skill_get_time(skill_id,skill_lv); + limit = skill->get_time(skill_id,skill_lv); range = skill_get_unit_range(skill_id,skill_lv); interval = skill_get_unit_interval(skill_id); - target = skill_get_unit_target(skill_id); - unit_flag = skill_get_unit_flag(skill_id); + target = skill->get_unit_target(skill_id); + unit_flag = skill->get_unit_flag(skill_id); layout = skill_get_unit_layout(skill_id,skill_lv,src,x,y); if( map[src->m].unit_count ) { @@ -10667,7 +10636,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: { - struct skill_condition req = skill_get_requirement(sd,skill_id,skill_lv); + struct skill_condition req = skill->get_requirement(sd,skill_id,skill_lv); ARR_FIND(0, MAX_SKILL_ITEM_REQUIRE, i, req.itemid[i] && (req.itemid[i] == ITEMID_TRAP || req.itemid[i] == ITEMID_TRAP_ALLOY)); if( req.itemid[i] ) req_item = req.itemid[i]; @@ -10695,9 +10664,9 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill { //Use the previous limit (minus the elapsed time) [Skotlex] limit = old_sg->limit - DIFF_TICK(gettick(), old_sg->tick); if (limit < 0) //This can happen... - limit = skill_get_time(skill_id,skill_lv); + limit = skill->get_time(skill_id,skill_lv); } - skill_clear_group(src,1); + skill->clear_group(src,1); } break; } @@ -10795,11 +10764,11 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill if (sd) val1 = sd->status.child; break; case NJ_KAENSIN: - skill_clear_group(src, 1); //Delete previous Kaensins/Suitons + skill->clear_group(src, 1); //Delete previous Kaensins/Suitons val2 = (skill_lv+1)/2 + 4; break; case NJ_SUITON: - skill_clear_group(src, 1); + skill->clear_group(src, 1); break; case GS_GROUNDDRIFT: @@ -10853,17 +10822,17 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill return NULL; break; case SO_CLOUD_KILL: - skill_clear_group(src, 4); + skill->clear_group(src, 4); break; case SO_WARMER: - skill_clear_group(src, 8); + skill->clear_group(src, 8); break; case SO_VACUUM_EXTREME: range++; break; case SC_BLOODYLUST: - skill_clear_group(src, 32); + skill->clear_group(src, 32); break; case GN_WALLOFTHORN: if( flag&1 ) @@ -10884,7 +10853,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill break; } - nullpo_retr(NULL, group=skill_initunitgroup(src,layout->count,skill_id,skill_lv,skill_get_unit_id(skill_id,flag&1)+subunt, limit, interval)); + nullpo_retr(NULL, group=skill->init_unitgroup(src,layout->count,skill_id,skill_lv,skill->get_unit_id(skill_id,flag&1)+subunt, limit, interval)); group->val1=val1; group->val2=val2; group->val3=val3; @@ -10916,7 +10885,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill (group->state.song_dance&2?BCT_SELF:0), limit+1000) && sd && group->state.song_dance&2 && skill_id != CG_HERMODE //Hermod is a encore with a warp! ) - skill_check_pc_partner(sd, skill_id, &skill_lv, 1, 1); + skill->check_pc_partner(sd, skill_id, &skill_lv, 1, 1); } limit = group->limit; @@ -10930,7 +10899,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill if( !group->state.song_dance && !map_getcell(src->m,ux,uy,CELL_CHKREACH) ) continue; // don't place skill units on walls (except for songs/dances/encores) - if( battle_config.skill_wall_check && skill_get_unit_flag(skill_id)&UF_PATHCHECK && !path_search_long(NULL,src->m,ux,uy,x,y,CELL_CHKWALL) ) + if( battle_config.skill_wall_check && skill->get_unit_flag(skill_id)&UF_PATHCHECK && !path_search_long(NULL,src->m,ux,uy,x,y,CELL_CHKWALL) ) continue; // no path between cell and center of casting. switch( skill_id ) { @@ -10989,7 +10958,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill val2 = unit_flag&(UF_DANCE|UF_SONG); //Store whether this is a song/dance break; } - if (skill_get_unit_flag(skill_id) & UF_RANGEDSINGLEUNIT && i == (layout->count / 2)) + if (skill->get_unit_flag(skill_id) & UF_RANGEDSINGLEUNIT && i == (layout->count / 2)) val2 |= UF_RANGEDSINGLEUNIT; // center. if( range <= 0 ) @@ -10997,7 +10966,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill if( !alive ) continue; - nullpo_retr(NULL, unit=skill_initunit(group,i,ux,uy,val1,val2)); + nullpo_retr(NULL, unit=skill->initunit(group,i,ux,uy,val1,val2)); unit->limit=limit; unit->range=range; @@ -11012,9 +10981,8 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill map_foreachincell(skill_unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1); } - if (!group->alive_count) - { //No cells? Something that was blocked completely by Land Protector? - skill_delunitgroup(group); + if (!group->alive_count) { //No cells? Something that was blocked completely by Land Protector? + skill->del_unitgroup(group,ALC_MARK); return NULL; } @@ -11034,9 +11002,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill /*========================================== * *------------------------------------------*/ -void ext_skill_unit_onplace(struct skill_unit *src, struct block_list *bl, unsigned int tick){skill_unit_onplace(src, bl, tick);} -static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned int tick) -{ +int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned int tick) { struct skill_unit_group *sg; struct block_list *ss; struct status_change *sc; @@ -11053,7 +11019,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un nullpo_ret(sg=src->group); nullpo_ret(ss=map_id2bl(sg->src_id)); - if( skill_get_type(sg->skill_id) == BF_MAGIC && map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR ) + if( skill->get_type(sg->skill_id) == BF_MAGIC && map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR ) return 0; //AoE skills are ineffective. [Skotlex] sc = status_get_sc(bl); @@ -11071,7 +11037,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un sc->data[SC_SPIDERWEB]->val2++; 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); + int sec = skill->get_time2(sg->skill_id,sg->skill_lv); if( status_change_start(bl,type,10000,sg->skill_lv,1,sg->group_id,0,sec,8) ) { const struct TimerData* td = sc->data[type]?get_timer(sc->data[type]->timer):NULL; if( td ) @@ -11101,13 +11067,13 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un break; //Does not affect the caster. if (!sce) { TBL_PC *sd = BL_CAST(BL_PC, bl); //prevent fullheal exploit - if (sd && sd->bloodylust_tick && DIFF_TICK(gettick(), sd->bloodylust_tick) < skill_get_time2(SC_BLOODYLUST, 1)) + if (sd && sd->bloodylust_tick && DIFF_TICK(gettick(), sd->bloodylust_tick) < skill->get_time2(SC_BLOODYLUST, 1)) clif_skill_nodamage(&src->bl,bl,sg->skill_id,sg->skill_lv, - sc_start4(bl, type, 100, sg->skill_lv, 1, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv))); + sc_start4(bl, type, 100, sg->skill_lv, 1, 0, 0, skill->get_time(LK_BERSERK, sg->skill_lv))); else { if (sd) sd->bloodylust_tick = gettick(); clif_skill_nodamage(&src->bl,bl,sg->skill_id,sg->skill_lv, - sc_start4(bl, type, 100, sg->skill_lv, 0, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv))); + sc_start4(bl, type, 100, sg->skill_lv, 0, 0, 0, skill->get_time(LK_BERSERK, sg->skill_lv))); } } break; @@ -11126,7 +11092,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un unsigned short m = sg->val3; if( --count <= 0 ) - skill_delunitgroup(sg); + skill->del_unitgroup(sg,ALC_MARK); if ( map_mapindex2mapid(sg->val3) == sd->bl.m && x == sd->bl.x && y == sd->bl.y ) working = 1;/* we break it because officials break it, lovely stuff. */ @@ -11205,7 +11171,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un { sc_start4(bl, type, 100, sg->skill_lv, sg->val1, sg->val2, sg->group_id, sg->limit); if (battle->check_target(&src->bl,bl,BCT_ENEMY)>0) - skill_additional_effect (ss, bl, sg->skill_id, sg->skill_lv, BF_MISC, ATK_DEF, tick); + skill->additional_effect (ss, bl, sg->skill_id, sg->skill_lv, BF_MISC, ATK_DEF, tick); } break; @@ -11227,19 +11193,19 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un break; if (ss == bl) //Also needed to prevent infinite loop crash. break; - skill_blown(ss,bl,skill_get_blewcount(sg->skill_id,sg->skill_lv),unit_getdir(bl),0); + skill->blown(ss,bl,skill->get_blewcount(sg->skill_id,sg->skill_lv),unit_getdir(bl),0); break; case UNT_WALLOFTHORN: if( status_get_mode(bl)&MD_BOSS ) break; // iRO Wiki says that this skill don't affect to Boss monsters. if( map_flag_vs(bl->m) || bl->id == src->bl.id || battle->check_target(&src->bl,bl, BCT_ENEMY) == 1 ) - skill_attack(skill_get_type(sg->skill_id), ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); + skill->attack(skill->get_type(sg->skill_id), ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); break; case UNT_VOLCANIC_ASH: if (!sce) - sc_start(bl, SC_ASH, 100, sg->skill_lv, skill_get_time(MH_VOLCANIC_ASH, sg->skill_lv)); + sc_start(bl, SC_ASH, 100, sg->skill_lv, skill->get_time(MH_VOLCANIC_ASH, sg->skill_lv)); break; case UNT_GD_LEADERSHIP: @@ -11323,22 +11289,22 @@ 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); + 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 && !status_isdead(bl)); if (src->val2<=0) - skill_delunit(src); + skill->delunit(src); } break; case UNT_SANCTUARY: if( battle->check_undead(tstatus->race, tstatus->def_ele) || tstatus->race==RC_DEMON ) { //Only damage enemies with offensive Sanctuary. [Skotlex] - if( battle->check_target(&src->bl,bl,BCT_ENEMY) > 0 && skill_attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0) ) + if( battle->check_target(&src->bl,bl,BCT_ENEMY) > 0 && skill->attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0) ) sg->val1 -= 2; // reduce healing count if this was meant for damaging [hekate] } else { - int heal = skill_calc_heal(ss,bl,sg->skill_id,sg->skill_lv,true); + int heal = skill->calc_heal(ss,bl,sg->skill_id,sg->skill_lv,true); struct mob_data *md = BL_CAST(BL_MOB, bl); #ifdef RENEWAL if( md && md->class_ == MOBID_EMPERIUM ) @@ -11358,7 +11324,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns sg->val1--; } if( sg->val1 <= 0 ) - skill_delunitgroup(sg); + skill->del_unitgroup(sg,ALC_MARK); break; case UNT_EVILLAND: @@ -11366,9 +11332,9 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns 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); + 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); + int heal = skill->calc_heal(ss,bl,sg->skill_id,sg->skill_lv,true); if (tstatus->hp >= tstatus->max_hp) break; if (status_isimmune(bl)) @@ -11381,7 +11347,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_MAGNUS: if (!battle->check_undead(tstatus->race,tstatus->def_ele) && tstatus->race!=RC_DEMON) break; - skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case UNT_DUMMYSKILL: @@ -11402,7 +11368,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns else // mobs if( status_charge(ss, 0, 2) ) // 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) ) + if( !skill->attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0) ) status_charge(ss, 0, 8); //costs additional 8 SP if miss } else @@ -11421,33 +11387,33 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case WZ_STORMGUST: //SG counter does not reset per stormgust. IE: One hit from a SG and two hits from another will freeze you. if (tsc) tsc->sg_counter++; //SG hit counter. - if (skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0) <= 0 && tsc) + if (skill->attack(skill->get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0) <= 0 && tsc) tsc->sg_counter=0; //Attack absorbed. break; #endif case GS_DESPERADO: if (rnd()%100 < src->val1) - skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case GN_CRAZYWEED_ATK: if( bl->type == BL_SKILL ){ struct skill_unit *su = (struct skill_unit *)bl; - if( su && !(skill_get_inf2(su->group->skill_id)&INF2_TRAP) ) + if( su && !(skill->get_inf2(su->group->skill_id)&INF2_TRAP) ) break; } default: - skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(skill->get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); } break; case UNT_FIREPILLAR_WAITING: - skill_unitsetting(ss,sg->skill_id,sg->skill_lv,src->bl.x,src->bl.y,1); - skill_delunit(src); + skill->unitsetting(ss,sg->skill_id,sg->skill_lv,src->bl.x,src->bl.y,1); + skill->delunit(src); break; case UNT_SKIDTRAP: { - skill_blown(&src->bl,bl,skill_get_blewcount(sg->skill_id,sg->skill_lv),unit_getdir(bl),0); + skill->blown(&src->bl,bl,skill->get_blewcount(sg->skill_id,sg->skill_lv),unit_getdir(bl),0); sg->unit_id = UNT_USED_TRAPS; clif_changetraplook(&src->bl, UNT_USED_TRAPS); sg->limit=DIFF_TICK(tick,sg->tick)+1500; @@ -11457,7 +11423,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_ANKLESNARE: 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); + int sec = skill->get_time2(sg->skill_id,sg->skill_lv); if( status_change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, 8) ) { const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL; if( td ) @@ -11488,21 +11454,21 @@ 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( status_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) ) { map_moveblock(bl, src->bl.x, src->bl.y, tick); clif_fixpos(bl); } - map_foreachinrange(skill_trap_splash, &src->bl, skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick); + map_foreachinrange(skill_trap_splash, &src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick); sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again. } break; case UNT_VENOMDUST: if(tsc && !tsc->data[type]) - status_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; @@ -11525,7 +11491,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_FLASHER: case UNT_FREEZINGTRAP: case UNT_FIREPILLAR_ACTIVE: - map_foreachinrange(skill_trap_splash,&src->bl, skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); + map_foreachinrange(skill_trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); if (sg->unit_id != UNT_FIREPILLAR_ACTIVE) clif_changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS); sg->limit=DIFF_TICK(tick,sg->tick)+1500 + @@ -11548,16 +11514,16 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_LULLABY: if (ss->id == bl->id) break; - skill_additional_effect(ss, bl, sg->skill_id, sg->skill_lv, BF_LONG|BF_SKILL|BF_MISC, ATK_DEF, tick); + skill->additional_effect(ss, bl, sg->skill_id, sg->skill_lv, BF_LONG|BF_SKILL|BF_MISC, ATK_DEF, tick); break; case UNT_UGLYDANCE: //Ugly Dance [Skotlex] if (ss->id != bl->id) - skill_additional_effect(ss, bl, sg->skill_id, sg->skill_lv, BF_LONG|BF_SKILL|BF_MISC, ATK_DEF, tick); + skill->additional_effect(ss, bl, sg->skill_id, sg->skill_lv, BF_LONG|BF_SKILL|BF_MISC, ATK_DEF, tick); break; case UNT_DISSONANCE: - skill_attack(BF_MISC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); + skill->attack(BF_MISC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); break; case UNT_APPLEIDUN: //Apple of Idun [Skotlex] @@ -11570,7 +11536,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns #endif if( sg->src_id == bl->id && !(tsc && tsc->data[SC_SPIRIT] && tsc->data[SC_SPIRIT]->val2 == SL_BARDDANCER) ) break; // affects self only when soullinked - heal = skill_calc_heal(ss,bl,sg->skill_id, sg->skill_lv, true); + heal = skill->calc_heal(ss,bl,sg->skill_id, sg->skill_lv, true); if( tsc->data[SC_AKAITSUKI] && heal ) heal = ~heal + 1; clif_skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1); @@ -11580,7 +11546,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_TATAMIGAESHI: case UNT_DEMONSTRATION: - skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case UNT_GOSPEL: @@ -11590,7 +11556,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns { // Support Effect only on party, not guild int heal; int i = rnd()%13; // Positive buff count - int time = skill_get_time2(sg->skill_id, sg->skill_lv); //Duration + int time = skill->get_time2(sg->skill_id, sg->skill_lv); //Duration switch (i) { case 0: // Heal 1~9999 HP @@ -11650,11 +11616,11 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns else if (battle->check_target(&src->bl,bl,BCT_ENEMY)>0) { // Offensive Effect int i = rnd()%9; // Negative buff count - int time = skill_get_time2(sg->skill_id, sg->skill_lv); + int time = skill->get_time2(sg->skill_id, sg->skill_lv); switch (i) { case 0: // Deal 1~9999 damage - skill_attack(BF_MISC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(BF_MISC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case 1: // Curse sc_start(bl,SC_CURSE,100,1,time); @@ -11689,7 +11655,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns int i = battle->check_target(&src->bl, bl, BCT_ENEMY); if( i > 0 && !(status_get_mode(bl)&MD_BOSS) ) { // knock-back any enemy except Boss - skill_blown(&src->bl, bl, 2, unit_getdir(bl), 0); + skill->blown(&src->bl, bl, 2, unit_getdir(bl), 0); clif_fixpos(bl); } @@ -11703,7 +11669,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_FIREWALK: case UNT_ELECTRICWALK: case UNT_PSYCHIC_WAVE: - skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(skill->get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case UNT_GROUNDDRIFT_WIND: @@ -11712,7 +11678,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_GROUNDDRIFT_WATER: case UNT_GROUNDDRIFT_FIRE: map_foreachinrange(skill_trap_splash,&src->bl, - skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, + skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); sg->unit_id = UNT_USED_TRAPS; //clif_changetraplook(&src->bl, UNT_FIREPILLAR_ACTIVE); @@ -11723,7 +11689,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns **/ case UNT_POISONSMOKE: if( battle->check_target(ss,bl,BCT_ENEMY) > 0 && !(tsc && tsc->data[sg->val2]) && rnd()%100 < 20 ) - sc_start(bl,sg->val2,100,sg->val3,skill_get_time2(GC_POISONINGWEAPON, 1)); + sc_start(bl,sg->val2,100,sg->val3,skill->get_time2(GC_POISONINGWEAPON, 1)); break; case UNT_EPICLESIS: @@ -11751,7 +11717,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns } /* Enable this if kRO fix the current skill. Currently no damage on undead and demon monster. [Jobbie] else if( battle->check_target(ss, bl, BCT_ENEMY) > 0 && battle_check_undead(tstatus->race, tstatus->def_ele) ) - skill_castend_damage_id(&src->bl, bl, sg->skill_id, sg->skill_lv, 0, 0);*/ + skill->castend_damage_id(&src->bl, bl, sg->skill_id, sg->skill_lv, 0, 0);*/ break; case UNT_STEALTHFIELD: @@ -11770,19 +11736,19 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_REVERBERATION: clif_changetraplook(&src->bl,UNT_USED_TRAPS); - map_foreachinrange(skill_trap_splash,&src->bl, skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); + map_foreachinrange(skill_trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); sg->limit = DIFF_TICK(tick,sg->tick)+1000; sg->unit_id = UNT_USED_TRAPS; break; case UNT_SEVERE_RAINSTORM: if( battle->check_target(&src->bl, bl, BCT_ENEMY) ) - skill_attack(BF_WEAPON,ss,&src->bl,bl,WM_SEVERE_RAINSTORM_MELEE,sg->skill_lv,tick,0); + skill->attack(BF_WEAPON,ss,&src->bl,bl,WM_SEVERE_RAINSTORM_MELEE,sg->skill_lv,tick,0); break; case UNT_NETHERWORLD: if( !(status_get_mode(bl)&MD_BOSS) && ss != bl && battle->check_target(&src->bl, bl, BCT_PARTY) ) { if( !(tsc && tsc->data[type]) ){ - sc_start(bl, type, 100, sg->skill_lv, skill_get_time2(sg->skill_id,sg->skill_lv)); + sc_start(bl, type, 100, sg->skill_lv, skill->get_time2(sg->skill_id,sg->skill_lv)); sg->limit = DIFF_TICK(tick,sg->tick); sg->unit_id = UNT_USED_TRAPS; } @@ -11791,7 +11757,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_THORNS_TRAP: if( tsc ) { if( !sg->val2 ) { - int sec = skill_get_time2(sg->skill_id, sg->skill_lv); + int sec = skill->get_time2(sg->skill_id, sg->skill_lv); if( sc_start(bl, type, 100, sg->skill_lv, sec) ) { const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL; if( td ) @@ -11803,7 +11769,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns sec = 3000; // Couldn't trap it? sg->limit = DIFF_TICK(tick, sg->tick) + sec; } else if( tsc->data[SC_THORNSTRAP] && bl->id == sg->val2 ) - skill_attack(skill_get_type(GN_THORNS_TRAP), ss, ss, bl, sg->skill_id, sg->skill_lv, tick, SD_LEVEL|SD_ANIMATION); + skill->attack(skill->get_type(GN_THORNS_TRAP), ss, ss, bl, sg->skill_id, sg->skill_lv, tick, SD_LEVEL|SD_ANIMATION); } break; @@ -11814,12 +11780,12 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case 2: default: sc_start(bl, SC_BURNING, 4 + 4 * sg->skill_lv, sg->skill_lv, - skill_get_time2(sg->skill_id, sg->skill_lv)); - skill_attack(skill_get_type(sg->skill_id), ss, &src->bl, bl, + skill->get_time2(sg->skill_id, sg->skill_lv)); + skill->attack(skill->get_type(sg->skill_id), ss, &src->bl, bl, sg->skill_id, sg->skill_lv + 10 * sg->val2, tick, 0); break; case 3: - skill_attack(skill_get_type(CR_ACIDDEMONSTRATION), ss, &src->bl, bl, + skill->attack(skill->get_type(CR_ACIDDEMONSTRATION), ss, &src->bl, bl, CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0); break; @@ -11837,15 +11803,15 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_HELLS_PLANT: if( battle->check_target(&src->bl,bl,BCT_ENEMY) > 0 ) - skill_attack(skill_get_type(GN_HELLS_PLANT_ATK), ss, &src->bl, bl, GN_HELLS_PLANT_ATK, sg->skill_lv, tick, 0); + skill->attack(skill->get_type(GN_HELLS_PLANT_ATK), ss, &src->bl, bl, GN_HELLS_PLANT_ATK, sg->skill_lv, tick, 0); if( ss != bl) //The caster is the only one who can step on the Plants, without destroying them sg->limit = DIFF_TICK(tick, sg->tick) + 100; break; case UNT_CLOUD_KILL: if(tsc && !tsc->data[type]) - 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); + 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: @@ -11859,7 +11825,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( tsc && tsc->data[SC_AKAITSUKI] && hp ) hp = ~hp + 1; status_heal(bl, hp, 0, 0); - sc_start(bl, SC_WARMER, 100, sg->skill_lv, skill_get_time2(sg->skill_id,sg->skill_lv)); + sc_start(bl, SC_WARMER, 100, sg->skill_lv, skill->get_time2(sg->skill_id,sg->skill_lv)); } break; @@ -11872,7 +11838,7 @@ 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)){ + 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) @@ -11918,7 +11884,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_FIRE_MANTLE: if( battle->check_target(&src->bl, bl, BCT_ENEMY) ) - skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case UNT_ZENKAI_WATER: @@ -11928,41 +11894,41 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( battle->check_target(&src->bl,bl,BCT_ENEMY) > 0 ){ switch( sg->unit_id ){ case UNT_ZENKAI_WATER: - sc_start(bl, SC_CRYSTALIZE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_FREEZE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_FREEZING, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_CRYSTALIZE, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_FREEZE, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_FREEZING, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_ZENKAI_LAND: - sc_start(bl, SC_STONE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_POISON, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_STONE, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_POISON, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_ZENKAI_FIRE: - sc_start(bl, SC_BURNING, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_BURNING, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_ZENKAI_WIND: - sc_start(bl, SC_SILENCE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_SLEEP, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_DEEPSLEEP, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_SILENCE, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_SLEEP, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_DEEPSLEEP, sg->val1*5, sg->skill_lv, skill->get_time2(sg->skill_id, sg->skill_lv)); break; } }else - sc_start2(bl,type,100,sg->val1,sg->val2,skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start2(bl,type,100,sg->val1,sg->val2,skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_MAKIBISHI: - skill_attack(BF_MISC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); + skill->attack(BF_MISC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); sg->limit = DIFF_TICK(tick, sg->tick); sg->unit_id = UNT_USED_TRAPS; break; case UNT_LAVA_SLIDE: - skill_attack(BF_WEAPON, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); + skill->attack(BF_WEAPON, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); if(++sg->val1 > 4) //after 5 stop hit and destroy me sg->limit = DIFF_TICK(tick, sg->tick); break; case UNT_POISON_MIST: - skill_attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); - 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); + skill->attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); + 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; } @@ -11974,8 +11940,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns /*========================================== * Triggered when a char steps out of a skill cell *------------------------------------------*/ -int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned int tick) -{ +int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned int tick) { struct skill_unit_group *sg; struct status_change *sc; struct status_change_entry *sce; @@ -12109,7 +12074,7 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i //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 = add_timer(tick+skill_get_time2(skill_id,1), status_change_timer, bl->id, type); + sce->timer = add_timer(tick+skill->get_time2(skill_id,1), status_change_timer, bl->id, type); } break; case PF_FOGWALL: @@ -12166,15 +12131,15 @@ static int skill_unit_effect (struct block_list* bl, va_list ap) //Target-type check. if( !(group->bl_flag&bl->type && battle->check_target(&unit->bl,bl,group->target_flag)>0) && (flag&4) ) { if( group->state.song_dance&0x1 || (group->src_id == bl->id && group->state.song_dance&0x2) ) - skill_unit_onleft(skill_id, bl, tick);//Ensemble check to terminate it. + skill->unit_onleft(skill_id, bl, tick);//Ensemble check to terminate it. } else { if( flag&1 ) - skill_unit_onplace(unit,bl,tick); + skill->unit_onplace(unit,bl,tick); else - skill_unit_onout(unit,bl,tick); + skill->unit_onout(unit,bl,tick); if( flag&4 ) - skill_unit_onleft(skill_id, bl, tick); + skill->unit_onleft(skill_id, bl, tick); } if( dissonance ) skill_dance_switch(unit, 1); @@ -12235,7 +12200,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) p_sd = va_arg(ap, int *); skill_id = va_arg(ap,int); - if ( ((skill_id != PR_BENEDICTIO && *c >=1) || *c >=2) && !(skill_get_inf2(skill_id)&INF2_CHORUS_SKILL) ) + if ( ((skill_id != PR_BENEDICTIO && *c >=1) || *c >=2) && !(skill->get_inf2(skill_id)&INF2_CHORUS_SKILL) ) return 0; //Partner found for ensembles, or the two companions for Benedictio. [Skotlex] if (bl == src) @@ -12247,7 +12212,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) if (tsd->sc.data[SC_SILENCE] || ( tsd->sc.opt1 && tsd->sc.opt1 != OPT1_BURNING )) return 0; - if( skill_get_inf2(skill_id)&INF2_CHORUS_SKILL ) { + if( skill->get_inf2(skill_id)&INF2_CHORUS_SKILL ) { if( tsd->status.party_id == sd->status.party_id && (tsd->class_&MAPID_THIRDMASK) == MAPID_MINSTRELWANDERER ) p_sd[(*c)++] = tsd->bl.id; return 1; @@ -12306,12 +12271,11 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) /*========================================== * Checks and stores partners for ensemble skills [Skotlex] *------------------------------------------*/ -int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short* skill_lv, int range, int cast_flag) -{ +int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short* skill_lv, int range, int cast_flag) { static int c=0; static int p_sd[2] = { 0, 0 }; int i; - bool is_chorus = ( skill_get_inf2(skill_id)&INF2_CHORUS_SKILL ); + bool is_chorus = ( skill->get_inf2(skill_id)&INF2_CHORUS_SKILL ); if (!battle_config.player_skill_partner_check || pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL)) return is_chorus ? MAX_PARTY : 99; //As if there were infinite partners. @@ -12334,7 +12298,7 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short* case WM_GREAT_ECHO: for( i = 0; i < c; i++ ) { if( (tsd = map_id2sd(p_sd[i])) != NULL ) - status_zap(&tsd->bl,0,skill_get_sp(skill_id,*skill_lv)/c); + status_zap(&tsd->bl,0,skill->get_sp(skill_id,*skill_lv)/c); } break; default: //Warning: Assuming Ensemble skills here (for speed) @@ -12342,7 +12306,7 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short* break;//Chorus skills are not to be parsed as ensambles if (c > 0 && sd->sc.data[SC_DANCING] && (tsd = map_id2sd(p_sd[0])) != NULL) { sd->sc.data[SC_DANCING]->val4 = tsd->bl.id; - sc_start4(&tsd->bl,SC_DANCING,100,skill_id,sd->sc.data[SC_DANCING]->val2,*skill_lv,sd->bl.id,skill_get_time(skill_id,*skill_lv)+1000); + sc_start4(&tsd->bl,SC_DANCING,100,skill_id,sd->sc.data[SC_DANCING]->val2,*skill_lv,sd->bl.id,skill->get_time(skill_id,*skill_lv)+1000); clif_skill_nodamage(&tsd->bl, &sd->bl, skill_id, *skill_lv, 1); tsd->skill_id_dance = skill_id; tsd->skill_lv_dance = *skill_lv; @@ -12391,15 +12355,15 @@ static int skill_check_condition_mob_master_sub (struct block_list *bl, va_list * Determines if a given skill should be made to consume ammo * when used by the player. [Skotlex] *------------------------------------------*/ -int skill_isammotype (struct map_session_data *sd, int skill) +int skill_isammotype (struct map_session_data *sd, int skill_id) { return ( battle_config.arrow_decrement==2 && (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)) && - skill != HT_PHANTASMIC && - skill_get_type(skill) == BF_WEAPON && - !(skill_get_nk(skill)&NK_NO_DAMAGE) && - !skill_get_spiritball(skill,1) //Assume spirit spheres are used as ammo instead. + skill_id != HT_PHANTASMIC && + skill->get_type(skill_id) == BF_WEAPON && + !(skill->get_nk(skill_id)&NK_NO_DAMAGE) && + !skill_get_spiritball(skill_id,1) //Assume spirit spheres are used as ammo instead. ); } @@ -12415,7 +12379,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id ) { //GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex] - sd->state.arrow_atk = skill_get_ammotype(skill_id)?1:0; //Need to do arrow state check. + sd->state.arrow_atk = skill->get_ammotype(skill_id)?1:0; //Need to do arrow state check. sd->spiritball_old = sd->spiritball; //Need to do Spiritball check. return 1; } @@ -12523,7 +12487,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id if( skill_lv < 1 || skill_lv > MAX_SKILL_LEVEL ) return 0; - require = skill_get_requirement(sd,skill_id,skill_lv); + require = skill->get_requirement(sd,skill_id,skill_lv); //Can only update state when weapon/arrow info is checked. sd->state.arrow_atk = require.ammo?1:0; @@ -12543,7 +12507,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case AL_WARP: if(!battle_config.duel_allow_teleport && sd->duel_group) { // duel restriction [LuzZza] - char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_WARP)); + char output[128]; sprintf(output, msg_txt(365), skill->get_name(AL_WARP)); clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel." return 0; } @@ -12611,8 +12575,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case TK_MISSION: - if( (sd->class_&MAPID_UPPERMASK) != MAPID_TAEKWON ) - {// Cannot be used by Non-Taekwon classes + if( (sd->class_&MAPID_UPPERMASK) != MAPID_TAEKWON ) { + // Cannot be used by Non-Taekwon classes clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12623,8 +12587,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case TK_READYSTORM: case TK_READYTURN: case TK_JUMPKICK: - if( (sd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER ) - {// Soul Linkers cannot use this skill + if( (sd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER ) { + // Soul Linkers cannot use this skill clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12660,10 +12624,10 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; } time = 1000*(sc->data[SC_DANCING]->val3>>16); - if (skill_get_time( + if (skill->get_time( (sc->data[SC_DANCING]->val1&0xFFFF), //Dance Skill ID (sc->data[SC_DANCING]->val1>>16)) //Dance Skill LV - - time < skill_get_time2(skill_id,skill_lv)) + - time < skill->get_time2(skill_id,skill_lv)) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; @@ -12672,7 +12636,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case PR_BENEDICTIO: - if (skill_check_pc_partner(sd, skill_id, &skill_lv, 1, 0) < 2) + if (skill->check_pc_partner(sd, skill_id, &skill_lv, 1, 0) < 2) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; @@ -12690,7 +12654,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case CG_HERMODE: - if(!npc_check_areanpc(1,sd->bl.m,sd->bl.x,sd->bl.y,skill_get_splash(skill_id, skill_lv))) + if(!npc_check_areanpc(1,sd->bl.m,sd->bl.x,sd->bl.y,skill->get_splash(skill_id, skill_lv))) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; @@ -12698,7 +12662,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case CG_MOONLIT: //Check there's no wall in the range+1 area around the caster. [Skotlex] { - int i,x,y,range = skill_get_splash(skill_id, skill_lv)+1; + int i,x,y,range = skill->get_splash(skill_id, skill_lv)+1; int size = range*2+1; for (i=0;i<size*size;i++) { x = sd->bl.x+(i%size-range); @@ -12855,7 +12819,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id * Warlock **/ case WL_COMET: - if( skill_check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && ((i = pc_search_inventory(sd,require.itemid[0])) < 0 || sd->status.inventory[i].amount < require.amount[0]) ) + if( skill->check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && ((i = pc_search_inventory(sd,require.itemid[0])) < 0 || sd->status.inventory[i].amount < require.amount[0]) ) { //clif_skill_fail(sd,skill_id,USESKILL_FAIL_NEED_ITEM,require.amount[0],require.itemid[0]); clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -12947,7 +12911,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id if( !(sc && sc->data[SC_BANDING]) ) { clif_skill_fail(sd,skill_id,USESKILL_FAIL,0); return 0; - } else if( skill_check_pc_partner(sd,skill_id,&skill_lv,skill_get_range(skill_id,skill_lv),0) < 1 ) + } else if( skill->check_pc_partner(sd,skill_id,&skill_lv,skill->get_range(skill_id,skill_lv),0) < 1 ) return 0; // Just fails, no msg here. break; case LG_HESPERUSLIT: @@ -12969,7 +12933,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case SR_CURSEDCIRCLE: if (map_flag_gvg(sd->bl.m)) { - if (map_foreachinrange(mob_count_sub, &sd->bl, skill_get_splash(skill_id, skill_lv), BL_MOB, + if (map_foreachinrange(mob_count_sub, &sd->bl, skill->get_splash(skill_id, skill_lv), BL_MOB, MOBID_EMPERIUM, MOBID_GUARIDAN_STONE1, MOBID_GUARIDAN_STONE2)) { char output[128]; sprintf(output, "You're too close to a stone or emperium to do this skill"); @@ -12997,7 +12961,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case WM_GREAT_ECHO: { int count; - count = skill_check_pc_partner(sd, skill_id, &skill_lv, skill_get_splash(skill_id,skill_lv), 0); + count = skill->check_pc_partner(sd, skill_id, &skill_lv, skill->get_splash(skill_id,skill_lv), 0); if( count < 1 ) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_NEED_HELPER,0); return 0; @@ -13008,7 +12972,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case SO_FIREWALK: case SO_ELECTRICWALK: // Can't be casted until you've walked all cells. if( sc && sc->data[SC_PROPERTYWALK] && - sc->data[SC_PROPERTYWALK]->val3 < skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) ) { + sc->data[SC_PROPERTYWALK]->val3 < skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) ) { clif_skill_fail(sd,skill_id,0x0,0); return 0; } @@ -13037,7 +13001,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case KO_KAZEHU_SEIRAN: case KO_DOHU_KOUKAI: { - int ttype = skill_get_ele(skill_id, skill_lv); + int ttype = skill->get_ele(skill_id, skill_lv); ARR_FIND(1, 5, i, sd->talisman[i] > 0 && i != ttype); if( (i < 5 && i != ttype) || sd->talisman[ttype] >= 10 ){ clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); @@ -13241,7 +13205,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id ) { //GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex] - sd->state.arrow_atk = skill_get_ammotype(skill_id)?1:0; //Need to do arrow state check. + sd->state.arrow_atk = skill->get_ammotype(skill_id)?1:0; //Need to do arrow state check. sd->spiritball_old = sd->spiritball; //Need to do Spiritball check. return 1; } @@ -13278,14 +13242,14 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, // perform skill-specific checks (and actions) switch( skill_id ) { case PR_BENEDICTIO: - skill_check_pc_partner(sd, skill_id, &skill_lv, 1, 1); + skill->check_pc_partner(sd, skill_id, &skill_lv, 1, 1); break; case AM_CANNIBALIZE: case AM_SPHEREMINE: { int c=0; int summons[5] = { 1589, 1579, 1575, 1555, 1590 }; //int summons[5] = { 1020, 1068, 1118, 1500, 1368 }; - int maxcount = (skill_id==AM_CANNIBALIZE)? 6-skill_lv : skill_get_maxcount(skill_id,skill_lv); + int maxcount = (skill_id==AM_CANNIBALIZE)? 6-skill_lv : skill->get_maxcount(skill_id,skill_lv); int mob_class = (skill_id==AM_CANNIBALIZE)? summons[skill_lv-1] :1142; if(battle_config.land_skill_limit && maxcount>0 && (battle_config.land_skill_limit&BL_PC)) { i = map_foreachinmap(skill_check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c); @@ -13301,7 +13265,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, case NC_SILVERSNIPER: case NC_MAGICDECOY: { int c = 0, j; - int maxcount = skill_get_maxcount(skill_id,skill_lv); + int maxcount = skill->get_maxcount(skill_id,skill_lv); int mob_class = 2042; if( skill_id == NC_MAGICDECOY ) mob_class = 2043; @@ -13322,7 +13286,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, case KO_ZANZOU: { int c = 0; i = map_foreachinmap(skill_check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, 2308, skill_id, &c); - if( c >= skill_get_maxcount(skill_id,skill_lv) || c != i) + if( c >= skill->get_maxcount(skill_id,skill_lv) || c != i) { clif_skill_fail(sd , skill_id, USESKILL_FAIL_LEVEL, 0); return 0; @@ -13333,7 +13297,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, status = &sd->battle_status; - require = skill_get_requirement(sd,skill_id,skill_lv); + require = skill->get_requirement(sd,skill_id,skill_lv); if( require.hp > 0 && status->hp <= (unsigned int)require.hp) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0); @@ -13352,7 +13316,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, } else if( sd->status.inventory[i].amount < require.ammo_qty ) { char e_msg[100]; sprintf(e_msg,"Skill Failed. [%s] requires %dx %s.", - skill_get_desc(skill_id), + skill->get_desc(skill_id), require.ammo_qty, itemdb_jname(sd->status.inventory[i].nameid)); clif_colormes(sd,COLOR_RED,e_msg); @@ -13392,7 +13356,7 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin nullpo_ret(sd); - req = skill_get_requirement(sd,skill_id,skill_lv); + req = skill->get_requirement(sd,skill_id,skill_lv); if( type&1 ) { @@ -13407,7 +13371,7 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin if(req.zeny > 0) { if( skill_id == NJ_ZENYNAGE ) - req.zeny = 0; //Zeny is reduced on skill_attack. + req.zeny = 0; //Zeny is reduced on skill->attack. if( sd->status.zeny < req.zeny ) req.zeny = sd->status.zeny; pc_payzeny(sd,req.zeny,LOG_TYPE_CONSUME,NULL); @@ -13490,7 +13454,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 return req; } - idx = skill_get_index(skill_id); + idx = skill->get_index(skill_id); if( idx == 0 ) // invalid skill id return req; if( skill_lv < 1 || skill_lv > MAX_SKILL_LEVEL ) @@ -13551,8 +13515,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 if (req.ammo_qty) req.ammo = skill_db[idx].ammo; - if (!req.ammo && skill_id && skill_isammotype(sd, skill_id)) - { //Assume this skill is using the weapon, therefore it requires arrows. + if (!req.ammo && skill_id && skill->isammotype(sd, skill_id)) { + //Assume this skill is using the weapon, therefore it requires arrows. req.ammo = 0xFFFFFFFF; //Enable use on all ammo types. req.ammo_qty = 1; } @@ -13575,11 +13539,11 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 continue; break; case AB_ADORAMUS: - if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 2) ) + if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill->check_pc_partner(sd,skill_id,&skill_lv, 1, 2) ) continue; break; case WL_COMET: - if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 0) ) + if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill->check_pc_partner(sd,skill_id,&skill_lv, 1, 0) ) continue; break; case GN_FIRE_EXPANSION: @@ -13731,7 +13695,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 * Does cast-time reductions based on dex, item bonuses and config setting *------------------------------------------*/ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { - int time = skill_get_cast(skill_id, skill_lv); + int time = skill->get_cast(skill_id, skill_lv); nullpo_ret(bl); #ifndef RENEWAL_CAST @@ -13741,7 +13705,7 @@ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { sd = BL_CAST(BL_PC, bl); // calculate base cast time (reduced by dex) - if( !(skill_get_castnodex(skill_id, skill_lv)&1) ) { + if( !(skill->get_castnodex(skill_id, skill_lv)&1) ) { int scale = battle_config.castrate_dex_scale - status_get_dex(bl); if( scale > 0 ) // not instant cast time = time * scale / battle_config.castrate_dex_scale; @@ -13750,7 +13714,7 @@ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { } // calculate cast time reduced by item/card bonuses - if( !(skill_get_castnodex(skill_id, skill_lv)&4) && sd ) + if( !(skill->get_castnodex(skill_id, skill_lv)&4) && sd ) { int i; if( sd->castrate != 100 ) @@ -13827,7 +13791,7 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 }else if( fixed < 0 ) // no fixed cast time fixed = 0; - if(sd && !(skill_get_castnodex(skill_id, skill_lv)&4) ){ // Increases/Decreases fixed/variable cast time of a skill by item/card bonuses. + if(sd && !(skill->get_castnodex(skill_id, skill_lv)&4) ){ // Increases/Decreases fixed/variable cast time of a skill by item/card bonuses. if( sd->bonus.varcastrate < 0 ) VARCAST_REDUCTION(sd->bonus.varcastrate); if( sd->bonus.add_varcast != 0 ) // bonus bVariableCast @@ -13858,7 +13822,7 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 } } - if (sc && sc->count && !(skill_get_castnodex(skill_id, skill_lv)&2) ) { + if (sc && sc->count && !(skill->get_castnodex(skill_id, skill_lv)&2) ) { // All variable cast additive bonuses must come first if (sc->data[SC_SLOWCAST]) VARCAST_REDUCTION(-sc->data[SC_SLOWCAST]->val2); @@ -13877,7 +13841,7 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 VARCAST_REDUCTION(sc->data[SC_POEMBRAGI]->val2); if (sc->data[SC_IZAYOI]) VARCAST_REDUCTION(50); - if (sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WATER)) + if (sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 3 && (skill->get_ele(skill_id, skill_lv) == ELE_WATER)) VARCAST_REDUCTION(30); //Reduces 30% Variable Cast Time of Water spells. // Fixed cast reduction bonuses if( sc->data[SC__LAZINESS] ) @@ -13895,14 +13859,14 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 fixed -= 1000; } - if( sd && !(skill_get_castnodex(skill_id, skill_lv)&4) ){ + if( sd && !(skill->get_castnodex(skill_id, skill_lv)&4) ){ VARCAST_REDUCTION( max(sd->bonus.varcastrate, 0) + max(i, 0) ); fixcast_r = max(fixcast_r, sd->bonus.fixcastrate) + min(sd->bonus.fixcastrate,0); } if( varcast_r < 0 ) // now compute overall factors time = time * (1 - (float)varcast_r / 100); - if( !(skill_get_castnodex(skill_id, skill_lv)&1) )// reduction from status point + if( !(skill->get_castnodex(skill_id, skill_lv)&1) )// reduction from status point time = (1 - sqrt( ((float)(status_get_dex(bl)*2 + status_get_int(bl)) / battle_config.vcast_stat_scale) )) * time; // underflow checking/capping time = max(time, 0) + (1 - (float)min(fixcast_r, 100) / 100) * max(fixed,0); @@ -13914,10 +13878,10 @@ 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_delayfix (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); + 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 = status_get_sc(bl); @@ -13986,7 +13950,7 @@ int skill_delayfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) if (sc && sc->count) { if (sc->data[SC_POEMBRAGI]) time -= time * sc->data[SC_POEMBRAGI]->val3 / 100; - if (sc->data[SC_WIND_INSIGNIA] && sc->data[SC_WIND_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WIND)) + if (sc->data[SC_WIND_INSIGNIA] && sc->data[SC_WIND_INSIGNIA]->val1 == 3 && (skill->get_ele(skill_id, skill_lv) == ELE_WIND)) time /= 2; // After Delay of Wind element spells reduced by 50%. } @@ -14153,7 +14117,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s map_foreachincell(skill_area_sub, bl->m,tc.val1[c],tc.val2[c],BL_CHAR, src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n, - skill_castend_damage_id); + skill->castend_damage_id); } } if(skill_lv > 6){ @@ -14169,7 +14133,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s map_foreachincell(skill_area_sub, bl->m,tc.val1[c],tc.val2[c],BL_CHAR, src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n, - skill_castend_damage_id); + skill->castend_damage_id); if(skill_lv > 6 && n==3 && c==4){ skill_brandishspear_dir(&tc,dir,-1); n--;c=-1; @@ -14181,7 +14145,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s map_foreachincell(skill_area_sub, bl->m,tc.val1[c%5],tc.val2[c%5],BL_CHAR, src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, - skill_castend_damage_id); + skill->castend_damage_id); } } @@ -14208,7 +14172,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { if( item->nameid <= 0 || item->attribute == 0 ) return; //Again invalid item.... - if( sd != target_sd && !battle->check_range(&sd->bl,&target_sd->bl, skill_get_range2(&sd->bl, sd->menuskill_id,sd->menuskill_val2) ) ){ + if( sd != target_sd && !battle->check_range(&sd->bl,&target_sd->bl, skill->get_range2(&sd->bl, sd->menuskill_id,sd->menuskill_val2) ) ){ clif_item_repaireffect(sd,idx,1); return; } @@ -14366,7 +14330,7 @@ int skill_autospell (struct map_session_data *sd, uint16 skill_id) maxlv = lv; sc_start4(&sd->bl,SC_AUTOSPELL,100,skill_lv,skill_id,maxlv,0, - skill_get_time(SA_AUTOSPELL,skill_lv)); + skill->get_time(SA_AUTOSPELL,skill_lv)); return 0; } @@ -14438,15 +14402,15 @@ int skill_sit (struct map_session_data *sd, int type) if((lv = pc_checkskill(sd,RG_GANGSTER)) > 0) { flag|=1; - range = skill_get_splash(RG_GANGSTER, lv); + range = skill->get_splash(RG_GANGSTER, lv); } if((lv = pc_checkskill(sd,TK_HPTIME)) > 0) { flag|=2; - range = skill_get_splash(TK_HPTIME, lv); + range = skill->get_splash(TK_HPTIME, lv); } else if ((lv = pc_checkskill(sd,TK_SPTIME)) > 0) { flag|=2; - range = skill_get_splash(TK_SPTIME, lv); + range = skill->get_splash(TK_SPTIME, lv); } if( type ) { @@ -14493,9 +14457,9 @@ int skill_frostjoke_scream (struct block_list *bl, va_list ap) } //It has been reported that Scream/Joke works the same regardless of woe-setting. [Skotlex] if(battle->check_target(src,bl,BCT_ENEMY) > 0) - skill_additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); + skill->additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); else if(battle->check_target(src,bl,BCT_PARTY) > 0 && rnd()%100 < 10) - skill_additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); + skill->additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); return 0; } @@ -14536,7 +14500,7 @@ 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); + return skill->attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag); if(battle->check_target(dsrc,bl,type) <= 0 || !status_check_skilluse(NULL, bl, skill_id, 2)) @@ -14550,10 +14514,10 @@ int skill_attack_area (struct block_list *bl, va_list ap) case NPC_FIREBREATH: case NPC_ICEBREATH: case NPC_THUNDERBREATH: - return skill_attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag); + return skill->attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag); default: //Area-splash, disable skill animation. - return skill_attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); + return skill->attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); } } /*========================================== @@ -14590,14 +14554,14 @@ int skill_clear_group (struct block_list *bl, int flag) group[count++] = ud->skillunit[i]; break; default: - if (flag&2 && skill_get_inf2(ud->skillunit[i]->skill_id)&INF2_TRAP) + if (flag&2 && skill->get_inf2(ud->skillunit[i]->skill_id)&INF2_TRAP) group[count++]= ud->skillunit[i]; break; } } for (i=0;i<count;i++) - skill_delunitgroup(group[i]); + skill->del_unitgroup(group[i],ALC_MARK); return count; } @@ -14638,7 +14602,7 @@ int skill_graffitiremover (struct block_list *bl, va_list ap) return 0; if((unit->group) && (unit->group->unit_id == UNT_GRAFFITI)) - skill_delunit(unit); + skill->delunit(unit); return 0; } @@ -14689,7 +14653,7 @@ int skill_detonator(struct block_list *bl, va_list ap) unit->group->val2 = -1; } else - map_foreachinrange(skill_trap_splash,bl,skill_get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick); + map_foreachinrange(skill_trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick); clif_changetraplook(bl,unit_id == UNT_FIRINGTRAP ? UNT_DUMMYSKILL : UNT_USED_TRAPS); unit->group->unit_id = UNT_USED_TRAPS; @@ -14720,18 +14684,18 @@ static int skill_cell_overlap(struct block_list *bl, va_list ap) case SA_LANDPROTECTOR: if( unit->group->skill_id == SA_LANDPROTECTOR ) {//Check for offensive Land Protector to delete both. [Skotlex] (*alive) = 0; - skill_delunit(unit); + skill->delunit(unit); return 1; } - if( !(skill_get_inf2(unit->group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP)) || unit->group->skill_id == WZ_FIREPILLAR ) { //It deletes everything except songs/dances and traps - skill_delunit(unit); + if( !(skill->get_inf2(unit->group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP)) || unit->group->skill_id == WZ_FIREPILLAR ) { //It deletes everything except songs/dances and traps + skill->delunit(unit); return 1; } break; case HW_GANBANTEIN: case LG_EARTHDRIVE: if( !(unit->group->state.song_dance&0x1) ) {// Don't touch song/dance. - skill_delunit(unit); + skill->delunit(unit); return 1; } break; @@ -14791,13 +14755,13 @@ static int skill_cell_overlap(struct block_list *bl, va_list ap) case UNT_VIOLENTGALE: case UNT_SAFETYWALL: case UNT_PNEUMA: - skill_delunit(unit); + skill->delunit(unit); return 1; } break; } - if (unit->group->skill_id == SA_LANDPROTECTOR && !(skill_get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_TRAP))) { //It deletes everything except songs/dances/traps + if (unit->group->skill_id == SA_LANDPROTECTOR && !(skill->get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_TRAP))) { //It deletes everything except songs/dances/traps (*alive) = 0; return 1; } @@ -14853,27 +14817,27 @@ static int skill_trap_splash (struct block_list *bl, va_list ap) case UNT_SHOCKWAVE: case UNT_SANDMAN: case UNT_FLASHER: - skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,ATK_DEF,tick); + skill->additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,ATK_DEF,tick); break; case UNT_GROUNDDRIFT_WIND: - if(skill_attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) - sc_start(bl,SC_STUN,5,sg->skill_lv,skill_get_time2(sg->skill_id, sg->skill_lv)); + if(skill->attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) + sc_start(bl,SC_STUN,5,sg->skill_lv,skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_GROUNDDRIFT_DARK: - if(skill_attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) - sc_start(bl,SC_BLIND,5,sg->skill_lv,skill_get_time2(sg->skill_id, sg->skill_lv)); + if(skill->attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) + sc_start(bl,SC_BLIND,5,sg->skill_lv,skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_GROUNDDRIFT_POISON: - if(skill_attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) - sc_start(bl,SC_POISON,5,sg->skill_lv,skill_get_time2(sg->skill_id, sg->skill_lv)); + if(skill->attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) + sc_start(bl,SC_POISON,5,sg->skill_lv,skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_GROUNDDRIFT_WATER: - if(skill_attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) - sc_start(bl,SC_FREEZE,5,sg->skill_lv,skill_get_time2(sg->skill_id, sg->skill_lv)); + if(skill->attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) + sc_start(bl,SC_FREEZE,5,sg->skill_lv,skill->get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_GROUNDDRIFT_FIRE: - if(skill_attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) - skill_blown(src,bl,skill_get_blewcount(sg->skill_id,sg->skill_lv),-1,0); + if(skill->attack(BF_WEAPON,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1)) + skill->blown(src,bl,skill->get_blewcount(sg->skill_id,sg->skill_lv),-1,0); break; case UNT_ELECTRICSHOCKER: clif_skill_damage(src,bl,tick,0,0,-30000,1,sg->skill_id,sg->skill_lv,5); @@ -14882,21 +14846,21 @@ static int skill_trap_splash (struct block_list *bl, va_list ap) case UNT_ICEBOUNDTRAP: case UNT_CLUSTERBOMB: if( ss != bl ) - skill_attack(BF_MISC,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1|SD_LEVEL); + skill->attack(BF_MISC,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1|SD_LEVEL); break; case UNT_MAGENTATRAP: case UNT_COBALTTRAP: case UNT_MAIZETRAP: case UNT_VERDURETRAP: if( bl->type != BL_PC && !is_boss(bl) ) - sc_start2(bl,SC_ELEMENTALCHANGE,100,sg->skill_lv,skill_get_ele(sg->skill_id,sg->skill_lv),skill_get_time2(sg->skill_id,sg->skill_lv)); + sc_start2(bl,SC_ELEMENTALCHANGE,100,sg->skill_lv,skill->get_ele(sg->skill_id,sg->skill_lv),skill->get_time2(sg->skill_id,sg->skill_lv)); break; case UNT_REVERBERATION: - skill_addtimerskill(ss,tick+50,bl->id,0,0,WM_REVERBERATION_MELEE,sg->skill_lv,BF_WEAPON,0); // for proper skill delay animation when use with Dominion Impulse - skill_addtimerskill(ss,tick+250,bl->id,0,0,WM_REVERBERATION_MAGIC,sg->skill_lv,BF_MAGIC,0); + skill->addtimerskill(ss,tick+50,bl->id,0,0,WM_REVERBERATION_MELEE,sg->skill_lv,BF_WEAPON,0); // for proper skill delay animation when use with Dominion Impulse + skill->addtimerskill(ss,tick+250,bl->id,0,0,WM_REVERBERATION_MAGIC,sg->skill_lv,BF_MAGIC,0); break; default: - skill_attack(skill_get_type(sg->skill_id),ss,src,bl,sg->skill_id,sg->skill_lv,tick,0); + skill->attack(skill->get_type(sg->skill_id),ss,src,bl,sg->skill_id,sg->skill_lv,tick,0); break; } return 1; @@ -15053,8 +15017,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int /*========================================== * *------------------------------------------*/ -int skill_delunit (struct skill_unit* unit) -{ +int skill_delunit (struct skill_unit* unit) { struct skill_unit_group *group; nullpo_ret(unit); @@ -15116,7 +15079,7 @@ int skill_delunit (struct skill_unit* unit) map_deliddb(&unit->bl); idb_remove(skillunit_db, unit->bl.id); if(--group->alive_count==0) - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); return 0; } @@ -15138,7 +15101,7 @@ static int skill_unit_group_newid = MAX_SKILL_DB; /// Fatal error if nothing is available. static int skill_get_new_group_id(void) { - if( skill_unit_group_newid >= MAX_SKILL_DB && skill_id2group(skill_unit_group_newid) == NULL ) + if( skill_unit_group_newid >= MAX_SKILL_DB && skill->id2group(skill_unit_group_newid) == NULL ) return skill_unit_group_newid++;// available {// find next id int base_id = skill_unit_group_newid; @@ -15146,7 +15109,7 @@ static int skill_get_new_group_id(void) { if( skill_unit_group_newid < MAX_SKILL_DB ) skill_unit_group_newid = MAX_SKILL_DB; - if( skill_id2group(skill_unit_group_newid) == NULL ) + if( skill->id2group(skill_unit_group_newid) == NULL ) return skill_unit_group_newid++;// available } // full loop, nothing available @@ -15178,7 +15141,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, maxdiff=x; j=i; } - skill_delunitgroup(ud->skillunit[j]); + skill->del_unitgroup(ud->skillunit[j],ALC_MARK); //Since elements must have shifted, we use the last slot. i = MAX_SKILLUNITGROUP-1; } @@ -15216,7 +15179,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, /*========================================== * *------------------------------------------*/ -int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int line, const char* func) +int skill_delunitgroup(struct skill_unit_group *group, const char* file, int line, const char* func) { struct block_list* src; struct unit_data *ud; @@ -15247,12 +15210,12 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li case DC_DONTFORGETME: case DC_FORTUNEKISS: case DC_SERVICEFORYOU: - skill_usave_add(((TBL_PC*)src), group->skill_id, group->skill_lv); + skill->usave_add(((TBL_PC*)src), group->skill_id, group->skill_lv); break; } } - if (skill_get_unit_flag(group->skill_id)&(UF_DANCE|UF_SONG|UF_ENSEMBLE)) + 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]) @@ -15321,7 +15284,7 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li // remove all unit cells if(group->unit != NULL) for( i = 0; i < group->unit_count; i++ ) - skill_delunit(&group->unit[i]); + skill->delunit(&group->unit[i]); // clear Talkie-box string if( group->valstr != NULL ) @@ -15339,13 +15302,11 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li // locate this group, swap with the last entry and delete it ARR_FIND( 0, MAX_SKILLUNITGROUP, i, ud->skillunit[i] == group ); ARR_FIND( i, MAX_SKILLUNITGROUP, j, ud->skillunit[j] == NULL ); j--; - if( i < MAX_SKILLUNITGROUP ) - { + if( i < MAX_SKILLUNITGROUP ) { ud->skillunit[i] = ud->skillunit[j]; ud->skillunit[j] = NULL; ers_free(skill_unit_ers, group); - } - else + } else ShowError("skill_delunitgroup: Group not found! (src_id: %d skill_id: %d)\n", group->src_id, group->skill_id); return 1; @@ -15361,7 +15322,7 @@ int skill_clear_unitgroup (struct block_list *src) nullpo_ret(ud); while (ud->skillunit[0]) - skill_delunitgroup(ud->skillunit[0]); + skill->del_unitgroup(ud->skillunit[0],ALC_MARK); return 1; } @@ -15384,7 +15345,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis set = ud->skillunittick; - if (skill_get_unit_flag(group->skill_id)&UF_NOOVERLAP) + if (skill->get_unit_flag(group->skill_id)&UF_NOOVERLAP) id = s = group->skill_id; else id = s = group->group_id; @@ -15421,7 +15382,7 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) nullpo_ret(group); - if( !(skill_get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) ) + if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) ) return 0; //AoE skills are ineffective. [Skotlex] if( battle->check_target(&unit->bl,bl,group->target_flag) <= 0 ) @@ -15472,7 +15433,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) case UNT_ELECTRICSHOCKER: if( group->val2 > 0 ) { // Used Trap don't returns back to item - skill_delunit(unit); + skill->delunit(unit); break; } case UNT_SKIDTRAP: @@ -15503,17 +15464,17 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) item_tmp.identify = 1; map_addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); } - skill_delunit(unit); + skill->delunit(unit); } break; case UNT_WARP_ACTIVE: // warp portal opens (morph to a UNT_WARP_WAITING cell) - group->unit_id = skill_get_unit_id(group->skill_id, 1); // UNT_WARP_WAITING + group->unit_id = skill->get_unit_id(group->skill_id, 1); // UNT_WARP_WAITING clif_changelook(&unit->bl, LOOK_BASE, group->unit_id); // restart timers - group->limit = skill_get_time(group->skill_id,group->skill_lv); - unit->limit = skill_get_time(group->skill_id,group->skill_lv); + group->limit = skill->get_time(group->skill_id,group->skill_lv); + unit->limit = skill->get_time(group->skill_id,group->skill_lv); // apply effect to all units standing on it map_foreachincell(skill_unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1); break; @@ -15533,17 +15494,17 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) if (sd && !map[sd->bl.m].flag.nowarp) pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT); } - skill_delunit(unit); + skill->delunit(unit); } break; case UNT_REVERBERATION: if( unit->val1 <= 0 ) { // If it was deactivated. - skill_delunit(unit); + skill->delunit(unit); break; } clif_changetraplook(bl,UNT_USED_TRAPS); - map_foreachinrange(skill_trap_splash, bl, skill_get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick); + map_foreachinrange(skill_trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick); group->limit = DIFF_TICK(tick,group->tick)+1000; unit->limit = DIFF_TICK(tick,group->tick)+1000; group->unit_id = UNT_USED_TRAPS; @@ -15552,8 +15513,8 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) case UNT_FEINTBOMB: { struct block_list *src = map_id2bl(group->src_id); if( src ) - map_foreachinrange(skill_area_sub, &group->unit->bl, unit->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill_castend_damage_id); - skill_delunit(unit); + map_foreachinrange(skill_area_sub, &group->unit->bl, unit->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id); + skill->delunit(unit); break; } @@ -15563,7 +15524,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) struct status_change *sc; if( !src || (sc = status_get_sc(src)) == NULL || !sc->data[SC_BANDING] ) { - skill_delunit(unit); + skill->delunit(unit); break; } // This unit isn't removed while SC_BANDING is active. @@ -15573,7 +15534,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) break; default: - skill_delunit(unit); + skill->delunit(unit); } } else @@ -15598,7 +15559,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) case UNT_ANKLESNARE: if( unit->val1 <= 0 ) { if( group->unit_id == UNT_ANKLESNARE && group->val2 > 0 ) - skill_delunit(unit); + skill->delunit(unit); else { clif_changetraplook(bl, group->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS); group->limit = DIFF_TICK(tick, group->tick) + 1500; @@ -15609,7 +15570,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) case UNT_REVERBERATION: if( unit->val1 <= 0 ){ clif_changetraplook(bl,UNT_USED_TRAPS); - map_foreachinrange(skill_trap_splash, bl, skill_get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick); + map_foreachinrange(skill_trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick); group->limit = DIFF_TICK(tick,group->tick)+1000; unit->limit = DIFF_TICK(tick,group->tick)+1000; group->unit_id = UNT_USED_TRAPS; @@ -15692,14 +15653,14 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) return 0; if( flag&1 && ( unit->group->skill_id == PF_SPIDERWEB || unit->group->skill_id == GN_THORNS_TRAP ) ) - return 0; // Fiberlock is never supposed to trigger on skill_unit_move. [Inkfish] + return 0; // Fiberlock is never supposed to trigger on skill->unit_move. [Inkfish] dissonance = skill_dance_switch(unit, 0); //Necessary in case the group is deleted after calling on_place/on_out [Skotlex] skill_id = unit->group->skill_id; - if( unit->group->interval != -1 && !(skill_get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) //Lullaby is the exception, bugreport:411 + if( unit->group->interval != -1 && !(skill->get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) //Lullaby is the exception, bugreport:411 { //Non-dualmode unit skills with a timer don't trigger when walking, so just return if( dissonance ) skill_dance_switch(unit, 1); return 0; @@ -15744,7 +15705,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) { if( flag&1 ) { - int result = skill_unit_onplace(unit,target,tick); + int result = skill->unit_onplace(unit,target,tick); if( flag&2 && result ) { //Clear skill ids we have stored in onout. ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == result ); @@ -15754,7 +15715,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) } else { - int result = skill_unit_onout(unit,target,tick); + int result = skill->unit_onout(unit,target,tick); if( flag&2 && result ) { //Store this unit id. ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == 0 ); @@ -15785,8 +15746,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) * units to figure out when they have left a group. * flag&4: Force a onleft event (triggered when the bl is killed, for example) *------------------------------------------*/ -int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) -{ +int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) { nullpo_ret(bl); if( bl->prev == NULL ) @@ -15828,7 +15788,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d if (group->unit==NULL) return 0; - if (skill_get_unit_flag(group->skill_id)&UF_ENSEMBLE) + if (skill->get_unit_flag(group->skill_id)&UF_ENSEMBLE) return 0; //Ensembles may not be moved around. if( group->unit_id == UNT_ICEWALL || group->unit_id == UNT_WALLOFTHORN ) @@ -15982,7 +15942,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, if( sd->skill_id_old == skill_id ) skill_lv = sd->skill_lv_old; - if( !(idx=skill_can_produce_mix(sd,nameid,-1, qty)) ) + if( !(idx=skill->can_produce_mix(sd,nameid,-1, qty)) ) return 0; idx--; @@ -16600,7 +16560,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) { return 0; } switch( nameid ) - { // t_lv used to take duration from skill_get_time2 + { // t_lv used to take duration from skill->get_time2 case PO_PARALYSE: type = SC_PARALYSE; break; case PO_PYREXIA: type = SC_PYREXIA; break; case PO_DEATHHURT: type = SC_DEATHHURT; break; @@ -16616,7 +16576,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) { chance = 2 + 2 * sd->menuskill_val; // 2 + 2 * skill_lv sc_start4(&sd->bl, SC_POISONINGWEAPON, 100, pc_checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1 - type, chance, 0, skill_get_time(GC_POISONINGWEAPON, sd->menuskill_val)); + type, chance, 0, skill->get_time(GC_POISONINGWEAPON, sd->menuskill_val)); return 0; } @@ -16626,7 +16586,7 @@ static void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) 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)) + if (skill->get_nk(skill_id)&NK_NO_DAMAGE || !(skill->get_type(skill_id)&BF_MAGIC)) return; if (sc && sc->count && sc->data[SC_MAGICPOWER]) @@ -16651,12 +16611,12 @@ static void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) int skill_magicdecoy(struct map_session_data *sd, int nameid) { - int x, y, i, class_, skill; + int x, y, i, class_, skill_id; struct mob_data *md; nullpo_ret(sd); - skill = sd->menuskill_val; + skill_id = sd->menuskill_val; - if( nameid <= 0 || !itemdb_is_element(nameid) || (i = pc_search_inventory(sd,nameid)) < 0 || !skill || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) + if( nameid <= 0 || !itemdb_is_element(nameid) || (i = pc_search_inventory(sd,nameid)) < 0 || !skill_id || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) { clif_skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); return 0; @@ -16678,9 +16638,9 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) { md->special_state.ai = AI_FLORA; if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (gettick() + skill_get_time(NC_MAGICDECOY,skill), mob_timer_delete, md->bl.id, 0); + md->deletetimer = add_timer (gettick() + skill->get_time(NC_MAGICDECOY,skill_id), mob_timer_delete, md->bl.id, 0); mob_spawn(md); - md->status.matk_min = md->status.matk_max = 250 + (50 * skill); + md->status.matk_min = md->status.matk_max = 250 + (50 * skill_id); } return 0; @@ -16708,7 +16668,7 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { if( !pc_checkskill(sd, (skill_id = skill_spellbook_db[i].skill_id)) ) { // User don't know the skill - sc_start(&sd->bl, SC_SLEEP, 100, 1, skill_get_time(WL_READING_SB, pc_checkskill(sd,WL_READING_SB))); + sc_start(&sd->bl, SC_SLEEP, 100, 1, skill->get_time(WL_READING_SB, pc_checkskill(sd,WL_READING_SB))); clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_DIFFICULT_SLEEP, 0); return 0; } @@ -16745,7 +16705,7 @@ int skill_select_menu(struct map_session_data *sd,uint16 skill_id) { status_change_end(&sd->bl,SC_STOP,INVALID_TIMER); } - if( skill_id >= GS_GLITTERING || skill_get_type(skill_id) != BF_MAGIC || + if( skill_id >= GS_GLITTERING || skill->get_type(skill_id) != BF_MAGIC || (id = sd->status.skill[skill_id].id) == 0 || sd->status.skill[skill_id].flag != SKILL_FLAG_PLAGIARIZED ) { clif_skill_fail(sd,SC_AUTOSHADOWSPELL,0,0); return 0; @@ -16754,7 +16714,7 @@ int skill_select_menu(struct map_session_data *sd,uint16 skill_id) { lv = (aslvl + 1) / 2; // The level the skill will be autocasted lv = min(lv,sd->status.skill[skill_id].lv); prob = (aslvl == 10) ? 15 : (32 - 2 * aslvl); // Probability at level 10 was increased to 15. - sc_start4(&sd->bl,SC__AUTOSHADOWSPELL,100,id,lv,prob,0,skill_get_time(SC_AUTOSHADOWSPELL,aslvl)); + sc_start4(&sd->bl,SC__AUTOSHADOWSPELL,100,id,lv,prob,0,skill->get_time(SC_AUTOSHADOWSPELL,aslvl)); return 0; } int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv, unsigned short* item_list) { @@ -16861,7 +16821,7 @@ int skill_changematerial(struct map_session_data *sd, int n, unsigned short *ite } while(n == j && c == n); p--; if ( p > 0 ) { - skill_produce_mix(sd,GN_CHANGEMATERIAL,skill_produce_db[i].nameid,0,0,0,p); + skill->produce_mix(sd,GN_CHANGEMATERIAL,skill_produce_db[i].nameid,0,0,0,p); return 1; } } @@ -16883,7 +16843,7 @@ static int skill_destroy_trap( struct block_list *bl, va_list ap ) { nullpo_ret(su); tick = va_arg(ap, unsigned int); - if (su->alive && (sg = su->group) && skill_get_inf2(sg->skill_id)&INF2_TRAP) { + if (su->alive && (sg = su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP) { switch( sg->unit_id ) { case UNT_LANDMINE: case UNT_CLAYMORETRAP: @@ -16895,11 +16855,11 @@ static int skill_destroy_trap( struct block_list *bl, va_list ap ) { case UNT_CLUSTERBOMB: case UNT_FIRINGTRAP: case UNT_ICEBOUNDTRAP: - map_foreachinrange(skill_trap_splash,&su->bl, skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick); + map_foreachinrange(skill_trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick); break; } // Traps aren't recovered. - skill_delunit(su); + skill->delunit(su); } return 0; } @@ -16955,7 +16915,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick, { int oskill_id = skill_id; struct skill_cd* cd = NULL; - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); nullpo_retr (-1, sd); @@ -17001,7 +16961,7 @@ int skill_blockhomun_end(int tid, unsigned int tick, int id, intptr_t data) //[o int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) //[orn] { - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); nullpo_retr (-1, hd); @@ -17028,7 +16988,7 @@ int skill_blockmerc_end(int tid, unsigned int tick, int id, intptr_t data) //[or int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick) { - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); nullpo_retr (-1, md); if (idx == 0) @@ -17066,7 +17026,7 @@ void skill_usave_trigger(struct map_session_data *sd) { return; } - skill_unitsetting(&sd->bl,sus->skill_id,sus->skill_lv,sd->bl.x,sd->bl.y,0); + skill->unitsetting(&sd->bl,sus->skill_id,sus->skill_lv,sd->bl.x,sd->bl.y,0); idb_remove(skillusave_db,sd->status.char_id); @@ -17425,8 +17385,8 @@ int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) { switch(type){ case SC_STASIS: - inf = skill_get_inf2(skill_id); - if( inf == INF2_SONG_DANCE || /*skill_get_inf2(skill_id) == INF2_CHORUS_SKILL ||*/ inf == INF2_SPIRIT_SKILL ) + inf = skill->get_inf2(skill_id); + if( inf == INF2_SONG_DANCE || /*skill->get_inf2(skill_id) == INF2_CHORUS_SKILL ||*/ inf == INF2_SPIRIT_SKILL ) return 1; // Can't do it. switch( skill_id ) { @@ -17512,7 +17472,7 @@ void skill_cooldown_load(struct map_session_data * sd) for( i = 0; i < cd->cursor; i++ ) { // block the skill from usage but ensure it is not recorded (load = true) - skill_blockpc_start_( sd, cd->nameid[i], cd->duration[i], true ); + skill->blockpc_start( sd, cd->nameid[i], cd->duration[i], true ); } } @@ -17533,7 +17493,7 @@ static bool skill_parse_row_skilldb(char* split[], int columns, int current) return false; } - idx = skill_get_index(skill_id); + idx = skill->get_index(skill_id); if( !idx ) // invalid skill id return false; @@ -17575,7 +17535,7 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current) int j; uint16 skill_id = atoi(split[0]); - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); if( !idx ) // invalid skill id return false; @@ -17663,7 +17623,7 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current) static bool skill_parse_row_castdb(char* split[], int columns, int current) {// skill_id,CastingTime,AfterCastActDelay,AfterCastWalkDelay,Duration1,Duration2 uint16 skill_id = atoi(split[0]); - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); if( !idx ) // invalid skill id return false; @@ -17682,7 +17642,7 @@ static bool skill_parse_row_castdb(char* split[], int columns, int current) static bool skill_parse_row_castnodexdb(char* split[], int columns, int current) {// Skill id,Cast,Delay (optional) uint16 skill_id = atoi(split[0]); - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); if( !idx ) // invalid skill id return false; @@ -17696,7 +17656,7 @@ static bool skill_parse_row_castnodexdb(char* split[], int columns, int current) static bool skill_parse_row_nocastdb(char* split[], int columns, int current) {// skill_id,Flag uint16 skill_id = atoi(split[0]); - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); if( !idx ) // invalid skill id return false; @@ -17708,7 +17668,7 @@ static bool skill_parse_row_nocastdb(char* split[], int columns, int current) static bool skill_parse_row_unitdb(char* split[], int columns, int current) {// ID,unit ID,unit ID 2,layout,range,interval,target,flag uint16 skill_id = atoi(split[0]); - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); if( !idx ) // invalid skill id return false; @@ -17793,12 +17753,12 @@ static bool skill_parse_row_spellbookdb(char* split[], int columns, int current) int points = atoi(split[1]); int nameid = atoi(split[2]); - if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) + if( !skill->get_index(skill_id) || !skill->get_max(skill_id) ) ShowError("spellbook_db: Invalid skill ID %d\n", skill_id); - if ( !skill_get_inf(skill_id) ) - ShowError("spellbook_db: Passive skills cannot be memorized (%d/%s)\n", skill_id, skill_get_name(skill_id)); + if ( !skill->get_inf(skill_id) ) + ShowError("spellbook_db: Passive skills cannot be memorized (%d/%s)\n", skill_id, skill->get_name(skill_id)); if( points < 1 ) - ShowError("spellbook_db: PreservePoints have to be 1 or above! (%d/%s)\n", skill_id, skill_get_name(skill_id)); + ShowError("spellbook_db: PreservePoints have to be 1 or above! (%d/%s)\n", skill_id, skill->get_name(skill_id)); else { skill_spellbook_db[current].skill_id = skill_id; @@ -17815,16 +17775,16 @@ static bool skill_parse_row_improvisedb(char* split[], int columns, int current) uint16 skill_id = atoi(split[0]); short j = atoi(split[1]); - if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) { + if( !skill->get_index(skill_id) || !skill->get_max(skill_id) ) { ShowError("skill_improvise_db: Invalid skill ID %d\n", skill_id); return false; } - if ( !skill_get_inf(skill_id) ) { - ShowError("skill_improvise_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill_get_name(skill_id)); + if ( !skill->get_inf(skill_id) ) { + ShowError("skill_improvise_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill->get_name(skill_id)); return false; } if( j < 1 ) { - ShowError("skill_improvise_db: Chances have to be 1 or above! (%d/%s)\n", skill_id, skill_get_name(skill_id)); + ShowError("skill_improvise_db: Chances have to be 1 or above! (%d/%s)\n", skill_id, skill->get_name(skill_id)); return false; } if( current >= MAX_SKILL_IMPROVISE_DB ) { @@ -17839,14 +17799,14 @@ static bool skill_parse_row_magicmushroomdb(char* split[], int column, int curre {// SkillID uint16 skill_id = atoi(split[0]); - if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) + if( !skill->get_index(skill_id) || !skill->get_max(skill_id) ) { ShowError("magicmushroom_db: Invalid skill ID %d\n", skill_id); return false; } - if ( !skill_get_inf(skill_id) ) + if ( !skill->get_inf(skill_id) ) { - ShowError("magicmushroom_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill_get_name(skill_id)); + ShowError("magicmushroom_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill->get_name(skill_id)); return false; } @@ -17857,7 +17817,7 @@ static bool skill_parse_row_magicmushroomdb(char* split[], int column, int curre static bool skill_parse_row_reproducedb(char* split[], int column, int current) { uint16 skill_id = atoi(split[0]); - uint16 idx = skill_get_index(skill_id); + uint16 idx = skill->get_index(skill_id); if( !idx ) return false; @@ -17870,14 +17830,14 @@ static bool skill_parse_row_reproducedb(char* split[], int column, int current) static bool skill_parse_row_abradb(char* split[], int columns, int current) {// skill_id,DummyName,RequiredHocusPocusLevel,Rate uint16 skill_id = atoi(split[0]); - if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) + if( !skill->get_index(skill_id) || !skill->get_max(skill_id) ) { ShowError("abra_db: Invalid skill ID %d\n", skill_id); return false; } - if ( !skill_get_inf(skill_id) ) + if ( !skill->get_inf(skill_id) ) { - ShowError("abra_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill_get_name(skill_id)); + ShowError("abra_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill->get_name(skill_id)); return false; } @@ -18004,8 +17964,8 @@ int do_init_skill (void) skill_timer_ers = ers_new(sizeof(struct skill_timerskill),"skill.c::skill_timer_ers",ERS_OPT_NONE); add_timer_func_list(skill_unit_timer,"skill_unit_timer"); - add_timer_func_list(skill_castend_id,"skill_castend_id"); - add_timer_func_list(skill_castend_pos,"skill_castend_pos"); + add_timer_func_list(skill->castend_id,"skill_castend_id"); + add_timer_func_list(skill->castend_pos,"skill_castend_pos"); add_timer_func_list(skill_timerskill,"skill_timerskill"); add_timer_func_list(skill_blockpc_end, "skill_blockpc_end"); @@ -18025,3 +17985,128 @@ int do_final_skill(void) ers_destroy(skill_timer_ers); return 0; } +/* initialize the interface */ +void skill_defaults(void) { + skill = &skill_s; + skill->init = do_init_skill; + skill->final = do_final_skill; + skill->reload = skill_reload; + /* accesssors */ + skill->get_index = skill_get_index; + skill->get_type = skill_get_type; + skill->get_hit = skill_get_hit; + skill->get_inf = skill_get_inf; + skill->get_ele = skill_get_ele; + skill->get_nk = skill_get_nk; + skill->get_max = skill_get_max; + skill->get_range = skill_get_range; + skill->get_range2 = skill_get_range2; + skill->get_splash = skill_get_splash; + skill->get_hp = skill_get_hp; + skill->get_mhp = skill_get_mhp; + skill->get_sp = skill_get_sp; + skill->get_state = skill_get_state; + skill->get_zeny = skill_get_zeny; + skill->get_num = skill_get_num; + skill->get_cast = skill_get_cast; + skill->get_delay = skill_get_delay; + skill->get_walkdelay = skill_get_walkdelay; + skill->get_time = skill_get_time; + skill->get_time2 = skill_get_time2; + skill->get_castnodex = skill_get_castnodex; + skill->get_delaynodex = skill_get_delaynodex; + skill->get_castdef = skill_get_castdef; + skill->get_weapontype = skill_get_weapontype; + skill->get_ammotype = skill_get_ammotype; + skill->get_ammo_qty = skill_get_ammo_qty; + skill->get_nocast = skill_get_nocast; + skill->get_unit_id = skill_get_unit_id; + skill->get_inf2 = skill_get_inf2; + skill->get_castcancel = skill_get_castcancel; + skill->get_maxcount = skill_get_maxcount; + skill->get_blewcount = skill_get_blewcount; + skill->get_unit_flag = skill_get_unit_flag; + skill->get_unit_target = skill_get_unit_target; + skill->get_unit_interval = skill_get_unit_interval; + skill->get_unit_bl_target = skill_get_unit_bl_target; + skill->tree_get_max = skill_tree_get_max; + skill->get_name = skill_get_name; + skill->get_desc = skill_get_desc; + skill->get_casttype = skill_get_casttype; + skill->name2id = skill_name2id; + skill->isammotype = skill_isammotype; + skill->castend_id = skill_castend_id; + skill->castend_pos = skill_castend_pos; + skill->castend_map = skill_castend_map; + skill->cleartimerskill = skill_cleartimerskill; + skill->addtimerskill = skill_addtimerskill; + skill->additional_effect = skill_additional_effect; + skill->counter_additional_effect = skill_counter_additional_effect; + skill->blown = skill_blown; + skill->break_equip = skill_break_equip; + skill->strip_equip = skill_strip_equip; + skill->id2group = skill_id2group; + skill->unitsetting = skill_unitsetting; + skill->initunit = skill_initunit; + skill->delunit = skill_delunit; + skill->init_unitgroup = skill_initunitgroup; + skill->del_unitgroup = skill_delunitgroup; + skill->clear_unitgroup = skill_clear_unitgroup; + skill->clear_group = skill_clear_group; + skill->unit_onplace = skill_unit_onplace; + skill->unit_ondamaged = skill_unit_ondamaged; + skill->cast_fix = skill_castfix; + skill->cast_fix_sc = skill_castfix_sc; +#ifdef RENEWAL_CAST + skill->vf_cast_fix = skill_vfcastfix; +#endif + skill->delay_fix = skill_delay_fix; + skill->check_condition_castbegin = skill_check_condition_castbegin; + skill->check_condition_castend = skill_check_condition_castend; + skill->get_requirement = skill_get_requirement; + skill->check_pc_partner = skill_check_pc_partner; + skill->consume_requirement = skill_consume_requirement; + skill->unit_move = skill_unit_move; + skill->unit_move_unit_group = skill_unit_move_unit_group; + skill->unit_onleft = skill_unit_onleft; + skill->unit_onout = skill_unit_onout; + skill->guildaura_sub = skill_guildaura_sub; + skill->sit = skill_sit; + skill->brandishspear = skill_brandishspear; + skill->repairweapon = skill_repairweapon; + skill->identify = skill_identify; + skill->weaponrefine = skill_weaponrefine; + skill->autospell = skill_autospell; + skill->calc_heal = skill_calc_heal; + skill->check_cloaking = skill_check_cloaking; + skill->enchant_elemental_end = skill_enchant_elemental_end; + skill->not_ok = skillnotok; + skill->not_ok_hom = skillnotok_hom; + skill->not_ok_mercenary = skillnotok_mercenary; + skill->chastle_mob_changetarget = skill_chastle_mob_changetarget; + skill->can_produce_mix = skill_can_produce_mix; + skill->produce_mix = skill_produce_mix; + skill->arrow_create = skill_arrow_create; + skill->castend_nodamage_id = skill_castend_nodamage_id; + skill->castend_damage_id = skill_castend_damage_id; + skill->castend_pos2 = skill_castend_pos2; + skill->blockpc_start = skill_blockpc_start_; + skill->blockhomun_start = skill_blockhomun_start; + skill->blockmerc_start = skill_blockmerc_start; + skill->attack = skill_attack; + skill->attack_area = skill_attack_area; + skill->usave_add = skill_usave_add; + skill->usave_trigger = skill_usave_trigger; + skill->cooldown_load = skill_cooldown_load; + skill->spellbook = skill_spellbook; + skill->block_check = skill_block_check; + skill->detonator = skill_detonator; + skill->check_camouflage = skill_check_camouflage; + skill->magicdecoy = skill_magicdecoy; + skill->poisoningweapon = skill_poisoningweapon; + skill->select_menu = skill_select_menu; + skill->elementalanalysis = skill_elementalanalysis; + skill->changematerial = skill_changematerial; + skill->get_elemental_type = skill_get_elemental_type; + +} diff --git a/src/map/skill.h b/src/map/skill.h index 94159d524..b55d32a4d 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -8,12 +8,19 @@ #include "../common/mmo.h" // MAX_SKILL, struct square #include "../common/db.h" #include "map.h" // struct block_list + +/** + * Declarations + **/ struct map_session_data; struct homun_data; struct skill_unit; struct skill_unit_group; struct status_change_entry; +/** + * Defines + **/ #define MAX_SKILL_DB MAX_SKILL #define MAX_SKILL_PRODUCE_DB 270 #define MAX_PRODUCE_RESOURCE 12 @@ -21,14 +28,32 @@ struct status_change_entry; #define MAX_ARROW_RESOURCE 5 #define MAX_SKILL_ABRA_DB 350 #define MAX_SKILL_IMPROVISE_DB 50 - #define MAX_SKILL_LEVEL 100 +#define MAX_SKILL_UNIT_LAYOUT 50 +#define MAX_SQUARE_LAYOUT 5 // 11*11 Placement of a maximum unit +#define MAX_SKILL_UNIT_COUNT ((MAX_SQUARE_LAYOUT*2+1)*(MAX_SQUARE_LAYOUT*2+1)) +#define MAX_SKILLTIMERSKILL 15 +#define MAX_SKILLUNITGROUP 25 +#define MAX_SKILL_ITEM_REQUIRE 10 +#define MAX_SKILLUNITGROUPTICKSET 25 -DBMap* skilldb_name2id; +// (Epoque:) To-do: replace this macro with some sort of skill tree check (rather than hard-coded skill names) +#define skill_ischangesex(id) ( \ + ((id) >= BD_ADAPTATION && (id) <= DC_SERVICEFORYOU) || ((id) >= CG_ARROWVULCAN && (id) <= CG_MARIONETTE) || \ + ((id) >= CG_LONGINGFREEDOM && (id) <= CG_TAROTCARD) || ((id) >= WA_SWING_DANCE && (id) <= WM_UNLIMITED_HUMMING_VOICE)) + +#define MAX_SKILL_SPELLBOOK_DB 17 +#define MAX_SKILL_MAGICMUSHROOM_DB 23 + +//Walk intervals at which chase-skills are attempted to be triggered. +#define WALK_SKILL_INTERVAL 5 + +/** + * Enumerations + **/ //Constants to identify the skill's inf value: -enum e_skill_inf -{ +enum e_skill_inf { INF_ATTACK_SKILL = 0x01, INF_GROUND_SKILL = 0x02, INF_SELF_SKILL = 0x04, // Skills casted on self where target is automatically chosen @@ -40,8 +65,7 @@ enum e_skill_inf //Constants to identify a skill's nk value (damage properties) //The NK value applies only to non INF_GROUND_SKILL skills //when determining skill castend function to invoke. -enum e_skill_nk -{ +enum e_skill_nk { NK_NO_DAMAGE = 0x01, NK_SPLASH = 0x02|0x04, // 0x4 = splash & split NK_SPLASHSPLIT = 0x04, @@ -54,8 +78,7 @@ enum e_skill_nk //A skill with 3 would be no damage + splash: area of effect. //Constants to identify a skill's inf2 value. -enum e_skill_inf2 -{ +enum e_skill_inf2 { INF2_QUEST_SKILL = 0x0001, INF2_NPC_SKILL = 0x0002, //NPC skills are those that players can't have in their skill tree. INF2_WEDDING_SKILL = 0x0004, @@ -73,118 +96,15 @@ enum e_skill_inf2 INF2_CHORUS_SKILL = 0x4000, // Chorus skill }; -//Walk intervals at which chase-skills are attempted to be triggered. -#define WALK_SKILL_INTERVAL 5 // Flags passed to skill_attack/skill_area_sub -enum e_skill_display -{ +enum e_skill_display { SD_LEVEL = 0x1000, // skill_attack will send -1 instead of skill level (affects display of some skills) SD_ANIMATION = 0x2000, // skill_attack will use '5' instead of the skill's 'type' (this makes skills show an animation) SD_SPLASH = 0x4000, // skill_area_sub will count targets in skill_area_temp[2] SD_PREAMBLE = 0x8000, // skill_area_sub will transmit a 'magic' damage packet (-30000 dmg) for the first target selected }; -#define MAX_SKILL_ITEM_REQUIRE 10 -struct skill_condition { - int weapon,ammo,ammo_qty,hp,sp,zeny,spiritball,mhp,state; - int itemid[MAX_SKILL_ITEM_REQUIRE],amount[MAX_SKILL_ITEM_REQUIRE]; -}; - -// Database skills - -struct s_skill_db { - char name[NAME_LENGTH]; - char desc[40]; - int range[MAX_SKILL_LEVEL],hit,inf,element[MAX_SKILL_LEVEL],nk,splash[MAX_SKILL_LEVEL],max; - int num[MAX_SKILL_LEVEL]; - int cast[MAX_SKILL_LEVEL],walkdelay[MAX_SKILL_LEVEL],delay[MAX_SKILL_LEVEL]; -#ifdef RENEWAL_CAST - int fixed_cast[MAX_SKILL_LEVEL]; -#endif - int upkeep_time[MAX_SKILL_LEVEL],upkeep_time2[MAX_SKILL_LEVEL],cooldown[MAX_SKILL_LEVEL]; - int castcancel,cast_def_rate; - int inf2,maxcount[MAX_SKILL_LEVEL],skill_type; - int blewcount[MAX_SKILL_LEVEL]; - int hp[MAX_SKILL_LEVEL],sp[MAX_SKILL_LEVEL],mhp[MAX_SKILL_LEVEL],hp_rate[MAX_SKILL_LEVEL],sp_rate[MAX_SKILL_LEVEL],zeny[MAX_SKILL_LEVEL]; - int weapon,ammo,ammo_qty[MAX_SKILL_LEVEL],state,spiritball[MAX_SKILL_LEVEL]; - int itemid[MAX_SKILL_ITEM_REQUIRE],amount[MAX_SKILL_ITEM_REQUIRE]; - int castnodex[MAX_SKILL_LEVEL], delaynodex[MAX_SKILL_LEVEL]; - int nocast; - int unit_id[2]; - int unit_layout_type[MAX_SKILL_LEVEL]; - int unit_range[MAX_SKILL_LEVEL]; - int unit_interval; - int unit_target; - int unit_flag; -}; -extern struct s_skill_db skill_db[MAX_SKILL_DB]; - -#define MAX_SKILL_UNIT_LAYOUT 50 -#define MAX_SQUARE_LAYOUT 5 // 11*11 Placement of a maximum unit -#define MAX_SKILL_UNIT_COUNT ((MAX_SQUARE_LAYOUT*2+1)*(MAX_SQUARE_LAYOUT*2+1)) -struct s_skill_unit_layout { - int count; - int dx[MAX_SKILL_UNIT_COUNT]; - int dy[MAX_SKILL_UNIT_COUNT]; -}; - -#define MAX_SKILLTIMERSKILL 15 -struct skill_timerskill { - int timer; - int src_id; - int target_id; - int map; - short x,y; - uint16 skill_id,skill_lv; - int type; // a BF_ type (NOTE: some places use this as general-purpose storage...) - int flag; -}; - -#define MAX_SKILLUNITGROUP 25 -struct skill_unit_group { - int src_id; - int party_id; - int guild_id; - int bg_id; - int map; - int target_flag; //Holds BCT_* flag for battle_check_target - int bl_flag; //Holds BL_* flag for map_foreachin* functions - unsigned int tick; - int limit,interval; - - uint16 skill_id,skill_lv; - int val1,val2,val3; - char *valstr; - int unit_id; - int group_id; - int unit_count,alive_count; - int item_id; //store item used. - struct skill_unit *unit; - struct { - unsigned ammo_consume : 1; - unsigned song_dance : 2; //0x1 Song/Dance, 0x2 Ensemble - unsigned guildaura : 1; - } state; -}; - -struct skill_unit { - struct block_list bl; - - struct skill_unit_group *group; - - int limit; - int val1,val2; - short alive,range; -}; - -#define MAX_SKILLUNITGROUPTICKSET 25 -struct skill_unit_group_tickset { - unsigned int tick; - int id; -}; - - enum { UF_DEFNOTENEMY = 0x0001, // If 'defunit_not_enemy' is set, the target is changed to 'friend' UF_NOREITERATION = 0x0002, // Spell cannot be stacked @@ -201,185 +121,15 @@ enum { UF_RANGEDSINGLEUNIT = 0x2000 // hack for ranged layout, only display center }; -// Create Database item - -struct s_skill_produce_db { - int nameid, trigger; - int req_skill,req_skill_lv,itemlv; - int mat_id[MAX_PRODUCE_RESOURCE],mat_amount[MAX_PRODUCE_RESOURCE]; -}; -extern struct s_skill_produce_db skill_produce_db[MAX_SKILL_PRODUCE_DB]; - -// Creating database arrow - -struct s_skill_arrow_db { - int nameid, trigger; - int cre_id[MAX_ARROW_RESOURCE],cre_amount[MAX_ARROW_RESOURCE]; -}; -extern struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB]; - -// Abracadabra database - -struct s_skill_abra_db { - uint16 skill_id; - int req_lv; - int per; -}; -extern struct s_skill_abra_db skill_abra_db[MAX_SKILL_ABRA_DB]; - -extern int enchant_eff[5]; -extern int deluge_eff[5]; - -int do_init_skill(void); -int do_final_skill(void); - //Returns the cast type of the skill: ground cast, castend damage, castend no damage enum { CAST_GROUND, CAST_DAMAGE, CAST_NODAMAGE }; -int skill_get_casttype(uint16 skill_id); //[Skotlex] - -// Accessor to the skills database -// -int skill_get_index( uint16 skill_id ); -int skill_get_type( uint16 skill_id ); -int skill_get_hit( uint16 skill_id ); -int skill_get_inf( uint16 skill_id ); -int skill_get_ele( uint16 skill_id , uint16 skill_lv ); -int skill_get_nk( uint16 skill_id ); -int skill_get_max( uint16 skill_id ); -int skill_get_range( uint16 skill_id , uint16 skill_lv ); -int skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv); -int skill_get_splash( uint16 skill_id , uint16 skill_lv ); -int skill_get_hp( uint16 skill_id ,uint16 skill_lv ); -int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ); -int skill_get_sp( uint16 skill_id ,uint16 skill_lv ); -int skill_get_state(uint16 skill_id); -int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ); -int skill_get_num( uint16 skill_id ,uint16 skill_lv ); -int skill_get_cast( uint16 skill_id ,uint16 skill_lv ); -int skill_get_delay( uint16 skill_id ,uint16 skill_lv ); -int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ); -int skill_get_time( uint16 skill_id ,uint16 skill_lv ); -int skill_get_time2( uint16 skill_id ,uint16 skill_lv ); -int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ); -int skill_get_castdef( uint16 skill_id ); -int skill_get_weapontype( uint16 skill_id ); -int skill_get_ammotype( uint16 skill_id ); -int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ); -int skill_get_nocast( uint16 skill_id ); -int skill_get_unit_id(uint16 skill_id,int flag); -int skill_get_inf2( uint16 skill_id ); -int skill_get_castcancel( uint16 skill_id ); -int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ); -int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ); -int skill_get_unit_flag( uint16 skill_id ); -int skill_get_unit_target( uint16 skill_id ); -int skill_tree_get_max( uint16 skill_id, int b_class ); // Celest -const char* skill_get_name( uint16 skill_id ); // [Skotlex] -const char* skill_get_desc( uint16 skill_id ); // [Skotlex] - -int skill_name2id(const char* name); - -int skill_isammotype(struct map_session_data *sd, int skill); -int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data); -int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data); -int skill_castend_map( struct map_session_data *sd,uint16 skill_id, const char *map); - -int skill_cleartimerskill(struct block_list *src); -int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int x,int y,uint16 skill_id,uint16 skill_lv,int type,int flag); - -// Results? Added -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_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_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag); -int skill_break_equip(struct block_list *bl, unsigned short where, int rate, int flag); -int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time); -// Skills unit -struct skill_unit_group* skill_id2group(int group_id); -struct skill_unit_group *skill_unitsetting(struct block_list* src, uint16 skill_id, uint16 skill_lv, short x, short y, int flag); -struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2); -int skill_delunit(struct skill_unit *unit); -struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval); -int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int line, const char* func); -#define skill_delunitgroup(group) skill_delunitgroup_(group,__FILE__,__LINE__,__func__) -int skill_clear_unitgroup(struct block_list *src); -int skill_clear_group(struct block_list *bl, int flag); -void ext_skill_unit_onplace(struct skill_unit *src, struct block_list *bl, unsigned int tick); - -int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl,int damage,unsigned int tick); - -int skill_castfix( struct block_list *bl, uint16 skill_id, uint16 skill_lv); -int skill_castfix_sc( struct block_list *bl, int time); -#ifdef RENEWAL_CAST -int skill_vfcastfix( struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv); -#endif -int skill_delayfix( struct block_list *bl, uint16 skill_id, uint16 skill_lv); - -// Skill conditions check and remove [Inkfish] -int skill_check_condition_castbegin(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); -int skill_check_condition_castend(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); -int skill_consume_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type); -struct skill_condition skill_get_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); - -int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, short* skill_lv, int range, int cast_flag); -// -- moonsoul (added skill_check_unit_cell) -int skill_check_unit_cell(uint16 skill_id,int16 m,int16 x,int16 y,int unit_id); -int skill_unit_out_all( struct block_list *bl,unsigned int tick,int range); -int skill_unit_move(struct block_list *bl,unsigned int tick,int flag); -int skill_unit_move_unit_group( struct skill_unit_group *group, int16 m,int16 dx,int16 dy); - -struct skill_unit_group *skill_check_dancing( struct block_list *src ); - -// Guild skills [celest] -int skill_guildaura_sub (struct map_session_data* sd, int id, int strvit, int agidex); - -// Chant canceled -int skill_castcancel(struct block_list *bl,int type); - -int skill_sit (struct map_session_data *sd, int type); -void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag); -void skill_repairweapon(struct map_session_data *sd, int idx); -void skill_identify(struct map_session_data *sd,int idx); -void skill_weaponrefine(struct map_session_data *sd,int idx); // [Celest] -int skill_autospell(struct map_session_data *md,uint16 skill_id); - -int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal); - -bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce); - -// Abnormal status -int skill_enchant_elemental_end(struct block_list *bl, int type); -int skillnotok(uint16 skill_id, struct map_session_data *sd); -int skillnotok_hom(uint16 skill_id, struct homun_data *hd); -int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md); - -int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap); - -// Item creation -int skill_can_produce_mix( struct map_session_data *sd, int nameid, int trigger, int qty); -int skill_produce_mix( struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty ); - -int skill_arrow_create( struct map_session_data *sd,int nameid); - -// skills for the mob -int skill_castend_nodamage_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 ); -int skill_castend_pos2( struct block_list *src, int x,int y,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag); - -int skill_blockpc_start_(struct map_session_data*, uint16 skill_id, int, bool); -int skill_blockhomun_start (struct homun_data*,uint16 skill_id,int); -int skill_blockmerc_start (struct mercenary_data*,uint16 skill_id,int); -#define skill_blockpc_start(sd, skill_id, tick) skill_blockpc_start_( sd, skill_id, tick, false ) - -// (Epoque:) To-do: replace this macro with some sort of skill tree check (rather than hard-coded skill names) -#define skill_ischangesex(id) ( \ - ((id) >= BD_ADAPTATION && (id) <= DC_SERVICEFORYOU) || ((id) >= CG_ARROWVULCAN && (id) <= CG_MARIONETTE) || \ - ((id) >= CG_LONGINGFREEDOM && (id) <= CG_TAROTCARD) || ((id) >= WA_SWING_DANCE && (id) <= WM_UNLIMITED_HUMMING_VOICE)) - -// Skill action, (return dmg,heal) -int skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag ); - -void skill_reload(void); +enum wl_spheres { + WLS_FIRE = 0x44, + WLS_WIND, + WLS_WATER, + WLS_STONE, +}; enum { ST_NONE, @@ -410,7 +160,7 @@ enum { enum e_skill { NV_BASIC = 1, - + SM_SWORD, SM_TWOHAND, SM_RECOVERY, @@ -418,7 +168,7 @@ enum e_skill { SM_PROVOKE, SM_MAGNUM, SM_ENDURE, - + MG_SRECOVERY, MG_SIGHT, MG_NAPALMBEAT, @@ -432,7 +182,7 @@ enum e_skill { MG_FIREBOLT, MG_LIGHTNINGBOLT, MG_THUNDERSTORM, - + AL_DP, AL_DEMONBANE, AL_RUWACH, @@ -447,7 +197,7 @@ enum e_skill { AL_ANGELUS, AL_BLESSING, AL_CURE, - + MC_INCCARRY, MC_DISCOUNT, MC_OVERCHARGE, @@ -455,22 +205,22 @@ enum e_skill { MC_IDENTIFY, MC_VENDING, MC_MAMMONITE, - + AC_OWL, AC_VULTURE, AC_CONCENTRATION, AC_DOUBLE, AC_SHOWER, - + TF_DOUBLE, TF_MISS, TF_STEAL, TF_HIDING, TF_POISON, TF_DETOXIFY, - + ALL_RESURRECTION, - + KN_SPEARMASTERY, KN_PIERCE, KN_BRANDISHSPEAR, @@ -481,7 +231,7 @@ enum e_skill { KN_BOWLINGBASH, KN_RIDING, KN_CAVALIERMASTERY, - + PR_MACEMASTERY, PR_IMPOSITIO, PR_SUFFRAGIUM, @@ -497,7 +247,7 @@ enum e_skill { PR_TURNUNDEAD, PR_LEXAETERNA, PR_MAGNUS, - + WZ_FIREPILLAR, WZ_SIGHTRASHER, WZ_FIREIVY, @@ -512,7 +262,7 @@ enum e_skill { WZ_HEAVENDRIVE, WZ_QUAGMIRE, WZ_ESTIMATION, - + BS_IRON, BS_STEEL, BS_ENCHANTEDSTONE, @@ -534,7 +284,7 @@ enum e_skill { BS_WEAPONPERFECT, BS_OVERTHRUST, BS_MAXIMIZE, - + HT_SKIDTRAP, HT_LANDMINE, HT_ANKLESNARE, @@ -552,7 +302,7 @@ enum e_skill { HT_BLITZBEAT, HT_DETECTING, HT_SPRINGTRAP, - + AS_RIGHT, AS_LEFT, AS_KATAR, @@ -563,7 +313,7 @@ enum e_skill { AS_POISONREACT, AS_VENOMDUST, AS_SPLASHER, - + NV_FIRSTAID, NV_TRICKDEAD, SM_MOVINGRECOVERY, @@ -580,7 +330,7 @@ enum e_skill { MC_LOUD, AL_HOLYLIGHT, MG_ENERGYCOAT, - + NPC_PIERCINGATT, NPC_MENTALBREAKER, NPC_RANGEATTACK, @@ -633,7 +383,7 @@ enum e_skill { NPC_HALLUCINATION, NPC_REBIRTH, NPC_SUMMONMONSTER, - + RG_SNATCHER, RG_STEALCOIN, RG_BACKSTAP, @@ -650,7 +400,7 @@ enum e_skill { RG_GANGSTER, RG_COMPULSION, RG_PLAGIARISM, - + AM_AXEMASTERY, AM_LEARNINGPOTION, AM_PHARMACY, @@ -673,7 +423,7 @@ enum e_skill { AM_DRILLMASTER, AM_HEALHOMUN, AM_RESURRECTHOMUN, - + CR_TRUST, CR_AUTOGUARD, CR_SHIELDCHARGE, @@ -685,7 +435,7 @@ enum e_skill { CR_PROVIDENCE, CR_DEFENDER, CR_SPEARQUICKEN, - + MO_IRONHAND, MO_SPIRITSRECOVERY, MO_CALLSPIRITS, @@ -701,7 +451,7 @@ enum e_skill { MO_EXTREMITYFIST, MO_CHAINCOMBO, MO_COMBOFINISH, - + SA_ADVANCEDBOOK, SA_CASTCANCEL, SA_MAGICROD, @@ -732,7 +482,7 @@ enum e_skill { SA_INSTANTDEATH, SA_FULLRECOVERY, SA_COMA, - + BD_ADAPTATION, BD_ENCORE, BD_LULLABY, @@ -744,7 +494,7 @@ enum e_skill { BD_INTOABYSS, BD_SIEGFRIED, BD_RAGNAROK, - + BA_MUSICALLESSON, BA_MUSICALSTRIKE, BA_DISSONANCE, @@ -753,7 +503,7 @@ enum e_skill { BA_ASSASSINCROSS, BA_POEMBRAGI, BA_APPLEIDUN, - + DC_DANCINGLESSON, DC_THROWARROW, DC_UGLYDANCE, @@ -762,17 +512,17 @@ enum e_skill { DC_DONTFORGETME, DC_FORTUNEKISS, DC_SERVICEFORYOU, - + NPC_RANDOMMOVE, NPC_SPEEDUP, NPC_REVENGE, - + WE_MALE, WE_FEMALE, WE_CALLPARTNER, - + ITM_TOMAHAWK, - + NPC_DARKCROSS, NPC_GRANDDARKNESS, NPC_DARKSTRIKE, @@ -790,7 +540,7 @@ enum e_skill { NPC_CALLSLAVE, NPC_INVISIBLE, NPC_RUN, - + LK_AURABLADE, LK_PARRYING, LK_CONCENTRATION, @@ -847,7 +597,7 @@ enum e_skill { WE_BABY, WE_CALLPARENT, WE_CALLBABY, - + TK_RUN, TK_READYSTORM, TK_STORMKICK, @@ -864,7 +614,7 @@ enum e_skill { TK_POWER, TK_SEVENWIND, TK_HIGHJUMP, - + SG_FEEL, SG_SUN_WARM, SG_MOON_WARM, @@ -883,7 +633,7 @@ enum e_skill { SG_FRIEND, SG_KNOWLEDGE, SG_FUSION, - + SL_ALCHEMIST, AM_BERSERKPITCHER, SL_MONK, @@ -912,7 +662,7 @@ enum e_skill { SL_SWOO, SL_SKE, SL_SKA, - + SM_SELFPROVOKE, NPC_EMOTION_ON, ST_PRESERVE, @@ -940,7 +690,7 @@ enum e_skill { AM_TWILIGHT2, AM_TWILIGHT3, HT_POWER, - + GS_GLITTERING, GS_FLING, GS_TRIPLEACTION, @@ -963,7 +713,7 @@ enum e_skill { GS_FULLBUSTER, GS_SPREADATTACK, GS_GROUNDDRIFT, - + NJ_TOBIDOUGU, NJ_SYURIKEN, NJ_KUNAI, @@ -987,7 +737,7 @@ enum e_skill { NJ_KAMAITACHI, NJ_NEN, NJ_ISSEN, - + MB_FIGHTING, MB_NEUTRAL, MB_TAIMING_PUTI, @@ -1015,7 +765,7 @@ enum e_skill { MB_M_WALLCRASH, MB_M_REINCARNATION, MB_B_EQUIP, - + SL_DEATHKNIGHT, SL_COLLECTOR, SL_NINJA, @@ -1024,7 +774,7 @@ enum e_skill { DA_RESET, DE_BERSERKAIZER, DA_DARKPOWER, - + DE_PASSIVE, DE_PATTACK, DE_PSPEED, @@ -1064,7 +814,7 @@ enum e_skill { DE_TWINATTACK, DE_WINDATTACK, DE_WATERATTACK, - + DA_ENERGY, DA_CLOUD, DA_FIRSTSLOT, @@ -1099,7 +849,7 @@ enum e_skill { ALL_TIMEIN, DA_ZENYRANK, DA_ACCESSORYMIX, - + NPC_EARTHQUAKE, NPC_FIREBREATH, NPC_ICEBREATH, @@ -1128,7 +878,7 @@ enum e_skill { NPC_WIDESTUN, NPC_VAMPIRE_GIFT, NPC_WIDESOULDRAIN, - + ALL_INCCARRY, NPC_TALK, NPC_HELLPOWER, @@ -1157,7 +907,7 @@ enum e_skill { NPC_VENOMFOG, NPC_MILLENNIUMSHIELD, NPC_COMET, - + KN_CHARGEATK = 1001, CR_SHRINK, AS_SONICACCEL, @@ -1177,7 +927,7 @@ enum e_skill { SA_ELEMENTGROUND, SA_ELEMENTFIRE, SA_ELEMENTWIND, - + RK_ENCHANTBLADE = 2001, RK_SONICWAVE, RK_DEATHBOUND, @@ -1198,7 +948,7 @@ enum e_skill { RK_FIGHTINGSPIRIT, RK_ABUNDANCE, RK_PHANTOMTHRUST, - + GC_VENOMIMPRESS, GC_CROSSIMPACT, GC_DARKILLUSION, @@ -1216,7 +966,7 @@ enum e_skill { GC_HALLUCINATIONWALK, GC_ROLLINGCUTTER, GC_CROSSRIPPERSLASHER, - + AB_JUDEX, AB_ANCILLA, AB_ADORAMUS, @@ -1237,7 +987,7 @@ enum e_skill { AB_DUPLELIGHT_MELEE, AB_DUPLELIGHT_MAGIC, AB_SILENTIUM, - + WL_WHITEIMPRISON = 2201, WL_SOULEXPANSION, WL_FROSTMISTY, @@ -1270,7 +1020,7 @@ enum e_skill { WL_RELEASE, WL_READING_SB, WL_FREEZE_SP, - + RA_ARROWSTORM, RA_FEARBREEZE, RA_RANGERMAIN, @@ -1293,7 +1043,7 @@ enum e_skill { RA_VERDURETRAP, RA_FIRINGTRAP, RA_ICEBOUNDTRAP, - + NC_MADOLICENCE, NC_BOOSTKNUCKLE, NC_PILEBUNKER, @@ -1323,7 +1073,7 @@ enum e_skill { NC_SILVERSNIPER, NC_MAGICDECOY, NC_DISJOINT, - + SC_FATALMENACE, SC_REPRODUCE, SC_AUTOSHADOWSPELL, @@ -1345,7 +1095,7 @@ enum e_skill { SC_MAELSTROM, SC_BLOODYLUST, SC_FEINTBOMB, - + LG_CANNONSPEAR = 2307, LG_BANISHINGPOINT, LG_TRAMPLE, @@ -1365,7 +1115,7 @@ enum e_skill { LG_EARTHDRIVE, LG_HESPERUSLIT, LG_INSPIRATION, - + SR_DRAGONCOMBO, SR_SKYNETBLOW, SR_EARTHSHAKER, @@ -1389,15 +1139,15 @@ enum e_skill { SR_GENTLETOUCH_ENERGYGAIN, SR_GENTLETOUCH_CHANGE, SR_GENTLETOUCH_REVITALIZE, - + WA_SWING_DANCE = 2350, WA_SYMPHONY_OF_LOVER, WA_MOONLIT_SERENADE, - + MI_RUSH_WINDMILL = 2381, MI_ECHOSONG, MI_HARMONIZE, - + WM_LESSON = 2412, WM_METALICSOUND, WM_REVERBERATION, @@ -1421,7 +1171,7 @@ enum e_skill { WM_MELODYOFSINK, WM_BEYOND_OF_WARCRY, WM_UNLIMITED_HUMMING_VOICE, - + SO_FIREWALK = 2443, SO_ELECTRICWALK, SO_SPELLFIST, @@ -1448,7 +1198,7 @@ enum e_skill { SO_WATER_INSIGNIA, SO_WIND_INSIGNIA, SO_EARTH_INSIGNIA, - + GN_TRAINING_SWORD = 2474, GN_REMODELING_CART, GN_CART_TORNADO, @@ -1474,14 +1224,14 @@ enum e_skill { GN_MAKEBOMB, GN_S_PHARMACY, GN_SLINGITEM_RANGEMELEEATK, - + AB_SECRAMENT = 2515, WM_SEVERE_RAINSTORM_MELEE, SR_HOWLINGOFLION, SR_RIDEINLIGHTNING, LG_OVERBRAND_BRANDISH, LG_OVERBRAND_PLUSATK, - + ALL_ODINS_RECALL = 2533, RETURN_TO_ELDICASTES, ALL_BUYING_STORE, @@ -1494,7 +1244,7 @@ enum e_skill { ALL_TETANY, ALL_RAY_OF_PROTECTION, MC_CARTDECORATE, - + KO_YAMIKUMO = 3001, KO_RIGHT, KO_LEFT, @@ -1524,13 +1274,13 @@ enum e_skill { OB_OBOROGENSOU, OB_OBOROGENSOU_TRANSITION_ATK, OB_AKAITSUKI, - + ECL_SNOWFLIP = 3031, ECL_PEONYMAMY, ECL_SADAGUI, ECL_SEQUOIADUST, ECLAGE_RECALL, - + HLIF_HEAL = 8001, HLIF_AVOID, HLIF_BRAIN, @@ -1574,7 +1324,7 @@ enum e_skill { MH_LAVA_SLIDE, MH_PYROCLASTIC, MH_VOLCANIC_ASH, - + MS_BASH = 8201, MS_MAGNUM, MS_BOWLINGBASH, @@ -1615,7 +1365,7 @@ enum e_skill { MER_KYRIE, MER_BLESSING, MER_INCAGI, - + EL_CIRCLE_OF_FIRE = 8401, EL_FIRE_CLOAK, EL_FIRE_MANTLE, @@ -1790,7 +1540,7 @@ enum { UNT_ZENKAI_WIND, UNT_MAKIBISHI, UNT_VENOMFOG, - + /** * Guild Auras **/ @@ -1798,51 +1548,10 @@ enum { UNT_GD_GLORYWOUNDS = 0xc2, UNT_GD_SOULCOLD = 0xc3, UNT_GD_HAWKEYES = 0xc4, - + UNT_MAX = 0x190 }; -/** - * Skill Unit Save - **/ -void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill_lv); -void skill_usave_trigger(struct map_session_data *sd); -/** - * Skill Cool Downs - load from pc.c when the character logs in - **/ -void skill_cooldown_load(struct map_session_data * sd); -/** - * Warlock - **/ -#define MAX_SKILL_SPELLBOOK_DB 17 -enum wl_spheres { - WLS_FIRE = 0x44, - WLS_WIND, - WLS_WATER, - WLS_STONE, -}; -int skill_spellbook (struct map_session_data *sd, int nameid); -int skill_block_check(struct block_list *bl, enum sc_type type, uint16 skill_id); -/** - * Guilottine Cross - **/ -#define MAX_SKILL_MAGICMUSHROOM_DB 23 -struct s_skill_magicmushroom_db { - uint16 skill_id; -}; -extern struct s_skill_magicmushroom_db skill_magicmushroom_db[MAX_SKILL_MAGICMUSHROOM_DB]; -/** - * Ranger - **/ -int skill_detonator(struct block_list *bl, va_list ap); -bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *sce); -/** - * Mechanic - **/ -int skill_magicdecoy(struct map_session_data *sd, int nameid); -/** - * Guiltoine Cross - **/ -int skill_poisoningweapon( struct map_session_data *sd, int nameid); + enum gx_poison { PO_PARALYSE = 12717, PO_LEECHESEND, @@ -1853,13 +1562,273 @@ enum gx_poison { PO_MAGICMUSHROOM, PO_VENOMBLEED }; + +/** + * Structures + **/ + +struct skill_condition { + int weapon,ammo,ammo_qty,hp,sp,zeny,spiritball,mhp,state; + int itemid[MAX_SKILL_ITEM_REQUIRE],amount[MAX_SKILL_ITEM_REQUIRE]; +}; + +// Database skills +struct s_skill_db { + char name[NAME_LENGTH]; + char desc[40]; + int range[MAX_SKILL_LEVEL],hit,inf,element[MAX_SKILL_LEVEL],nk,splash[MAX_SKILL_LEVEL],max; + int num[MAX_SKILL_LEVEL]; + int cast[MAX_SKILL_LEVEL],walkdelay[MAX_SKILL_LEVEL],delay[MAX_SKILL_LEVEL]; +#ifdef RENEWAL_CAST + int fixed_cast[MAX_SKILL_LEVEL]; +#endif + int upkeep_time[MAX_SKILL_LEVEL],upkeep_time2[MAX_SKILL_LEVEL],cooldown[MAX_SKILL_LEVEL]; + int castcancel,cast_def_rate; + int inf2,maxcount[MAX_SKILL_LEVEL],skill_type; + int blewcount[MAX_SKILL_LEVEL]; + int hp[MAX_SKILL_LEVEL],sp[MAX_SKILL_LEVEL],mhp[MAX_SKILL_LEVEL],hp_rate[MAX_SKILL_LEVEL],sp_rate[MAX_SKILL_LEVEL],zeny[MAX_SKILL_LEVEL]; + int weapon,ammo,ammo_qty[MAX_SKILL_LEVEL],state,spiritball[MAX_SKILL_LEVEL]; + int itemid[MAX_SKILL_ITEM_REQUIRE],amount[MAX_SKILL_ITEM_REQUIRE]; + int castnodex[MAX_SKILL_LEVEL], delaynodex[MAX_SKILL_LEVEL]; + int nocast; + int unit_id[2]; + int unit_layout_type[MAX_SKILL_LEVEL]; + int unit_range[MAX_SKILL_LEVEL]; + int unit_interval; + int unit_target; + int unit_flag; +}; +extern struct s_skill_db skill_db[MAX_SKILL_DB]; + +struct s_skill_unit_layout { + int count; + int dx[MAX_SKILL_UNIT_COUNT]; + int dy[MAX_SKILL_UNIT_COUNT]; +}; + +struct skill_timerskill { + int timer; + int src_id; + int target_id; + int map; + short x,y; + uint16 skill_id,skill_lv; + int type; // a BF_ type (NOTE: some places use this as general-purpose storage...) + int flag; +}; + +struct skill_unit_group { + int src_id; + int party_id; + int guild_id; + int bg_id; + int map; + int target_flag; //Holds BCT_* flag for battle_check_target + int bl_flag; //Holds BL_* flag for map_foreachin* functions + unsigned int tick; + int limit,interval; + + uint16 skill_id,skill_lv; + int val1,val2,val3; + char *valstr; + int unit_id; + int group_id; + int unit_count,alive_count; + int item_id; //store item used. + struct skill_unit *unit; + struct { + unsigned ammo_consume : 1; + unsigned song_dance : 2; //0x1 Song/Dance, 0x2 Ensemble + unsigned guildaura : 1; + } state; +}; + +struct skill_unit { + struct block_list bl; + + struct skill_unit_group *group; + + int limit; + int val1,val2; + short alive,range; +}; + +struct skill_unit_group_tickset { + unsigned int tick; + int id; +}; + +// Create Database item +struct s_skill_produce_db { + int nameid, trigger; + int req_skill,req_skill_lv,itemlv; + int mat_id[MAX_PRODUCE_RESOURCE],mat_amount[MAX_PRODUCE_RESOURCE]; +}; +extern struct s_skill_produce_db skill_produce_db[MAX_SKILL_PRODUCE_DB]; + +// Creating database arrow +struct s_skill_arrow_db { + int nameid, trigger; + int cre_id[MAX_ARROW_RESOURCE],cre_amount[MAX_ARROW_RESOURCE]; +}; +extern struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB]; + +// Abracadabra database +struct s_skill_abra_db { + uint16 skill_id; + int req_lv; + int per; +}; +extern struct s_skill_abra_db skill_abra_db[MAX_SKILL_ABRA_DB]; + +//GCross magic mushroom database +struct s_skill_magicmushroom_db { + uint16 skill_id; +}; +extern struct s_skill_magicmushroom_db skill_magicmushroom_db[MAX_SKILL_MAGICMUSHROOM_DB]; + /** - * Auto Shadow Spell (Shadow Chaser) + * Vars **/ -int skill_select_menu(struct map_session_data *sd,uint16 skill_id); +extern int enchant_eff[5]; +extern int deluge_eff[5]; +DBMap* skilldb_name2id; -int skill_elementalanalysis(struct map_session_data *sd, int n, uint16 skill_lv, unsigned short *item_list); // Sorcerer Four Elemental Analisys. -int skill_changematerial(struct map_session_data *sd, int n, unsigned short *item_list); // Genetic Change Material. -int skill_get_elemental_type(uint16 skill_id, uint16 skill_lv); +/** + * Skill.c Interface + **/ +struct skill_interface { + int (*init) (void); + int (*final) (void); + void (*reload) (void); + /* accesssors */ + int (*get_index) ( uint16 skill_id ); + int (*get_type) ( uint16 skill_id ); + int (*get_hit) ( uint16 skill_id ); + int (*get_inf) ( uint16 skill_id ); + int (*get_ele) ( uint16 skill_id, uint16 skill_lv ); + int (*get_nk) ( uint16 skill_id ); + int (*get_max) ( uint16 skill_id ); + int (*get_range) ( uint16 skill_id, uint16 skill_lv ); + int (*get_range2) (struct block_list *bl, uint16 skill_id, uint16 skill_lv); + int (*get_splash) ( uint16 skill_id, uint16 skill_lv ); + int (*get_hp) ( uint16 skill_id, uint16 skill_lv ); + int (*get_mhp) ( uint16 skill_id, uint16 skill_lv ); + int (*get_sp) ( uint16 skill_id, uint16 skill_lv ); + int (*get_state) (uint16 skill_id); + int (*get_zeny) ( uint16 skill_id, uint16 skill_lv ); + int (*get_num) ( uint16 skill_id, uint16 skill_lv ); + int (*get_cast) ( uint16 skill_id, uint16 skill_lv ); + int (*get_delay) ( uint16 skill_id, uint16 skill_lv ); + int (*get_walkdelay) ( uint16 skill_id, uint16 skill_lv ); + int (*get_time) ( uint16 skill_id, uint16 skill_lv ); + int (*get_time2) ( uint16 skill_id, uint16 skill_lv ); + int (*get_castnodex) ( uint16 skill_id, uint16 skill_lv ); + int (*get_delaynodex) ( uint16 skill_id ,uint16 skill_lv ); + int (*get_castdef) ( uint16 skill_id ); + int (*get_weapontype) ( uint16 skill_id ); + int (*get_ammotype) ( uint16 skill_id ); + int (*get_ammo_qty) ( uint16 skill_id, uint16 skill_lv ); + int (*get_nocast) ( uint16 skill_id ); + int (*get_unit_id) (uint16 skill_id,int flag); + int (*get_inf2) ( uint16 skill_id ); + int (*get_castcancel) ( uint16 skill_id ); + int (*get_maxcount) ( uint16 skill_id, uint16 skill_lv ); + int (*get_blewcount) ( uint16 skill_id, uint16 skill_lv ); + int (*get_unit_flag) ( uint16 skill_id ); + int (*get_unit_target) ( uint16 skill_id ); + int (*get_unit_interval) ( uint16 skill_id ); + int (*get_unit_bl_target) ( uint16 skill_id ); + int (*tree_get_max) ( uint16 skill_id, int b_class ); + const char* (*get_name) ( uint16 skill_id ); + const char* (*get_desc) ( uint16 skill_id ); + /* whether its CAST_GROUND, CAST_DAMAGE or CAST_NODAMAGE */ + int (*get_casttype) (uint16 skill_id); + int (*name2id) (const char* name); + int (*isammotype) (struct map_session_data *sd, int skill); + int (*castend_id) (int tid, unsigned int tick, int id, intptr_t data); + int (*castend_pos) (int tid, unsigned int tick, int id, intptr_t data); + int (*castend_map) ( struct map_session_data *sd,uint16 skill_id, const char *map); + int (*cleartimerskill) (struct block_list *src); + int (*addtimerskill) (struct block_list *src,unsigned int tick,int target,int x,int y,uint16 skill_id,uint16 skill_lv,int type,int flag); + int (*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 (*counter_additional_effect) ( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,unsigned int tick); + int (*blown) (struct block_list* src, struct block_list* target, int count, int8 dir, int flag); + int (*break_equip) (struct block_list *bl, unsigned short where, int rate, int flag); + int (*strip_equip) (struct block_list *bl, unsigned short where, int rate, int lv, int time); + struct skill_unit_group* (*id2group) (int group_id); + struct skill_unit_group *(*unitsetting) (struct block_list* src, uint16 skill_id, uint16 skill_lv, short x, short y, int flag); + struct skill_unit *(*initunit) (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2); + int (*delunit) (struct skill_unit *unit); + struct skill_unit_group *(*init_unitgroup) (struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval); + int (*del_unitgroup) (struct skill_unit_group *group, const char* file, int line, const char* func); + int (*clear_unitgroup) (struct block_list *src); + int (*clear_group) (struct block_list *bl, int flag); + int (*unit_onplace) (struct skill_unit *src, struct block_list *bl, unsigned int tick); + int (*unit_ondamaged) (struct skill_unit *src,struct block_list *bl,int damage,unsigned int tick); + int (*cast_fix) ( struct block_list *bl, uint16 skill_id, uint16 skill_lv); + int (*cast_fix_sc) ( struct block_list *bl, int time); +#ifdef RENEWAL_CAST + int (*vf_cast_fix) ( struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv); +#endif + int (*delay_fix) ( struct block_list *bl, uint16 skill_id, uint16 skill_lv); + int (*check_condition_castbegin) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); + int (*check_condition_castend) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); + int (*consume_requirement) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type); + struct skill_condition (*get_requirement) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); + int (*check_pc_partner) (struct map_session_data *sd, uint16 skill_id, short* skill_lv, int range, int cast_flag); + int (*unit_move) (struct block_list *bl,unsigned int tick,int flag); + int (*unit_onleft) (uint16 skill_id, struct block_list *bl,unsigned int tick); + int (*unit_onout) (struct skill_unit *src, struct block_list *bl, unsigned int tick); + //ake + int (*unit_move_unit_group) ( struct skill_unit_group *group, int16 m,int16 dx,int16 dy); + int (*guildaura_sub) (struct map_session_data* sd, int id, int strvit, int agidex); + int (*sit) (struct map_session_data *sd, int type); + void (*brandishspear) (struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag); + void (*repairweapon) (struct map_session_data *sd, int idx); + void (*identify) (struct map_session_data *sd,int idx); + void (*weaponrefine) (struct map_session_data *sd,int idx); + int (*autospell) (struct map_session_data *md,uint16 skill_id); + int (*calc_heal) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal); + bool (*check_cloaking) (struct block_list *bl, struct status_change_entry *sce); + int (*enchant_elemental_end) (struct block_list *bl, int type); + int (*not_ok) (uint16 skill_id, struct map_session_data *sd); + int (*not_ok_hom) (uint16 skill_id, struct homun_data *hd); + int (*not_ok_mercenary) (uint16 skill_id, struct mercenary_data *md); + int (*chastle_mob_changetarget) (struct block_list *bl,va_list ap); + int (*can_produce_mix) ( struct map_session_data *sd, int nameid, int trigger, int qty); + int (*produce_mix) ( struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty ); + int (*arrow_create) ( struct map_session_data *sd,int nameid); + int (*castend_nodamage_id) ( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag ); + int (*castend_damage_id) ( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag ); + int (*castend_pos2) ( struct block_list *src, int x,int y,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag); + int (*blockpc_start) (struct map_session_data*, uint16 skill_id, int, bool); + int (*blockhomun_start) (struct homun_data*,uint16 skill_id,int); + int (*blockmerc_start) (struct mercenary_data*,uint16 skill_id,int); + int (*attack) ( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag ); + int (*attack_area) (struct block_list *bl,va_list ap); + /* save new unit skill */ + void (*usave_add) (struct map_session_data * sd, uint16 skill_id, uint16 skill_lv); + /* trigger saved unit skills */ + void (*usave_trigger) (struct map_session_data *sd); + /* load all stored skill cool downs */ + void (*cooldown_load) (struct map_session_data * sd); + /* run spellbook of nameid id */ + int (*spellbook) (struct map_session_data *sd, int nameid); + /* */ + int (*block_check) (struct block_list *bl, enum sc_type type, uint16 skill_id); + int (*detonator) (struct block_list *bl, va_list ap); + bool (*check_camouflage) (struct block_list *bl, struct status_change_entry *sce); + int (*magicdecoy) (struct map_session_data *sd, int nameid); + int (*poisoningweapon) ( struct map_session_data *sd, int nameid); + int (*select_menu) (struct map_session_data *sd,uint16 skill_id); + int (*elementalanalysis) (struct map_session_data *sd, int n, uint16 skill_lv, unsigned short *item_list); + int (*changematerial) (struct map_session_data *sd, int n, unsigned short *item_list); + int (*get_elemental_type) (uint16 skill_id, uint16 skill_lv); +} skill_s; + +struct skill_interface *skill; + +void skill_defaults(void); #endif /* _SKILL_H_ */ diff --git a/src/map/status.c b/src/map/status.c index 2f4b11e13..79579fe05 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -91,10 +91,9 @@ static unsigned int StatusChangeStateTable[SC_MAX]; // status -> flags * @param skill The skill to look up * @return The status registered for this skill **/ -sc_type status_skill2sc(int skill) -{ - int idx = skill_get_index(skill); - if( idx == 0 ) { +sc_type status_skill2sc(int skill_id) { + int idx; + if( (idx = skill->get_index(skill_id)) == 0 ) { ShowError("status_skill2sc: Unsupported skill id %d\n", skill); return SC_NONE; } @@ -151,10 +150,9 @@ int status_type2relevant_bl_types(int type) // indicates that the status displays a visual effect for the affected unit, and should be sent to the client for all supported units #define set_sc_with_vfx(skill, sc, icon, flag) set_sc((skill), (sc), (icon), (flag)); if((icon) < SI_MAX) StatusRelevantBLTypes[(icon)] |= BL_SCEFFECT -static void set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) -{ - uint16 idx = skill_get_index(skill_id); - if( idx == 0 ) { +static void set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) { + uint16 idx; + if( (idx = skill->get_index(skill_id)) == 0 ) { ShowError("set_sc: Unsupported skill id %d\n", skill_id); return; } @@ -1153,7 +1151,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s } if (target->type == BL_SKILL) - return skill_unit_ondamaged((struct skill_unit *)target, src, hp, gettick()); + return skill->unit_ondamaged((struct skill_unit *)target, src, hp, gettick()); status = status_get_status_data(target); if( status == &dummy_status ) @@ -1207,9 +1205,9 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s status_change_end(target, SC_ENDURE, INVALID_TIMER); } if ((sce=sc->data[SC_GRAVITATION]) && sce->val3 == BCT_SELF) { - struct skill_unit_group* sg = skill_id2group(sce->val4); + struct skill_unit_group* sg = skill->id2group(sce->val4); if (sg) { - skill_delunitgroup(sg); + skill->del_unitgroup(sg, ALC_MARK); sce->val4 = 0; status_change_end(target, SC_GRAVITATION, INVALID_TIMER); } @@ -1285,7 +1283,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s status->hp = 0; if (battle_config.clear_unit_ondeath && battle_config.clear_unit_ondeath&target->type) - skill_clear_unitgroup(target); + skill->clear_unitgroup(target); if(target->type&BL_REGEN) { //Reset regen ticks. @@ -1301,7 +1299,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s if( sc && sc->data[SC_KAIZEL] && !map_flag_gvg(target->m) ) { //flag&8 = disable Kaizel - int time = skill_get_time2(SL_KAIZEL,sc->data[SC_KAIZEL]->val1); + 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 ) status_revive(target, 100, 100); @@ -1320,7 +1318,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s 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_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, 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 hp + sp; @@ -1347,8 +1345,8 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s unit_stop_walking(target,1); unit_skillcastcancel(target,0); clif_clearunit_area(target,CLR_DEAD); - skill_unit_move(target,gettick(),4); - skill_cleartimerskill(target); + skill->unit_move(target,gettick(),4); + skill->cleartimerskill(target); } return hp+sp; @@ -1589,7 +1587,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin if (skill_id != RK_REFRESH && sc->opt1 >0 && !(sc->opt1 == OPT1_CRYSTALIZE && src->type == BL_MOB) && sc->opt1 != OPT1_BURNING && skill_id != SR_GENTLETOUCH_CURE) { //Stuned/Frozen/etc if (flag != 1) //Can't cast, casted stuff can't damage. return 0; - if (!(skill_get_inf(skill_id)&INF_GROUND_SKILL)) + if (!(skill->get_inf(skill_id)&INF_GROUND_SKILL)) return 0; //Targetted spells can't come off. } @@ -1626,7 +1624,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin return 0; } else if(sc->data[SC_LONGING]) { //Allow everything except dancing/re-dancing. [Skotlex] if (skill_id == BD_ENCORE || - skill_get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_ENSEMBLE_SKILL) + skill->get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_ENSEMBLE_SKILL) ) return 0; } else { @@ -1651,8 +1649,8 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin sc->cant.cast || (sc->data[SC_MARIONETTE] && skill_id != CG_MARIONETTE) || //Only skill you can use is marionette again to cancel it (sc->data[SC_MARIONETTE2] && skill_id == CG_MARIONETTE) || //Cannot use marionette if you are being buffed by another - (sc->data[SC_STASIS] && skill_block_check(src, SC_STASIS, skill_id)) || - (sc->data[SC_KAGEHUMI] && skill_block_check(src, SC_KAGEHUMI, skill_id)) + (sc->data[SC_STASIS] && skill->block_check(src, SC_STASIS, skill_id)) || + (sc->data[SC_KAGEHUMI] && skill->block_check(src, SC_KAGEHUMI, skill_id)) )) return 0; @@ -1660,7 +1658,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin if ( (sc->data[SC_VOLCANO] && skill_id == WZ_ICEWALL) || (sc->data[SC_ROKISWEIL] && skill_id != BD_ADAPTATION) || - (sc->data[SC_HERMODE] && skill_get_inf(skill_id) & INF_SUPPORT_SKILL) || + (sc->data[SC_HERMODE] && skill->get_inf(skill_id) & INF_SUPPORT_SKILL) || (sc->data[SC_NOCHAT] && sc->data[SC_NOCHAT]->val1&MANNER_NOSKILL) ) return 0; @@ -1724,7 +1722,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin hide_flag = flag?OPTION_HIDE:(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK); //You cannot hide from ground skills. - if( skill_get_ele(skill_id,1) == ELE_EARTH ) //TODO: Need Skill Lv here :/ + if( skill->get_ele(skill_id,1) == ELE_EARTH ) //TODO: Need Skill Lv here :/ hide_flag &= ~OPTION_HIDE; switch( target->type ) { @@ -1752,7 +1750,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin case BL_HOM: case BL_MER: case BL_ELEM: - if( target->type == BL_HOM && skill_id && battle_config.hom_setting&0x1 && skill_get_inf(skill_id)&INF_SUPPORT_SKILL && battle->get_master(target) != src ) + if( target->type == BL_HOM && skill_id && battle_config.hom_setting&0x1 && skill->get_inf(skill_id)&INF_SUPPORT_SKILL && battle->get_master(target) != src ) return 0; // Can't use support skills on Homunculus (only Master/Self) if( target->type == BL_MER && (skill_id == PR_ASPERSIO || (skill_id >= SA_FLAMELAUNCHER && skill_id <= SA_SEISMICWEAPON)) && battle->get_master(target) != src ) return 0; // Can't use Weapon endow skills on Mercenary (only Master) @@ -5836,7 +5834,7 @@ defType status_get_def(struct block_list *bl) { int def = status?status->def:0; ud = unit_bl2ud(bl); if (ud && ud->skilltimer != INVALID_TIMER) - def -= def * skill_get_castdef(ud->skill_id)/100; + def -= def * skill->get_castdef(ud->skill_id)/100; return cap_value(def, DEFTYPE_MIN, DEFTYPE_MAX); } @@ -6579,7 +6577,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val return 0;//Overthrust and Overthrust Max cannot be used on Mado Gear [Ind] break; case SC_ADRENALINE: - if(sd && !pc_check_weapontype(sd,skill_get_weapontype(BS_ADRENALINE))) + if(sd && !pc_check_weapontype(sd,skill->get_weapontype(BS_ADRENALINE))) return 0; if (sc->data[SC_QUAGMIRE] || sc->data[SC_DECREASEAGI] || @@ -6588,7 +6586,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val return 0; break; case SC_ADRENALINE2: - if(sd && !pc_check_weapontype(sd,skill_get_weapontype(BS_ADRENALINE2))) + if(sd && !pc_check_weapontype(sd,skill->get_weapontype(BS_ADRENALINE2))) return 0; if (sc->data[SC_QUAGMIRE] || sc->data[SC_DECREASEAGI] @@ -6626,7 +6624,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val //Due to the cloaking card, we have to check the wall versus to known //skill level rather than the used one. [Skotlex] //if (sd && val1 < 3 && skill_check_cloaking(bl,NULL)) - if( sd && pc_checkskill(sd, AS_CLOAKING) < 3 && !skill_check_cloaking(bl,NULL) ) + if( sd && pc_checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(bl,NULL) ) return 0; break; case SC_MODECHANGE: @@ -6767,7 +6765,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val return 0; break; case SC_CAMOUFLAGE: - if( sd && pc_checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill_check_camouflage(bl,NULL) ) + if( sd && pc_checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill->check_camouflage(bl,NULL) ) return 0; break; case SC__STRIPACCESSORY: @@ -7265,7 +7263,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_EARTHWEAPON: case SC_SHADOWWEAPON: case SC_GHOSTWEAPON: - skill_enchant_elemental_end(bl,type); + skill->enchant_elemental_end(bl,type); break; case SC_ELEMENTALCHANGE: // val1 : Element Lvl (if called by skill lvl 1, takes random value between 1 and 4) @@ -7517,7 +7515,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_SIGHT: /* splash status */ case SC_RUWACH: case SC_SIGHTBLASTER: - val3 = skill_get_splash(val2, val1); //Val2 should bring the skill-id. + val3 = skill->get_splash(val2, val1); //Val2 should bring the skill-id. val2 = tick/250; tick_time = 10; // [GodLesZ] tick time break; @@ -7606,7 +7604,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_BLEEDING,100,val1,val3,skill_get_time2(status_sc2skill(type),val1)); + sc_start2(bl,SC_BLEEDING,100,val1,val3,skill->get_time2(status_sc2skill(type),val1)); break; case SC_BERSERK: @@ -7615,7 +7613,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC__BLOODYLUST: //HP healing is performing after the calc_status call. //Val2 holds HP penalty - if (!val4) val4 = skill_get_time2(status_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 @@ -7705,7 +7703,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val { 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)); + sc_start(bl, type2, 100, d_sc->data[type2]->val1, skill->get_time(status_sc2skill(type2),d_sc->data[type2]->val1)); i--; } } @@ -7918,7 +7916,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_UTSUSEMI: val2=(val1+1)/2; // number of hits blocked - val3=skill_get_blewcount(NJ_UTSUSEMI, val1); //knockback value. + val3=skill->get_blewcount(NJ_UTSUSEMI, val1); //knockback value. break; case SC_BUNSINJYUTSU: val2=(val1+1)/2; // number of hits blocked @@ -7944,7 +7942,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_ENCHANTARMS: //end previous enchants - skill_enchant_elemental_end(bl,type); + skill->enchant_elemental_end(bl,type); //Make sure the received element is valid. if (val2 >= ELE_MAX) val2 = val2%ELE_MAX; @@ -8299,7 +8297,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_SATURDAYNIGHTFEVER: - if (!val4) val4 = skill_get_time2(status_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 @@ -8322,7 +8320,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if( sd && !pc_issit(sd) ) { pc_setsit(sd); - skill_sit(sd,1); + skill->sit(sd,1); clif_sitting(bl); } break; @@ -9161,7 +9159,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const } case SC_PYROCLASTIC: if(bl->type == BL_PC) - skill_break_equip(bl,EQP_WEAPON,10000,BCT_SELF); + skill->break_equip(bl,EQP_WEAPON,10000,BCT_SELF); break; case SC_WEDDING: case SC_XMAS: @@ -9200,7 +9198,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const DIFF_TICK(gettick(), sce->val4) <= 1000 && (!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0)) ) - sc_start(bl,SC_SPURT,100,sce->val1,skill_get_time2(status_sc2skill(type), sce->val1)); + sc_start(bl,SC_SPURT,100,sce->val1,skill->get_time2(status_sc2skill(type), sce->val1)); } break; case SC_AUTOBERSERK: @@ -9302,7 +9300,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if(sce->val2) {// erase associated land skill - group = skill_id2group(sce->val2); + group = skill->id2group(sce->val2); if( group == NULL ) { @@ -9315,7 +9313,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const } sce->val2 = 0; - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); } if((sce->val1&0xFFFF) == CG_MOONLIT) @@ -9337,7 +9335,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const { struct block_list *src=map_id2bl(sce->val3); if(src && tid != INVALID_TIMER) - skill_castend_damage_id(src, bl, sce->val2, sce->val1, gettick(), SD_LEVEL ); + skill->castend_damage_id(src, bl, sce->val2, sce->val1, gettick(), SD_LEVEL ); } break; case SC_CLOSECONFINE2: @@ -9355,8 +9353,8 @@ 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, status_sc2skill(type), sce->val1) - +skill_get_range2(bl, TF_BACKSLIDING, 1); //Since most people use this to escape the hold.... + +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.... map_foreachinarea(status_change_timer_sub, bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,sce,type,gettick()); } @@ -9410,23 +9408,23 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const status_change_end(bl, SC_ENDURE, INVALID_TIMER); } case SC__BLOODYLUST: - sc_start4(bl, SC_REGENERATION, 100, 10,0,0,(RGN_HP|RGN_SP), skill_get_time(LK_BERSERK, sce->val1)); + sc_start4(bl, SC_REGENERATION, 100, 10,0,0,(RGN_HP|RGN_SP), skill->get_time(LK_BERSERK, sce->val1)); if( type == SC_SATURDAYNIGHTFEVER ) //Sit down force of Saturday Night Fever has the duration of only 3 seconds. - sc_start(bl,SC_SITDOWN_FORCE,100,sce->val1,skill_get_time2(WM_SATURDAY_NIGHT_FEVER,sce->val1)); + sc_start(bl,SC_SITDOWN_FORCE,100,sce->val1,skill->get_time2(WM_SATURDAY_NIGHT_FEVER,sce->val1)); break; case SC_GOSPEL: if (sce->val3) { //Clear the group. - struct skill_unit_group* group = skill_id2group(sce->val3); + struct skill_unit_group* group = skill->id2group(sce->val3); sce->val3 = 0; - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); } break; case SC_HERMODE: if(sce->val3 == BCT_SELF) - skill_clear_unitgroup(bl); + skill->clear_unitgroup(bl); break; case SC_BASILICA: //Clear the skill area. [Skotlex] - skill_clear_unitgroup(bl); + skill->clear_unitgroup(bl); break; case SC_TRICKDEAD: if (vd) vd->dead_sit = 0; @@ -9434,10 +9432,10 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const case SC_WARM: case SC__MANHOLE: if (sce->val4) { //Clear the group. - struct skill_unit_group* group = skill_id2group(sce->val4); + struct skill_unit_group* group = skill->id2group(sce->val4); sce->val4 = 0; if( group ) /* might have been cleared before status ended, e.g. land protector */ - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); } break; case SC_KAAHI: @@ -9485,7 +9483,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const clif_millenniumshield(sd,0); break; case SC_HALLUCINATIONWALK: - sc_start(bl,SC_HALLUCINATIONWALK_POSTDELAY,100,sce->val1,skill_get_time2(GC_HALLUCINATIONWALK,sce->val1)); + sc_start(bl,SC_HALLUCINATIONWALK_POSTDELAY,100,sce->val1,skill->get_time2(GC_HALLUCINATIONWALK,sce->val1)); break; case SC_WHITEIMPRISON: { @@ -9524,18 +9522,18 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const case SC_NEUTRALBARRIER_MASTER: case SC_STEALTHFIELD_MASTER: if( sce->val2 ) { - struct skill_unit_group* group = skill_id2group(sce->val2); + struct skill_unit_group* group = skill->id2group(sce->val2); sce->val2 = 0; if( group ) /* might have been cleared before status ended, e.g. land protector */ - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); } break; case SC_BANDING: if(sce->val4) { - struct skill_unit_group *group = skill_id2group(sce->val4); + struct skill_unit_group *group = skill->id2group(sce->val4); sce->val4 = 0; if( group ) /* might have been cleared before status ended, e.g. land protector */ - skill_delunitgroup(group); + skill->del_unitgroup(group,ALC_MARK); } break; case SC_CURSEDCIRCLE_ATKER: @@ -9549,7 +9547,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const pc_delspiritball(sd, sd->spiritball, 0); status_change_end(bl, SC_EXPLOSIONSPIRITS, INVALID_TIMER); while( i > 0 ) { - pc_addspiritball(sd, skill_get_time(MO_CALLSPIRITS, pc_checkskill(sd,MO_CALLSPIRITS)), 5); + pc_addspiritball(sd, skill->get_time(MO_CALLSPIRITS, pc_checkskill(sd,MO_CALLSPIRITS)), 5); --i; } } @@ -9763,7 +9761,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const status_calc_bl(bl,calc_flag); if(opt_flag&4) //Out of hiding, invoke on place. - skill_unit_move(bl,gettick(),1); + skill->unit_move(bl,gettick(),1); if(opt_flag&2 && sd && map_getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) npc_touch_areanpc(sd,bl->m,bl->x,bl->y); //Trigger on-touch event. @@ -9865,7 +9863,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) if (!sc->data[SC_INCSTR]) { sc_start(bl, SC_INCSTR,100,1<<(sce->val1-1), (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_ROGUE?10:1) //SL bonus -> x10 duration - *skill_get_time2(status_sc2skill(type),sce->val1)); + *skill->get_time2(status_sc2skill(type),sce->val1)); } sc_timer_next(sce->val2+tick, status_change_timer, bl->id, data); return 0; @@ -10210,15 +10208,15 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) } while( mushroom_skill_id == 0 ); - switch( skill_get_casttype(mushroom_skill_id) ) { // Magic Mushroom skills are buffs or area damage + switch( skill->get_casttype(mushroom_skill_id) ) { // Magic Mushroom skills are buffs or area damage case CAST_GROUND: - skill_castend_pos2(bl,bl->x,bl->y,mushroom_skill_id,1,tick,0); + skill->castend_pos2(bl,bl->x,bl->y,mushroom_skill_id,1,tick,0); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(bl,bl,mushroom_skill_id,1,tick,0); + skill->castend_nodamage_id(bl,bl,mushroom_skill_id,1,tick,0); break; case CAST_DAMAGE: - skill_castend_damage_id(bl,bl,mushroom_skill_id,1,tick,0); + skill->castend_damage_id(bl,bl,mushroom_skill_id,1,tick,0); break; } } @@ -10669,7 +10667,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); status_change_end(bl, SC__INVISIBILITY, INVALID_TIMER); if(battle->check_target( src, bl, BCT_ENEMY ) > 0) - skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,1,tick,0); + skill->attack(BF_MAGIC,src,src,bl,AL_RUWACH,1,tick,0); } if( tsc && tsc->data[SC__SHADOWFORM] && (sce && sce->val4 >0 && sce->val4%2000 == 0) && // for every 2 seconds do the checking rnd()%100 < 100-tsc->data[SC__SHADOWFORM]->val1*10 ) // [100 - (Skill Level x 10)] % @@ -10680,7 +10678,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) 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. } } @@ -11101,7 +11099,7 @@ static int status_natural_heal(struct block_list* bl, va_list args) sd->state.doridori = 0; if ((rate = pc_checkskill(sd,TK_SPTIME))) sc_start(bl,status_skill2sc(TK_SPTIME), - 100,rate,skill_get_time(TK_SPTIME, rate)); + 100,rate,skill->get_time(TK_SPTIME, rate)); if ( (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && rnd()%10000 < battle_config.sg_angel_skill_ratio diff --git a/src/map/unit.c b/src/map/unit.c index b2d4f569a..c9d6ab165 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -497,8 +497,8 @@ int unit_run(struct block_list *bl) unit_bl2ud(bl)->state.running = 0; status_change_end(bl, SC_RUN, INVALID_TIMER); - skill_blown(bl,bl,skill_get_blewcount(TK_RUN,lv),unit_getdir(bl),0); - clif_fixpos(bl); //Why is a clif_slide (skill_blown) AND a fixpos needed? Ask Aegis. + skill->blown(bl,bl,skill->get_blewcount(TK_RUN,lv),unit_getdir(bl),0); + clif_fixpos(bl); //Why is a clif_slide (skill->blown) AND a fixpos needed? Ask Aegis. clif_status_change(bl, SI_BUMP, 0, 0, 0, 0, 0); return 0; } @@ -509,7 +509,7 @@ int unit_run(struct block_list *bl) to_x -= dir_x; to_y -= dir_y; } while (--i > 0 && !unit_walktoxy(bl, to_x, to_y, 1)); - if (i==0) { + if ( i == 0 ) { // copy-paste from above clif_status_change(bl, SI_BUMP, 1, 0, 0, 0, 0); @@ -517,7 +517,7 @@ int unit_run(struct block_list *bl) unit_bl2ud(bl)->state.running = 0; status_change_end(bl, SC_RUN, INVALID_TIMER); - skill_blown(bl,bl,skill_get_blewcount(TK_RUN,lv),unit_getdir(bl),0); + skill->blown(bl,bl,skill->get_blewcount(TK_RUN,lv),unit_getdir(bl),0); clif_fixpos(bl); clif_status_change(bl, SI_BUMP, 0, 0, 0, 0, 0); return 0; @@ -567,7 +567,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) { if( sd ){ clif_fixpos(bl); - skill_castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, gettick(), SD_LEVEL); + skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, gettick(), SD_LEVEL); } return 0; } @@ -584,7 +584,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) { if( sd ){ clif_fixpos(bl); - skill_castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, gettick(), SD_LEVEL); + skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, gettick(), SD_LEVEL); } return 0; } @@ -722,7 +722,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag) map_foreachinmovearea(clif_outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl); if(su) { - skill_unit_move_unit_group(su->group, bl->m, dx, dy); + skill->unit_move_unit_group(su->group, bl->m, dx, dy); } else { map_moveblock(bl, nx, ny, gettick()); } @@ -809,7 +809,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) if (bl->m != m && battle_config.clear_unit_onwarp && battle_config.clear_unit_onwarp&bl->type) - skill_clear_unitgroup(bl); + skill->clear_unitgroup(bl); bl->x=ud->to_x=x; bl->y=ud->to_y=y; @@ -817,7 +817,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) map_addblock(bl); clif_spawn(bl); - skill_unit_move(bl,gettick(),1); + skill->unit_move(bl,gettick(),1); return 0; } @@ -877,8 +877,8 @@ int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uin { return unit_skilluse_id2( src, target_id, skill_id, skill_lv, - skill_castfix(src, skill_id, skill_lv), - skill_get_castcancel(skill_id) + skill->cast_fix(src, skill_id, skill_lv), + skill->get_castcancel(skill_id) ); } @@ -906,7 +906,7 @@ int unit_can_move(struct block_list *bl) { if (!ud) return 0; - if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skill_id)&INF2_GUILD_SKILL)) + if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill->get_inf2(ud->skill_id)&INF2_GUILD_SKILL)) return 0; // prevent moving while casting if (DIFF_TICK(ud->canmove_tick, gettick()) > 0) @@ -1040,19 +1040,19 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui //temp: used to signal combo-skills right now. if (sc && sc->data[SC_COMBO] && (sc->data[SC_COMBO]->val1 == skill_id || - (sd?skill_check_condition_castbegin(sd,skill_id,skill_lv):0) )) { + (sd?skill->check_condition_castbegin(sd,skill_id,skill_lv):0) )) { if (sc->data[SC_COMBO]->val2) target_id = sc->data[SC_COMBO]->val2; else target_id = ud->target; - if( skill_get_inf(skill_id)&INF_SELF_SKILL && skill_get_nk(skill_id)&NK_NO_DAMAGE )// exploit fix + if( skill->get_inf(skill_id)&INF_SELF_SKILL && skill->get_nk(skill_id)&NK_NO_DAMAGE )// exploit fix target_id = src->id; temp = 1; } else if ( target_id == src->id && - skill_get_inf(skill_id)&INF_SELF_SKILL && - skill_get_inf2(skill_id)&INF2_NO_TARGET_SELF ) + skill->get_inf(skill_id)&INF_SELF_SKILL && + skill->get_inf2(skill_id)&INF2_NO_TARGET_SELF ) { target_id = ud->target; //Auto-select target. [Skotlex] temp = 1; @@ -1060,7 +1060,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if (sd) { //Target_id checking. - if(skillnotok(skill_id, sd)) // [MouseJstr] + if(skill->not_ok(skill_id, sd)) // [MouseJstr] return 0; switch(skill_id) @@ -1110,7 +1110,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if(ud->skilltimer != INVALID_TIMER && skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return 0; - if(skill_get_inf2(skill_id)&INF2_NO_TARGET_SELF && src->id == target_id) + if(skill->get_inf2(skill_id)&INF2_NO_TARGET_SELF && src->id == target_id) return 0; if(!status_check_skilluse(src, target, skill_id, 0)) @@ -1120,7 +1120,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui // Record the status of the previous skill) if(sd) { - if( (skill_get_inf2(skill_id)&INF2_ENSEMBLE_SKILL) && skill_check_pc_partner(sd, skill_id, &skill_lv, 1, 0) < 1 ) { + if( (skill->get_inf2(skill_id)&INF2_ENSEMBLE_SKILL) && skill->check_pc_partner(sd, skill_id, &skill_lv, 1, 0) < 1 ) { clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -1153,13 +1153,12 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui sd->skill_lv_old = skill_lv; break; } - if (!skill_check_condition_castbegin(sd, skill_id, skill_lv)) + if (!skill->check_condition_castbegin(sd, skill_id, skill_lv)) return 0; } if( src->type == BL_MOB ) - switch( skill_id ) - { + switch( skill_id ) { case NPC_SUMMONSLAVE: case NPC_SUMMONMONSTER: case AL_TELEPORT: @@ -1170,12 +1169,12 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if (src->type == BL_NPC) // NPC-objects can override cast distance range = AREA_SIZE; // Maximum visible distance before NPC goes out of sight else - range = skill_get_range2(src, skill_id, skill_lv); // Skill cast distance from database + range = skill->get_range2(src, skill_id, skill_lv); // Skill cast distance from database //Check range when not using skill on yourself or is a combo-skill during attack //(these are supposed to always have the same range as your attack) if( src->id != target_id && (!temp || ud->attacktimer == INVALID_TIMER) ) { - if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) { + if( skill->get_state(ud->skill_id) == ST_MOVE_ENABLE ) { if( !unit_can_reach_bl(src, target, range + 1, 1, NULL, NULL) ) return 0; // Walk-path check failed. } else if( src->type == BL_MER && skill_id == MA_REMOVETRAP ) { @@ -1273,10 +1272,10 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui // moved here to prevent Suffragium from ending if skill fails #ifndef RENEWAL_CAST - if (!(skill_get_castnodex(skill_id, skill_lv)&2)) - casttime = skill_castfix_sc(src, casttime); + if (!(skill->get_castnodex(skill_id, skill_lv)&2)) + casttime = skill->cast_fix_sc(src, casttime); #else - casttime = skill_vfcastfix(src, casttime, skill_id, skill_lv); + casttime = skill->vf_cast_fix(src, casttime, skill_id, skill_lv); #endif if (src->type == BL_NPC) { // NPC-objects do not have cast time @@ -1286,7 +1285,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if(!ud->state.running) //need TK_RUN or WUGDASH handler to be done before that, see bugreport:6026 unit_stop_walking(src,1);// eventhough this is not how official works but this will do the trick. bugreport:6829 // in official this is triggered even if no cast time. - clif_skillcasting(src, src->id, target_id, 0,0, skill_id, skill_get_ele(skill_id, skill_lv), casttime); + clif_skillcasting(src, src->id, target_id, 0,0, skill_id, skill->get_ele(skill_id, skill_lv), casttime); if( casttime > 0 || temp ) { if (sd && target->type == BL_MOB) @@ -1321,7 +1320,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if( casttime <= 0 ) ud->state.skillcastcancel = 0; - if( !sd || sd->skillitem != skill_id || skill_get_cast(skill_id,skill_lv) ) + if( !sd || sd->skillitem != skill_id || skill->get_cast(skill_id,skill_lv) ) ud->canact_tick = tick + casttime + 100; if( sd ) { @@ -1352,14 +1351,12 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui } - if( casttime > 0 ) - { - ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 ); + if( casttime > 0 ) { + ud->skilltimer = add_timer( tick+casttime, skill->castend_id, src->id, 0 ); if( sd && (pc_checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) ) status_calc_bl(&sd->bl, SCB_SPEED); - } - else - skill_castend_id(ud->skilltimer,tick,src->id,0); + } else + skill->castend_id(ud->skilltimer,tick,src->id,0); return 1; } @@ -1368,8 +1365,8 @@ int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint { return unit_skilluse_pos2( src, skill_x, skill_y, skill_id, skill_lv, - skill_castfix(src, skill_id, skill_lv), - skill_get_castcancel(skill_id) + skill->cast_fix(src, skill_id, skill_lv), + skill->get_castcancel(skill_id) ); } @@ -1400,7 +1397,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui if( sd ) { - if( skillnotok(skill_id, sd) || !skill_check_condition_castbegin(sd, skill_id, skill_lv) ) + if( skill->not_ok(skill_id, sd) || !skill->check_condition_castbegin(sd, skill_id, skill_lv) ) return 0; /** * "WHY IS IT HEREE": pneuma cannot be cancelled past this point, the client displays the animation even, @@ -1430,24 +1427,22 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui if (src->type == BL_NPC) // NPC-objects can override cast distance range = AREA_SIZE; // Maximum visible distance before NPC goes out of sight else - range = skill_get_range2(src, skill_id, skill_lv); // Skill cast distance from database + range = skill->get_range2(src, skill_id, skill_lv); // Skill cast distance from database - if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) - { + if( skill->get_state(ud->skill_id) == ST_MOVE_ENABLE ) { if( !unit_can_reach_bl(src, &bl, range + 1, 1, NULL, NULL) ) return 0; //Walk-path check failed. - } - else if( !battle->check_range(src, &bl, range + 1) ) + } else if( !battle->check_range(src, &bl, range + 1) ) return 0; //Arrow-path check failed. unit_stop_attack(src); // moved here to prevent Suffragium from ending if skill fails #ifndef RENEWAL_CAST - if (!(skill_get_castnodex(skill_id, skill_lv)&2)) - casttime = skill_castfix_sc(src, casttime); + if (!(skill->get_castnodex(skill_id, skill_lv)&2)) + casttime = skill->cast_fix_sc(src, casttime); #else - casttime = skill_vfcastfix(src, casttime, skill_id, skill_lv ); + casttime = skill->vf_cast_fix(src, casttime, skill_id, skill_lv ); #endif if (src->type == BL_NPC) { // NPC-objects do not have cast time @@ -1455,7 +1450,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui } ud->state.skillcastcancel = castcancel&&casttime>0?1:0; - if( !sd || sd->skillitem != skill_id || skill_get_cast(skill_id,skill_lv) ) + if( !sd || sd->skillitem != skill_id || skill->get_cast(skill_id,skill_lv) ) ud->canact_tick = tick + casttime + 100; // if( sd ) // { @@ -1486,17 +1481,14 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui unit_stop_walking(src,1); // in official this is triggered even if no cast time. - clif_skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill_get_ele(skill_id, skill_lv), casttime); - if( casttime > 0 ) - { - ud->skilltimer = add_timer( tick+casttime, skill_castend_pos, src->id, 0 ); + clif_skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill->get_ele(skill_id, skill_lv), casttime); + if( casttime > 0 ) { + ud->skilltimer = add_timer( tick+casttime, skill->castend_pos, src->id, 0 ); if( (sd && pc_checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK) status_calc_bl(&sd->bl, SCB_SPEED); - } - else - { + } else { ud->skilltimer = INVALID_TIMER; - skill_castend_pos(ud->skilltimer,tick,src->id,0); + skill->castend_pos(ud->skilltimer,tick,src->id,0); } return 1; } @@ -1886,7 +1878,7 @@ int unit_skillcastcancel(struct block_list *bl,int type) struct map_session_data *sd = NULL; struct unit_data *ud = unit_bl2ud( bl); unsigned int tick=gettick(); - int ret=0, skill; + int ret=0, skill_id; nullpo_ret(bl); if (!ud || ud->skilltimer == INVALID_TIMER) @@ -1907,15 +1899,15 @@ int unit_skillcastcancel(struct block_list *bl,int type) ud->canact_tick = tick; if(type&1 && sd) - skill = sd->skill_id_old; + skill_id = sd->skill_id_old; else - skill = ud->skill_id; + skill_id = ud->skill_id; - if (skill_get_inf(skill) & INF_GROUND_SKILL) - ret=delete_timer( ud->skilltimer, skill_castend_pos ); + if (skill->get_inf(skill_id) & INF_GROUND_SKILL) + ret = delete_timer( ud->skilltimer, skill->castend_pos ); else - ret=delete_timer( ud->skilltimer, skill_castend_id ); - if(ret<0) + ret = delete_timer( ud->skilltimer, skill->castend_id ); + if( ret < 0 ) ShowError("delete timer error : skill_id : %d\n",ret); ud->skilltimer = INVALID_TIMER; @@ -1923,13 +1915,11 @@ int unit_skillcastcancel(struct block_list *bl,int type) if( sd && pc_checkskill(sd,SA_FREECAST) > 0 ) status_calc_bl(&sd->bl, SCB_SPEED); - if( sd ) - { - switch( skill ) - { - case CG_ARROWVULCAN: - sd->canequip_tick = tick; - break; + if( sd ) { + switch( skill_id ) { + case CG_ARROWVULCAN: + sd->canequip_tick = tick; + break; } } @@ -2063,8 +2053,8 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, } if (bl->type&(BL_CHAR|BL_PET)) { - skill_unit_move(bl,gettick(),4); - skill_cleartimerskill(bl); + skill->unit_move(bl,gettick(),4); + skill->cleartimerskill(bl); } switch( bl->type ) { @@ -2114,7 +2104,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, if(pc_issit(sd)) { pc_setstand(sd); - skill_sit(sd,0); + skill->sit(sd,0); } party_send_dot_remove(sd);//minimap dot fix [Kevin] guild_send_dot_remove(sd); @@ -2493,7 +2483,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) } } - skill_clear_unitgroup(bl); + skill->clear_unitgroup(bl); status_change_clear(bl,1); map_deliddb(bl); if( bl->type != BL_PC ) //Players are handled by map_quit |