diff options
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 3669 |
1 files changed, 1837 insertions, 1832 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index 06bfca5f8..685fec353 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -189,57 +189,66 @@ void skill_chk(int16* skill_id) { } #define skill_get(var,id) { skill->chk(&id); if(!id) return 0; return var; } -#define skill_get2(var,id,lv) { skill->chk(&id); if(!id) return 0; if( lv > MAX_SKILL_LEVEL ) { int lv2 = lv; lv = skill_db[id].max; return (var) + (lv2-lv); } return var; } +#define skill_get2(var,id,lv) { \ + skill->chk(&id); \ + if(!id) return 0; \ + if( lv >= MAX_SKILL_LEVEL && var > 1 ) { \ + int lv2 = lv; lv = skill_db[id].max; \ + return (var) + (lv2-lv);\ + } \ + return var;\ +} +#define skill_glv(lv) min(lv,MAX_SKILL_LEVEL-1) // Skill DB int skill_get_hit( uint16 skill_id ) { skill_get (skill_db[skill_id].hit, skill_id); } int skill_get_inf( uint16 skill_id ) { skill_get (skill_db[skill_id].inf, skill_id); } -int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill_db[skill_id].element[skill_lv-1], skill_id, skill_lv); } +int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { skill_get (skill_db[skill_id].element[skill_glv(skill_lv-1)], skill_id); } int skill_get_nk( uint16 skill_id ) { skill_get (skill_db[skill_id].nk, skill_id); } int skill_get_max( uint16 skill_id ) { skill_get (skill_db[skill_id].max, skill_id); } -int skill_get_range( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill_db[skill_id].range[skill_lv-1], skill_id, skill_lv); } -int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { skill_get2 ( (skill_db[skill_id].splash[skill_lv-1]>=0?skill_db[skill_id].splash[skill_lv-1]:AREA_SIZE), skill_id, skill_lv); } -int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp[skill_lv-1], skill_id, skill_lv); } -int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp[skill_lv-1], skill_id, skill_lv); } -int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp_rate[skill_lv-1], skill_id, skill_lv); } -int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp_rate[skill_lv-1], skill_id, skill_lv); } +int skill_get_range( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill_db[skill_id].range[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { skill_get2 ( (skill_db[skill_id].splash[skill_glv(skill_lv-1)]>=0?skill_db[skill_id].splash[skill_glv(skill_lv-1)]:AREA_SIZE), skill_id, skill_lv); } +int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } int skill_get_state(uint16 skill_id) { skill_get (skill_db[skill_id].state, skill_id); } -int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { skill_get2 (skill_db[skill_id].spiritball[skill_lv-1], skill_id, skill_lv); } +int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { skill_get2 (skill_db[skill_id].spiritball[skill_glv(skill_lv-1)], skill_id, skill_lv); } int skill_get_itemid(uint16 skill_id, int idx) { skill_get (skill_db[skill_id].itemid[idx], skill_id); } int skill_get_itemqty(uint16 skill_id, int idx) { skill_get (skill_db[skill_id].amount[idx], skill_id); } -int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].zeny[skill_lv-1], skill_id, skill_lv); } -int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].num[skill_lv-1], skill_id, skill_lv); } -int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cast[skill_lv-1], skill_id, skill_lv); } -int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].delay[skill_lv-1], skill_id, skill_lv); } -int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].walkdelay[skill_lv-1], skill_id, skill_lv); } -int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time[skill_lv-1], skill_id, skill_lv); } -int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time2[skill_lv-1], skill_id, skill_lv); } +int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].zeny[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].num[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cast[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].delay[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].walkdelay[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time2[skill_glv(skill_lv-1)], skill_id, skill_lv); } int skill_get_castdef( uint16 skill_id ) { skill_get (skill_db[skill_id].cast_def_rate, skill_id); } int skill_get_weapontype( uint16 skill_id ) { skill_get (skill_db[skill_id].weapon, skill_id); } int skill_get_ammotype( uint16 skill_id ) { skill_get (skill_db[skill_id].ammo, skill_id); } -int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].ammo_qty[skill_lv-1], skill_id, skill_lv); } +int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].ammo_qty[skill_glv(skill_lv-1)], skill_id, skill_lv); } int skill_get_inf2( uint16 skill_id ) { skill_get (skill_db[skill_id].inf2, skill_id); } int skill_get_castcancel( uint16 skill_id ) { skill_get (skill_db[skill_id].castcancel, skill_id); } -int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].maxcount[skill_lv-1], skill_id, skill_lv); } -int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].blewcount[skill_lv-1], skill_id, skill_lv); } -int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].mhp[skill_lv-1], skill_id, skill_lv); } -int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].castnodex[skill_lv-1], skill_id, skill_lv); } -int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].delaynodex[skill_lv-1], skill_id, skill_lv); } +int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].maxcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].blewcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].mhp[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].castnodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].delaynodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } int skill_get_type( uint16 skill_id ) { skill_get (skill_db[skill_id].skill_type, skill_id); } int skill_get_unit_id ( uint16 skill_id, int flag ){ skill_get (skill_db[skill_id].unit_id[flag], skill_id); } int skill_get_unit_interval( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_interval, skill_id); } -int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].unit_range[skill_lv-1], skill_id, skill_lv); } +int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].unit_range[skill_glv(skill_lv-1)], skill_id, skill_lv); } int skill_get_unit_target( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_target&BCT_ALL, skill_id); } int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_target&BL_ALL, skill_id); } int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_flag, skill_id); } -int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].unit_layout_type[skill_lv-1], skill_id, skill_lv); } -int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cooldown[skill_lv-1], skill_id, skill_lv); } +int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].unit_layout_type[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cooldown[skill_glv(skill_lv-1)], skill_id, skill_lv); } #ifdef RENEWAL_CAST -int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].fixed_cast[skill_lv-1], skill_id, skill_lv); } +int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].fixed_cast[skill_glv(skill_lv-1)], skill_id, skill_lv); } #endif int skill_tree_get_max(uint16 skill_id, int b_class) { int i; - b_class = pc_class2idx(b_class); + b_class = pc->class2idx(b_class); ARR_FIND( 0, MAX_SKILL_TREE, i, skill_tree[b_class][i].id == 0 || skill_tree[b_class][i].id == skill_id ); if( i < MAX_SKILL_TREE && skill_tree[b_class][i].id == skill_id ) @@ -313,7 +322,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { case RA_AIMEDBOLT: case RA_WUGBITE: if( bl->type == BL_PC ) - range += pc_checkskill((TBL_PC*)bl, AC_VULTURE); + range += pc->checkskill((TBL_PC*)bl, AC_VULTURE); else range += 10; //Assume level 10? break; @@ -324,20 +333,19 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { case GS_SPREADATTACK: case GS_GROUNDDRIFT: if (bl->type == BL_PC) - range += pc_checkskill((TBL_PC*)bl, GS_SNAKEEYE); + 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)); + 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: @@ -346,9 +354,10 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { case WL_COMET: case WL_CHAINLIGHTNING: case WL_TETRAVORTEX: + case WL_EARTHSTRAIN: case WL_RELEASE: if( bl->type == BL_PC ) - range += pc_checkskill((TBL_PC*)bl, WL_RADIUS); + range += pc->checkskill((TBL_PC*)bl, WL_RADIUS); break; /** * Ranger Bonus @@ -361,7 +370,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: if( bl->type == BL_PC ) - range += (1 + pc_checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2; + range += (1 + pc->checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2; } if( !range && bl->type != BL_PC ) @@ -376,14 +385,14 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk struct status_change* sc; switch( skill_id ) { - case BA_APPLEIDUN: + case BA_APPLEIDUN: #ifdef RENEWAL - hp = 100+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery + hp = 100+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery #else - hp = 30+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery + hp = 30+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery #endif - if( sd ) - hp += 5*pc_checkskill(sd,BA_MUSICALLESSON); + if( sd ) + hp += 5*pc->checkskill(sd,BA_MUSICALLESSON); break; case PR_SANCTUARY: hp = (skill_lv>6)?777:skill_lv*100; @@ -397,13 +406,13 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk #ifdef RENEWAL /** * Renewal Heal Formula - * Formula: ( [(Base Level + INT) / 5] × 30 ) × (Heal Level / 10) × (Modifiers) + MATK + * Formula: ( [(Base Level + INT) / 5] ? 30 ) ? (Heal Level / 10) ? (Modifiers) + MATK **/ hp = (status_get_lv(src) + status_get_int(src)) / 5 * 30 * skill_lv / 10; #else - hp = ( status_get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc_checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8); + hp = ( status_get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8); #endif - if( sd && ((skill = pc_checkskill(sd, HP_MEDITATIO)) > 0) ) + if( sd && ((skill = pc->checkskill(sd, HP_MEDITATIO)) > 0) ) hp += hp * skill * 2 / 100; else if( src->type == BL_HOM && (skill = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 ) hp += hp * skill * 2 / 100; @@ -413,10 +422,10 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk if( ( (target && target->type == BL_MER) || !heal ) && skill_id != NPC_EVILLAND ) hp >>= 1; - if( sd && (skill = pc_skillheal_bonus(sd, skill_id)) ) + if( sd && (skill = pc->skillheal_bonus(sd, skill_id)) ) hp += hp*skill/100; - if( tsd && (skill = pc_skillheal2_bonus(tsd, skill_id)) ) + if( tsd && (skill = pc->skillheal2_bonus(tsd, skill_id)) ) hp += hp*skill/100; sc = status_get_sc(target); @@ -425,10 +434,12 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk hp -= hp * sc->data[SC_CRITICALWOUND]->val2/100; if( sc->data[SC_DEATHHURT] && heal ) hp -= hp * 20/100; - if( sc->data[SC_INCHEALRATE] && skill_id != NPC_EVILLAND && skill_id != BA_APPLEIDUN ) - hp += hp * sc->data[SC_INCHEALRATE]->val1/100; // Only affects Heal, Sanctuary and PotionPitcher.(like bHealPower) [Inkfish] + if( sc->data[SC_HEALPLUS] && skill_id != NPC_EVILLAND && skill_id != BA_APPLEIDUN ) + hp += hp * sc->data[SC_HEALPLUS]->val1/100; // Only affects Heal, Sanctuary and PotionPitcher.(like bHealPower) [Inkfish] if( sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 2) hp += hp / 10; + if( sc->data[SC_OFFERTORIUM] && (skill_id == AB_HIGHNESSHEAL || skill_id == AB_CHEAL || skill_id == PR_SANCTUARY || skill_id == AL_HEAL) ) + hp += hp * sc->data[SC_OFFERTORIUM]->val2 / 100; } #ifdef RENEWAL @@ -438,32 +449,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk case BA_APPLEIDUN: case PR_SANCTUARY: case NPC_EVILLAND: break; default: - { - struct status_data *status = status_get_status_data(src); - int min, max; - - min = max = status_base_matk(status, status_get_lv(src)); - if( status->rhw.matk > 0 ){ - int wMatk, variance; - wMatk = status->rhw.matk; - variance = wMatk * status->rhw.wlv / 10; - min += wMatk - variance; - max += wMatk + variance; - } - - if( sc && sc->data[SC_RECOGNIZEDSPELL] ) - min = max; - - if( sd && sd->right_weapon.overrefine > 0 ){ - min++; - max += sd->right_weapon.overrefine - 1; - } - - if(max > min) - hp += min+rnd()%(max-min); - else - hp += min; - } + hp += status_get_matk(src, 3); } #endif return hp; @@ -523,7 +509,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) // allowing a skill to be cast. This is to prevent no-delay ACT files from spamming skills such as // AC_DOUBLE which do not have a skill delay and are not regarded in terms of attack motion. if( !sd->state.autocast && sd->skillitem != skill_id && sd->canskill_tick && - DIFF_TICK(gettick(), sd->canskill_tick) < (sd->battle_status.amotion * (battle_config.skill_amotion_leniency) / 100) ) + DIFF_TICK(iTimer->gettick(), sd->canskill_tick) < (sd->battle_status.amotion * (battle_config.skill_amotion_leniency) / 100) ) {// attempted to cast a skill before the attack motion has finished return 1; } @@ -548,7 +534,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case RETURN_TO_ELDICASTES: case ALL_GUARDIAN_RECALL: if(map[m].flag.nowarp) { - clif->skill_teleportmessage(sd,0); + clif->skill_mapinfomessage(sd,0); return 1; } return 0; @@ -556,7 +542,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case SC_FATALMENACE: case SC_DIMENSIONDOOR: if(map[m].flag.noteleport) { - clif->skill_teleportmessage(sd,0); + clif->skill_mapinfomessage(sd,0); return 1; } return 0; // gonna be checked in 'skill->castend_nodamage_id' @@ -564,7 +550,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case WE_CALLPARENT: case WE_CALLBABY: if (map[m].flag.nomemo) { - clif->skill_teleportmessage(sd,1); + clif->skill_mapinfomessage(sd,1); return 1; } break; @@ -595,7 +581,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) break; case GD_EMERGENCYCALL: if ( - !(battle_config.emergency_call&((agit_flag || agit2_flag)?2:1)) || + !(battle_config.emergency_call&((iMap->agit_flag || iMap->agit2_flag)?2:1)) || !(battle_config.emergency_call&(map[m].flag.gvg || map[m].flag.gvg_castle?8:4)) || (battle_config.emergency_call&16 && map[m].flag.nowarpto && !map[m].flag.gvg_castle) ) { @@ -616,7 +602,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) * These skills cannot be used while in mado gear (credits to Xantara) **/ if( pc_ismadogear(sd) ) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_MADOGEAR_RIDE,0); return 1; } break; @@ -627,7 +613,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case WM_LULLABY_DEEPSLEEP: case WM_SATURDAY_NIGHT_FEVER: if( !map_flag_vs(m) ) { - clif->skill_teleportmessage(sd,2); // This skill uses this msg instead of skill fails. + clif->skill_mapinfomessage(sd,2); // This skill uses this msg instead of skill fails. return 1; } break; @@ -692,7 +678,7 @@ struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill if (pos != -1) // simple single-definition layout return &skill_unit_layout[pos]; - dir = (src->x == x && src->y == y) ? 6 : map_calc_dir(src,x,y); // 6 - default aegis direction + dir = (src->x == x && src->y == y) ? 6 : iMap->calc_dir(src,x,y); // 6 - default aegis direction if (skill_id == MG_FIREWALL) return &skill_unit_layout [firewall_unit_pos + dir]; @@ -805,44 +791,44 @@ 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 && (temp=pc_checkskill(sd,HT_BLITZBEAT))>0 && - rnd()%1000 <= sstatus->luk*10/3+1 ) { - rate=(sd->status.job_level+9)/10; + if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=pc->checkskill(sd,HT_BLITZBEAT))>0 && + rnd()%1000 <= sstatus->luk*3 ) { + rate = sd->status.job_level / 10 + 1; 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) && (temp=pc_checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*10/3+1 ) + if( pc_iswug(sd) && (temp=pc->checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*3 ) skill->castend_damage_id(src,bl,RA_WUGSTRIKE,temp,tick,0); // Gank if(dstmd && sd->status.weapon != W_BOW && - (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))) + (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,temp,1); else clif->skill_fail(sd,RG_SNATCHER,USESKILL_FAIL_LEVEL,0); } // Chance to trigger Taekwon kicks [Dralnu] - if(sc && !sc->data[SC_COMBO]) { - if(sc->data[SC_READYSTORM] && - sc_start(src,SC_COMBO, 15, TK_STORMKICK, + if(sc && !sc->data[SC_COMBOATTACK]) { + if(sc->data[SC_STORMKICK_READY] && + sc_start(src,SC_COMBOATTACK, 15, TK_STORMKICK, (2000 - 4*sstatus->agi - 2*sstatus->dex))) ; //Stance triggered - else if(sc->data[SC_READYDOWN] && - sc_start(src,SC_COMBO, 15, TK_DOWNKICK, + else if(sc->data[SC_DOWNKICK_READY] && + sc_start(src,SC_COMBOATTACK, 15, TK_DOWNKICK, (2000 - 4*sstatus->agi - 2*sstatus->dex))) ; //Stance triggered - else if(sc->data[SC_READYTURN] && - sc_start(src,SC_COMBO, 15, TK_TURNKICK, + else if(sc->data[SC_TURNKICK_READY] && + sc_start(src,SC_COMBOATTACK, 15, TK_TURNKICK, (2000 - 4*sstatus->agi - 2*sstatus->dex))) ; //Stance triggered - else if (sc->data[SC_READYCOUNTER]) { //additional chance from SG_FRIEND [Komurka] + else if (sc->data[SC_COUNTERKICK_READY]) { //additional chance from SG_FRIEND [Komurka] rate = 20; if (sc->data[SC_SKILLRATE_UP] && sc->data[SC_SKILLRATE_UP]->val1 == TK_COUNTER) { rate += rate*sc->data[SC_SKILLRATE_UP]->val2/100; status_change_end(src, SC_SKILLRATE_UP, INVALID_TIMER); } - sc_start2(src, SC_COMBO, rate, TK_COUNTER, bl->id, + sc_start2(src, SC_COMBOATTACK, rate, TK_COUNTER, bl->id, (2000 - 4*sstatus->agi - 2*sstatus->dex)); } } @@ -853,7 +839,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint if (sc) { struct status_change_entry *sce; // 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. + if((sce=sc->data[SC_ENCHANTPOISON])) //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); // Enchant Deadly Poison gives a chance to deadly poison attacked enemies @@ -862,10 +848,10 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint skill->get_time2(ASC_EDP,sce->val1)); } } - break; + break; case SM_BASH: - if( sd && skill_lv > 5 && pc_checkskill(sd,SM_FATALBLOW)>0 ){ + 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)); @@ -878,7 +864,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case AS_VENOMKNIFE: if (sd) //Poison chance must be that of Envenom. [Skotlex] - skill_lv = pc_checkskill(sd, TF_POISON); + 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)) @@ -981,7 +967,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case AM_ACIDTERROR: - sc_start2(bl,SC_BLEEDING,(skill_lv*3),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)); + sc_start2(bl,SC_BLOODING,(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; @@ -1025,7 +1011,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case DC_UGLYDANCE: rate = 5+5*skill_lv; - if(sd && (temp=pc_checkskill(sd,DC_DANCINGLESSON))) + if(sd && (temp=pc->checkskill(sd,DC_DANCINGLESSON))) rate += 5+temp; status_zap(bl, 0, rate); break; @@ -1053,14 +1039,12 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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_BLOODING,(20*skill_lv),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)); break; case NPC_MENTALBREAKER: { //Based on observations by Tharis, Mental Breaker should do SP damage - //equal to Matk*skLevel. - rate = sstatus->matk_min; - if (rate < sstatus->matk_max) - rate += rnd()%(sstatus->matk_max - sstatus->matk_min); + //equal to Matk*skLevel. + rate = status_get_matk(src, 2); rate*=skill_lv; status_zap(bl, 0, rate); break; @@ -1099,7 +1083,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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_BLOODING,50, skill_lv, src->id, skill->get_time2(skill_id,skill_lv)); break; case LK_JOINTBEAT: @@ -1119,8 +1103,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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_BLOODING,(5+skill_lv*5),skill_lv,src->id,skill->get_time2(skill_id,3)); + } break; case HW_NAPALMVULCAN: @@ -1142,12 +1126,12 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case TK_JUMPKICK: if( dstsd && dstsd->class_ != MAPID_SOUL_LINKER && !tsc->data[SC_PRESERVE] ) {// debuff the following statuses - status_change_end(bl, SC_SPIRIT, INVALID_TIMER); + status_change_end(bl, SC_SOULLINK, INVALID_TIMER); status_change_end(bl, SC_ADRENALINE2, INVALID_TIMER); status_change_end(bl, SC_KAITE, INVALID_TIMER); status_change_end(bl, SC_KAAHI, INVALID_TIMER); - status_change_end(bl, SC_ONEHAND, INVALID_TIMER); - status_change_end(bl, SC_ASPDPOTION2, INVALID_TIMER); + status_change_end(bl, SC_ONEHANDQUICKEN, INVALID_TIMER); + status_change_end(bl, SC_ATTHASTE_POTION3, INVALID_TIMER); } break; case TK_TURNKICK: @@ -1160,7 +1144,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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_BLOODING,(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)); @@ -1185,7 +1169,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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 ) + 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 ) @@ -1195,42 +1179,45 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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,0,src->id,0,skill->get_time(skill_id,skill_lv)); + break; + case RK_DRAGONBREATH_WATER: + sc_start4(bl,SC_FROSTMISTY,5+5*skill_lv,skill_lv,0,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. + if( tsc && !tsc->data[SC_DEC_AGI] ) //Prevent duplicate agi-down effect. 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)); 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,0,src->id,0,skill->get_time2(skill_id,skill_lv)); break; case WL_EARTHSTRAIN: { - int rate = 0, i; - const int pos[5] = { EQP_WEAPON, EQP_HELM, EQP_SHIELD, EQP_ARMOR, EQP_ACC }; - rate = 6 * skill_lv + sstatus->dex / 10 + (sd? sd->status.job_level / 4 : 0) - tstatus->dex /5;// The tstatus->dex / 5 part is unofficial, but players gotta have some kind of way to have resistance. [Rytech] - //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)); + // lv 1 & 2 = Strip Helm, lv 3 = Strip Armor, lv 4 = Strip Weapon and lv 5 = Strip Accessory. [malufett] + const int pos[5] = { EQP_HELM, EQP_HELM, EQP_ARMOR, EQP_WEAPON, EQP_ACC }; + skill->strip_equip(bl, pos[skill_lv], 6 * skill_lv + status_get_lv(src) / 4 + status_get_dex(src) / 10, + skill_lv, skill->get_time2(skill_id,skill_lv)); } break; case WL_JACKFROST: sc_start(bl,SC_FREEZE,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; + case WL_FROSTMISTY: + sc_start(bl,SC_FROSTMISTY,25 + 5 * skill_lv,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_WUGBITE, (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_start4(bl, (skill_id == RA_FIRINGTRAP) ? SC_BURNING:SC_FROSTMISTY, 40 + 10 * skill_lv, skill_lv, 0, src->id, 0, skill->get_time2(skill_id, skill_lv)); break; case NC_PILEBUNKER: if( rnd()%100 < 5 + 15*skill_lv ) @@ -1243,32 +1230,39 @@ 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, 0, 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_FROSTMISTY, 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)); 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 NC_MAGMA_ERUPTION: + sc_start4(bl, SC_BURNING, 10 * skill_lv, skill_lv, 0, src->id, 0, skill->get_time2(skill_id, skill_lv)); + sc_start(bl, SC_STUN, 10 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); break; case GC_WEAPONCRUSH: skill->castend_nodamage_id(src,bl,skill_id,skill_lv,tick,BCT_ENEMY); break; + case GC_DARKCROW: + sc_start(bl, SC_DARKCROW, 10 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); + break; case LG_SHIELDPRESS: 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); + 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_BLOODING,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); + 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); @@ -1326,25 +1320,25 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint status_change_end(bl, SC_APPLEIDUN, INVALID_TIMER); status_change_end(bl, SC_HUMMING, INVALID_TIMER); status_change_end(bl, SC_FORTUNE, INVALID_TIMER); - status_change_end(bl, SC_SERVICE4U, INVALID_TIMER); + status_change_end(bl, SC_SERVICEFORYOU, INVALID_TIMER); status_change_end(bl, SC_LONGING, INVALID_TIMER); - status_change_end(bl, SC_SWINGDANCE, INVALID_TIMER); - status_change_end(bl, SC_SYMPHONYOFLOVER, INVALID_TIMER); - status_change_end(bl, SC_MOONLITSERENADE, INVALID_TIMER); - status_change_end(bl, SC_RUSHWINDMILL, INVALID_TIMER); + status_change_end(bl, SC_SWING, INVALID_TIMER); + status_change_end(bl, SC_SYMPHONY_LOVE, INVALID_TIMER); + status_change_end(bl, SC_MOONLIT_SERENADE, INVALID_TIMER); + status_change_end(bl, SC_RUSH_WINDMILL, INVALID_TIMER); status_change_end(bl, SC_ECHOSONG, INVALID_TIMER); status_change_end(bl, SC_HARMONIZE, INVALID_TIMER); - status_change_end(bl, SC_WINKCHARM, INVALID_TIMER); - status_change_end(bl, SC_SONGOFMANA, INVALID_TIMER); - status_change_end(bl, SC_DANCEWITHWUG, INVALID_TIMER); - status_change_end(bl, SC_LERADSDEW, INVALID_TIMER); + status_change_end(bl, SC_DC_WINKCHARM, INVALID_TIMER); + status_change_end(bl, SC_SONG_OF_MANA, INVALID_TIMER); + status_change_end(bl, SC_DANCE_WITH_WUG, INVALID_TIMER); + status_change_end(bl, SC_LERADS_DEW, INVALID_TIMER); status_change_end(bl, SC_MELODYOFSINK, INVALID_TIMER); - status_change_end(bl, SC_BEYONDOFWARCRY, INVALID_TIMER); - status_change_end(bl, SC_UNLIMITEDHUMMINGVOICE, INVALID_TIMER); + status_change_end(bl, SC_BEYOND_OF_WARCRY, INVALID_TIMER); + status_change_end(bl, SC_UNLIMITED_HUMMING_VOICE, INVALID_TIMER); } 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_BLOODING, 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; @@ -1360,14 +1354,14 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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_start2(bl, SC_BLOODING, 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 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_SITDOWN_POSTDELAY, 75, skill_lv, skill->get_time(GN_SLINGITEM_RANGEMELEEATK,skill_lv)); // Sitdown for 3 seconds. break; } sd->itemid = -1; @@ -1375,10 +1369,10 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint 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_start2(bl, SC_BLOODING, 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_BLOODING, 25, skill_lv, src->id, skill->get_time(skill_id,skill_lv)); break; case EL_STONE_HAMMER: rate = 10 * skill_lv; @@ -1391,26 +1385,26 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case EL_TYPOON_MIS: 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)); + case KO_JYUMONJIKIRI: + sc_start(bl,SC_KO_JYUMONJIKIRI,90,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, 10 * skill_lv, skill_lv, 1000 * (skill_lv / 2 + 2)); 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, 0, 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)); 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_NEEDLE_OF_PARALYZE, 40 + (5*skill_lv), skill_lv, skill->get_time(skill_id, skill_lv)); break; } if (md && battle_config.summons_trigger_autospells && md->master_id && md->special_state.ai) { //Pass heritage to Master for status causing effects. [Skotlex] - sd = map_id2sd(md->master_id); + sd = iMap->id2sd(md->master_id); src = sd?&sd->bl:src; } @@ -1433,7 +1427,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint rate += 10; if(sc->data[SC_OVERTHRUST]) rate += 10; - if(sc->data[SC_MAXOVERTHRUST]) + if(sc->data[SC_OVERTHRUSTMAX]) rate += 10; } if( rate ) @@ -1483,7 +1477,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers ) - clif->status_change(src, SI_ACTIONDELAY, 1, rate, 0, 0, 0); + clif->status_change(src, SI_POSTDELAY, 1, rate, 0, 0, 0); } } } @@ -1580,7 +1574,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers && sd ) - clif->status_change(src, SI_ACTIONDELAY, 1, rate, 0, 0, 0); + clif->status_change(src, SI_POSTDELAY, 1, rate, 0, 0, 0); } } } @@ -1600,7 +1594,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint sd->autobonus[i].atk_type&attack_type&BF_RANGEMASK && sd->autobonus[i].atk_type&attack_type&BF_SKILLMASK)) continue; // one or more trigger conditions were not fulfilled - pc_exeautobonus(sd,&sd->autobonus[i]); + pc->exeautobonus(sd,&sd->autobonus[i]); } } @@ -1713,7 +1707,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1 continue; if( sd->autobonus3[i].atk_type != skill_id ) continue; - pc_exeautobonus(sd,&sd->autobonus3[i]); + pc->exeautobonus(sd,&sd->autobonus3[i]); } } @@ -1798,9 +1792,9 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * if(sd && skill_id && attack_type&BF_MAGIC && status_isdead(bl) && !(skill->get_inf(skill_id)&(INF_GROUND_SKILL|INF_SELF_SKILL)) && - (rate=pc_checkskill(sd,HW_SOULDRAIN))>0 + (rate=pc->checkskill(sd,HW_SOULDRAIN))>0 ){ //Soul Drain should only work on targetted spells [Skotlex] - if (pc_issit(sd)) pc_setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex] + if (pc_issit(sd)) pc->setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex] clif->skill_nodamage(src,bl,HW_SOULDRAIN,rate,1); status_heal(src, 0, status_get_lv(bl)*(95+15*rate)/100, 2); } @@ -1819,10 +1813,10 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * if( skill_id == WZ_WATERBALL ) {//(bugreport:5303) struct status_change *sc = NULL; if( ( sc = status_get_sc(src) ) ) { - if(sc->data[SC_SPIRIT] && - sc->data[SC_SPIRIT]->val2 == SL_WIZARD && - sc->data[SC_SPIRIT]->val3 == WZ_WATERBALL) - sc->data[SC_SPIRIT]->val3 = 0; //Clear bounced spell check. + if(sc->data[SC_SOULLINK] && + sc->data[SC_SOULLINK]->val2 == SL_WIZARD && + sc->data[SC_SOULLINK]->val3 == WZ_WATERBALL) + sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check. } } } @@ -1916,7 +1910,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers && dstsd ) - clif->status_change(bl, SI_ACTIONDELAY, 1, rate, 0, 0, 0); + clif->status_change(bl, SI_POSTDELAY, 1, rate, 0, 0, 0); } } } @@ -1934,7 +1928,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * dstsd->autobonus2[i].atk_type&attack_type&BF_RANGEMASK && dstsd->autobonus2[i].atk_type&attack_type&BF_SKILLMASK)) continue; // one or more trigger conditions were not fulfilled - pc_exeautobonus(dstsd,&dstsd->autobonus2[i]); + pc->exeautobonus(dstsd,&dstsd->autobonus2[i]); } } @@ -1948,8 +1942,8 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * --------------------------------------------------------------------------*/ 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}; + const enum sc_type scatk[4] = {SC_NOEQUIPWEAPON, SC_NOEQUIPARMOR, SC_NOEQUIPSHIELD, SC_NOEQUIPHELM}; + const enum sc_type scdef[4] = {SC_PROTECTWEAPON, SC_PROTECTARMOR, SC_PROTECTSHIELD, SC_PROTECTHELM}; struct status_change *sc = status_get_sc(bl); int i,j; TBL_PC *sd; @@ -2027,7 +2021,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in } if (flag) { sd->status.inventory[j].attribute = 1; - pc_unequipitem(sd, j, 3); + pc->unequipitem(sd, j, 3); } } clif->equiplist(sd); @@ -2039,8 +2033,8 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in 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}; - const enum sc_type sc_def[5] = {SC_CP_WEAPON, SC_CP_SHIELD, SC_CP_ARMOR, SC_CP_HELM, 0}; + const enum sc_type sc_atk[5] = {SC_NOEQUIPWEAPON, SC_NOEQUIPSHIELD, SC_NOEQUIPARMOR, SC_NOEQUIPHELM, SC__STRIPACCESSARY}; + const enum sc_type sc_def[5] = {SC_PROTECTWEAPON, SC_PROTECTSHIELD, SC_PROTECTARMOR, SC_PROTECTHELM, 0}; int i; if (rnd()%100 >= rate) @@ -2107,7 +2101,7 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in } if (dir == -1) // <optimized>: do the computation here instead of outside - dir = map_calc_dir(target, src->x, src->y); // direction from src to target, reversed + dir = iMap->calc_dir(target, src->x, src->y); // direction from src to target, reversed if (dir >= 0 && dir < 8) { // take the reversed 'direction' and reverse it @@ -2173,7 +2167,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds struct status_data *sstatus, *tstatus; struct status_change *sc; struct map_session_data *sd, *tsd; - int type,damage,rdamage=0; + int type,damage; int8 rmdamage=0;//magic reflected bool additional_effects = true; @@ -2244,15 +2238,15 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds flag |= 2; //Spirit of Wizard blocks Kaite's reflection - if( type == 2 && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_WIZARD ) + if( type == 2 && sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_WIZARD ) { //Consume one Fragment per hit of the casted skill? [Skotlex] - type = tsd?pc_search_inventory (tsd, 7321):0; + type = tsd?pc->search_inventory (tsd, 7321):0; if (type >= 0) { - if ( tsd ) pc_delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME); + if ( tsd ) pc->delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME); dmg.damage = dmg.damage2 = 0; dmg.dmg_lv = ATK_MISS; - sc->data[SC_SPIRIT]->val3 = skill_id; - sc->data[SC_SPIRIT]->val4 = dsrc->id; + sc->data[SC_SOULLINK]->val3 = skill_id; + sc->data[SC_SOULLINK]->val4 = dsrc->id; } } else if( type != 2 ) /* Kaite bypasses */ additional_effects = false; @@ -2302,19 +2296,15 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if( (skill_id == AL_INCAGI || skill_id == AL_BLESSING || skill_id == CASH_BLESSING || skill_id == CASH_INCAGI || - skill_id == MER_INCAGI || skill_id == MER_BLESSING) && tsd->sc.data[SC_CHANGEUNDEAD] ) + skill_id == MER_INCAGI || skill_id == MER_BLESSING) && tsd->sc.data[SC_PROPERTYUNDEAD] ) damage = 1; - if( damage > 0 && (( dmg.flag&BF_WEAPON && src != bl && ( src == dsrc || ( dsrc->type == BL_SKILL && ( skill_id == SG_SUN_WARM || skill_id == SG_MOON_WARM || skill_id == SG_STAR_WARM ) ) )) - || (sc && sc->data[SC_REFLECTDAMAGE])) ) - rdamage = battle->calc_return_damage(bl,src, &damage, dmg.flag, skill_id); - if( damage && sc && sc->data[SC_GENSOU] && dmg.flag&BF_MAGIC ){ struct block_list *nbl; nbl = battle->get_enemy_area(bl,bl->x,bl->y,2,BL_CHAR,bl->id); if( nbl ){ // Only one target is chosen. - damage = damage / 2; // Deflect half of the damage to a target nearby - clif->skill_damage(bl, nbl, tick, status_get_amotion(src), 0, status_fix_damage(bl,nbl,damage,0), dmg.div_, OB_OBOROGENSOU_TRANSITION_ATK, -1, 6); + int temp = (int)(damage / (float)(10 / skill_lv)); + clif->skill_damage(bl, nbl, tick, status_get_amotion(src), 0, status_fix_damage(bl,nbl,temp,0), 1, OB_OBOROGENSOU_TRANSITION_ATK, -1, 6); } } @@ -2339,84 +2329,88 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if(sd) { int flag = 0; //Used to signal if this skill can be combo'ed later on. struct status_change_entry *sce; - if ((sce = sd->sc.data[SC_COMBO])) {//End combo state after skill is invoked. [Skotlex] + if ((sce = sd->sc.data[SC_COMBOATTACK])) {//End combo state after skill is invoked. [Skotlex] switch (skill_id) { case TK_TURNKICK: case TK_STORMKICK: case TK_DOWNKICK: case TK_COUNTER: - if (pc_famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time. + if (pc->famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time. sce->val1 = skill_id; //Update combo-skill sce->val3 = skill_id; if( sce->timer != INVALID_TIMER ) - delete_timer(sce->timer, status_change_timer); - sce->timer = add_timer(tick+sce->val4, status_change_timer, src->id, SC_COMBO); + iTimer->delete_timer(sce->timer, status_change_timer); + sce->timer = iTimer->add_timer(tick+sce->val4, status_change_timer, src->id, SC_COMBOATTACK); break; } unit_cancel_combo(src); // Cancel combo wait break; default: if( src == dsrc ) // Ground skills are exceptions. [Inkfish] - status_change_end(src, SC_COMBO, INVALID_TIMER); + status_change_end(src, SC_COMBOATTACK, INVALID_TIMER); } } switch(skill_id) { case MO_TRIPLEATTACK: - if (pc_checkskill(sd, MO_CHAINCOMBO) > 0 || pc_checkskill(sd, SR_DRAGONCOMBO) > 0) + if (pc->checkskill(sd, MO_CHAINCOMBO) > 0 || pc->checkskill(sd, SR_DRAGONCOMBO) > 0) flag=1; break; case MO_CHAINCOMBO: - if(pc_checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0) + if(pc->checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0) flag=1; break; case MO_COMBOFINISH: if (sd->status.party_id>0) //bonus from SG_FRIEND [Komurka] - party_skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skill_lv); - if (pc_checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0) + party->skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skill_lv); + if (pc->checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0) flag=1; case CH_TIGERFIST: - if (!flag && pc_checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1) + if (!flag && pc->checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1) flag=1; case CH_CHAINCRUSH: - if (!flag && pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball > 0 && sd->sc.data[SC_EXPLOSIONSPIRITS]) + if (!flag && pc->checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball > 0 && sd->sc.data[SC_EXPLOSIONSPIRITS]) flag=1; break; case AC_DOUBLE: - if( (tstatus->race == RC_BRUTE || tstatus->race == RC_INSECT) && pc_checkskill(sd, HT_POWER)) + if( (tstatus->race == RC_BRUTE || tstatus->race == RC_INSECT) && pc->checkskill(sd, HT_POWER)) { //TODO: This code was taken from Triple Blows, is this even how it should be? [Skotlex] - sc_start2(src,SC_COMBO,100,HT_POWER,bl->id,2000); + sc_start2(src,SC_COMBOATTACK,100,HT_POWER,bl->id,2000); clif->combo_delay(src,2000); } break; case TK_COUNTER: { //bonus from SG_FRIEND [Komurka] int level; - if(sd->status.party_id>0 && (level = pc_checkskill(sd,SG_FRIEND))) - party_skill_check(sd, sd->status.party_id, TK_COUNTER,level); + if(sd->status.party_id>0 && (level = pc->checkskill(sd,SG_FRIEND))) + party->skill_check(sd, sd->status.party_id, TK_COUNTER,level); } break; 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)); + if (skill_lv >= 7 && !sd->sc.data[SC_SMA_READY]) + sc_start(src,SC_SMA_READY,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] sd->ud.attackabletime = sd->canuseitem_tick = sd->ud.canact_tick; break; + case TK_DODGE: + if( pc->checkskill(sd, TK_JUMPKICK) > 0 ) + flag = 1; + break; case SR_DRAGONCOMBO: - if( pc_checkskill(sd, SR_FALLENEMPIRE) > 0 ) + if( pc->checkskill(sd, SR_FALLENEMPIRE) > 0 ) flag = 1; break; case SR_FALLENEMPIRE: - if( pc_checkskill(sd, SR_TIGERCANNON) > 0 || pc_checkskill(sd, SR_GATEOFHELL) > 0 ) + if( pc->checkskill(sd, SR_TIGERCANNON) > 0 || pc->checkskill(sd, SR_GATEOFHELL) > 0 ) flag = 1; break; } //Switch End if (flag) { //Possible to chain if ( (flag = DIFF_TICK(sd->ud.canact_tick, tick)) < 50 ) flag = 50;/* less is a waste. */ - sc_start2(src,SC_COMBO,100,skill_id,bl->id,flag); + sc_start2(src,SC_COMBOATTACK,100,skill_id,bl->id,flag); clif->combo_delay(src, flag); } } @@ -2450,9 +2444,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case SR_EARTHSHAKER: dmg.dmotion = clif->skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,1,skill_id,-2,6); break; + case KO_MUCHANAGE: + if( dmg.dmg_lv == ATK_FLEE ) + break; case WL_SOULEXPANSION: case WL_COMET: - case KO_MUCHANAGE: case NJ_HUUMA: dmg.dmotion = clif->skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skill_id,skill_lv,8); break; @@ -2479,6 +2475,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case EL_HURRICANE_ATK: case KO_BAKURETSU: case GN_CRAZYWEED_ATK: + case NC_MAGMA_ERUPTION: dmg.dmotion = clif->skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skill_id,-1,5); break; case GN_SLINGITEM_RANGEMELEEATK: @@ -2494,6 +2491,12 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case WM_REVERBERATION_MAGIC: dmg.dmotion = clif->skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,WM_REVERBERATION,-2,6); break; + case WL_TETRAVORTEX_FIRE: + case WL_TETRAVORTEX_WATER: + case WL_TETRAVORTEX_WIND: + case WL_TETRAVORTEX_GROUND: + dmg.dmotion = clif->skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_, WL_TETRAVORTEX,-1,5); + break; case HT_CLAYMORETRAP: case HT_BLASTMINE: case HT_FLASHER: @@ -2509,7 +2512,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds break; case WZ_SIGHTBLASTER: dmg.dmotion = clif->skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, flag&SD_LEVEL?-1:skill_lv, 5); - break; + break; case AB_DUPLELIGHT_MELEE: case AB_DUPLELIGHT_MAGIC: dmg.amotion = 300;/* makes the damage value not overlap with previous damage (when displayed by the client) */ @@ -2525,10 +2528,10 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds break; } - map_freeblock_lock(); + iMap->freeblock_lock(); if(damage > 0 && dmg.flag&BF_SKILL && tsd - && pc_checkskill(tsd,RG_PLAGIARISM) + && pc->checkskill(tsd,RG_PLAGIARISM) && (!sc || !sc->data[SC_PRESERVE]) && damage < tsd->battle_status.hp) { //Updated to not be able to copy skills if the blow will kill you. [Skotlex] @@ -2570,7 +2573,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if( sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) ) { //Level dependent and limitation. lv = min(lv,skill->get_max(copy_skill)); - idx = skill->get_index(tsd->reproduceskill_id); + if( tsd->reproduceskill_id ) { idx = skill->get_index(tsd->reproduceskill_id); if(tsd->status.skill[idx].flag == SKILL_FLAG_PLAGIARIZED ) { @@ -2601,16 +2604,16 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } } - if ((type = pc_checkskill(tsd,RG_PLAGIARISM)) < lv) + if ((type = pc->checkskill(tsd,RG_PLAGIARISM)) < lv) lv = type; tsd->cloneskill_id = copy_skill; pc_setglobalreg(tsd, "CLONE_SKILL", copy_skill); pc_setglobalreg(tsd, "CLONE_SKILL_LV", lv); - tsd->status.skill[idx].id = copy_skill; - tsd->status.skill[idx].lv = lv; - tsd->status.skill[idx].flag = SKILL_FLAG_PLAGIARIZED; + tsd->status.skill[cidx].id = copy_skill; + tsd->status.skill[cidx].lv = lv; + tsd->status.skill[cidx].flag = SKILL_FLAG_PLAGIARIZED; clif->addskill(tsd,copy_skill); } } @@ -2634,8 +2637,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds 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)); + if( skill_id == WL_HELLINFERNO && dmg.damage > 0 && !(flag&ELE_DARK) ) + sc_start4(bl,SC_BURNING,55+5*skill_lv,skill_lv,0,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,7 +2662,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds dir = rand()%8; break; case WL_CRIMSONROCK: - dir = map_calc_dir(bl,skill_area_temp[4],skill_area_temp[5]); + dir = iMap->calc_dir(bl,skill_area_temp[4],skill_area_temp[5]); break; } @@ -2670,7 +2673,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds 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 ) + if( iMap->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 ); } else skill->addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag ); @@ -2680,7 +2683,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds 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 ) + if( iMap->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); } break; @@ -2706,7 +2709,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if( sc && sc->data[SC_DEVOTION] && skill_id != PA_PRESSURE ) { struct status_change_entry *sce = sc->data[SC_DEVOTION]; - struct block_list *d_bl = map_id2bl(sce->val1); + struct block_list *d_bl = iMap->id2bl(sce->val1); if( d_bl && ( (d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id) || @@ -2714,12 +2717,12 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds ) && check_distance_bl(bl, d_bl, sce->val3) ) { if(!rmdamage){ - clif->damage(d_bl,d_bl, gettick(), 0, 0, damage, 0, 0, 0); + clif->damage(d_bl,d_bl, iTimer->gettick(), 0, 0, damage, 0, 0, 0); status_fix_damage(NULL,d_bl, damage, 0); } else{ //Reflected magics are done directly on the target not on paladin //This check is only for magical skill. //For BF_WEAPON skills types track var rdamage and function battle_calc_return_damage - clif->damage(bl,bl, gettick(), 0, 0, damage, 0, 0, 0); + clif->damage(bl,bl, iTimer->gettick(), 0, 0, damage, 0, 0, 0); status_fix_damage(bl,bl, damage, 0); } } @@ -2744,7 +2747,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds dmg.flag |= BF_WEAPON; if( sd && src != bl && damage > 0 && ( dmg.flag&BF_WEAPON || - (dmg.flag&BF_MISC && (skill_id == RA_CLUSTERBOMB || skill_id == RA_FIRINGTRAP || skill_id == RA_ICEBOUNDTRAP || skill_id == RK_DRAGONBREATH)) ) ) + (dmg.flag&BF_MISC && (skill_id == RA_CLUSTERBOMB || skill_id == RA_FIRINGTRAP || skill_id == RA_ICEBOUNDTRAP || skill_id == RK_DRAGONBREATH || skill_id == RK_DRAGONBREATH_WATER)) ) ) { if (battle_config.left_cardfix_to_right) battle->drain(sd, bl, dmg.damage, dmg.damage, tstatus->race, tstatus->mode&MD_BOSS); @@ -2752,30 +2755,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds battle->drain(sd, bl, dmg.damage, dmg.damage2, tstatus->race, tstatus->mode&MD_BOSS); } - if( rdamage > 0 ) { - if( sc && sc->data[SC_REFLECTDAMAGE] ) { - if( src != bl ) {// Don't reflect your own damage (Grand Cross) - bool change = false; - if( sd && !sd->state.autocast ) - change = true; - if( change ) - sd->state.autocast = 1; - map_foreachinshootrange(battle->damage_area,bl,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,bl,dmg.amotion,sstatus->dmotion,rdamage,tstatus->race); - if( change ) - sd->state.autocast = 0; - } - } else { - if( dmg.amotion ) - battle->delay_damage(tick, dmg.amotion,bl,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,0,additional_effects); - else - status_fix_damage(bl,src,rdamage,0); - clif->damage(src,src,tick, dmg.amotion,0,rdamage,1,4,0); // in aegis damage reflected is shown in single hit. - //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); - } - } + if( damage > 0 ) { /** * Post-damage effects @@ -2794,7 +2774,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } break; case WM_METALICSOUND: - status_zap(bl, 0, damage*100/(100*(110-pc_checkskill(sd,WM_LESSON)*10))); + status_zap(bl, 0, damage*100/(100*(110-pc->checkskill(sd,WM_LESSON)*10))); break; case SR_TIGERCANNON: status_zap(bl, 0, damage/10); // 10% of damage dealt @@ -2809,14 +2789,14 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT ) && (sc = status_get_sc(src)) && - sc->data[SC_DOUBLECAST] && - rnd() % 100 < sc->data[SC_DOUBLECAST]->val2) + sc->data[SC_DOUBLECASTING] && + rnd() % 100 < sc->data[SC_DOUBLECASTING]->val2) { // skill->addtimerskill(src, tick + dmg.div_*dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2); skill->addtimerskill(src, tick + dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2); } - map_freeblock_unlock(); + iMap->freeblock_unlock(); return damage; } @@ -2928,7 +2908,7 @@ int skill_check_unit_range (struct block_list *bl, int x, int y, uint16 skill_id } range += layout_type; - return map_foreachinarea(skill->check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id); + return iMap->foreachinarea(skill->check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id); } int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) { @@ -2975,7 +2955,7 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i else type = BL_PC; - return map_foreachinarea(skill->check_unit_range2_sub, bl->m, + return iMap->foreachinarea(skill->check_unit_range2_sub, bl->m, x - range, y - range, x + range, y + range, type, skill_id); } @@ -3089,10 +3069,10 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, { index[i] = -1; if( itemid[i] < 1 ) continue; // No item - index[i] = pc_search_inventory(sd, itemid[i]); + 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_id, USESKILL_FAIL_LEVEL, 0); + clif->skill_fail(sd, skill_id, USESKILL_FAIL_NEED_ITEM, amount[i]|(itemid[i] << 16)); return 0; } } @@ -3100,7 +3080,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, // Consume items for( i = 0; i < ARRAYLENGTH(itemid); i++ ) { - if( index[i] >= 0 ) pc_delitem(sd, index[i], amount[i], 0, 1, LOG_TYPE_CONSUME); + if( index[i] >= 0 ) pc->delitem(sd, index[i], amount[i], 0, 1, LOG_TYPE_CONSUME); } if( type&2 ) @@ -3123,7 +3103,7 @@ int skill_area_sub_count (struct block_list *src, struct block_list *target, uin * *------------------------------------------*/ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { - struct block_list *src = map_id2bl(id),*target; + struct block_list *src = iMap->id2bl(id),*target; struct unit_data *ud = unit_bl2ud(src); struct skill_timerskill *skl; int range; @@ -3138,7 +3118,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { if(src->prev == NULL) break; // Source not on Map if(skl->target_id) { - target = map_id2bl(skl->target_id); + target = iMap->id2bl(skl->target_id); if( ( skl->skill_id == RG_INTIMIDATE || skl->skill_id == SC_FATALMENACE ) && (!target || target->prev == NULL || !check_distance_bl(src,target,AREA_SIZE)) ) target = src; //Required since it has to warp. if(target == NULL) @@ -3156,7 +3136,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { case RG_INTIMIDATE: if (unit_warp(src,-1,-1,-1,CLR_TELEPORT) == 0) { short x,y; - map_search_freecell(src, 0, &x, &y, 1, 1, 0); + iMap->search_freecell(src, 0, &x, &y, 1, 1, 0); if (target != src && !status_isdead(target)) unit_warp(target, -1, x, y, CLR_TELEPORT); } @@ -3164,16 +3144,16 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { case BA_FROSTJOKER: case DC_SCREAM: range= skill->get_splash(skl->skill_id, skl->skill_lv); - map_foreachinarea(skill->frostjoke_scream,skl->map,skl->x-range,skl->y-range, + iMap->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_area_temp[0] = iMap->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); + iMap->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 @@ -3184,10 +3164,10 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { } else { struct status_change *sc = status_get_sc(src); if(sc) { - if(sc->data[SC_SPIRIT] && - sc->data[SC_SPIRIT]->val2 == SL_WIZARD && - sc->data[SC_SPIRIT]->val3 == skl->skill_id) - sc->data[SC_SPIRIT]->val3 = 0; //Clear bounced spell check. + if(sc->data[SC_SOULLINK] && + sc->data[SC_SOULLINK]->val2 == SL_WIZARD && + sc->data[SC_SOULLINK]->val3 == skl->skill_id) + sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check. } } break; @@ -3196,48 +3176,33 @@ 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, (9-skl->type)); // 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... - if( nbl == NULL && skl->x > 1 ) { - nbl = target; - skl->x--; - } else - skl->x = 3; + + if( skl->type < (4 + skl->skill_lv - 1) && skl->x < 3 ) + { // Remaining Chains Hit + nbl = battle->get_enemy_area(src, target->x, target->y, (skl->type>2)?2:3, // After 2 bounces, it will bounce to other targets in 7x7 range. + BL_CHAR|BL_SKILL, target->id); // Search for a new Target around current one... + if( nbl == NULL) + skl->x++; + else + skl->x = 0; + + skill->addtimerskill(src, tick + 651, (nbl?nbl:target)->id, skl->x, 0, WL_CHAINLIGHTNING_ATK, skl->skill_lv, skl->type + 1, skl->flag); } - - 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); } 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); + clif->skill_nodamage(src, target, skl->skill_id, skl->skill_lv, 1); + skill_attack(BF_MAGIC, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag); skill->toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify - if( skl->type >= 3 ) { // Final Hit - if( !status_isdead(target) ) { // Final Status Effect - int effects[4] = { SC_BURNING, SC_FREEZING, SC_BLEEDING, SC_STUN }, - applyeffects[4] = { 0, 0, 0, 0 }, - i, j = 0, k = 0; - for( i = 1; i <= 8; i = i + i ) { - if( skl->x&i ) - { - applyeffects[j] = effects[k]; - j++; - } - k++; - } - if( j ) { - i = applyeffects[rnd()%j]; - 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); - } - } + if( skl->type == 4 ){ + const enum sc_type scs[] = { SC_BURNING, SC_BLOODING, SC_FROSTMISTY, SC_STUN }; // status inflicts are depend on what summoned element is used. + int rate = skl->y, index = skl->x-1; + sc_start2(target, scs[index], rate, skl->skill_lv, src->id, skill->get_time(WL_TETRAVORTEX,index)); } break; case WM_REVERBERATION_MELEE: @@ -3249,7 +3214,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { unit_warp(src, -1, skl->x, skl->y, 3); else { // Target's Part short x = skl->x, y = skl->y; - map_search_freecell(NULL, target->m, &x, &y, 2, 2, 1); + iMap->search_freecell(NULL, target->m, &x, &y, 2, 2, 1); unit_warp(target,-1,x,y,3); } break; @@ -3270,9 +3235,22 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { 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, + iMap->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 SR_FLASHCOMBO_ATK_STEP1: + case SR_FLASHCOMBO_ATK_STEP2: + case SR_FLASHCOMBO_ATK_STEP3: + case SR_FLASHCOMBO_ATK_STEP4: + if( src->type == BL_PC ) { + struct map_session_data *sd = NULL; + const enum e_skill combos[] = {SR_DRAGONCOMBO, SR_FALLENEMPIRE, SR_TIGERCANNON, SR_SKYNETBLOW}; + if( (sd = ((TBL_PC*)src)) ){ + uint16 cid = combos[skl->skill_id-SR_FLASHCOMBO_ATK_STEP1]; + skill->castend_damage_id(src, target, cid, pc->checkskill(sd, cid), tick, 0); + } + } + break; case CH_PALMSTRIKE: { struct status_change* tsc = status_get_sc(target); @@ -3304,7 +3282,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { break; case GN_CRAZYWEED_ATK: { int dummy = 1, i = skill->get_unit_range(skl->skill_id,skl->skill_lv); - 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); + iMap->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); @@ -3335,7 +3313,7 @@ int skill_addtimerskill (struct block_list *src, unsigned int tick, int target, if( i == MAX_SKILLTIMERSKILL ) return 1; ud->skilltimerskill[i] = ers_alloc(skill_timer_ers, struct skill_timerskill); - ud->skilltimerskill[i]->timer = add_timer(tick, skill->timerskill, src->id, i); + ud->skilltimerskill[i]->timer = iTimer->add_timer(tick, skill->timerskill, src->id, i); ud->skilltimerskill[i]->src_id = src->id; ud->skilltimerskill[i]->target_id = target; ud->skilltimerskill[i]->skill_id = skill_id; @@ -3361,7 +3339,7 @@ int skill_cleartimerskill (struct block_list *src) for(i=0;i<MAX_SKILLTIMERSKILL;i++) { if(ud->skilltimerskill[i]) { - delete_timer(ud->skilltimerskill[i]->timer, skill->timerskill); + iTimer->delete_timer(ud->skilltimerskill[i]->timer, skill->timerskill); ers_free(skill_timer_ers, ud->skilltimerskill[i]); ud->skilltimerskill[i]=NULL; } @@ -3374,8 +3352,8 @@ int skill_activate_reverbetion( 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()); - su->limit=DIFF_TICK(gettick(),sg->tick); + iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, iTimer->gettick()); + su->limit=DIFF_TICK(iTimer->gettick(),sg->tick); sg->unit_id = UNT_USED_TRAPS; } return 0; @@ -3433,7 +3411,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint tstatus = status_get_status_data(bl); - map_freeblock_lock(); + iMap->freeblock_lock(); switch(skill_id) { case MER_CRASH: @@ -3516,7 +3494,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case GS_FULLBUSTER: case NJ_SYURIKEN: case NJ_KUNAI: +#ifndef RENEWAL case ASC_BREAKER: +#endif case HFLI_MOON: //[orn] case HFLI_SBR44: //[orn] case NPC_BLEEDING: @@ -3524,6 +3504,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case NPC_HELLPOWER: case RK_SONICWAVE: case RK_HUNDREDSPEAR: + case RK_STORMBLAST: + case RK_CRUSHSTRIKE: case AB_DUPLELIGHT_MELEE: case RA_AIMEDBOLT: case NC_AXEBOOMERANG: @@ -3546,7 +3528,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case GN_SLINGITEM_RANGEMELEEATK: case KO_JYUMONJIKIRI: case KO_SETSUDAN: - case KO_KAIHOU: + case GC_DARKCROW: skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; @@ -3558,7 +3540,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case NC_VULCANARM: case NC_COLDSLOWER: case NC_ARMSCANNON: - if (sd) pc_overheat(sd,1); + if (sd) pc->overheat(sd,1); case RK_WINDCUTTER: skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); break; @@ -3579,9 +3561,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case MO_COMBOFINISH: - if (!(flag&1) && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_MONK) + if (!(flag&1) && sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_MONK) { //Becomes a splash attack when Soul Linked. - map_foreachinrange(skill->area_sub, bl, + iMap->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); @@ -3592,7 +3574,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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, + iMap->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; @@ -3600,7 +3582,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case KN_CHARGEATK: { bool path = path_search_long(NULL, src->m, src->x, src->y, bl->x, bl->y,CELL_CHKWALL); unsigned int dist = distance_bl(src, bl); - uint8 dir = map_calc_dir(bl, src->x, src->y); + uint8 dir = iMap->calc_dir(bl, src->x, src->y); // teleport to target (if not on WoE grounds) if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground && unit_movepos(src, bl->x, bl->y, 0, 1) ) @@ -3619,7 +3601,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case NC_FLAMELAUNCHER: - if (sd) pc_overheat(sd,1); + if (sd) pc->overheat(sd,1); case SN_SHARPSHOOTING: case MA_SHARPSHOOTING: case NJ_KAMAITACHI: @@ -3627,7 +3609,7 @@ 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, + iMap->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; @@ -3638,7 +3620,7 @@ 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, + iMap->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; @@ -3650,8 +3632,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case RG_BACKSTAP: { - 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) { + uint8 dir = iMap->calc_dir(src, bl->x, bl->y), t_dir = unit_getdir(bl); + if ((!check_distance_bl(src, bl, 0) && !iMap->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); dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest] @@ -3678,9 +3660,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case NJ_ISSEN: - status_change_end(src, SC_NEN, INVALID_TIMER); - status_change_end(src, SC_HIDING, INVALID_TIMER); - // fall through case MO_EXTREMITYFIST: { short x, y, i = 2; // Move 2 cells for Issen(from target) @@ -3699,7 +3678,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint #ifdef RENEWAL sc_start(src,SC_EXTREMITYFIST2,100,skill_lv,skill->get_time(skill_id,skill_lv)); #endif - }else + }else{ + status_change_end(src, SC_NJ_NEN, INVALID_TIMER); + status_change_end(src, SC_HIDING, INVALID_TIMER); status_set_hp(src, #ifdef RENEWAL max(status_get_max_hp(src)/100, 1) @@ -3707,8 +3688,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 1 #endif , 0); - - dir = map_calc_dir(src,bl->x,bl->y); + } + dir = iMap->calc_dir(src,bl->x,bl->y); if( dir > 0 && dir < 4) x = -i; else if( dir > 4 ) x = i; else x = 0; @@ -3784,7 +3765,7 @@ 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)) || flag&SD_ANIMATION ) 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); @@ -3799,6 +3780,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case GN_CARTCANNON: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; + case SR_TIGERCANNON: + flag |= SD_ANIMATION; case LG_MOONSLASHER: clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; @@ -3821,10 +3804,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint //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); + skill_area_temp[0] = iMap->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); + iMap->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; @@ -3852,13 +3835,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint for(i=0;i<c;i++){ 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] = iMap->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); + iMap->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); @@ -3874,14 +3857,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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); + dir = iMap->calc_dir(bl,src->x,src->y); skill_area_temp[1] = bl->id; 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); for (i=0;i<4;i++) { - map_foreachincell(skill->area_sub,bl->m,x,y,BL_CHAR, + iMap->foreachincell(skill->area_sub,bl->m,x,y,BL_CHAR, src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); x += dirx[dir]; y += diry[dir]; @@ -3894,7 +3877,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint { 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, + iMap->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); @@ -3936,6 +3919,7 @@ 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: + case KO_KAIHOU: skill->attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; @@ -3977,11 +3961,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint for( y = src->y - range; y <= src->y + range; ++y ) for( x = src->x - range; x <= src->x + range; ++x ) { - if( !map_find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) ) + if( !iMap->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) ) { - if( src->type != BL_PC || map_getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement + if( src->type != BL_PC || iMap->getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement count++; // natural water cell - 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 ) + else if( (unit = iMap->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL || (unit = iMap->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL ) { count++; // skill-induced water cell skill->delunit(unit); // consume cell @@ -4002,7 +3986,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case SL_SMA: - status_change_end(src, SC_SMA, INVALID_TIMER); + status_change_end(src, SC_SMA_READY, INVALID_TIMER); case SL_STIN: case SL_STUN: if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) { @@ -4024,11 +4008,15 @@ 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: +#ifdef RENEWAL + case ASC_BREAKER: +#endif skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; /** * Rune Knight **/ + case RK_DRAGONBREATH_WATER: case RK_DRAGONBREATH: { struct status_change *tsc = NULL; if( (tsc = status_get_sc(bl)) && (tsc->data[SC_HIDING] )) { @@ -4087,7 +4075,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground ) { //You don't move on GVG grounds. short x, y; - map_search_freecell(bl, 0, &x, &y, 1, 1, 0); + iMap->search_freecell(bl, 0, &x, &y, 1, 1, 0); if (unit_movepos(src, x, y, 0, 0)) clif->slide(src,src->x,src->y); } @@ -4095,7 +4083,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case RK_PHANTOMTHRUST: - unit_setdir(src,map_calc_dir(src, bl->x, bl->y)); + unit_setdir(src,iMap->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); @@ -4103,20 +4091,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); 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); - 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); - break; case GC_DARKILLUSION: { short x, y; - short dir = map_calc_dir(src,bl->x,bl->y); + short dir = iMap->calc_dir(src,bl->x,bl->y); if( dir > 0 && dir < 4) x = 2; else if( dir > 4 ) x = -2; @@ -4136,9 +4114,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } break; - case GC_WEAPONCRUSH: - if( sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == GC_WEAPONBLOCKING ) + if( sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == GC_WEAPONBLOCKING ) 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); @@ -4164,7 +4141,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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+status_get_amotion(src),bl->id,0,0,WL_CHAINLIGHTNING_ATK,skill_lv,0,flag); break; case WL_DRAINLIFE: { @@ -4173,7 +4150,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint heal = heal * (5 + 5 * skill_lv) / 100; - if( bl->type == BL_SKILL ) + if( bl->type == BL_SKILL || status_get_hp(src) == status_get_max_hp(src)) // Don't absorb when caster was in full HP heal = 0; // Don't absorb heal from Ice Walls or other skill units. if( heal && rnd()%100 < rate ) @@ -4185,61 +4162,43 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case WL_TETRAVORTEX: - if( sd ) { - int spheres[5] = { 0, 0, 0, 0, 0 }, - positions[5] = {-1,-1,-1,-1,-1 }, - i, j = 0, k, subskill = 0; - - for( i = SC_SPHERE_1; i <= SC_SPHERE_5; i++ ) - if( sc && sc->data[i] ) - { - spheres[j] = i; - positions[j] = sc->data[i]->val2; - j++; // - } - - if( j < 4 ) - { // Need 4 spheres minimum - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - break; - } - - // Sphere Sort, this time from new to old - for( i = 0; i <= j - 2; i++ ) - for( k = i + 1; k <= j - 1; k++ ) - if( positions[i] < positions[k] ) - { - swap(positions[i],positions[k]); - swap(spheres[i],spheres[k]); + if( sc ){ + int i = SC_SUMMON5, x = 0; + int types[][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + for(; i >= SC_SUMMON1; i--){ + if( sc->data[i] ){ + int skillid = WL_TETRAVORTEX_FIRE + (sc->data[i]->val1 - WLS_FIRE) + (sc->data[i]->val1 == WLS_WIND) - (sc->data[i]->val1 == WLS_WATER), sc_index = 0, rate = 0; + if( x < 4 ){ + types[x][0] = (sc->data[i]->val1 - WLS_FIRE) + 1; + types[x][1] = 25; // 25% each for equal sharing + if( x == 3 ){ + x = 0; + sc_index = types[rand()%4][0]; + for(; x < 4; x++) + if(types[x][0] == sc_index) + rate += types[x][1]; + } + skill->addtimerskill(src, tick + (SC_SUMMON5-i) * 206, bl->id, sc_index, rate, skillid, skill_lv, x, flag); } - - k = 0; - for( i = 0; i < 4; i++ ) - { - switch( sc->data[spheres[i]]->val1 ) - { - case WLS_FIRE: subskill = WL_TETRAVORTEX_FIRE; k |= 1; break; - case WLS_WIND: subskill = WL_TETRAVORTEX_WIND; k |= 4; break; - case WLS_WATER: subskill = WL_TETRAVORTEX_WATER; k |= 2; break; - case WLS_STONE: subskill = WL_TETRAVORTEX_GROUND; k |= 8; break; + status_change_end(src, (sc_type)i, INVALID_TIMER); + x++; } - 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); } } break; case WL_RELEASE: if( sd ) { - int i; + int i, cooldown; + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + skill->toggle_magicpower(src, skill_id); // Priority is to release SpellBook if( sc && sc->data[SC_READING_SB] ) { // SpellBook uint16 skill_id, skill_lv, point, s = 0; - int spell[SC_MAXSPELLBOOK-SC_SPELLBOOK1 + 1]; + int spell[SC_SPELLBOOK7-SC_SPELLBOOK1 + 1]; - for(i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--) // List all available spell to be released - if( sc->data[i] ) spell[s++] = i; + for(i = SC_SPELLBOOK7; i >= SC_SPELLBOOK1; i--) // List all available spell to be released + if( sc->data[i] ) spell[s++] = i; if ( s == 0 ) break; @@ -4252,13 +4211,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint status_change_end(src, (sc_type)i, INVALID_TIMER); }else //something went wrong :( break; - + if( sc->data[SC_READING_SB]->val2 > point ) sc->data[SC_READING_SB]->val2 -= point; else // Last spell to be released status_change_end(src, SC_READING_SB, INVALID_TIMER); - if( bl->type != BL_SKILL ) /* skill types will crash the client */ - clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + if( !skill->check_condition_castbegin(sd, skill_id, skill_lv) ) break; @@ -4275,47 +4233,32 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } 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] ) { - spheres[j] = i; - positions[j] = sc->data[i]->val2; - sc->data[i]->val2--; // Prepares for next position - j++; - } + clif->status_change(src, SI_POSTDELAY, 1, skill->delay_fix(src, skill_id, skill_lv), 0, 0, 0); - if( j == 0 ) { // No Spheres - clif->skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON_NONE,0); - break; + cooldown = skill_get_cooldown(skill_id, skill_lv); + for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) { + if (sd->skillcooldown[i].id == skill_id){ + cooldown += sd->skillcooldown[i].val; + break; + } } - - // Sphere Sort - for( i = 0; i <= j - 2; i++ ) - for( k = i + 1; k <= j - 1; 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++ ) { - 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); - status_change_end(src, spheres[i], INVALID_TIMER); // Eliminate ball + if(cooldown) + skill->blockpc_start(sd, skill_id, cooldown, false); + }else if( sc ){ // Summon Balls + int i = SC_SUMMON5; + for(; i >= SC_SUMMON1; i--){ + if( sc->data[i] ){ + int skillid = WL_SUMMON_ATK_FIRE + (sc->data[i]->val1 - WLS_FIRE); + skill->addtimerskill(src, tick + status_get_adelay(src) * (SC_SUMMON5 - i), bl->id, 0, 0, skillid, skill_lv, BF_MAGIC, flag); + status_change_end(src, (sc_type)i, INVALID_TIMER); + if(skill_lv == 1) + break; + } } - clif->skill_nodamage(src,bl,skill_id,0,1); } } 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)); // 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); @@ -4328,7 +4271,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if( sd && pc_isridingwug(sd) ){ short x[8]={0,-1,-1,-1,0,1,1,1}; short y[8]={1,1,0,-1,-1,-1,0,1}; - uint8 dir = map_calc_dir(bl, src->x, src->y); + uint8 dir = iMap->calc_dir(bl, src->x, src->y); if( unit_movepos(src, bl->x+x[dir], bl->y+y[dir], 1, 1) ) { @@ -4368,7 +4311,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint item_tmp.nameid = sg->item_id?sg->item_id:ITEMID_TRAP; item_tmp.identify = 1; if( item_tmp.nameid ) - map_addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); + iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); } skill->delunit(su); } @@ -4385,9 +4328,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } 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); + iMap->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); + if( sd ) pc->overheat(sd,1); } break; @@ -4400,11 +4343,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint else { short x, y; - map_search_freecell(src, 0, &x, &y, -1, -1, 0); + iMap->search_freecell(src, 0, &x, &y, -1, -1, 0); // 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); + iMap->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); } @@ -4444,19 +4387,19 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case SR_HOWLINGOFLION: - status_change_end(bl, SC_SWINGDANCE, INVALID_TIMER); - status_change_end(bl, SC_SYMPHONYOFLOVER, INVALID_TIMER); - status_change_end(bl, SC_MOONLITSERENADE, INVALID_TIMER); - status_change_end(bl, SC_RUSHWINDMILL, INVALID_TIMER); + status_change_end(bl, SC_SWING, INVALID_TIMER); + status_change_end(bl, SC_SYMPHONY_LOVE, INVALID_TIMER); + status_change_end(bl, SC_MOONLIT_SERENADE, INVALID_TIMER); + status_change_end(bl, SC_RUSH_WINDMILL, INVALID_TIMER); status_change_end(bl, SC_ECHOSONG, INVALID_TIMER); status_change_end(bl, SC_HARMONIZE, INVALID_TIMER); status_change_end(bl, SC_SIRCLEOFNATURE, INVALID_TIMER); - status_change_end(bl, SC_SATURDAYNIGHTFEVER, INVALID_TIMER); - status_change_end(bl, SC_DANCEWITHWUG, INVALID_TIMER); - status_change_end(bl, SC_LERADSDEW, INVALID_TIMER); + status_change_end(bl, SC_SATURDAY_NIGHT_FEVER, INVALID_TIMER); + status_change_end(bl, SC_DANCE_WITH_WUG, INVALID_TIMER); + status_change_end(bl, SC_LERADS_DEW, INVALID_TIMER); status_change_end(bl, SC_MELODYOFSINK, INVALID_TIMER); - status_change_end(bl, SC_BEYONDOFWARCRY, INVALID_TIMER); - status_change_end(bl, SC_UNLIMITEDHUMMINGVOICE, INVALID_TIMER); + status_change_end(bl, SC_BEYOND_OF_WARCRY, INVALID_TIMER); + status_change_end(bl, SC_UNLIMITED_HUMMING_VOICE, INVALID_TIMER); skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_ANIMATION); break; @@ -4466,7 +4409,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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); + iMap->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; @@ -4487,7 +4430,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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, iTimer->gettick() + skill->get_time(skill_id, skill_lv) - 1000, bl->id, 0, 0, skill_id, skill_lv, 0, 0); } break; @@ -4503,7 +4446,7 @@ 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, 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); + iMap->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); } @@ -4526,7 +4469,7 @@ 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 < 30 ) - map_foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); + iMap->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); } @@ -4564,7 +4507,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } break; - //recursive homon skill case MH_MAGMA_FLOW: case MH_XENO_SLASHER: @@ -4572,7 +4514,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if(flag & 1) 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); + iMap->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; @@ -4580,8 +4522,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case MH_NEEDLE_OF_PARALYZE: 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)) { + case MH_TINDER_BREAKER: + if (unit_movepos(src, bl->x, bl->y, 1, 1)) { #if PACKETVER >= 20111005 clif->snap(src, bl->x, bl->y); #else @@ -4589,7 +4531,7 @@ 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))); + sc_start4(bl,SC_RG_CCONFINE_S,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; @@ -4600,7 +4542,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, SD_LEVEL|flag); } else { skill_area_temp[1] = bl->id; - map_foreachinrange(skill->area_sub, bl, + iMap->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); @@ -4614,18 +4556,18 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint 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)); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] ) //Should only remove after the skill has been casted. status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER); - map_freeblock_unlock(); + iMap->freeblock_unlock(); if( sd && !(flag&1) ) {// ensure that the skill last-cast tick is recorded - sd->canskill_tick = gettick(); + sd->canskill_tick = iTimer->gettick(); if( sd->state.arrow_atk ) {// consume arrow on last invocation to this skill. @@ -4642,6 +4584,333 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint /*========================================== * *------------------------------------------*/ +int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) +{ + struct block_list *target, *src; + struct map_session_data *sd; + struct mob_data *md; + struct unit_data *ud; + struct status_change *sc = NULL; + int inf,inf2,flag = 0; + + src = iMap->id2bl(id); + if( src == NULL ) + { + ShowDebug("skill_castend_id: src == NULL (tid=%d, id=%d)\n", tid, id); + return 0;// not found + } + + ud = unit_bl2ud(src); + if( ud == NULL ) + { + ShowDebug("skill_castend_id: ud == NULL (tid=%d, id=%d)\n", tid, id); + return 0;// ??? + } + + sd = BL_CAST(BL_PC, src); + md = BL_CAST(BL_MOB, src); + + if( src->prev == NULL ) { + ud->skilltimer = INVALID_TIMER; + return 0; + } + + if(ud->skill_id != SA_CASTCANCEL && ud->skill_id != SO_SPELLFIST) {// otherwise handled in unit_skillcastcancel() + if( ud->skilltimer != tid ) { + ShowError("skill_castend_id: Timer mismatch %d!=%d!\n", ud->skilltimer, tid); + ud->skilltimer = INVALID_TIMER; + return 0; + } + + if( sd && ud->skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) ) + {// restore original walk speed + ud->skilltimer = INVALID_TIMER; + status_calc_bl(&sd->bl, SCB_SPEED); + } + + ud->skilltimer = INVALID_TIMER; + } + + if (ud->skilltarget == id) + target = src; + else + target = iMap->id2bl(ud->skilltarget); + + // Use a do so that you can break out of it when the skill fails. + do { + if(!target || target->prev==NULL) break; + + if(src->m != target->m || status_isdead(src)) break; + + switch (ud->skill_id) { + //These should become skill_castend_pos + case WE_CALLPARTNER: + if(sd) clif->callpartner(sd); + case WE_CALLPARENT: + case WE_CALLBABY: + 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); + ud->skillx = target->x + inf2; + ud->skilly = target->y + inf2; + if (inf2 && !iMap->random_dir(target, &ud->skillx, &ud->skilly)) { + ud->skillx = target->x; + ud->skilly = target->y; + } + ud->skilltimer=tid; + 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); + } + + if(ud->skill_id == RG_BACKSTAP) { + uint8 dir = iMap->calc_dir(src,target->x,target->y),t_dir = unit_getdir(target); + if(check_distance_bl(src, target, 0) || iMap->check_dir(dir,t_dir)) { + break; + } + } + + if( ud->skill_id == PR_TURNUNDEAD ) { + struct status_data *tstatus = status_get_status_data(target); + if( !battle->check_undead(tstatus->race, tstatus->def_ele) ) + break; + } + + if( ud->skill_id == RA_WUGSTRIKE ){ + if( !path_search(NULL,src->m,src->x,src->y,target->x,target->y,1,CELL_CHKNOREACH)) + break; + } + + if( ud->skill_id == PR_LEXDIVINA || ud->skill_id == MER_LEXDIVINA ) + { + sc = status_get_sc(target); + if( battle->check_target(src,target, BCT_ENEMY) <= 0 && (!sc || !sc->data[SC_SILENCE]) ) + { //If it's not an enemy, and not silenced, you can't use the skill on them. [Skotlex] + clif->skill_nodamage (src, target, ud->skill_id, ud->skill_lv, 0); + break; + } + } + else + { // Check target validity. + 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 + ) // Casted through combo. + inf = BCT_ENEMY; //Offensive skill. + else if(inf2&INF2_NO_ENEMY) + inf = BCT_NOENEMY; + else + inf = 0; + + if(inf2 & (INF2_PARTY_ONLY|INF2_GUILD_ONLY) && src != target) + { + inf |= + (inf2&INF2_PARTY_ONLY?BCT_PARTY:0)| + (inf2&INF2_GUILD_ONLY?BCT_GUILD:0); + //Remove neutral targets (but allow enemy if skill is designed to be so) + inf &= ~BCT_NEUTRAL; + } + + 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; + } + + if( ud->skill_id >= SL_SKE && ud->skill_id <= SL_SKA && target->type == BL_MOB ) + { + if( ((TBL_MOB*)target)->class_ == MOBID_EMPERIUM ) + break; + } + else if (inf && battle->check_target(src, target, inf) <= 0){ + if (sd) clif->skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); + break; + } + + if(inf&BCT_ENEMY && (sc = status_get_sc(target)) && + sc->data[SC_FOGWALL] && + rnd() % 100 < 75) { //Fogwall makes all offensive-type targetted skills fail at 75% + if (sd) clif->skill_fail(sd, ud->skill_id, USESKILL_FAIL_LEVEL, 0); + break; + } + } + + //Avoid doing double checks for instant-cast skills. + if (tid != INVALID_TIMER && !status_check_skilluse(src, target, ud->skill_id, 1)) + break; + + if(md) { + md->last_thinktime=tick +MIN_MOBTHINKTIME; + if(md->skill_idx >= 0 && md->db->skill[md->skill_idx].emotion >= 0) + clif->emotion(src, md->db->skill[md->skill_idx].emotion); + } + + 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)) + { + 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); + } + break; + } + + if( sd ) + { + 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); + } +#ifdef OFFICIAL_WALKPATH + if( !path_search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) ) + break; +#endif + if( (src->type == BL_MER || src->type == BL_HOM) && !skill->check_condition_mercenary(src, ud->skill_id, ud->skill_lv, 1) ) + break; + + if (ud->state.running && ud->skill_id == TK_JUMPKICK) { + ud->state.running = 0; + status_change_end(src, SC_RUN, INVALID_TIMER); + flag = 1; + } + + 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->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. + if (sd->skillcooldown[i].id == ud->skill_id){ + cooldown += sd->skillcooldown[i].val; + break; + } + } + if(cooldown) + skill->blockpc_start(sd, ud->skill_id, cooldown, false); + } + if( battle_config.display_status_timers && sd ) + clif->status_change(src, SI_POSTDELAY, 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); + break; + case CR_GRANDCROSS: + case NPC_GRANDDARKNESS: + if( (sc = status_get_sc(src)) && sc->data[SC_NOEQUIPSHIELD] ) + { + const struct TimerData *timer = iTimer->get_timer(sc->data[SC_NOEQUIPSHIELD]->timer); + if( timer && timer->func == status_change_timer && DIFF_TICK(timer->tick,iTimer->gettick()+skill->get_time(ud->skill_id, ud->skill_lv)) > 0 ) + break; + } + sc_start2(src, SC_NOEQUIPSHIELD, 100, 0, 1, skill->get_time(ud->skill_id, ud->skill_lv)); + 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(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", + src->type, src->id, ud->skill_id, ud->skill_lv, target->id); + + iMap->freeblock_lock(); + + // SC_MAGICPOWER needs to switch states before any damage is actually dealt + skill->toggle_magicpower(src, ud->skill_id); + 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); + else + skill->castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); + + sc = status_get_sc(src); + if(sc && sc->count) { + if(sc->data[SC_SOULLINK] && + sc->data[SC_SOULLINK]->val2 == SL_WIZARD && + sc->data[SC_SOULLINK]->val3 == ud->skill_id && + ud->skill_id != WZ_WATERBALL) + sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check. + + if( sc->data[SC_DANCING] && skill->get_inf2(ud->skill_id)&INF2_SONG_DANCE && sd ) + 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] + sd->skillitem = sd->skillitemlv = 0; + + if (ud->skilltimer == INVALID_TIMER) { + if(md) md->skill_idx = -1; + else ud->skill_id = 0; //mobs can't clear this one as it is used for skill condition 'afterskill' + ud->skill_lv = ud->skilltarget = 0; + } + iMap->freeblock_unlock(); + return 1; + } while(0); + + //Skill failed. + if (ud->skill_id == MO_EXTREMITYFIST && sd && !(sc && sc->data[SC_FOGWALL])) + { //When Asura fails... (except when it fails from Fog of Wall) + //Consume SP/spheres + skill->consume_requirement(sd,ud->skill_id, ud->skill_lv,1); + status_set_sp(src, 0, 0); + sc = &sd->sc; + if (sc->count) + { //End states + 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)); +#endif + } + if (target && target->m == src->m) + { //Move character to target anyway. + int dir, x, y; + dir = iMap->calc_dir(src,target->x,target->y); + if( dir > 0 && dir < 4) x = -2; + else if( dir > 4 ) x = 2; + else x = 0; + if( dir > 2 && dir < 6 ) y = -2; + else if( dir == 7 || dir < 2 ) y = 2; + else y = 0; + if (unit_movepos(src, src->x+x, src->y+y, 1, 1)) + { //Display movement + animation. + clif->slide(src,src->x,src->y); + clif->skill_damage(src,target,tick,sd->battle_status.amotion,0,0,1,ud->skill_id, ud->skill_lv, 5); + } + clif->skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); + } + } + + 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) ) + 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 + //which would lead to double 'skill failed' messages u.u [Skotlex] + if(sd) + sd->skillitem = sd->skillitemlv = 0; + else if(md) + md->skill_idx = -1; + return 0; +} + +/*========================================== + * + *------------------------------------------*/ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { struct map_session_data *sd, *dstsd; @@ -4733,6 +5002,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui return ret; } break; + case RK_MILLENNIUMSHIELD: + case RK_CRUSHSTRIKE: + case RK_REFRESH: + case RK_GIANTGROWTH: + case RK_STONEHARDSKIN: + case RK_VITALITYACTIVATION: + case RK_STORMBLAST: + case RK_FIGHTINGSPIRIT: + case RK_ABUNDANCE: + if( sd && !pc->checkskill(sd, RK_RUNEMASTERY) ){ + if( status_change_start(&sd->bl, (sc_type)(rnd()%SC_CONFUSION), 1000, 1, 0, 0, 0, skill->get_time2(skill_id,skill_lv),8) ){ + skill->consume_requirement(sd,skill_id,skill_lv,2); + iMap->freeblock_unlock(); + return 0; + } + } + break; default: //Skill is actually ground placed. if (src == bl && skill->get_unit_id(skill_id,0)) @@ -4749,7 +5035,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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. - map_freeblock_lock(); + iMap->freeblock_lock(); switch(skill_id) { case HLIF_HEAL: //[orn] case AL_HEAL: @@ -4785,7 +5071,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui dstsd = sd; } } - else if (tsc->data[SC_BERSERK] || tsc->data[SC_SATURDAYNIGHTFEVER] || tsc->data[SC__BLOODYLUST]) + else if (tsc->data[SC_BERSERK] || tsc->data[SC_SATURDAY_NIGHT_FEVER] || tsc->data[SC__BLOODYLUST]) heal = 0; //Needed so that it actually displays 0 when healing. } clif->skill_nodamage (src, bl, skill_id, heal, 1); @@ -4797,7 +5083,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100; if (heal_get_jobexp <= 0) heal_get_jobexp = 1; - pc_gainexp (sd, bl, 0, heal_get_jobexp, false); + pc->gainexp (sd, bl, 0, heal_get_jobexp, false); } } break; @@ -4819,8 +5105,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } skill_area_temp[0] = 5 - skill_area_temp[0]; // The actual penalty... if (skill_area_temp[0] > 0 && !map[src->m].flag.noexppenalty) { //Apply penalty - sd->status.base_exp -= min(sd->status.base_exp, pc_nextbaseexp(sd) * skill_area_temp[0] * 2/1000); //0.2% penalty per each. - sd->status.job_exp -= min(sd->status.job_exp, pc_nextjobexp(sd) * skill_area_temp[0] * 2/1000); + sd->status.base_exp -= min(sd->status.base_exp, pc->nextbaseexp(sd) * skill_area_temp[0] * 2/1000); //0.2% penalty per each. + sd->status.job_exp -= min(sd->status.job_exp, pc->nextjobexp(sd) * skill_area_temp[0] * 2/1000); clif->updatestatus(sd,SP_BASEEXP); clif->updatestatus(sd,SP_JOBEXP); } @@ -4864,16 +5150,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { int exp = 0,jexp = 0; int lv = dstsd->status.base_level - sd->status.base_level, jlv = dstsd->status.job_level - sd->status.job_level; - if(lv > 0 && pc_nextbaseexp(dstsd)) { + if(lv > 0 && pc->nextbaseexp(dstsd)) { exp = (int)((double)dstsd->status.base_exp * (double)lv * (double)battle_config.resurrection_exp / 1000000.); if (exp < 1) exp = 1; } - if(jlv > 0 && pc_nextjobexp(dstsd)) { + if(jlv > 0 && pc->nextjobexp(dstsd)) { jexp = (int)((double)dstsd->status.job_exp * (double)lv * (double)battle_config.resurrection_exp / 1000000.); if (jexp < 1) jexp = 1; } if(exp > 0 || jexp > 0) - pc_gainexp (sd, bl, exp, jexp, false); + pc->gainexp (sd, bl, exp, jexp, false); } } } @@ -4889,7 +5175,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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)); else { - map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR, + iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); } @@ -4945,7 +5231,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) { - bl = map_id2bl(target_id); + bl = iMap->id2bl(target_id); if (!bl) bl = src; unit_skilluse_pos(src, bl->x, bl->y, abra_skill_id, abra_skill_lv); } else @@ -4985,7 +5271,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SA_LEVELUP: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if (sd && pc_nextbaseexp(sd)) pc_gainexp(sd, NULL, pc_nextbaseexp(sd) * 10 / 100, 0, false); + if (sd && pc->nextbaseexp(sd)) pc->gainexp(sd, NULL, pc->nextbaseexp(sd) * 10 / 100, 0, false); break; case SA_INSTANTDEATH: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -5010,7 +5296,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui mob_class_change(dstmd,class_); if( tsc && dstmd->status.mode&MD_BOSS ) { - const enum sc_type scs[] = { SC_QUAGMIRE, SC_PROVOKE, SC_ROKISWEIL, SC_GRAVITATION, SC_SUITON, SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM, SC_BLADESTOP }; + const enum sc_type scs[] = { SC_QUAGMIRE, SC_PROVOKE, SC_ROKISWEIL, SC_GRAVITATION, SC_NJ_SUITON, SC_NOEQUIPWEAPON, SC_NOEQUIPSHIELD, SC_NOEQUIPARMOR, SC_NOEQUIPHELM, SC_BLADESTOP }; for (i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++) if (tsc->data[i]) status_change_end(bl, (sc_type)i, INVALID_TIMER); for (i = 0; i < ARRAYLENGTH(scs); i++) @@ -5033,7 +5319,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SA_FORTUNE: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if(sd) pc_getzeny(sd,status_get_lv(bl)*100,LOG_TYPE_STEAL,NULL); + if(sd) pc->getzeny(sd,status_get_lv(bl)*100,LOG_TYPE_STEAL,NULL); break; case SA_TAMINGMONSTER: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -5048,7 +5334,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(sd && dstsd){ //Check they are not another crusader [Skotlex] if ((dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } } @@ -5063,31 +5349,31 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( sd && dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex ) {// Cannot cast on another bard/dancer-type class of the same gender as caster clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } if( sc && tsc ) { - if( !sc->data[SC_MARIONETTE] && !tsc->data[SC_MARIONETTE2] ) + if( !sc->data[SC_MARIONETTE_MASTER] && !tsc->data[SC_MARIONETTE] ) { - 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_MASTER,100,bl->id,skill->get_time(skill_id,skill_lv)); + sc_start(bl,SC_MARIONETTE,100,src->id,skill->get_time(skill_id,skill_lv)); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); } else - if( sc->data[SC_MARIONETTE ] && sc->data[SC_MARIONETTE ]->val1 == bl->id && - tsc->data[SC_MARIONETTE2] && tsc->data[SC_MARIONETTE2]->val1 == src->id ) + if( sc->data[SC_MARIONETTE_MASTER ] && sc->data[SC_MARIONETTE_MASTER ]->val1 == bl->id && + tsc->data[SC_MARIONETTE] && tsc->data[SC_MARIONETTE]->val1 == src->id ) { - status_change_end(src, SC_MARIONETTE, INVALID_TIMER); - status_change_end(bl, SC_MARIONETTE2, INVALID_TIMER); + status_change_end(src, SC_MARIONETTE_MASTER, INVALID_TIMER); + status_change_end(bl, SC_MARIONETTE, INVALID_TIMER); } else { if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } } @@ -5106,13 +5392,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(dstsd->status.weapon == W_FIST || (dstsd->sc.count && !dstsd->sc.data[type] && ( //Allow re-enchanting to lenghten time. [Skotlex] - dstsd->sc.data[SC_FIREWEAPON] || - dstsd->sc.data[SC_WATERWEAPON] || - dstsd->sc.data[SC_WINDWEAPON] || - dstsd->sc.data[SC_EARTHWEAPON] || - dstsd->sc.data[SC_SHADOWWEAPON] || - dstsd->sc.data[SC_GHOSTWEAPON] || - dstsd->sc.data[SC_ENCPOISON] + dstsd->sc.data[SC_PROPERTYFIRE] || + dstsd->sc.data[SC_PROPERTYWATER] || + dstsd->sc.data[SC_PROPERTYWIND] || + dstsd->sc.data[SC_PROPERTYGROUND] || + dstsd->sc.data[SC_PROPERTYDARK] || + dstsd->sc.data[SC_PROPERTYTELEKINESIS] || + dstsd->sc.data[SC_ENCHANTPOISON] )) ) { if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -5146,18 +5432,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case TK_SEVENWIND: 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; - case ELE_FIRE : type = SC_FIREWEAPON; break; - case ELE_GHOST : type = SC_GHOSTWEAPON; break; - case ELE_DARK : type = SC_SHADOWWEAPON; break; + case ELE_EARTH : type = SC_PROPERTYGROUND; break; + case ELE_WIND : type = SC_PROPERTYWIND; break; + case ELE_WATER : type = SC_PROPERTYWATER; break; + case ELE_FIRE : type = SC_PROPERTYFIRE; break; + case ELE_GHOST : type = SC_PROPERTYTELEKINESIS; break; + case ELE_DARK : type = SC_PROPERTYDARK; break; 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,SC_SEVENWIND,100,skill_lv,skill->get_time(skill_id,skill_lv)); + sc_start2(bl,SC_TK_SEVENWIND,100,skill_lv,skill->get_ele(skill_id,skill_lv),skill->get_time(skill_id,skill_lv)); break; @@ -5170,7 +5456,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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, + iMap->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. @@ -5199,7 +5485,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AL_BLESSING: case MER_INCAGI: case MER_BLESSING: - if (dstsd != NULL && tsc->data[SC_CHANGEUNDEAD]) { + if (dstsd != NULL && tsc->data[SC_PROPERTYUNDEAD]) { skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; } @@ -5270,6 +5556,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SR_GENTLETOUCH_ENERGYGAIN: case GN_CARTBOOST: case KO_MEIKYOUSISUI: + case ALL_FULL_THROTTLE: + case RA_UNLIMIT: + case WL_TELEKINESIS_INTENSE: + case AB_OFFERTORIUM: + case RK_GIANTGROWTH: + case RK_VITALITYACTIVATION: + case RK_ABUNDANCE: + case RK_CRUSHSTRIKE: clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); break; @@ -5277,7 +5571,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SO_STRIKING: if (sd) { int bonus = 25 + 10 * skill_lv; - bonus += (pc_checkskill(sd, SA_FLAMELAUNCHER)+pc_checkskill(sd, SA_FROSTWEAPON)+pc_checkskill(sd, SA_LIGHTNINGLOADER)+pc_checkskill(sd, SA_SEISMICWEAPON))*5; + 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) > 0 ? sc_start2(bl, type, 100, skill_lv, bonus, skill->get_time(skill_id,skill_lv)) : @@ -5317,7 +5611,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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))); - status_change_end(bl, SC_NEN, INVALID_TIMER); + status_change_end(bl, SC_NJ_NEN, INVALID_TIMER); break; /* Was modified to only affect targetted char. [Skotlex] case HP_ASSUMPTIO: @@ -5325,7 +5619,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); else { - map_foreachinrange(skill->area_sub, bl, + iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill->castend_nodamage_id); @@ -5342,13 +5636,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AS_ENCHANTPOISON: // Prevent spamming [Valaris] if (sd && dstsd && dstsd->sc.count) { - if (dstsd->sc.data[SC_FIREWEAPON] || - dstsd->sc.data[SC_WATERWEAPON] || - dstsd->sc.data[SC_WINDWEAPON] || - dstsd->sc.data[SC_EARTHWEAPON] || - dstsd->sc.data[SC_SHADOWWEAPON] || - dstsd->sc.data[SC_GHOSTWEAPON] - // dstsd->sc.data[SC_ENCPOISON] //People say you should be able to recast to lengthen the timer. [Skotlex] + if (dstsd->sc.data[SC_PROPERTYFIRE] || + dstsd->sc.data[SC_PROPERTYWATER] || + dstsd->sc.data[SC_PROPERTYWIND] || + dstsd->sc.data[SC_PROPERTYGROUND] || + dstsd->sc.data[SC_PROPERTYDARK] || + dstsd->sc.data[SC_PROPERTYTELEKINESIS] + // dstsd->sc.data[SC_ENCHANTPOISON] //People say you should be able to recast to lengthen the timer. [Skotlex] ) { clif->skill_nodamage(src,bl,skill_id,skill_lv,0); clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -5394,7 +5688,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))); - map_foreachinrange( status_change_timer_sub, src, + iMap->foreachinrange( status_change_timer_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR, src,NULL,type,tick); } @@ -5405,7 +5699,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case MER_PROVOKE: if( (tstatus->mode&MD_BOSS) || battle->check_undead(tstatus->race,tstatus->def_ele) ) { - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } //TODO: How much does base level affects? Dummy value of 1% per level difference used. [Skotlex] @@ -5415,7 +5709,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } unit_skillcastcancel(bl, 2); @@ -5457,7 +5751,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } @@ -5472,7 +5766,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( i == count ) { // No free slots, skill Fail clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } } @@ -5494,7 +5788,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; @@ -5505,13 +5799,13 @@ 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; @@ -5528,7 +5822,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER) { // split the if for readability, and included gunslingers in the check so that their coins cannot be removed [Reddozen] i = dstsd->spiritball * 7; - pc_delspiritball(dstsd,dstsd->spiritball,0); + pc->delspiritball(dstsd,dstsd->spiritball,0); } else if (dstmd && !(tstatus->mode&MD_BOSS) && rnd() % 100 < 20) { // check if target is a monster and not a Boss, for the 20% chance to absorb 2 SP per monster's level [Reddozen] i = 2 * dstmd->level; @@ -5566,7 +5860,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RG_RAID: skill_area_temp[1] = 0; clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - map_foreachinrange(skill->area_sub, bl, + iMap->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); @@ -5584,7 +5878,7 @@ 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), + i = iMap->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); @@ -5617,7 +5911,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //Passive side of the attack. status_change_end(src, SC_SIGHT, INVALID_TIMER); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - map_foreachinrange(skill->area_sub,src, + iMap->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|1, skill->castend_damage_id); @@ -5628,7 +5922,7 @@ 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, + iMap->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; @@ -5640,12 +5934,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui i = ((!md || md->special_state.ai == 2) && !map_flag_vs(src->m))? BCT_ENEMY:BCT_ALL; 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, + iMap->delblock(src); //Required to prevent chain-self-destructions hitting back. + iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|i, skill->castend_damage_id); - map_addblock(src); + iMap->addblock(src); status_damage(src, src, sstatus->max_hp,0,0,1); break; @@ -5656,6 +5950,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case CASH_BLESSING: case CASH_INCAGI: case CASH_ASSUMPTIO: + case WM_FRIGG_SONG: 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))); else if( sd ) @@ -5704,7 +5999,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( tsce ) { clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER)); - map_freeblock_unlock(); + iMap->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))); @@ -5715,7 +6010,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SL_KAUPE: if (sd) { if (!dstsd || !( - (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SOULLINKER) || + (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_SOULLINKER) || (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER || dstsd->status.char_id == sd->status.char_id || dstsd->status.char_id == sd->status.partner_id || @@ -5743,12 +6038,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (tsce) { clif->skill_nodamage(src,bl,skill_id,-1,status_change_end(bl, type, INVALID_TIMER)); //Hide skill-scream animation. - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } else if( tsc && tsc->option&OPTION_MADOGEAR ) { //Mado Gear cannot hide if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->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))); @@ -5757,7 +6052,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (tsce) { clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER)); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(bl,type,100,skill_lv,unit_getdir(bl),0,0,0)); @@ -5775,7 +6070,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif->skill_nodamage(src,bl,skill_id,( skill_id == LG_FORCEOFVANGUARD ) ? skill_lv : -1,i); else if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } case RA_CAMOUFLAGE: @@ -5831,7 +6126,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case TF_STEAL: if(sd) { - if(pc_steal_item(sd,bl,skill_lv)) + if(pc->steal_item(sd,bl,skill_lv)) clif->skill_nodamage(src,bl,skill_id,skill_lv,1); else clif->skill_fail(sd,skill_id,USESKILL_FAIL,0); @@ -5840,7 +6135,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RG_STEALCOIN: if(sd) { - if(pc_steal_coin(sd,bl)) + if(pc->steal_coin(sd,bl)) { dstmd->state.provoke_flag = src->id; mob_target(dstmd, src, skill->get_range2(src,skill_id,skill_lv)); @@ -5879,7 +6174,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui // Level 6-10 doesn't consume a red gem if it fails [celest] if (skill_lv > 5) { // not to consume items - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } } @@ -5939,7 +6234,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); break; case MER_COMPRESS: - status_change_end(bl, SC_BLEEDING, INVALID_TIMER); + status_change_end(bl, SC_BLOODING, INVALID_TIMER); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; case MER_MENTALCURE: @@ -5997,23 +6292,31 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case MC_IDENTIFY: - if(sd) + if(sd) { clif->item_identify_list(sd); + if( sd->menuskill_id != MC_IDENTIFY ) {/* failed, dont consume anything, return */ + iMap->freeblock_unlock(); + return 1; + } + status_zap(src,0,skill_db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded + } break; // Weapon Refining [Celest] case WS_WEAPONREFINE: - if(sd) + if(sd){ + sd->state.prerefining = 1; clif->item_refine_list(sd); + } break; case MC_VENDING: if(sd) { //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex] - if ( !pc_can_give_items(sd) ) + if ( !pc->can_give_items(sd) ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); else { - sd->state.prevend = 1; + sd->state.prevend = sd->state.workinprogress = 3; clif->openvendingreq(sd,2+skill_lv); } } @@ -6023,7 +6326,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(sd) { if (map[bl->m].flag.noteleport && skill_lv <= 2) { - clif->skill_teleportmessage(sd,0); + clif->skill_mapinfomessage(sd,0); break; } if(!battle_config.duel_allow_teleport && sd->duel_group && skill_lv <= 2) { // duel restriction [LuzZza] @@ -6035,9 +6338,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1 ) || skill_lv == 3 ) { if( skill_lv == 1 ) - pc_randomwarp(sd,CLR_TELEPORT); + pc->randomwarp(sd,CLR_TELEPORT); else - pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); + pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); break; } @@ -6076,10 +6379,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui item_tmp.identify = 1; tbl.id = 0; clif->takeitem(&sd->bl,&tbl); - eflag = pc_additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE); + eflag = pc->additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE); if(eflag) { clif->additem(sd,0,0,eflag); - map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } break; @@ -6146,7 +6449,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } //Special message when trying to use strip on FCP [Jobbie] - if( sd && skill_id == ST_FULLSTRIP && tsc && tsc->data[SC_CP_WEAPON] && tsc->data[SC_CP_HELM] && tsc->data[SC_CP_ARMOR] && tsc->data[SC_CP_SHIELD]) + if( sd && skill_id == ST_FULLSTRIP && tsc && tsc->data[SC_PROTECTWEAPON] && tsc->data[SC_PROTECTHELM] && tsc->data[SC_PROTECTARMOR] && tsc->data[SC_PROTECTSHIELD]) { clif->gospel_info(sd, 0x28); break; @@ -6164,29 +6467,30 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AM_BERSERKPITCHER: case AM_POTIONPITCHER: { - int i,hp = 0,sp = 0; + int i,sp = 0; + int64 hp = 0; if( dstmd && dstmd->class_ == MOBID_EMPERIUM ) { - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } if( sd ) { int x,bonus=100; x = skill_lv%11 - 1; - i = pc_search_inventory(sd,skill_db[skill_id].itemid[x]); + i = pc->search_inventory(sd,skill_db[skill_id].itemid[x]); if( i < 0 || skill_db[skill_id].itemid[x] <= 0 ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } if(sd->inventory_data[i] == NULL || sd->status.inventory[i].amount < skill_db[skill_id].amount[x]) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } if( skill_id == AM_BERSERKPITCHER ) { if( dstsd && dstsd->status.base_level < (unsigned int)sd->inventory_data[i]->elv ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } } @@ -6195,27 +6499,27 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui potion_target = bl->id; run_script(sd->inventory_data[i]->script,0,sd->bl.id,0); potion_flag = potion_target = 0; - if( sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_ALCHEMIST ) + if( sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_ALCHEMIST ) bonus += sd->status.base_level; if( potion_per_hp > 0 || potion_per_sp > 0 ) { hp = tstatus->max_hp * potion_per_hp / 100; - hp = hp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; + hp = hp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; if( dstsd ) { sp = dstsd->status.max_sp * potion_per_sp / 100; - sp = sp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; + sp = sp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; } } else { if( potion_hp > 0 ) { - hp = potion_hp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; + hp = potion_hp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; hp = hp * (100 + (tstatus->vit<<1)) / 100; if( dstsd ) - hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10) / 100; + hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10) / 100; } if( potion_sp > 0 ) { - sp = potion_sp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; + sp = potion_sp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000; sp = sp * (100 + (tstatus->int_<<1)) / 100; if( dstsd ) - sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10) / 100; + sp = sp * (100 + pc->checkskill(dstsd,MG_SRECOVERY)*10) / 100; } } @@ -6224,7 +6528,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sp += sp * sd->itemgrouphealrate[IG_POTION] / 100; } - if( (i = pc_skillheal_bonus(sd, skill_id)) ) { + if( (i = pc->skillheal_bonus(sd, skill_id)) ) { hp += hp * i / 100; sp += sp * i / 100; } @@ -6232,9 +6536,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui hp = (1 + rnd()%400) * (100 + skill_lv*10) / 100; hp = hp * (100 + (tstatus->vit<<1)) / 100; if( dstsd ) - hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10) / 100; + hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10) / 100; } - if( dstsd && (i = pc_skillheal2_bonus(dstsd, skill_id)) ) { + if( dstsd && (i = pc->skillheal2_bonus(dstsd, skill_id)) ) { hp += hp * i / 100; sp += sp * i / 100; } @@ -6254,14 +6558,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } clif->skill_nodamage(src,bl,skill_id,skill_lv,1); if( hp > 0 || (skill_id == AM_POTIONPITCHER && sp <= 0) ) - clif->skill_nodamage(NULL,bl,AL_HEAL,hp,1); + clif->skill_nodamage(NULL,bl,AL_HEAL,(int)hp,1); if( sp > 0 ) clif->skill_nodamage(NULL,bl,MG_SRECOVERY,sp,1); #ifdef RENEWAL if( tsc && tsc->data[SC_EXTREMITYFIST2] ) sp = 0; #endif - status_heal(bl,hp,sp,0); + status_heal(bl,(int)hp,sp,0); } break; case AM_CP_WEAPON: @@ -6271,9 +6575,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { unsigned int equip[] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP}; - if( sd && ( bl->type != BL_PC || ( dstsd && pc_checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){ + if( sd && ( bl->type != BL_PC || ( dstsd && pc->checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){ clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); // Don't consume item requirements + iMap->freeblock_unlock(); // Don't consume item requirements return 0; } @@ -6299,7 +6603,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case AM_TWILIGHT3: if (sd) { - int ebottle = pc_search_inventory(sd,713); + int ebottle = pc->search_inventory(sd,713); if( ebottle >= 0 ) ebottle = sd->status.inventory[ebottle].amount; //check if you can produce all three, if not, then fail: @@ -6322,9 +6626,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) - || (tsc && tsc->data[SC_SPIRIT] && tsc->data[SC_SPIRIT]->val2 == SL_ROGUE) //Rogue's spirit defends againt dispel. - || rnd()%100 >= 50+10*skill_lv - || ( tsc && tsc->option&OPTION_MADOGEAR ) )//Mado Gear is immune to dispell according to bug report 49 [Ind] + || (tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SL_ROGUE) //Rogue's spirit defends againt dispel. + || rnd()%100 >= 50+10*skill_lv ) { if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -6337,84 +6640,45 @@ 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; } - - for(i=0;i<SC_MAX;i++) + + for(i = 0; i < SC_MAX; i++) { - if (!tsc->data[i]) - continue; - switch (i) { - case SC_WEIGHT50: case SC_WEIGHT90: case SC_HALLUCINATION: - case SC_STRIPWEAPON: case SC_STRIPSHIELD: case SC_STRIPARMOR: - case SC_STRIPHELM: case SC_CP_WEAPON: case SC_CP_SHIELD: - case SC_CP_ARMOR: case SC_CP_HELM: case SC_COMBO: - case SC_STRFOOD: case SC_AGIFOOD: case SC_VITFOOD: - case SC_INTFOOD: case SC_DEXFOOD: case SC_LUKFOOD: - case SC_HITFOOD: case SC_FLEEFOOD: case SC_BATKFOOD: - case SC_WATKFOOD: case SC_MATKFOOD: case SC_DANCING: - case SC_EDP: case SC_AUTOBERSERK: - case SC_CARTBOOST: case SC_MELTDOWN: case SC_SAFETYWALL: - case SC_SMA: case SC_SPEEDUP0: case SC_NOCHAT: - case SC_ANKLE: case SC_SPIDERWEB: case SC_JAILED: - case SC_ITEMBOOST: case SC_EXPBOOST: case SC_LIFEINSURANCE: - case SC_BOSSMAPINFO: case SC_PNEUMA: case SC_AUTOSPELL: - case SC_INCHITRATE: case SC_INCATKRATE: case SC_NEN: - case SC_READYSTORM: case SC_READYDOWN: case SC_READYTURN: - case SC_READYCOUNTER: case SC_DODGE: case SC_WARM: - case SC_SPEEDUP1: case SC_AUTOTRADE: case SC_CRITICALWOUND: - case SC_JEXPBOOST: case SC_INVINCIBLE: case SC_INVINCIBLEOFF: - case SC_HELLPOWER: case SC_MANU_ATK: case SC_MANU_DEF: - case SC_SPL_ATK: case SC_SPL_DEF: case SC_MANU_MATK: - case SC_SPL_MATK: case SC_RICHMANKIM: case SC_ETERNALCHAOS: - case SC_DRUMBATTLE: case SC_NIBELUNGEN: case SC_ROKISWEIL: - case SC_INTOABYSS: case SC_SIEGFRIED: case SC_FOOD_STR_CASH: - case SC_FOOD_AGI_CASH: case SC_FOOD_VIT_CASH: case SC_FOOD_DEX_CASH: - case SC_FOOD_INT_CASH: case SC_FOOD_LUK_CASH: case SC_SEVENWIND: - case SC_MIRACLE: case SC_S_LIFEPOTION: case SC_L_LIFEPOTION: - case SC_INCHEALRATE: case SC_ELECTRICSHOCKER: case SC__STRIPACCESSORY: - //case SC_SAVAGE_STEAK: case SC_COCKTAIL_WARG_BLOOD: case SC_MINOR_BBQ: - //case SC_SIROMA_ICE_TEA: case SC_DROCERA_HERB_STEAMED: case SC_PUTTI_TAILS_NOODLES: - case SC_NEUTRALBARRIER_MASTER: case SC_NEUTRALBARRIER: case SC_STEALTHFIELD_MASTER: - case SC_STEALTHFIELD: case SC_GIANTGROWTH: case SC_MILLENNIUMSHIELD: - case SC_REFRESH: case SC_STONEHARDSKIN: case SC_VITALITYACTIVATION: - case SC_FIGHTINGSPIRIT: case SC_ABUNDANCE: case SC__SHADOWFORM: - case SC_LEADERSHIP: case SC_GLORYWOUNDS: case SC_SOULCOLD: - case SC_HAWKEYES: case SC_GUILDAURA: case SC_PUSH_CART: - case SC_RAISINGDRAGON: case SC_GT_ENERGYGAIN: case SC_GT_CHANGE: - case SC_GT_REVITALIZE: case SC_REFLECTDAMAGE: case SC_INSPIRATION: - case SC_EXEEDBREAK: case SC_FORCEOFVANGUARD: case SC_BANDING: - case SC_DUPLELIGHT: case SC_EXPIATIO: case SC_LAUDAAGNUS: - case SC_LAUDARAMUS: case SC_GATLINGFEVER: case SC_INCREASING: - case SC_ADJUSTMENT: case SC_MADNESSCANCEL: case SC_ALL_RIDING: - #ifdef RENEWAL - case SC_EXTREMITYFIST2: - #endif - continue; - /** - * bugreport:4888 these songs may only be dispelled if you're not in their song area anymore - **/ - case SC_WHISTLE: - case SC_ASSNCROS: - case SC_POEMBRAGI: - case SC_APPLEIDUN: - case SC_HUMMING: - case SC_DONTFORGETME: - case SC_FORTUNE: - case SC_SERVICE4U: - if( !tsc->data[i]->val4 ) //val4 = out-of-song-area + if ( !tsc->data[i] ) continue; - break; - case SC_ASSUMPTIO: - if( bl->type == BL_MOB ) + if( SC_COMMON_MAX < i ){ + if ( status_get_sc_type(i)&SC_NO_DISPELL ) continue; - break; } - if(i==SC_BERSERK || i==SC_SATURDAYNIGHTFEVER) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. + switch (i) { + /** + * bugreport:4888 these songs may only be dispelled if you're not in their song area anymore + **/ + case SC_WHISTLE: + case SC_ASSNCROS: + case SC_POEMBRAGI: + case SC_APPLEIDUN: + case SC_HUMMING: + case SC_DONTFORGETME: + case SC_FORTUNE: + case SC_SERVICEFORYOU: + if( tsc->data[i]->val4 ) //val4 = out-of-song-area + continue; + break; + case SC_ASSUMPTIO: + if( bl->type == BL_MOB ) + continue; + break; + case SC_BERSERK: + case SC_SATURDAY_NIGHT_FEVER: + tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. + break; + } status_change_end(bl, (sc_type)i, INVALID_TIMER); } break; } //Affect all targets on splash area. - map_foreachinrange(skill->area_sub, bl, i, BL_CHAR, + iMap->foreachinrange(skill->area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill->castend_damage_id); break; @@ -6440,7 +6704,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } clif->skill_nodamage(src,bl,TK_HIGHJUMP,skill_lv,1); - if(!map_count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB) && map_getcell(src->m,x,y,CELL_CHKREACH)) { + if(!iMap->count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB) && iMap->getcell(src->m,x,y,CELL_CHKREACH)) { clif->slide(src,x,y); unit_movepos(src, x, y, 1, 0); } @@ -6520,7 +6784,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui static const int spellarray[3] = { MG_COLDBOLT,MG_FIREBOLT,MG_LIGHTNINGBOLT }; if(skill_lv >= 10) { spellid = MG_FROSTDIVER; - // if (tsc && tsc->data[SC_SPIRIT] && tsc->data[SC_SPIRIT]->val2 == SA_SAGE) + // if (tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SA_SAGE) // maxlv = 10; // else maxlv = skill_lv - 9; @@ -6551,7 +6815,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case BS_GREED: if(sd){ clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - map_foreachinrange(skill->greed,bl, + iMap->foreachinrange(skill->greed,bl, skill->get_splash(skill_id, skill_lv),BL_ITEM,bl); } break; @@ -6648,9 +6912,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_SPEEDUP: { // or does it increase casting rate? just a guess xD - int i = SC_ASPDPOTION0 + skill_lv - 1; - if (i > SC_ASPDPOTION3) - i = SC_ASPDPOTION3; + int i = SC_ATTHASTE_POTION1 + skill_lv - 1; + if (i > SC_ATTHASTE_INFINITY) + i = SC_ATTHASTE_INFINITY; clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,(sc_type)i,100,skill_lv,skill_lv * 60000)); } @@ -6660,7 +6924,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui // not really needed... but adding here anyway ^^ if (md && md->master_id > 0) { struct block_list *mbl, *tbl; - if ((mbl = map_id2bl(md->master_id)) == NULL || + if ((mbl = iMap->id2bl(md->master_id)) == NULL || (tbl = battle->get_targeted(mbl)) == NULL) break; md->state.provoke_flag = tbl->id; @@ -6671,7 +6935,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_RUN: { const int mask[8][2] = {{0,-1},{1,-1},{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1}}; - uint8 dir = (bl == src)?unit_getdir(src):map_calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away. + uint8 dir = (bl == src)?unit_getdir(src):iMap->calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away. unit_stop_attack(src); //Run skillv tiles overriding the can-move check. if (unit_walktoxy(src, src->x + skill_lv * mask[dir][0], src->y + skill_lv * mask[dir][1], 2) && md) @@ -6722,7 +6986,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case NPC_AGIUP: - sc_start(bl,SC_SPEEDUP1,100,skill_lv,skill->get_time(skill_id, skill_lv)); + sc_start(bl,SC_MOVHASTE_INFINITY,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))); break; @@ -6756,12 +7020,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui // parent-baby skills case WE_BABY: if(sd){ - struct map_session_data *f_sd = pc_get_father(sd); - struct map_session_data *m_sd = pc_get_mother(sd); + struct map_session_data *f_sd = pc->get_father(sd); + struct map_session_data *m_sd = pc->get_mother(sd); // if neither was found if(!f_sd && !m_sd){ clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } status_change_start(bl,SC_STUN,10000,skill_lv,0,0,0,skill->get_time2(skill_id,skill_lv),8); @@ -6809,10 +7073,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = skill_db[su->group->skill_id].itemid[i]; item_tmp.identify = 1; - if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) ) + if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) ) { clif->additem(sd,0,0,flag); - map_addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } } @@ -6823,10 +7087,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = su->group->item_id?su->group->item_id:ITEMID_TRAP; item_tmp.identify = 1; - if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) ) + if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) ) { clif->additem(sd,0,0,flag); - map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } } @@ -6881,7 +7145,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui #endif ) { if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } clif->skill_nodamage(src,bl,skill_id,skill_lv, @@ -6894,14 +7158,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case PF_MINDBREAKER: { if(tstatus->mode&MD_BOSS || battle->check_undead(tstatus->race,tstatus->def_ele) ) { - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } if (tsce) { //HelloKitty2 (?) explained that this silently fails when target is //already inflicted. [Skotlex] - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } @@ -6910,7 +7174,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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(); + iMap->freeblock_unlock(); return 0; } @@ -6967,9 +7231,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sp = sp * (100 + (tstatus->int_<<1))/100; if (dstsd) { if (hp) - hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10 + pc_skillheal2_bonus(dstsd, skill_id))/100; + hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10 + pc->skillheal2_bonus(dstsd, skill_id))/100; if (sp) - sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10 + pc_skillheal2_bonus(dstsd, skill_id))/100; + sp = sp * (100 + pc->checkskill(dstsd,MG_SRECOVERY)*10 + pc->skillheal2_bonus(dstsd, skill_id))/100; } if( tsc && tsc->count ) { if (tsc->data[SC_CRITICALWOUND]) { @@ -6999,14 +7263,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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 ) ) + if( bl->type != BL_PC || ( dstsd && pc->checkequip(dstsd,equip[i]) < 0 ) ) continue; - sc_start(bl,(sc_type)(SC_CP_WEAPON + i),100,skill_lv,skilltime); + sc_start(bl,(sc_type)(SC_PROTECTWEAPON + i),100,skill_lv,skilltime); s++; } if( sd && !s ){ clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); // Don't consume item requirements + iMap->freeblock_unlock(); // Don't consume item requirements return 0; } clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -7031,18 +7295,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case CG_TAROTCARD: { int eff, count = -1; + if( tsc && tsc->data[type] ){ + iMap->freeblock_unlock(); + return 0; + } if( rnd() % 100 > skill_lv * 8 || (dstmd && ((dstmd->guardian_data && dstmd->class_ == MOBID_EMPERIUM) || mob_is_battleground(dstmd))) ) { if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } 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); + if( eff == 5 ) + clif->specialeffect(src, 528, AREA); + else + clif->specialeffect(bl, 523 + eff, AREA); switch (eff) { case 0: // heals SP to 0 @@ -7112,6 +7383,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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,type,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; default: break; @@ -7136,7 +7408,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SL_STAR: case SL_SUPERNOVICE: case SL_WIZARD: - //NOTE: here, 'type' has the value of the associated MAPID, not of the SC_SPIRIT constant. + //NOTE: here, 'type' has the value of the associated MAPID, not of the SC_SOULLINK constant. if (sd && !(dstsd && (dstsd->class_&MAPID_UPPERMASK) == type)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; @@ -7146,11 +7418,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui dstsd->die_counter = 0; pc_setglobalreg(dstsd,"PC_DIE_COUNTER", 0); clif->specialeffect(bl, 0x152, AREA); - //SC_SPIRIT invokes status_calc_pc for us. + //SC_SOULLINK 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_SOULLINK,100,skill_lv,skill_id,0,0,skill->get_time(skill_id,skill_lv))); + sc_start(src,SC_SMA_READY,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)) { @@ -7159,7 +7431,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_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_start(src,SC_SMA_READY,100,skill_lv,skill->get_time(SL_SMA,skill_lv)); break; case SL_SWOO: @@ -7179,7 +7451,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))); 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_READY,100,skill_lv,skill->get_time(SL_SMA,skill_lv)); break; // New guild skills [Celest] @@ -7189,7 +7461,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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, + iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_PC, src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, skill->castend_nodamage_id); @@ -7203,7 +7475,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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, + iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_PC, src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, skill->castend_nodamage_id); @@ -7217,7 +7489,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif->skill_nodamage(src,bl,AL_HEAL,status_percent_heal(bl,90,90),1); } else if (status_get_guild_id(src)) { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - map_foreachinrange(skill->area_sub, src, + iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_PC, src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, skill->castend_nodamage_id); @@ -7241,9 +7513,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) { if (map[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m)) continue; - if(map_getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH)) + if(iMap->getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH)) dx[j] = dy[j] = 0; - pc_setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN); + pc->setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN); } } if (sd) @@ -7264,7 +7536,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SG_HATE: if (sd) { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if (!pc_set_hate_mob(sd, skill_lv-1, bl)) + if (!pc->set_hate_mob(sd, skill_lv-1, bl)) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; @@ -7273,9 +7545,9 @@ 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); + pc->delspiritball(sd,1,0); } break; @@ -7323,7 +7595,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, + iMap->foreachinrange(skill->chastle_mob_changetarget,src, AREA_SIZE, BL_MOB, bl, src); } } @@ -7343,7 +7615,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui else if(r<per[i][1]) //Master bl = battle->get_master(src); else //Enemy - bl = map_id2bl(battle->get_target(src)); + bl = iMap->id2bl(battle->get_target(src)); if (!bl) bl = src; i = skill->calc_heal(src, bl, skill_id, 1+rnd()%skill_lv, true); @@ -7368,7 +7640,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_DRAGONFEAR: if (flag&1) { - const enum sc_type sc[] = { SC_STUN, SC_SILENCE, SC_CONFUSION, SC_BLEEDING }; + const enum sc_type sc[] = { SC_STUN, SC_SILENCE, SC_CONFUSION, SC_BLOODING }; 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)) ) { @@ -7395,7 +7667,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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, + iMap->foreachinrange(skill->area_sub, bl, 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); @@ -7407,7 +7679,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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, + iMap->foreachinrange(skill->area_sub, bl, 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); @@ -7447,7 +7719,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { skill_area_temp[2] = 0; clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - map_foreachinrange(skill->area_sub, src, + iMap->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|1, skill->castend_nodamage_id); @@ -7459,13 +7731,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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); + iMap->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, + iMap->foreachinrange(skill->area_sub, bl,i,BL_CHAR, 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 ) + if( sd ) { int heal = sstatus->hp / 4; // 25% HP if( status_charge(bl,heal,0) ) @@ -7475,7 +7747,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } break; case RK_REFRESH: - if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 8 ) { int heal = status_get_max_hp(bl) * 25 / 100; clif->skill_nodamage(src,bl,skill_id,skill_lv, @@ -7486,8 +7757,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case RK_MILLENNIUMSHIELD: - if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 9 ) - { + if( sd ){ 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)); clif->millenniumshield(sd,shields); @@ -7495,31 +7765,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } break; - case RK_GIANTGROWTH: - case RK_VITALITYACTIVATION: - case RK_ABUNDANCE: - case RK_CRUSHSTRIKE: - if( sd ) - { - int lv = 1; // RK_GIANTGROWTH - if( skill_id == RK_VITALITYACTIVATION ) - lv = 2; - else if( skill_id == RK_ABUNDANCE ) - lv = 6; - 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))); - } - 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)); - } else if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 5 ) { + } else if( sd ) { 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); skill_area_temp[5] = 7 * i; // ATK @@ -7536,7 +7788,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); + iMap->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; @@ -7590,7 +7842,7 @@ 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, + iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR, src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); break; @@ -7622,8 +7874,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AB_CLEMENTIA: case AB_CANTO: { - int bless_lv = pc_checkskill(sd,AL_BLESSING) + (sd->status.job_level / 10); - int agi_lv = pc_checkskill(sd,AL_INCAGI) + (sd->status.job_level / 10); + int bless_lv = pc->checkskill(sd,AL_BLESSING) + (sd->status.job_level / 10); + 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))); @@ -7642,7 +7894,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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] @@ -7662,7 +7914,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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, + iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); } @@ -7671,14 +7923,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AB_LAUDAAGNUS: if( flag&1 || sd == NULL ) { if( tsc && (tsc->data[SC_FREEZE] || tsc->data[SC_STONE] || tsc->data[SC_BLIND] || - tsc->data[SC_BURNING] || tsc->data[SC_FREEZING] || tsc->data[SC_CRYSTALIZE])) { + tsc->data[SC_BURNING] || tsc->data[SC_FROSTMISTY] || tsc->data[SC_CRYSTALIZE])) { // Success Chance: (40 + 10 * Skill Level) % if( rnd()%100 > 40+10*skill_lv ) break; status_change_end(bl, SC_FREEZE, INVALID_TIMER); status_change_end(bl, SC_STONE, INVALID_TIMER); status_change_end(bl, SC_BLIND, INVALID_TIMER); status_change_end(bl, SC_BURNING, INVALID_TIMER); - status_change_end(bl, SC_FREEZING, INVALID_TIMER); + status_change_end(bl, SC_FROSTMISTY, INVALID_TIMER); 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, @@ -7717,71 +7969,33 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if(status_isimmune(bl) || !tsc || !tsc->count) break; - for(i=0;i<SC_MAX;i++) + for(i = 0; i < SC_MAX; i++) { - if (!tsc->data[i]) + if ( !tsc->data[i] ) continue; - switch (i) { - case SC_WEIGHT50: case SC_WEIGHT90: case SC_HALLUCINATION: - case SC_STRIPWEAPON: case SC_STRIPSHIELD: case SC_STRIPARMOR: - case SC_STRIPHELM: case SC_CP_WEAPON: case SC_CP_SHIELD: - case SC_CP_ARMOR: case SC_CP_HELM: case SC_COMBO: - case SC_STRFOOD: case SC_AGIFOOD: case SC_VITFOOD: - case SC_INTFOOD: case SC_DEXFOOD: case SC_LUKFOOD: - case SC_HITFOOD: case SC_FLEEFOOD: case SC_BATKFOOD: - case SC_WATKFOOD: case SC_MATKFOOD: case SC_DANCING: - case SC_SPIRIT: case SC_AUTOBERSERK: - case SC_CARTBOOST: case SC_MELTDOWN: case SC_SAFETYWALL: - case SC_SMA: case SC_SPEEDUP0: case SC_NOCHAT: - case SC_ANKLE: case SC_SPIDERWEB: case SC_JAILED: - case SC_ITEMBOOST: case SC_EXPBOOST: case SC_LIFEINSURANCE: - case SC_BOSSMAPINFO: case SC_PNEUMA: case SC_AUTOSPELL: - case SC_INCHITRATE: case SC_INCATKRATE: case SC_NEN: - case SC_READYSTORM: case SC_READYDOWN: case SC_READYTURN: - case SC_READYCOUNTER:case SC_DODGE: case SC_WARM: - case SC_SPEEDUP1: case SC_AUTOTRADE: case SC_CRITICALWOUND: - case SC_JEXPBOOST: case SC_INVINCIBLE: case SC_INVINCIBLEOFF: - case SC_HELLPOWER: case SC_MANU_ATK: case SC_MANU_DEF: - case SC_SPL_ATK: case SC_SPL_DEF: case SC_MANU_MATK: - case SC_SPL_MATK: case SC_RICHMANKIM: case SC_ETERNALCHAOS: - case SC_DRUMBATTLE: case SC_NIBELUNGEN: case SC_ROKISWEIL: - case SC_INTOABYSS: case SC_SIEGFRIED: case SC_WHISTLE: - case SC_ASSNCROS: case SC_POEMBRAGI: case SC_APPLEIDUN: - case SC_HUMMING: case SC_DONTFORGETME: case SC_FORTUNE: - case SC_SERVICE4U: case SC_FOOD_STR_CASH: case SC_FOOD_AGI_CASH: - case SC_FOOD_VIT_CASH: case SC_FOOD_DEX_CASH: case SC_FOOD_INT_CASH: - case SC_FOOD_LUK_CASH: case SC_ELECTRICSHOCKER: case SC_BITE: - case SC__STRIPACCESSORY: case SC__ENERVATION: case SC__GROOMY: - case SC__IGNORANCE: case SC__LAZINESS: case SC__UNLUCKY: - case SC__WEAKNESS: //case SC_SAVAGE_STEAK: case SC_COCKTAIL_WARG_BLOOD: - case SC_MAGNETICFIELD://case SC_MINOR_BBQ: case SC_SIROMA_ICE_TEA: - //case SC_DROCERA_HERB_STEAMED: case SC_PUTTI_TAILS_NOODLES: - case SC_NEUTRALBARRIER_MASTER: case SC_NEUTRALBARRIER: - case SC_STEALTHFIELD_MASTER: case SC_STEALTHFIELD: - case SC_LEADERSHIP: case SC_GLORYWOUNDS: case SC_SOULCOLD: - case SC_HAWKEYES: case SC_GUILDAURA: case SC_PUSH_CART: - case SC_PARTYFLEE: case SC_GT_REVITALIZE: - case SC_RAISINGDRAGON: case SC_GT_ENERGYGAIN: case SC_GT_CHANGE: - #ifdef RENEWAL - case SC_EXTREMITYFIST2: - #endif - continue; - case SC_ASSUMPTIO: - if( bl->type == BL_MOB ) + if( SC_COMMON_MAX > i ) + if ( status_get_sc_type(i)&SC_NO_CLEARANCE ) continue; - break; + switch (i) { + case SC_ASSUMPTIO: + if( bl->type == BL_MOB ) + continue; + break; + case SC_BERSERK: + case SC_SATURDAY_NIGHT_FEVER: + tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. + break; } - if(i==SC_BERSERK || i==SC_SATURDAYNIGHTFEVER) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. status_change_end(bl,(sc_type)i,INVALID_TIMER); } break; } - map_foreachinrange(skill->area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill->castend_damage_id); + iMap->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, + iMap->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; @@ -7793,7 +8007,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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); + iMap->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; @@ -7813,7 +8027,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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)); clif->skill_nodamage(src,bl,skill_id,skill_lv,i); - if( !i ) + if( sd && !i ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } }else @@ -7823,51 +8037,33 @@ 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); + iMap->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); + iMap->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))); + sc_start(bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv))); break; case WL_SIENNAEXECRATE: - if( status_isimmune(bl) || !tsc ) - break; - if( flag&1 ) { - if( bl->id == skill_area_temp[1] ) - break; // Already work on this target - + if( status_isimmune(bl) || !tsc ) + break; 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,500,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); - else { - rate = 1; - status_change_end(bl,SC_STONE,INVALID_TIMER); - } - - 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); - } - // Doesn't send failure packet if it fails on defense. - } - else if( sd ) // Failure on Rate + int rate = 45 + 5 * skill_lv; + if( rnd()%100 < rate ){ + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + iMap->foreachinrange(skill_area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id); + }else if( sd ) // Failure on Rate clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; @@ -7876,36 +8072,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WL_SUMMONBL: case WL_SUMMONWB: case WL_SUMMONSTONE: - { - short element = 0, sctype = 0, pos = -1; - struct status_change *sc = status_get_sc(src); - if( !sc ) break; - - for( i = SC_SPHERE_1; i <= SC_SPHERE_5; i++ ) - { - if( !sctype && !sc->data[i] ) - sctype = i; // Take the free SC - if( sc->data[i] ) - pos = max(sc->data[i]->val2,pos); - } - - if( !sctype ) - { - if( sd ) // No free slots to put SC - clif->skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON,0); + for( i = SC_SUMMON1; i <= SC_SUMMON5; i++ ){ + if( tsc && !tsc->data[i] ){ // officially it doesn't work like a stack + int ele = WLS_FIRE + (skill_id - WL_SUMMONFB) - (skill_id == WL_SUMMONSTONE ? 4 : 0); + clif->skill_nodamage(src, bl, skill_id, skill_lv, + sc_start(bl, (sc_type)i, 100, ele, skill->get_time(skill_id, skill_lv))); break; } - - pos++; // Used in val2 for SC. Indicates the order of this ball - switch( skill_id ) { // Set val1. The SC element for this ball - case WL_SUMMONFB: element = WLS_FIRE; break; - case WL_SUMMONBL: element = WLS_WIND; break; - case WL_SUMMONWB: element = WLS_WATER; break; - case WL_SUMMONSTONE: element = WLS_STONE; break; - } - - 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; @@ -7913,10 +8086,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( sd ) { struct status_change *sc = status_get_sc(bl); - for( i = SC_SPELLBOOK1; i <= SC_MAXSPELLBOOK; i++) + for( i = SC_SPELLBOOK1; i <= SC_SPELLBOOK7; i++) if( sc && !sc->data[i] ) break; - if( i == SC_MAXSPELLBOOK ) { + if( i == SC_SPELLBOOK7 ) { clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_READING, 0); break; } @@ -7937,9 +8110,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RA_WUGMASTERY: if( sd ) { if( !pc_iswug(sd) ) - pc_setoption(sd,sd->sc.option|OPTION_WUG); + pc->setoption(sd,sd->sc.option|OPTION_WUG); else - pc_setoption(sd,sd->sc.option&~OPTION_WUG); + pc->setoption(sd,sd->sc.option&~OPTION_WUG); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -7947,11 +8120,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RA_WUGRIDER: if( sd ) { if( !pc_isridingwug(sd) && pc_iswug(sd) ) { - pc_setoption(sd,sd->sc.option&~OPTION_WUG); - pc_setoption(sd,sd->sc.option|OPTION_WUGRIDER); + pc->setoption(sd,sd->sc.option&~OPTION_WUG); + pc->setoption(sd,sd->sc.option|OPTION_WUGRIDER); } else if( pc_isridingwug(sd) ) { - pc_setoption(sd,sd->sc.option&~OPTION_WUGRIDER); - pc_setoption(sd,sd->sc.option|OPTION_WUG); + pc->setoption(sd,sd->sc.option&~OPTION_WUGRIDER); + pc->setoption(sd,sd->sc.option|OPTION_WUG); } clif->skill_nodamage(src,bl,skill_id,skill_lv,1); } @@ -7960,7 +8133,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RA_WUGDASH: if( tsce ) { clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER)); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } if( sd && pc_isridingwug(sd) ) { @@ -7972,7 +8145,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); + iMap->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 @@ -7981,9 +8154,8 @@ 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,0); clif->slide(src,src->x,src->y); - clif->fixpos(src); //Aegis sent this packet clif->skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -7991,7 +8163,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NC_SELFDESTRUCTION: if( sd ) { if( pc_ismadogear(sd) ) - pc_setmadogear(sd, 0); + 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); status_set_sp(src, 0, 0); @@ -8002,15 +8174,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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))); - if( sd ) pc_overheat(sd,1); + 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))) ) { - 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);; + iMap->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); + if (sd) pc->overheat(sd,1); } clif->skill_nodamage(src,src,skill_id,skill_lv,i); break; @@ -8036,7 +8208,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NC_DISJOINT: { if( bl->type != BL_MOB ) break; - md = map_id2md(bl->id); + md = iMap->id2md(bl->id); if( md && md->class_ >= MOBID_SILVERSNIPER && md->class_ <= MOBID_MAGICDECOY_WIND ) status_kill(bl); clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); @@ -8080,7 +8252,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } 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, + iMap->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 +8290,7 @@ 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); + iMap->foreachinrange(skill->destroy_trap,bl,skill->get_splash(skill_id,skill_lv),BL_SKILL,tick); break; case LG_REFLECTDAMAGE: @@ -8158,7 +8330,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); + iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER); break; case 2: @@ -8186,14 +8358,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); + iMap->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); + iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id); break; case 3: if( sc_start(bl,SC_SHIELDSPELL_MDEF,brate,opt,sd->bonus.shieldmdef * 30000) ) @@ -8245,15 +8417,42 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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); + iMap->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; + case LG_KINGS_GRACE: + if( flag&1 ){ + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); + for(i=0; i<SC_MAX; i++) + { + if (!tsc->data[i]) + continue; + switch(i){ + case SC_POISON: case SC_BLIND: + case SC_FREEZE: case SC_STONE: + case SC_STUN: case SC_SLEEP: + case SC_BLOODING: case SC_CURSE: + case SC_CONFUSION: case SC_ILLUSION: + case SC_SILENCE: case SC_BURNING: + case SC_CRYSTALIZE: case SC_FROSTMISTY: + case SC_DEEP_SLEEP: case SC_FEAR: + case SC_MANDRAGORA: + status_change_end(bl, (sc_type)i, INVALID_TIMER); + } + } + }else { + skill_area_temp[2] = 0; + if( !map_flag_vs(src->m) && !map_flag_gvg(src->m) ) + flag |= BCT_GUILD; + iMap->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; - case LG_INSPIRATION: if( sd && !map[sd->bl.m].flag.noexppenalty && sd->status.base_level != MAX_LEVEL ) { - sd->status.base_exp -= min(sd->status.base_exp, pc_nextbaseexp(sd) * 1 / 100); // 1% penalty. - sd->status.job_exp -= min(sd->status.job_exp, pc_nextjobexp(sd) * 1 / 100); + sd->status.base_exp -= min(sd->status.base_exp, pc->nextbaseexp(sd) * 1 / 100); // 1% penalty. + sd->status.job_exp -= min(sd->status.job_exp, pc->nextjobexp(sd) * 1 / 100); clif->updatestatus(sd,SP_BASEEXP); clif->updatestatus(sd,SP_JOBEXP); } @@ -8265,18 +8464,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( is_boss(bl) ) break; 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()); + mob_unlocktarget((TBL_MOB*)bl,iTimer->gettick()); unit_stop_attack(bl); clif->bladestop(src, bl->id, 1); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } } 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 + count = iMap->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); + 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))); } @@ -8287,7 +8486,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui short max = 5 + 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); + 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; @@ -8298,13 +8497,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER ) { i = dstsd->spiritball; //1%sp per spiritball. - pc_delspiritball(dstsd, dstsd->spiritball, 0); + pc->delspiritball(dstsd, dstsd->spiritball, 0); } if( i ) status_percent_heal(src, 0, i); 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); + iMap->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; @@ -8313,8 +8512,8 @@ 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_delspiritball(sd, sd->spiritball, 0); + pc->addspiritball(dstsd, skill->get_time(MO_CALLSPIRITS, pc->checkskill(sd,MO_CALLSPIRITS)), i); + pc->delspiritball(sd, sd->spiritball, 0); } } clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); @@ -8341,9 +8540,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_change_end(bl, SC_POISON, INVALID_TIMER); status_change_end(bl, SC_SILENCE, INVALID_TIMER); status_change_end(bl, SC_BLIND, INVALID_TIMER); - status_change_end(bl, SC_HALLUCINATION, INVALID_TIMER); + status_change_end(bl, SC_ILLUSION, INVALID_TIMER); status_change_end(bl, SC_BURNING, INVALID_TIMER); - status_change_end(bl, SC_FREEZING, INVALID_TIMER); + status_change_end(bl, SC_FROSTMISTY, INVALID_TIMER); } clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -8354,6 +8553,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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))); break; + case SR_FLASHCOMBO: + clif->skill_nodamage(src,bl,skill_id,skill_lv,1); + for(i = SR_FLASHCOMBO_ATK_STEP1; i <= SR_FLASHCOMBO_ATK_STEP4; i++) + skill->addtimerskill(src, tick + 500 * (i - SR_FLASHCOMBO_ATK_STEP1), bl->id, 0, 0, i, skill_lv, BF_WEAPON, flag|SD_LEVEL); + break; case WA_SWING_DANCE: case WA_MOONLIT_SERENADE: if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) @@ -8368,7 +8572,7 @@ 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); @@ -8393,7 +8597,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui tstatus->hp = heal; tstatus->sp -= tstatus->sp * ( 120 - 20 * skill_lv ) / 100; clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - pc_revive((TBL_PC*)bl,heal,0); + pc->revive((TBL_PC*)bl,heal,0); clif->resurrection(bl,1); } } @@ -8407,16 +8611,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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)); } 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); + iMap->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; case WM_GLOOMYDAY: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if( dstsd && ( pc_checkskill(dstsd,KN_BRANDISHSPEAR) || pc_checkskill(dstsd,LK_SPIRALPIERCE) || - pc_checkskill(dstsd,CR_SHIELDCHARGE) || pc_checkskill(dstsd,CR_SHIELDBOOMERANG) || - pc_checkskill(dstsd,PA_SHIELDCHAIN) || pc_checkskill(dstsd,LG_SHIELDPRESS) ) ) + if( dstsd && ( pc->checkskill(dstsd,KN_BRANDISHSPEAR) || pc->checkskill(dstsd,LK_SPIRALPIERCE) || + 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)); break; @@ -8437,12 +8641,12 @@ 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( iMap->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); + iMap->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))); if( flag&2 ) // Dealed here to prevent conflicts @@ -8476,7 +8680,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } 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); + iMap->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; @@ -8515,7 +8719,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) { - bl = map_id2bl(target_id); + bl = iMap->id2bl(target_id); if (!bl) bl = src; unit_skilluse_pos(src, bl->x, bl->y, improv_skill_id, improv_skill_lv); } else @@ -8549,10 +8753,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(!mapindex) { //Given map not found? clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } - pc_setpos(sd, mapindex, x, y, CLR_TELEPORT); + pc->setpos(sd, mapindex, x, y, CLR_TELEPORT); } break; @@ -8569,7 +8773,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SO_ARRULLO: { - // [(15 + 5 * Skill Level) + ( Caster’s INT / 5 ) + ( Caster’s Job Level / 5 ) - ( Target’s INT / 6 ) - ( Target’s LUK / 10 )] % + // [(15 + 5 * Skill Level) + ( Caster?s INT / 5 ) + ( Caster?s Job Level / 5 ) - ( Target?s INT / 6 ) - ( Target?s LUK / 10 )] % 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); @@ -8579,13 +8783,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case WM_LULLABY_DEEPSLEEP: if( flag&1 ){ - //[(Skill Level x 4) + (Voice Lessons Skill Level x 2) + (Caster’s Base Level / 15) + (Caster’s Job Level / 5)] % - int rate = (4 * skill_lv) + ( (sd) ? pc_checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + status_get_lv(src) / 15; + //[(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)); }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, + iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill->castend_nodamage_id); } break; @@ -8704,7 +8908,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui 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, + iMap->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; @@ -8721,7 +8925,7 @@ 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); + iMap->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); } else //Otherwise, it fails, shows animation and removes items. @@ -8826,7 +9030,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(sd) { 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); + ARR_FIND(1, 6, i, sd->charm[i] > 0 && ttype != i); + if( i < 6 ) + pc->del_charm(sd, sd->charm[i], i); // replace with a new one. + pc->add_charm(sd, skill->get_time(skill_id, skill_lv), 10, ttype); } break; @@ -8840,10 +9047,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui md->master_id = src->id; 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); + iTimer->delete_timer(md->deletetimer, mob_timer_delete); + md->deletetimer = iTimer->add_timer (iTimer->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 + 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); } @@ -8851,45 +9058,50 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; 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))); - }else if( sd ) - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + { + int rate = max(5, (45 + 5 * skill_lv - status_get_int(bl) / 10)); + if( sd && !map_flag_gvg(src->m) ){ + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SIZE, 0); + break; + } + if( dstsd && tsc && !tsc->data[type] && rand()%100 < rate ){ + clif->skill_nodamage(src, bl, 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; case KO_JYUSATSU: 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_zap(bl, tstatus->max_hp*skill_lv*5/100 , 0); + rand()%100 < (10 * (5 * skill_lv - status_get_int(bl) / 2 + 45 + 5 * skill_lv)) ){ + 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_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); + status_change_start(bl, SC_COMA, skill_lv, skill_lv, 0, src->id, 0, 0, 0); }else if( sd ) - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; case KO_GENWAKU: - if ( !map_flag_gvg(src->m) && ( dstsd || dstmd ) && battle->check_target(src,bl,BCT_ENEMY) > 0 ) { + if ( !map_flag_gvg(src->m) && ( dstsd || dstmd ) && !(tstatus->mode&MD_PLANT) && battle->check_target(src,bl,BCT_ENEMY) > 0 ) { int x = src->x, y = src->y; - - if( sd && rnd()%100 > ((45+5*skill_lv) - status_get_int(bl)/10) ){//[(Base chance of success) - (Intelligence Objectives / 10)]%. - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + if( sd && rnd()%100 > max(5, (45 + 5 * skill_lv) - status_get_int(bl) / 10) ){//[(Base chance of success) - ( target's int / 10)]%. + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; } - 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)); - if (unit_movepos(bl,x,y,0,0)) + 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, 25, skill_lv, skill->get_time(skill_id, skill_lv)); + if ( !is_boss(bl) && unit_stop_walking(&sd->bl, 1) && 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)); + if( dstsd && pc_issit(dstsd) ) + pc->setstand(dstsd); + clif->slide(bl, x, y) ; + sc_start(bl, SC_CONFUSION, 75, skill_lv, skill->get_time(skill_id, skill_lv)); } } } @@ -8899,7 +9111,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case OB_OBOROGENSOU: if( sd && ( (skill_id == OB_OBOROGENSOU && bl->type == BL_MOB) // This skill does not work on monsters. || is_boss(bl) ) ){ // Does not work on Boss monsters. - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd, skill_id, USESKILL_FAIL_TOTARGET_PLAYER, 0); break; } case KO_IZAYOI: @@ -8915,7 +9127,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( flag&1 ){ if(tsc && ( tsc->option&(OPTION_CLOAK|OPTION_HIDE) || tsc->data[SC_CAMOUFLAGE] || tsc->data[SC__SHADOWFORM] || - tsc->data[SC_MARIONETTE] || tsc->data[SC_HARMONIZE])){ + tsc->data[SC_MARIONETTE_MASTER] || 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)); status_change_end(bl, SC_HIDING, INVALID_TIMER); @@ -8923,7 +9135,7 @@ 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_CAMOUFLAGE, INVALID_TIMER); status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER); - status_change_end(bl, SC_MARIONETTE, INVALID_TIMER); + status_change_end(bl, SC_MARIONETTE_MASTER, INVALID_TIMER); status_change_end(bl, SC_HARMONIZE, INVALID_TIMER); } if( skill_area_temp[2] == 1 ){ @@ -8932,7 +9144,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } }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); + iMap->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; @@ -8940,7 +9152,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui struct status_change *ssc = status_get_sc(src); struct block_list *m_bl = battle->get_master(src); const enum sc_type scs[] = { - SC_MANDRAGORA, SC_HARMONIZE, SC_DEEPSLEEP, SC_VOICEOFSIREN, SC_SLEEP, SC_CONFUSION, SC_HALLUCINATION + SC_MANDRAGORA, SC_HARMONIZE, SC_DEEP_SLEEP, SC_SIREN, SC_SLEEP, SC_CONFUSION, SC_ILLUSION }; int heal; if(tsc){ @@ -9010,27 +9222,31 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui int summons[5] = {1004, 1303, 1303, 1994, 1994}; int qty[5] = {3 , 3 , 4 , 4 , 5}; struct mob_data *md; - int i; + int i, dummy = 0; + i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,hd->bl.m, BL_MOB, hd->bl.id, summons[skill_lv-1], skill_id, &dummy); + if(i >= qty[skill_lv-1]) + break; + for(i=0; i<qty[skill_lv - 1]; i++){ //easy way md = mob_once_spawn_sub(src, src->m, src->x, src->y, status_get_name(src), summons[skill_lv - 1], "", SZ_SMALL, AI_ATTACK); if (md) { - md->master_id = src->id; + 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); + iTimer->delete_timer(md->deletetimer, mob_timer_delete); + md->deletetimer = iTimer->add_timer(iTimer->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); + sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_CANATTACK|MD_AGGRESSIVE, 0, 60000); } } - if (hd) - skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); + if (hd) + skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); } break; default: ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skill_id); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } @@ -9046,7 +9262,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if( sd && !(flag&1) ) { // ensure that the skill last-cast tick is recorded - sd->canskill_tick = gettick(); + sd->canskill_tick = iTimer->gettick(); if( sd->state.arrow_atk ) { // consume arrow on last invocation to this skill. battle->consume_ammo(sd, skill_id, skill_lv); @@ -9056,334 +9272,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui skill->consume_requirement(sd,skill_id,skill_lv,2); } - map_freeblock_unlock(); - return 0; -} - -/*========================================== - * - *------------------------------------------*/ -int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) -{ - struct block_list *target, *src; - struct map_session_data *sd; - struct mob_data *md; - struct unit_data *ud; - struct status_change *sc = NULL; - int inf,inf2,flag = 0; - - src = map_id2bl(id); - if( src == NULL ) - { - ShowDebug("skill_castend_id: src == NULL (tid=%d, id=%d)\n", tid, id); - return 0;// not found - } - - ud = unit_bl2ud(src); - if( ud == NULL ) - { - ShowDebug("skill_castend_id: ud == NULL (tid=%d, id=%d)\n", tid, id); - return 0;// ??? - } - - sd = BL_CAST(BL_PC, src); - md = BL_CAST(BL_MOB, src); - - if( src->prev == NULL ) { - ud->skilltimer = INVALID_TIMER; - return 0; - } - - if(ud->skill_id != SA_CASTCANCEL && ud->skill_id != SO_SPELLFIST) {// otherwise handled in unit_skillcastcancel() - if( ud->skilltimer != tid ) { - ShowError("skill_castend_id: Timer mismatch %d!=%d!\n", ud->skilltimer, tid); - ud->skilltimer = INVALID_TIMER; - return 0; - } - - if( sd && ud->skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) ) - {// restore original walk speed - ud->skilltimer = INVALID_TIMER; - status_calc_bl(&sd->bl, SCB_SPEED); - } - - ud->skilltimer = INVALID_TIMER; - } - - if (ud->skilltarget == id) - target = src; - else - target = map_id2bl(ud->skilltarget); - - // Use a do so that you can break out of it when the skill fails. - do { - if(!target || target->prev==NULL) break; - - if(src->m != target->m || status_isdead(src)) break; - - switch (ud->skill_id) { - //These should become skill_castend_pos - case WE_CALLPARTNER: - if(sd) clif->callpartner(sd); - case WE_CALLPARENT: - case WE_CALLBABY: - 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); - ud->skillx = target->x + inf2; - ud->skilly = target->y + inf2; - if (inf2 && !map_random_dir(target, &ud->skillx, &ud->skilly)) { - ud->skillx = target->x; - ud->skilly = target->y; - } - ud->skilltimer=tid; - 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); - } - - if(ud->skill_id == RG_BACKSTAP) { - uint8 dir = map_calc_dir(src,target->x,target->y),t_dir = unit_getdir(target); - if(check_distance_bl(src, target, 0) || map_check_dir(dir,t_dir)) { - break; - } - } - - if( ud->skill_id == PR_TURNUNDEAD ) { - struct status_data *tstatus = status_get_status_data(target); - if( !battle->check_undead(tstatus->race, tstatus->def_ele) ) - break; - } - - if( ud->skill_id == RA_WUGSTRIKE ){ - if( !path_search(NULL,src->m,src->x,src->y,target->x,target->y,1,CELL_CHKNOREACH)) - break; - } - - if( ud->skill_id == PR_LEXDIVINA || ud->skill_id == MER_LEXDIVINA ) - { - sc = status_get_sc(target); - if( battle->check_target(src,target, BCT_ENEMY) <= 0 && (!sc || !sc->data[SC_SILENCE]) ) - { //If it's not an enemy, and not silenced, you can't use the skill on them. [Skotlex] - clif->skill_nodamage (src, target, ud->skill_id, ud->skill_lv, 0); - break; - } - } - else - { // Check target validity. - 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 - ) // Casted through combo. - inf = BCT_ENEMY; //Offensive skill. - else if(inf2&INF2_NO_ENEMY) - inf = BCT_NOENEMY; - else - inf = 0; - - if(inf2 & (INF2_PARTY_ONLY|INF2_GUILD_ONLY) && src != target) - { - inf |= - (inf2&INF2_PARTY_ONLY?BCT_PARTY:0)| - (inf2&INF2_GUILD_ONLY?BCT_GUILD:0); - //Remove neutral targets (but allow enemy if skill is designed to be so) - inf &= ~BCT_NEUTRAL; - } - - 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; - } - - if( ud->skill_id >= SL_SKE && ud->skill_id <= SL_SKA && target->type == BL_MOB ) - { - if( ((TBL_MOB*)target)->class_ == MOBID_EMPERIUM ) - break; - } - else if (inf && battle->check_target(src, target, inf) <= 0){ - if (sd) clif->skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); - break; - } - - if(inf&BCT_ENEMY && (sc = status_get_sc(target)) && - sc->data[SC_FOGWALL] && - rnd() % 100 < 75) { //Fogwall makes all offensive-type targetted skills fail at 75% - if (sd) clif->skill_fail(sd, ud->skill_id, USESKILL_FAIL_LEVEL, 0); - break; - } - } - - //Avoid doing double checks for instant-cast skills. - if (tid != INVALID_TIMER && !status_check_skilluse(src, target, ud->skill_id, 1)) - break; - - if(md) { - md->last_thinktime=tick +MIN_MOBTHINKTIME; - if(md->skill_idx >= 0 && md->db->skill[md->skill_idx].emotion >= 0) - clif->emotion(src, md->db->skill[md->skill_idx].emotion); - } - - 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)) - { - 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); - } - break; - } - - if( sd ) - { - 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); - } -#ifdef OFFICIAL_WALKPATH - if( !path_search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) ) - break; -#endif - if( (src->type == BL_MER || src->type == BL_HOM) && !skill->check_condition_mercenary(src, ud->skill_id, ud->skill_lv, 1) ) - break; - - if (ud->state.running && ud->skill_id == TK_JUMPKICK) { - ud->state.running = 0; - status_change_end(src, SC_RUN, INVALID_TIMER); - flag = 1; - } - - 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->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. - if (sd->skillcooldown[i].id == ud->skill_id){ - cooldown += sd->skillcooldown[i].val; - break; - } - } - if(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->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); - 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 ) - break; - } - 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(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", - src->type, src->id, ud->skill_id, ud->skill_lv, target->id); - - map_freeblock_lock(); - - // SC_MAGICPOWER needs to switch states before any damage is actually dealt - skill->toggle_magicpower(src, ud->skill_id); - 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); - else - skill->castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); - - sc = status_get_sc(src); - if(sc && sc->count) { - if(sc->data[SC_SPIRIT] && - sc->data[SC_SPIRIT]->val2 == SL_WIZARD && - sc->data[SC_SPIRIT]->val3 == ud->skill_id && - 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, 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] - sd->skillitem = sd->skillitemlv = 0; - - if (ud->skilltimer == INVALID_TIMER) { - if(md) md->skill_idx = -1; - else ud->skill_id = 0; //mobs can't clear this one as it is used for skill condition 'afterskill' - ud->skill_lv = ud->skilltarget = 0; - } - map_freeblock_unlock(); - return 1; - } while(0); - - //Skill failed. - if (ud->skill_id == MO_EXTREMITYFIST && sd && !(sc && sc->data[SC_FOGWALL])) - { //When Asura fails... (except when it fails from Fog of Wall) - //Consume SP/spheres - skill->consume_requirement(sd,ud->skill_id, ud->skill_lv,1); - status_set_sp(src, 0, 0); - sc = &sd->sc; - if (sc->count) - { //End states - 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)); -#endif - } - if (target && target->m == src->m) - { //Move character to target anyway. - int dir, x, y; - dir = map_calc_dir(src,target->x,target->y); - if( dir > 0 && dir < 4) x = -2; - else if( dir > 4 ) x = 2; - else x = 0; - if( dir > 2 && dir < 6 ) y = -2; - else if( dir == 7 || dir < 2 ) y = 2; - else y = 0; - if (unit_movepos(src, src->x+x, src->y+y, 1, 1)) - { //Display movement + animation. - clif->slide(src,src->x,src->y); - clif->skill_damage(src,target,tick,sd->battle_status.amotion,0,0,1,ud->skill_id, ud->skill_lv, 5); - } - clif->skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); - } - } - - 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) ) - 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 - //which would lead to double 'skill failed' messages u.u [Skotlex] - if(sd) - sd->skillitem = sd->skillitemlv = 0; - else if(md) - md->skill_idx = -1; + iMap->freeblock_unlock(); return 0; } @@ -9392,7 +9281,7 @@ 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) { - struct block_list* src = map_id2bl(id); + struct block_list* src = iMap->id2bl(id); int maxcount; struct map_session_data *sd; struct unit_data *ud = unit_bl2ud(src); @@ -9415,7 +9304,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) return 0; } - if( sd && ud->skilltimer != INVALID_TIMER && ( pc_checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) ) + if( sd && ud->skilltimer != INVALID_TIMER && ( pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) ) {// restore original walk speed ud->skilltimer = INVALID_TIMER; status_calc_bl(&sd->bl, SCB_SPEED); @@ -9507,7 +9396,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) skill->blockpc_start(sd, ud->skill_id, cooldown, false); } if( battle_config.display_status_timers && sd ) - clif->status_change(src, SI_ACTIONDELAY, 1, skill->delay_fix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); + clif->status_change(src, SI_POSTDELAY, 1, skill->delay_fix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); // if( sd ) // { // switch( ud->skill_id ) @@ -9519,7 +9408,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) // } 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(); + iMap->freeblock_lock(); 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] @@ -9531,7 +9420,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) ud->skill_lv = ud->skillx = ud->skilly = 0; } - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 1; } while(0); @@ -9553,6 +9442,143 @@ static int skill_count_wos(struct block_list *bl,va_list ap) { } return 0; } + +/*========================================== + * + *------------------------------------------*/ +int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *map) +{ + nullpo_ret(sd); + +//Simplify skill_failed code. +#define skill_failed(sd) { sd->menuskill_id = sd->menuskill_val = 0; } + if(skill_id != sd->menuskill_id) + return 0; + + if( sd->bl.prev == NULL || pc_isdead(sd) ) { + skill_failed(sd); + return 0; + } + + if( ( sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING ) || sd->sc.option&OPTION_HIDE ) { + skill_failed(sd); + return 0; + } + if(sd->sc.count && ( + sd->sc.data[SC_SILENCE] || + sd->sc.data[SC_ROKISWEIL] || + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_STEELBODY] || + (sd->sc.data[SC_DANCING] && skill_id < RK_ENCHANTBLADE && !pc->checkskill(sd, WM_LESSON)) || + sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || + sd->sc.data[SC_BASILICA] || + sd->sc.data[SC_MARIONETTE_MASTER] || + sd->sc.data[SC_WHITEIMPRISON] || + (sd->sc.data[SC_STASIS] && skill->block_check(&sd->bl, SC_STASIS, skill_id)) || + (sd->sc.data[SC_KG_KAGEHUMI] && skill->block_check(&sd->bl, SC_KG_KAGEHUMI, skill_id)) || + sd->sc.data[SC_OBLIVIONCURSE] || + sd->sc.data[SC__MANHOLE] || + (sd->sc.data[SC_VOLCANIC_ASH] && rnd()%2) //50% fail chance under ASH + )) { + skill_failed(sd); + return 0; + } + + pc_stop_attack(sd); + pc_stop_walking(sd,0); + + if(battle_config.skill_log && battle_config.skill_log&BL_PC) + ShowInfo("PC %d skill castend skill =%d map=%s\n",sd->bl.id,skill_id,map); + + if(strcmp(map,"cancel")==0) { + skill_failed(sd); + return 0; + } + + switch(skill_id) { + case AL_TELEPORT: + if(strcmp(map,"Random")==0) + pc->randomwarp(sd,CLR_TELEPORT); + else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here. + pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); + break; + + case AL_WARP: + { + const struct point *p[4]; + struct skill_unit_group *group; + int i, lv, wx, wy; + int maxcount=0; + int x,y; + unsigned short mapindex; + + mapindex = mapindex_name2id((char*)map); + sd->state.workinprogress = 0; + if(!mapindex) { //Given map not found? + clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + skill_failed(sd); + return 0; + } + p[0] = &sd->status.save_point; + p[1] = &sd->status.memo_point[0]; + 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) { + for(i=0;i<MAX_SKILLUNITGROUP && sd->ud.skillunit[i] && maxcount;i++) { + if(sd->ud.skillunit[i]->skill_id == skill_id) + maxcount--; + } + if(!maxcount) { + clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + skill_failed(sd); + return 0; + } + } + + lv = sd->skillitem==skill_id?sd->skillitemlv:pc->checkskill(sd,skill_id); + wx = sd->menuskill_val>>16; + wy = sd->menuskill_val&0xffff; + + if( lv <= 0 ) return 0; + if( lv > 4 ) lv = 4; // crash prevention + + // check if the chosen map exists in the memo list + ARR_FIND( 0, lv, i, mapindex == p[i]->map ); + if( i < lv ) { + x=p[i]->x; + y=p[i]->y; + } else { + skill_failed(sd); + return 0; + } + + 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); + 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) { + skill_failed(sd); + return 0; + } + + group->val1 = (group->val1<<16)|(short)0; + // record the destination coordinates + group->val2 = (x<<16)|y; + group->val3 = mapindex; + } + break; + } + + sd->menuskill_id = sd->menuskill_val = 0; + return 0; +#undef skill_failed +} + /*========================================== * *------------------------------------------*/ @@ -9600,11 +9626,11 @@ 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); - map_foreachinarea(skill->area_sub, + iMap->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); - map_foreachinarea(skill->area_sub, + iMap->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); @@ -9612,7 +9638,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case BS_HAMMERFALL: i = skill->get_splash(skill_id, skill_lv); - map_foreachinarea (skill->area_sub, + iMap->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); @@ -9620,17 +9646,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case HT_DETECTING: i = skill->get_splash(skill_id, skill_lv); - map_foreachinarea( status_change_timer_sub, + iMap->foreachinarea( status_change_timer_sub, src->m, x-i, y-i, x+i,y+i,BL_CHAR, src,NULL,SC_SIGHT,tick); if(battle_config.traps_setting&1) - map_foreachinarea( skill_reveal_trap, + iMap->foreachinarea( skill_reveal_trap, src->m, x-i, y-i, x+i,y+i,BL_SKILL); break; case SR_RIDEINLIGHTNING: 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, + iMap->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); break; @@ -9641,7 +9667,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui struct skill_unit_group *sg; if ((sg= skill->locate_element_field(src)) != NULL && ( sg->skill_id == SA_VOLCANO || sg->skill_id == SA_DELUGE || sg->skill_id == SA_VIOLENTGALE )) { - if (sg->limit - DIFF_TICK(gettick(), sg->tick) > 0) { + if (sg->limit - DIFF_TICK(iTimer->gettick(), sg->tick) > 0) { skill->unitsetting(src,skill_id,skill_lv,x,y,0); return 0; // not to consume items } else @@ -9719,6 +9745,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case NJ_HUUMA: #endif case NPC_EVILLAND: + case WL_COMET: case RA_ELECTRICSHOCKER: case RA_CLUSTERBOMB: case RA_MAGENTATRAP: @@ -9755,6 +9782,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case MH_POISON_MIST: case MH_STEINWAND: case MH_XENO_SLASHER: + case NC_MAGMA_ERUPTION: 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); @@ -9768,7 +9796,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if( sc->data[SC_BASILICA] ) status_change_end(src, SC_BASILICA, INVALID_TIMER); // Cancel Basilica else { // Create Basilica. Start SC on caster. Unit timer start SC on others. - if( map_foreachinrange(skill_count_wos, src, 2, BL_MOB|BL_PC, src) ) { + if( iMap->foreachinrange(skill_count_wos, src, 2, BL_MOB|BL_PC, src) ) { if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL,0); return 1; @@ -9789,7 +9817,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; case RG_CLEANER: // [Valaris] i = skill->get_splash(skill_id, skill_lv); - map_foreachinarea(skill->graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL); + iMap->foreachinarea(skill->graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL); break; case SO_WARMER: @@ -9866,8 +9894,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui md->master_id = src->id; 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); + iTimer->delete_timer(md->deletetimer, mob_timer_delete); + md->deletetimer = iTimer->add_timer (iTimer->gettick() + skill->get_time(skill_id,skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn (md); //Now it is ready for spawning. } } @@ -9877,7 +9905,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case CR_SLIMPITCHER: if (sd) { int i = skill_lv%11 - 1; - int j = pc_search_inventory(sd,skill_db[skill_id].itemid[i]); + int j = pc->search_inventory(sd,skill_db[skill_id].itemid[i]); if( j < 0 || skill_db[skill_id].itemid[i] <= 0 || sd->inventory_data[j] == NULL || sd->status.inventory[j].amount < skill_db[skill_id].amount[i] ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -9889,17 +9917,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui run_script(sd->inventory_data[j]->script,0,sd->bl.id,0); potion_flag = 0; //Apply skill bonuses - i = pc_checkskill(sd,CR_SLIMPITCHER)*10 - + pc_checkskill(sd,AM_POTIONPITCHER)*10 - + pc_checkskill(sd,AM_LEARNINGPOTION)*5 - + pc_skillheal_bonus(sd, skill_id); + i = pc->checkskill(sd,CR_SLIMPITCHER)*10 + + pc->checkskill(sd,AM_POTIONPITCHER)*10 + + pc->checkskill(sd,AM_LEARNINGPOTION)*5 + + pc->skillheal_bonus(sd, skill_id); 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); - map_foreachinarea(skill->area_sub, + iMap->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); @@ -9921,7 +9949,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if(potion_hp > 0 || potion_sp > 0) { i = skill->get_splash(skill_id, skill_lv); - map_foreachinarea(skill->area_sub, + iMap->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); @@ -9934,7 +9962,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui int dummy = 1; clif->skill_poseffect(src,skill_id,skill_lv,x,y,tick); 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); + iMap->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); return 1; @@ -9950,7 +9978,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui // Plant Cultivation [Celest] case CR_CULTIVATION: if (sd) { - if( map_count_oncell(src->m,x,y,BL_CHAR) > 0 ) + if( iMap->count_oncell(src->m,x,y,BL_CHAR) > 0 ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; @@ -9965,8 +9993,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if ((i = skill->get_time(skill_id, skill_lv)) > 0) { if( md->deletetimer != INVALID_TIMER ) - delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (tick + i, mob_timer_delete, md->bl.id, 0); + iTimer->delete_timer(md->deletetimer, mob_timer_delete); + md->deletetimer = iTimer->add_timer (tick + i, mob_timer_delete, md->bl.id, 0); } mob_spawn (md); } @@ -10017,14 +10045,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: + case RK_DRAGONBREATH_WATER: 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), + iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); break; case SO_ARRULLO: 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), + iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id); break; /** @@ -10046,24 +10075,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case AB_EPICLESIS: 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); + iMap->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; - /** - * Warlock - **/ - case WL_COMET: - if( sc ) { - 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); - break; case WL_EARTHSTRAIN: { - int i, wave = skill_lv + 4, dir = map_calc_dir(src,x,y); + int i, wave = skill_lv + 4, dir = iMap->calc_dir(src,x,y); int sx = x = src->x, sy = y = src->y; // Store first caster's location to avoid glitch on unit setting for( i = 1; i <= wave; i++ ) @@ -10074,7 +10092,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,iTimer->gettick() + (50 * i),0,sx,sy,skill_id,skill_lv,dir,flag&2); } } break; @@ -10083,7 +10101,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui **/ 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); + iMap->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; /** @@ -10094,7 +10112,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui 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); + if( sd ) pc->overheat(sd,1); } break; @@ -10109,8 +10127,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui md->master_id = src->id; 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); + iTimer->delete_timer(md->deletetimer, mob_timer_delete); + md->deletetimer = iTimer->add_timer (iTimer->gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn( md ); } } @@ -10121,10 +10139,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; 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 + clif->skill_nodamage(src,src,skill_id,skill_lv,1); if( skill->blown(src,src,6,unit_getdir(src),0) ) - skill->castend_nodamage_id(src,src,TF_HIDING,1,tick,0); + skill->castend_nodamage_id(src,src,TF_HIDING,1,tick,0x2); break; case LG_OVERBRAND: @@ -10132,10 +10150,10 @@ 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); + iMap->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); + iMap->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; @@ -10144,7 +10162,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui 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)); - if( sd ) pc_banding(sd,skill_lv); + if( sd ) pc->banding(sd,skill_lv); } clif->skill_nodamage(src,src,skill_id,skill_lv,1); break; @@ -10152,7 +10170,7 @@ 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); - map_foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), + iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); } else if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL,0); @@ -10160,13 +10178,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case WM_DOMINION_IMPULSE: i = skill->get_splash(skill_id, skill_lv); - map_foreachinarea( skill->activate_reverberation, + iMap->foreachinarea( skill->activate_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); + iMap->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); @@ -10198,10 +10216,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui clif->changetraplook(&ud->skillunit[i]->unit->bl, UNT_FIRE_EXPANSION_TEAR_GAS); break; case 5: - map_foreachinarea(skill->area_sub, src->m, + iMap->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); + 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: @@ -10244,7 +10262,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER); if( sd ) {// ensure that the skill last-cast tick is recorded - sd->canskill_tick = gettick(); + sd->canskill_tick = iTimer->gettick(); if( sd->state.arrow_atk && !(flag&1) ) { // consume arrow if this is a ground skill @@ -10258,141 +10276,6 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui return 0; } -/*========================================== - * - *------------------------------------------*/ -int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *map) -{ - nullpo_ret(sd); - -//Simplify skill_failed code. -#define skill_failed(sd) { sd->menuskill_id = sd->menuskill_val = 0; } - if(skill_id != sd->menuskill_id) - return 0; - - if( sd->bl.prev == NULL || pc_isdead(sd) ) { - skill_failed(sd); - return 0; - } - - if( ( sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING ) || sd->sc.option&OPTION_HIDE ) { - skill_failed(sd); - return 0; - } - if(sd->sc.count && ( - sd->sc.data[SC_SILENCE] || - sd->sc.data[SC_ROKISWEIL] || - sd->sc.data[SC_AUTOCOUNTER] || - sd->sc.data[SC_STEELBODY] || - (sd->sc.data[SC_DANCING] && skill_id < RK_ENCHANTBLADE && !pc_checkskill(sd, WM_LESSON)) || - sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || - 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_OBLIVIONCURSE] || - sd->sc.data[SC__MANHOLE] || - (sd->sc.data[SC_ASH] && rnd()%2) //50% fail chance under ASH - )) { - skill_failed(sd); - return 0; - } - - pc_stop_attack(sd); - pc_stop_walking(sd,0); - - if(battle_config.skill_log && battle_config.skill_log&BL_PC) - ShowInfo("PC %d skill castend skill =%d map=%s\n",sd->bl.id,skill_id,map); - - if(strcmp(map,"cancel")==0) { - skill_failed(sd); - return 0; - } - - switch(skill_id) { - case AL_TELEPORT: - if(strcmp(map,"Random")==0) - pc_randomwarp(sd,CLR_TELEPORT); - else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here. - pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); - break; - - case AL_WARP: - { - const struct point *p[4]; - struct skill_unit_group *group; - int i, lv, wx, wy; - int maxcount=0; - int x,y; - unsigned short mapindex; - - mapindex = mapindex_name2id((char*)map); - if(!mapindex) { //Given map not found? - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - skill_failed(sd); - return 0; - } - p[0] = &sd->status.save_point; - p[1] = &sd->status.memo_point[0]; - 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) { - for(i=0;i<MAX_SKILLUNITGROUP && sd->ud.skillunit[i] && maxcount;i++) { - if(sd->ud.skillunit[i]->skill_id == skill_id) - maxcount--; - } - if(!maxcount) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - skill_failed(sd); - return 0; - } - } - - lv = sd->skillitem==skill_id?sd->skillitemlv:pc_checkskill(sd,skill_id); - wx = sd->menuskill_val>>16; - wy = sd->menuskill_val&0xffff; - - if( lv <= 0 ) return 0; - if( lv > 4 ) lv = 4; // crash prevention - - // check if the chosen map exists in the memo list - ARR_FIND( 0, lv, i, mapindex == p[i]->map ); - if( i < lv ) { - x=p[i]->x; - y=p[i]->y; - } else { - skill_failed(sd); - return 0; - } - - 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); - 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) { - skill_failed(sd); - return 0; - } - - group->val1 = (group->val1<<16)|(short)0; - // record the destination coordinates - group->val2 = (x<<16)|y; - group->val3 = mapindex; - } - break; - } - - sd->menuskill_id = sd->menuskill_val = 0; - return 0; -#undef skill_failed -} - /// transforms 'target' skill unit into dissonance (if conditions are met) int skill_dance_overlap_sub(struct block_list* bl, va_list ap) { struct skill_unit* target = (struct skill_unit*)bl; @@ -10431,7 +10314,7 @@ int skill_dance_overlap(struct skill_unit* unit, int flag) { unit->val2 &= ~UF_ENSEMBLE; } - return map_foreachincell(skill->dance_overlap_sub, unit->bl.m,unit->bl.x,unit->bl.y,BL_SKILL, unit,flag); + return iMap->foreachincell(skill->dance_overlap_sub, unit->bl.m,unit->bl.x,unit->bl.y,BL_SKILL, unit,flag); } /*========================================== @@ -10494,14 +10377,14 @@ int skill_icewall_block(struct block_list *bl,va_list ap) { nullpo_ret(bl); nullpo_ret(md); - if( !md->target_id || ( target = map_id2bl(md->target_id) ) == NULL ) + if( !md->target_id || ( target = iMap->id2bl(md->target_id) ) == NULL ) return 0; if( path_search_long(NULL,bl->m,bl->x,bl->y,target->x,target->y,CELL_CHKICEWALL) ) return 0; if( !check_distance_bl(bl, target, status_get_range(bl) ) ) { - mob_unlocktarget(md,gettick()); + mob_unlocktarget(md,iTimer->gettick()); mob_stop_walking(md,1); } @@ -10572,7 +10455,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill { //Warp Portal morphing to active mode, extract relevant data from src. [Skotlex] if( src->type != BL_SKILL ) return NULL; group = ((TBL_SKILL*)src)->group; - src = map_id2bl(group->src_id); + src = iMap->id2bl(group->src_id); if( !src ) return NULL; val2 = group->val2; //Copy the (x,y) position you warp to val3 = group->val3; //as well as the mapindex to warp to. @@ -10588,7 +10471,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill break; case WZ_FIREPILLAR: - if( map_getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) ) + if( iMap->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) ) return NULL; if((flag&1)!=0) limit=1000; @@ -10653,7 +10536,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill old_sg->skill_id == SA_VIOLENTGALE ) && old_sg->limit > 0) { //Use the previous limit (minus the elapsed time) [Skotlex] - limit = old_sg->limit - DIFF_TICK(gettick(), old_sg->tick); + limit = old_sg->limit - DIFF_TICK(iTimer->gettick(), old_sg->tick); if (limit < 0) //This can happen... limit = skill->get_time(skill_id,skill_lv); } @@ -10670,8 +10553,8 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill val1 = skill_lv +status->agi/10; // Flee increase val2 = ((skill_lv+1)/2)+status->luk/10; // Perfect dodge increase if(sd){ - val1 += pc_checkskill(sd,BA_MUSICALLESSON); - val2 += pc_checkskill(sd,BA_MUSICALLESSON); + val1 += pc->checkskill(sd,BA_MUSICALLESSON); + val2 += pc->checkskill(sd,BA_MUSICALLESSON); } break; case DC_HUMMING: @@ -10680,47 +10563,58 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill val1 *= 2; #endif if(sd) - val1 += pc_checkskill(sd,DC_DANCINGLESSON); + val1 += pc->checkskill(sd,DC_DANCINGLESSON); break; case BA_POEMBRAGI: val1 = 3*skill_lv+status->dex/10; // Casting time reduction //For some reason at level 10 the base delay reduction is 50%. val2 = (skill_lv<10?3*skill_lv:50)+status->int_/5; // After-cast delay reduction if(sd){ - val1 += 2*pc_checkskill(sd,BA_MUSICALLESSON); - val2 += 2*pc_checkskill(sd,BA_MUSICALLESSON); + val1 += 2*pc->checkskill(sd,BA_MUSICALLESSON); + val2 += 2*pc->checkskill(sd,BA_MUSICALLESSON); } break; case DC_DONTFORGETME: +#ifdef RENEWAL + val1 = status->dex/10 + 3*skill_lv; // ASPD decrease + val2 = status->agi/10 + 2*skill_lv; // Movement speed adjustment. +#else val1 = status->dex/10 + 3*skill_lv + 5; // ASPD decrease val2 = status->agi/10 + 3*skill_lv + 5; // Movement speed adjustment. +#endif if(sd){ - val1 += pc_checkskill(sd,DC_DANCINGLESSON); - val2 += pc_checkskill(sd,DC_DANCINGLESSON); + val1 += pc->checkskill(sd,DC_DANCINGLESSON); + val2 += pc->checkskill(sd,DC_DANCINGLESSON); } break; case BA_APPLEIDUN: val1 = 5+2*skill_lv+status->vit/10; // MaxHP percent increase if(sd) - val1 += pc_checkskill(sd,BA_MUSICALLESSON); + val1 += pc->checkskill(sd,BA_MUSICALLESSON); break; case DC_SERVICEFORYOU: val1 = 15+skill_lv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed val2 = 20+3*skill_lv+(status->int_/10); // SP cost reduction if(sd){ - val1 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed - val2 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value + val1 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed + val2 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value } break; case BA_ASSASSINCROSS: +#ifdef RENEWAL + val1 = 10 + skill_lv + (status->agi/10); // ASPD increase + if(sd) + val1 += 4*pc->checkskill(sd,BA_MUSICALLESSON); +#else val1 = 100+(10*skill_lv)+(status->agi/10); // ASPD increase if(sd) - val1 += 5*pc_checkskill(sd,BA_MUSICALLESSON); + val1 += 5*pc->checkskill(sd,BA_MUSICALLESSON); +#endif break; case DC_FORTUNEKISS: val1 = 10+skill_lv+(status->luk/10); // Critical increase if(sd) - val1 += pc_checkskill(sd,DC_DANCINGLESSON); + val1 += pc->checkskill(sd,DC_DANCINGLESSON); val1*=10; //Because every 10 crit is an actual cri point. break; case BD_DRUMBATTLEFIELD: @@ -10802,6 +10696,12 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill case GD_HAWKEYES: limit = 1000000;//it doesn't matter break; + case WL_COMET: + if( sc ) { + sc->comet_x = x; + sc->comet_y = y; + } + break; case LG_BANDING: limit = -1; break; @@ -10809,7 +10709,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill interval = limit; val2 = 1; case WM_POEMOFNETHERWORLD: // Can't be placed on top of Land Protector. - if( map_getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) ) + if( iMap->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) ) return NULL; break; case SO_CLOUD_KILL: @@ -10820,7 +10720,6 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill break; case SO_VACUUM_EXTREME: range++; - break; case SC_BLOODYLUST: skill->clear_group(src, 32); @@ -10832,13 +10731,13 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill break; case KO_ZENKAI: if( sd ){ - ARR_FIND(1, 6, i, sd->talisman[i] > 0); + ARR_FIND(1, 6, i, sd->charm[i] > 0); if( i < 5 ){ - val1 = sd->talisman[i]; // no. of aura + val1 = sd->charm[i]; // no. of aura val2 = i; // aura type limit += val1 * 1000; subunt = i - 1; - pc_del_talisman(sd, sd->talisman[i], i); + pc->del_charm(sd, sd->charm[i], i); } } break; @@ -10855,7 +10754,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill group->state.guildaura = ( skill_id >= GD_LEADERSHIP && skill_id <= GD_HAWKEYES )?1:0; group->item_id = req_item; //if tick is greater than current, do not invoke onplace function just yet. [Skotlex] - if (DIFF_TICK(group->tick, gettick()) > SKILLUNITTIMER_INTERVAL) + if (DIFF_TICK(group->tick, iTimer->gettick()) > SKILLUNITTIMER_INTERVAL) active_flag = 0; if(skill_id==HT_TALKIEBOX || skill_id==RG_GRAFFITI){ @@ -10888,7 +10787,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill int val2 = 0; int alive = 1; - if( !group->state.song_dance && !map_getcell(src->m,ux,uy,CELL_CHKREACH) ) + if( !group->state.song_dance && !iMap->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) ) continue; // no path between cell and center of casting. @@ -10900,7 +10799,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill break; case WZ_ICEWALL: val1 = (skill_lv <= 1) ? 500 : 200 + 200*skill_lv; - val2 = map_getcell(src->m, ux, uy, CELL_GETTYPE); + val2 = iMap->getcell(src->m, ux, uy, CELL_GETTYPE); break; case HT_LANDMINE: case MA_LANDMINE: @@ -10953,7 +10852,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill val2 |= UF_RANGEDSINGLEUNIT; // center. if( range <= 0 ) - map_foreachincell(skill->cell_overlap,src->m,ux,uy,BL_SKILL,skill_id, &alive, src); + iMap->foreachincell(skill->cell_overlap,src->m,ux,uy,BL_SKILL,skill_id, &alive, src); if( !alive ) continue; @@ -10969,7 +10868,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill // execute on all targets standing on this cell if (range==0 && active_flag) - map_foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1); + iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,iTimer->gettick(),1); } if (!group->alive_count) { //No cells? Something that was blocked completely by Land Protector? @@ -10980,7 +10879,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill //success, unit created. switch( skill_id ) { case WZ_ICEWALL: - map_foreachinrange(skill->icewall_block, src, AREA_SIZE, BL_MOB); + iMap->foreachinrange(skill->icewall_block, src, AREA_SIZE, BL_MOB); break; case NJ_TATAMIGAESHI: //Store number of tiles. group->val1 = group->alive_count; @@ -11008,9 +10907,9 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned return 0; nullpo_ret(sg=src->group); - nullpo_ret(ss=map_id2bl(sg->src_id)); + nullpo_ret(ss=iMap->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 && iMap->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); @@ -11030,10 +10929,10 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned } else if( sc && battle->check_target(&sg->unit->bl,bl,sg->target_flag) > 0 ) { int sec = skill->get_time2(sg->skill_id,sg->skill_lv); if( 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; + const struct TimerData* td = sc->data[type]?iTimer->get_timer(sc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); - map_moveblock(bl, src->bl.x, src->bl.y, tick); + iMap->moveblock(bl, src->bl.x, src->bl.y, tick); clif->fixpos(bl); sg->val2 = bl->id; } @@ -11058,11 +10957,11 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned 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(iTimer->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))); else { - if (sd) sd->bloodylust_tick = gettick(); + if (sd) sd->bloodylust_tick = iTimer->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))); } @@ -11085,15 +10984,15 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned if( --count <= 0 ) skill->del_unitgroup(sg,ALC_MARK); - if ( map_mapindex2mapid(sg->val3) == sd->bl.m && x == sd->bl.x && y == sd->bl.y ) + if ( iMap->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. */ sg->val1 = (count<<16)|working; - pc_setpos(sd,m,x,y,CLR_TELEPORT); + pc->setpos(sd,m,x,y,CLR_TELEPORT); } } else if(bl->type == BL_MOB && battle_config.mob_warp&2) { - int16 m = map_mapindex2mapid(sg->val3); + int16 m = iMap->mapindex2mapid(sg->val3); if (m < 0) break; //Map not available on this map-server. unit_warp(bl,m,sg->val2>>16,sg->val2&0xffff,CLR_TELEPORT); } @@ -11130,7 +11029,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned case UNT_INTOABYSS: case UNT_SIEGFRIED: //Needed to check when a dancer/bard leaves their ensemble area. - if (sg->src_id==bl->id && !(sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_BARDDANCER)) + if (sg->src_id==bl->id && !(sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_BARDDANCER)) return skill_id; if (!sce) sc_start4(bl,type,100,sg->skill_lv,sg->val1,sg->val2,0,sg->limit); @@ -11143,7 +11042,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned case UNT_DONTFORGETME: case UNT_FORTUNEKISS: case UNT_SERVICEFORYOU: - if (sg->src_id==bl->id && !(sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_BARDDANCER)) + if (sg->src_id==bl->id && !(sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_BARDDANCER)) return 0; if (!sc) return 0; @@ -11152,8 +11051,8 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned else if (sce->val4 == 1) { //Readjust timers since the effect will not last long. sce->val4 = 0; - delete_timer(sce->timer, status_change_timer); - sce->timer = add_timer(tick+sg->limit, status_change_timer, bl->id, type); + iTimer->delete_timer(sce->timer, status_change_timer); + sce->timer = iTimer->add_timer(tick+sg->limit, status_change_timer, bl->id, type); } break; @@ -11196,7 +11095,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned 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_VOLCANIC_ASH, 100, sg->skill_lv, skill->get_time(MH_VOLCANIC_ASH, sg->skill_lv)); break; case UNT_GD_LEADERSHIP: @@ -11231,7 +11130,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns return 0; nullpo_ret(sg=src->group); - nullpo_ret(ss=map_id2bl(sg->src_id)); + nullpo_ret(ss=iMap->id2bl(sg->src_id)); tsd = BL_CAST(BL_PC, bl); tsc = status_get_sc(bl); @@ -11263,7 +11162,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns ts->tick = tick+sg->interval; if ((skill_id==CR_GRANDCROSS || skill_id==NPC_GRANDDARKNESS) && !battle_config.gx_allhit) - ts->tick += sg->interval*(map_count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1); + ts->tick += sg->interval*(iMap->count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1); } switch (sg->unit_id) { @@ -11413,7 +11312,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( sg->val2 == 0 && tsc && (sg->unit_id == UNT_ANKLESNARE || bl->id != sg->src_id) ) { int sec = skill->get_time2(sg->skill_id,sg->skill_lv); if( 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; + const struct TimerData* td = tsc->data[type]?iTimer->get_timer(tsc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); if( sg->unit_id == UNT_MANHOLE || battle_config.skill_trap_type || !map_flag_gvg(src->bl.m) ) { @@ -11444,12 +11343,12 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns 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) ) { - map_moveblock(bl, src->bl.x, src->bl.y, tick); + iMap->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); + iMap->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; @@ -11479,7 +11378,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); + iMap->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 + @@ -11522,7 +11421,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( md && md->class_ == MOBID_EMPERIUM ) break; #endif - if( sg->src_id == bl->id && !(tsc && tsc->data[SC_SPIRIT] && tsc->data[SC_SPIRIT]->val2 == SL_BARDDANCER) ) + if( sg->src_id == bl->id && !(tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SL_BARDDANCER) ) break; // affects self only when soullinked heal = skill->calc_heal(ss,bl,sg->skill_id, sg->skill_lv, true); if( tsc->data[SC_AKAITSUKI] && heal ) @@ -11553,7 +11452,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns status_heal(bl,heal,0,0); break; case 1: // End all negative status - status_change_clear_buffs(bl,6); + status_change_clear_buffs(bl,2); if (tsd) clif->gospel_info(tsd, 0x15); break; case 2: // Immunity to all status @@ -11576,7 +11475,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns sc_start(bl,SC_BLESSING,100,10,time); break; case 7: // Level 10 Increase AGI - sc_start(bl,SC_INCREASEAGI,100,10,time); + sc_start(bl,SC_INC_AGI,100,10,time); break; case 8: // Enchant weapon with Holy element sc_start(bl,SC_ASPERSIO,100,1,time); @@ -11657,6 +11556,8 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_FIREWALK: case UNT_ELECTRICWALK: case UNT_PSYCHIC_WAVE: + case UNT_MAGMA_ERUPTION: + case UNT_MAKIBISHI: skill->attack(skill->get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; @@ -11665,7 +11566,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_GROUNDDRIFT_POISON: case UNT_GROUNDDRIFT_WATER: case UNT_GROUNDDRIFT_FIRE: - map_foreachinrange(skill->trap_splash,&src->bl, + iMap->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; @@ -11702,7 +11603,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) ) + 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);*/ break; @@ -11715,14 +11616,14 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_DIMENSIONDOOR: if( tsd && !map[bl->m].flag.noteleport ) - pc_randomwarp(tsd,3); + pc->randomwarp(tsd,3); else if( bl->type == BL_MOB && battle_config.mob_warp&8 ) unit_warp(bl,-1,-1,-1,3); break; 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); + iMap->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; @@ -11745,16 +11646,16 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( !sg->val2 ) { 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; + const struct TimerData* td = tsc->data[type]?iTimer->get_timer(tsc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); - ///map_moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett] + ///iMap->moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett] clif->fixpos(bl); sg->val2 = bl->id; } else sec = 3000; // Couldn't trap it? sg->limit = DIFF_TICK(tick, sg->tick) + sec; - } else if( tsc->data[SC_THORNSTRAP] && bl->id == sg->val2 ) + } else if( tsc->data[SC_THORNS_TRAP] && 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); } break; @@ -11765,14 +11666,14 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case 1: case 2: default: - sc_start(bl, SC_BURNING, 4 + 4 * sg->skill_lv, sg->skill_lv, + sc_start4(bl, SC_BURNING, 4 + 4 * sg->skill_lv, sg->skill_lv, 0, ss->id, 0, 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, - CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0); + CR_ACIDDEMONSTRATION, sd ? pc->checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0); break; } @@ -11882,36 +11783,31 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns 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_FROSTMISTY, 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)); 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_start4(bl, SC_BURNING, sg->val1*5, sg->skill_lv, 0, ss->id, 0, 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_DEEP_SLEEP, 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)); break; - case UNT_MAKIBISHI: - 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); 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); @@ -11963,7 +11859,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in break; case UNT_SPIDERWEB: { - struct block_list *target = map_id2bl(sg->val2); + struct block_list *target = iMap->id2bl(sg->val2); if (target && target==bl) { if (sce && sce->val3 == sg->group_id) @@ -12053,11 +11949,11 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i case DC_FORTUNEKISS: case DC_SERVICEFORYOU: if (sce) { - delete_timer(sce->timer, status_change_timer); + iTimer->delete_timer(sce->timer, status_change_timer); //NOTE: It'd be nice if we could get the skill_lv for a more accurate extra time, but alas... //not possible on our current implementation. sce->val4 = 1; //Store the fact that this is a "reduced" duration effect. - sce->timer = add_timer(tick+skill->get_time2(skill_id,1), status_change_timer, bl->id, type); + sce->timer = iTimer->add_timer(tick+skill->get_time2(skill_id,1), status_change_timer, bl->id, type); } break; case PF_FOGWALL: @@ -12067,8 +11963,8 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i if (bl->type == BL_PC) //Players get blind ended inmediately, others have it still for 30 secs. [Skotlex] status_change_end(bl, SC_BLIND, INVALID_TIMER); else { - delete_timer(sce->timer, status_change_timer); - sce->timer = add_timer(30000+tick, status_change_timer, bl->id, SC_BLIND); + iTimer->delete_timer(sce->timer, status_change_timer); + sce->timer = iTimer->add_timer(30000+tick, status_change_timer, bl->id, SC_BLIND); } } } @@ -12199,7 +12095,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) { switch(skill_id) { case PR_BENEDICTIO: { - uint8 dir = map_calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y); + uint8 dir = iMap->calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y); dir = (unit_getdir(&sd->bl) + dir)%8; //This adjusts dir to account for the direction the sd is facing. if ((tsd->class_&MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == 2 || dir == 6) //Must be standing to the left/right of Priest. && sd->status.sp >= 10) @@ -12213,7 +12109,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) { return 1; case WL_COMET: // Comet does not consume Red Gemstones when there is at least 1 Warlock class next to the caster - if( ( sd->class_&MAPID_THIRDMASK ) == MAPID_WARLOCK ) + if( ( tsd->class_&MAPID_THIRDMASK ) == MAPID_WARLOCK ) p_sd[(*c)++] = tsd->bl.id; return 1; case LG_RAYOFGENESIS: @@ -12228,7 +12124,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) { return 0; if (sd->status.sex != tsd->status.sex && (tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && - (skill_lv = pc_checkskill(tsd, skill_id)) > 0 && + (skill_lv = pc->checkskill(tsd, skill_id)) > 0 && (tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) && sd->status.party_id && tsd->status.party_id && sd->status.party_id == tsd->status.party_id && @@ -12264,26 +12160,26 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short* switch (skill_id) { case PR_BENEDICTIO: for (i = 0; i < c; i++) { - if ((tsd = map_id2sd(p_sd[i])) != NULL) + if ((tsd = iMap->id2sd(p_sd[i])) != NULL) status_charge(&tsd->bl, 0, 10); } return c; case AB_ADORAMUS: - if( c > 0 && (tsd = map_id2sd(p_sd[0])) != NULL ) { + if( c > 0 && (tsd = iMap->id2sd(p_sd[0])) != NULL ) { i = 2 * (*skill_lv); status_charge(&tsd->bl, 0, i); } break; case WM_GREAT_ECHO: for( i = 0; i < c; i++ ) { - if( (tsd = map_id2sd(p_sd[i])) != NULL ) + if( (tsd = iMap->id2sd(p_sd[i])) != NULL ) status_zap(&tsd->bl,0,skill->get_sp(skill_id,*skill_lv)/c); } break; default: //Warning: Assuming Ensemble skills here (for speed) if( is_chorus ) 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) { + if (c > 0 && sd->sc.data[SC_DANCING] && (tsd = iMap->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); clif->skill_nodamage(&tsd->bl, &sd->bl, skill_id, *skill_lv, 1); @@ -12300,7 +12196,7 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short* if( is_chorus ) i = party_foreachsamemap(skill->check_condition_char_sub,sd,AREA_SIZE,&sd->bl, &c, &p_sd, skill_id, *skill_lv); else - i = map_foreachinrange(skill->check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id); + i = iMap->foreachinrange(skill->check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id); if ( skill_id != PR_BENEDICTIO && skill_id != AB_ADORAMUS && skill_id != WL_COMET ) //Apply the average lv to encore skills. *skill_lv = (i+(*skill_lv))/(c+1); //I know c should be one, but this shows how it could be used for the average of n partners. @@ -12319,10 +12215,8 @@ int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap) { mob_class=va_arg(ap,int); skill=va_arg(ap,int); c=va_arg(ap,int *); - - if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill == AM_SPHEREMINE?2:skill == KO_ZANZOU?4:3) ) + if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill == AM_SPHEREMINE?2:skill == KO_ZANZOU?4:skill == MH_SUMMON_LEGION?1:3) ) return 0; //Non alchemist summoned mobs have nothing to do here. - if(md->class_==mob_class) (*c)++; @@ -12407,7 +12301,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id if( skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2 ) // [marquis007] ; //Do not consume item. else if( sd->status.inventory[i].expire_time == 0 ) - pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration + pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration } return 1; } @@ -12450,11 +12344,11 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case BS_ADRENALINE: case WS_WEAPONREFINE: case BS_WEAPONPERFECT: case WS_CARTTERMINATION: case BS_OVERTHRUST: case WS_OVERTHRUSTMAX: - case BS_MAXIMIZE: case NC_AXEBOOMERANG: - case BS_ADRENALINE2: case NC_POWERSWING: - case BS_UNFAIRLYTRICK: case NC_AXETORNADO: + case BS_MAXIMIZE: + case BS_ADRENALINE2: + case BS_UNFAIRLYTRICK: case BS_GREED: - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_MADOGEAR,0); return 0; default: //Only Mechanic exlcusive skill can be used. break; @@ -12510,30 +12404,43 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; if(sc->data[SC_BLADESTOP]) break; - if(sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == MO_TRIPLEATTACK) + if( (i=(sc && sc->data[SC_COMBOATTACK])) && sc->data[SC_COMBOATTACK]->val1 == MO_TRIPLEATTACK ) break; + if( i ) + clif->skill_fail(sd, skill_id, USESKILL_FAIL_COMBOSKILL, MO_TRIPLEATTACK); return 0; case MO_COMBOFINISH: - if(!(sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == MO_CHAINCOMBO)) + if(!sc) return 0; - break; + if( (i=(sc && sc->data[SC_COMBOATTACK])) && sc->data[SC_COMBOATTACK]->val1 == MO_CHAINCOMBO ) + break; + if( i ) + clif->skill_fail(sd, skill_id, USESKILL_FAIL_COMBOSKILL, MO_CHAINCOMBO); + return 0; case CH_TIGERFIST: - if(!(sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == MO_COMBOFINISH)) + if(!sc) return 0; - break; + if( (i=(sc && sc->data[SC_COMBOATTACK])) && sc->data[SC_COMBOATTACK]->val1 == MO_COMBOFINISH ) + break; + if( i ) + clif->skill_fail(sd, skill_id, USESKILL_FAIL_COMBOSKILL, MO_COMBOFINISH); + return 0; case CH_CHAINCRUSH: - if(!(sc && sc->data[SC_COMBO])) - return 0; - if(sc->data[SC_COMBO]->val1 != MO_COMBOFINISH && sc->data[SC_COMBO]->val1 != CH_TIGERFIST) + if(!sc) return 0; - break; + if( (i=(sc && sc->data[SC_COMBOATTACK])) && sc->data[SC_COMBOATTACK]->val1 == CH_TIGERFIST ) + break; + if( i ) + clif->skill_fail(sd, skill_id, USESKILL_FAIL_COMBOSKILL, CH_TIGERFIST); + return 0; case MO_EXTREMITYFIST: // if(sc && sc->data[SC_EXTREMITYFIST]) //To disable Asura during the 5 min skill block uncomment this... // return 0; if( sc && (sc->data[SC_BLADESTOP] || sc->data[SC_CURSEDCIRCLE_ATKER]) ) break; - if( sc && sc->data[SC_COMBO] ) { - switch(sc->data[SC_COMBO]->val1) { + if( sc && sc->data[SC_COMBOATTACK] ) + { + switch(sc->data[SC_COMBOATTACK]->val1) { case MO_COMBOFINISH: case CH_TIGERFIST: case CH_CHAINCRUSH: @@ -12575,17 +12482,17 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case TK_COUNTER: if ((sd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) return 0; //Anti-Soul Linker check in case you job-changed with Stances active. - if(!(sc && sc->data[SC_COMBO]) || sc->data[SC_COMBO]->val1 == TK_JUMPKICK) + if(!(sc && sc->data[SC_COMBOATTACK]) || sc->data[SC_COMBOATTACK]->val1 == TK_JUMPKICK) return 0; //Combo needs to be ready - if (sc->data[SC_COMBO]->val3) { //Kick chain + if (sc->data[SC_COMBOATTACK]->val3) { //Kick chain //Do not repeat a kick. - if (sc->data[SC_COMBO]->val3 != skill_id) + if (sc->data[SC_COMBOATTACK]->val3 != skill_id) break; - status_change_end(&sd->bl, SC_COMBO, INVALID_TIMER); + status_change_end(&sd->bl, SC_COMBOATTACK, INVALID_TIMER); return 0; } - if(sc->data[SC_COMBO]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) )) { //Cancel combo wait. + if(sc->data[SC_COMBOATTACK]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )) { //Cancel combo wait. unit_cancel_combo(&sd->bl); return 0; } @@ -12619,12 +12526,12 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case SL_SMA: - if(!(sc && sc->data[SC_SMA])) + if(!(sc && sc->data[SC_SMA_READY])) return 0; break; case HT_POWER: - if(!(sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_id)) + if(!(sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == skill_id)) return 0; break; @@ -12642,7 +12549,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id for (i=0;i<size*size;i++) { x = sd->bl.x+(i%size-range); y = sd->bl.y+(i/size-range); - if (map_getcell(sd->bl.m,x,y,CELL_CHKWALL)) { + if (iMap->getcell(sd->bl.m,x,y,CELL_CHKWALL)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12652,8 +12559,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case PR_REDEMPTIO: { int exp; - if( ((exp = pc_nextbaseexp(sd)) > 0 && get_percentage(sd->status.base_exp, exp) < 1) || - ((exp = pc_nextjobexp(sd)) > 0 && get_percentage(sd->status.job_exp, exp) < 1)) { + if( ((exp = pc->nextbaseexp(sd)) > 0 && get_percentage(sd->status.base_exp, exp) < 1) || + ((exp = pc->nextjobexp(sd)) > 0 && get_percentage(sd->status.job_exp, exp) < 1)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); //Not enough exp. return 0; } @@ -12661,7 +12568,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } case AM_TWILIGHT2: case AM_TWILIGHT3: - if (!party_skill_check(sd, sd->status.party_id, skill_id, skill_lv)) + if (!party->skill_check(sd, sd->status.party_id, skill_id, skill_lv)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; @@ -12690,7 +12597,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; case SG_FUSION: - if (sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_STAR) + if (sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_STAR) break; //Auron insists we should implement SP consumption when you are not Soul Linked. [Skotlex] //Only invoke on skill begin cast (instant cast skill). [Kevin] @@ -12732,7 +12639,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; } case NJ_BUNSINJYUTSU: - if (!(sc && sc->data[SC_NEN])) { + if (!(sc && sc->data[SC_NJ_NEN])) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12794,7 +12701,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); @@ -12805,13 +12712,36 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case WL_SUMMONBL: case WL_SUMMONWB: case WL_SUMMONSTONE: - if( sc ) + case WL_TETRAVORTEX: + case WL_RELEASE: { - ARR_FIND(SC_SPHERE_1,SC_SPHERE_5+1,i,!sc->data[i]); - if( i == SC_SPHERE_5+1 ) - { // No more free slots - clif->skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON,0); - return 0; + int x = SC_SUMMON1; + i = 0; + for(; x <= SC_SUMMON5; x++) + if( sc && sc->data[x] ) + i++; + + switch(skill_id){ + case WL_TETRAVORTEX: + if( i < 4 ){ + clif->skill_fail(sd,skill_id,USESKILL_FAIL_CONDITION,0); + return 0; + } + break; + case WL_RELEASE: + for(x = SC_SPELLBOOK7; x >= SC_SPELLBOOK1; x--) + if( sc && sc->data[x] ) + i++; + if( i == 0 ){ + clif->skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON_NONE,0); + return 0; + } + break; + default: + if( i == 5 ){ + clif->skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON,0); + return 0; + } } } break; @@ -12826,7 +12756,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case GC_COUNTERSLASH: case GC_WEAPONCRUSH: - if( !(sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == GC_WEAPONBLOCKING) ) { + if( !(sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == GC_WEAPONBLOCKING) ) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_GC_WEAPONBLOCKING, 0); return 0; } @@ -12835,26 +12765,26 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id * Ranger **/ case RA_WUGMASTERY: - if( pc_isfalcon(sd) || pc_isridingwug(sd) || sd->sc.data[SC__GROOMY]) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + if( pc_isfalcon(sd) || pc_isridingwug(sd) || sd->sc.data[SC__GROOMY] ) { + clif->skill_fail(sd,skill_id,sd->sc.data[SC__GROOMY]?USESKILL_FAIL_MANUAL_NOTIFY:USESKILL_FAIL_CONDITION,0); return 0; } break; case RA_WUGSTRIKE: if( !pc_iswug(sd) && !pc_isridingwug(sd) ) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_CONDITION,0); return 0; } break; case RA_WUGRIDER: if( pc_isfalcon(sd) || ( !pc_isridingwug(sd) && !pc_iswug(sd) ) ) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_CONDITION,0); return 0; } break; case RA_WUGDASH: if(!pc_isridingwug(sd)) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_CONDITION,0); return 0; } break; @@ -12896,10 +12826,13 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } break; case SR_FALLENEMPIRE: - if( !(sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == SR_DRAGONCOMBO) ) + if( !sc ) return 0; - break; - + if( (i=(sc && sc->data[SC_COMBOATTACK])) && sc->data[SC_COMBOATTACK]->val1 == SR_DRAGONCOMBO ) + break; + if( i ) + clif->skill_fail(sd, skill_id, USESKILL_FAIL_COMBOSKILL, SR_DRAGONCOMBO); + return 0; case SR_CRESCENTELBOW: if( sc && sc->data[SC_CRESCENTELBOW] ) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_DUPLICATE, 0); @@ -12908,7 +12841,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 (iMap->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"); @@ -12954,7 +12887,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case SO_EL_CONTROL: if( !sd->status.ele_id || !sd->ed ) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_EL_SUMMON,0); return 0; } break; @@ -12966,7 +12899,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case LG_REFLECTDAMAGE: case CR_REFLECTSHIELD: - if( sc && sc->data[SC_KYOMU] && rand()%100 < 30){ + if( sc && sc->data[SC_KYOMU] && rand()%100 < 5 * sc->data[SC_KYOMU]->val1 ){ clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12977,18 +12910,17 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case KO_DOHU_KOUKAI: { 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); + if( sd->charm[ttype] >= 10 ){ + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SUMMON, 0); return 0; } } break; case KO_KAIHOU: case KO_ZENKAI: - ARR_FIND(1, 6, i, sd->talisman[i] > 0); + ARR_FIND(1, 6, i, sd->charm[i] > 0); if( i > 4 ) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON,0); return 0; } break; @@ -13032,7 +12964,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } case ST_CART: if(!pc_iscarton(sd)) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_CART,0); return 0; } break; @@ -13050,7 +12982,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case ST_EXPLOSIONSPIRITS: if(!(sc && sc->data[SC_EXPLOSIONSPIRITS])) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_EXPLOSIONSPIRITS,0); return 0; } break; @@ -13061,8 +12993,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } break; case ST_MOVE_ENABLE: - if (sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_id) - sd->ud.canmove_tick = gettick(); //When using a combo, cancel the can't move delay to enable the skill. [Skotlex] + if (sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == skill_id) + sd->ud.canmove_tick = iTimer->gettick(); //When using a combo, cancel the can't move delay to enable the skill. [Skotlex] if (!unit_can_move(&sd->bl)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -13070,15 +13002,15 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } break; case ST_WATER: - if (sc && (sc->data[SC_DELUGE] || sc->data[SC_SUITON])) + if (sc && (sc->data[SC_DELUGE] || sc->data[SC_NJ_SUITON])) break; - if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER)) + if (iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER)) break; clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; case ST_RIDINGDRAGON: if( !pc_isridingdragon(sd) ) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_DRAGON,0); return 0; } break; @@ -13096,7 +13028,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case ST_MADO: if( !pc_ismadogear(sd) ) { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,skill_id,USESKILL_FAIL_MADOGEAR,0); return 0; } break; @@ -13163,7 +13095,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; } - if( sd->sc.data[SC_COMBO] ) { + if( sd->sc.data[SC_COMBOATTACK] ) { switch( skill_id ) { case MO_CHAINCOMBO: case MO_COMBOFINISH: @@ -13174,12 +13106,14 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case TK_STORMKICK: case TK_DOWNKICK: case TK_COUNTER: + case TK_JUMPKICK: case HT_POWER: case GC_COUNTERSLASH: case GC_WEAPONCRUSH: case SR_FALLENEMPIRE: case SR_DRAGONCOMBO: case SR_TIGERCANNON: + case SR_GATEOFHELL: break; default: return 0; } @@ -13252,7 +13186,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, 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); + i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c); if(c >= maxcount || (skill_id==AM_CANNIBALIZE && c != i && battle_config.summon_flora&2)) { //Fails when: exceed max limit. There are other plant types already out. @@ -13273,9 +13207,9 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, if( battle_config.land_skill_limit && maxcount > 0 && ( battle_config.land_skill_limit&BL_PC ) ) { if( skill_id == NC_MAGICDECOY ) { for( j = mob_class; j <= 2046; j++ ) - map_foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, j, skill_id, &c); + iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, j, skill_id, &c); } else - map_foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c); + iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c); if( c >= maxcount ) { clif->skill_fail(sd , skill_id, USESKILL_FAIL_LEVEL, 0); return 0; @@ -13285,7 +13219,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, break; 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); + i = iMap->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) { clif->skill_fail(sd , skill_id, USESKILL_FAIL_LEVEL, 0); return 0; @@ -13310,7 +13244,10 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, if( require.ammo ) { //Skill requires stuff equipped in the arrow slot. if((i=sd->equip_index[EQI_AMMO]) < 0 || !sd->inventory_data[i] ) { - clif->arrow_fail(sd,0); + if( require.ammo&1<<8 ) + clif->skill_fail(sd,skill_id,USESKILL_FAIL_CANONBALL,0); + else + clif->arrow_fail(sd,0); return 0; } else if( sd->status.inventory[i].amount < require.ammo_qty ) { char e_msg[100]; @@ -13332,14 +13269,41 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; ++i ) { if( !require.itemid[i] ) continue; - index[i] = pc_search_inventory(sd,require.itemid[i]); + index[i] = pc->search_inventory(sd,require.itemid[i]); if( index[i] < 0 || sd->status.inventory[index[i]].amount < require.amount[i] ) { - if( require.itemid[i] == ITEMID_RED_GEMSTONE ) - clif->skill_fail(sd,skill_id,USESKILL_FAIL_REDJAMSTONE,0);// red gemstone required - else if( require.itemid[i] == ITEMID_BLUE_GEMSTONE ) - clif->skill_fail(sd,skill_id,USESKILL_FAIL_BLUEJAMSTONE,0);// blue gemstone required - else - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + useskill_fail_cause cause = USESKILL_FAIL_NEED_ITEM; + switch( skill_id ){ + case NC_SILVERSNIPER: + case NC_MAGICDECOY: + cause = USESKILL_FAIL_STUFF_INSUFFICIENT; + break; + default: + switch(require.itemid[i]){ + case ITEMID_RED_GEMSTONE: + cause = USESKILL_FAIL_REDJAMSTONE; break; + case ITEMID_BLUE_GEMSTONE: + cause = USESKILL_FAIL_BLUEJAMSTONE; break; + case ITEMID_HOLY_WATER: + cause = USESKILL_FAIL_HOLYWATER; break; + case ITEMID_ANCILLA: + cause = USESKILL_FAIL_ANCILLA; break; + case ITEMID_ACCELERATOR: + case ITEMID_HOVERING_BOOSTER: + case ITEMID_SUICIDAL_DEVICE: + case ITEMID_SHAPE_SHIFTER: + case ITEMID_COOLING_DEVICE: + case ITEMID_MAGNETIC_FIELD_GENERATOR: + case ITEMID_BARRIER_BUILDER: + case ITEMID_CAMOUFLAGE_GENERATOR: + case ITEMID_REPAIR_KIT: + case ITEMID_MONKEY_SPANNER: + cause = USESKILL_FAIL_NEED_EQUIPMENT; + default: + clif->skill_fail(sd, skill_id, cause, max(1,require.amount[i])|(require.itemid[i] << 16)); + return 0; + } + } + clif->skill_fail(sd, skill_id, cause, 0); return 0; } } @@ -13349,23 +13313,31 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, // type&2: consume items (after skill was used) // type&1: consume the others (before skill was used) -int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type) -{ +int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type) { struct skill_condition req; nullpo_ret(sd); req = skill->get_requirement(sd,skill_id,skill_lv); - if( type&1 ) - { - if( skill_id == CG_TAROTCARD || sd->state.autocast ) - req.sp = 0; // TarotCard will consume sp in skill_cast_nodamage_id [Inkfish] + if( type&1 ) { + + switch( skill_id ) { + case CG_TAROTCARD: // TarotCard will consume sp in skill_cast_nodamage_id [Inkfish] + case MC_IDENTIFY: + req.sp = 0; + break; + default: + if( sd->state.autocast ) + req.sp = 0; + break; + } + if(req.hp || req.sp) status_zap(&sd->bl, req.hp, req.sp); if(req.spiritball > 0) - pc_delspiritball(sd,req.spiritball,0); + pc->delspiritball(sd,req.spiritball,0); if(req.zeny > 0) { @@ -13373,7 +13345,7 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin 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); + pc->payzeny(sd,req.zeny,LOG_TYPE_CONSUME,NULL); } } @@ -13390,7 +13362,7 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin if( !req.itemid[i] ) continue; - if( itemid_isgemstone(req.itemid[i]) && skill_id != HW_GANBANTEIN && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_WIZARD ) + if( itemid_isgemstone(req.itemid[i]) && skill_id != HW_GANBANTEIN && sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_WIZARD ) continue; //Gemstones are checked, but not substracted from inventory. switch( skill_id ){ @@ -13415,8 +13387,8 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin break; } - if( (n = pc_search_inventory(sd,req.itemid[i])) >= 0 ) - pc_delitem(sd,n,req.amount[i],0,1,LOG_TYPE_CONSUME); + if( (n = pc->search_inventory(sd,req.itemid[i])) >= 0 ) + pc->delitem(sd,n,req.amount[i],0,1,LOG_TYPE_CONSUME); } } @@ -13494,10 +13466,12 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 if( sc ) { if( sc->data[SC__LAZINESS] ) req.sp += req.sp + sc->data[SC__LAZINESS]->val1 * 10; - if (sc->data[SC_UNLIMITEDHUMMINGVOICE]) - req.sp += req.sp * sc->data[SC_UNLIMITEDHUMMINGVOICE]->val2 / 100; + if( sc->data[SC_UNLIMITED_HUMMING_VOICE] ) + req.sp += req.sp * sc->data[SC_UNLIMITED_HUMMING_VOICE]->val2 / 100; if( sc->data[SC_RECOGNIZEDSPELL] ) req.sp += req.sp / 4; + if( sc->data[SC_TELEKINESIS_INTENSE] && skill->get_ele(skill_id, skill_lv) == ELE_GHOST) + req.sp -= req.sp * sc->data[SC_TELEKINESIS_INTENSE]->val2 / 100; } req.zeny = skill_db[idx].zeny[skill_lv-1]; @@ -13583,9 +13557,9 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 req.amount[i] = 1; // Hocus Pocus allways use at least 1 gem } } - if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && pc_checkskill(sd, RA_RESEARCHTRAP) > 0){ + if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && pc->checkskill(sd, RA_RESEARCHTRAP) > 0){ int16 itIndex; - if( (itIndex = pc_search_inventory(sd,req.itemid[i])) < 0 || ( itIndex >= 0 && sd->status.inventory[itIndex].amount < req.amount[i] ) ){ + if( (itIndex = pc->search_inventory(sd,req.itemid[i])) < 0 || ( itIndex >= 0 && sd->status.inventory[itIndex].amount < req.amount[i] ) ){ req.itemid[i] = ITEMID_TRAP_ALLOY; req.amount[i] = 1; } @@ -13613,18 +13587,18 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 // Check for cost reductions due to skills & SCs switch(skill_id) { case MC_MAMMONITE: - if(pc_checkskill(sd,BS_UNFAIRLYTRICK)>0) + if(pc->checkskill(sd,BS_UNFAIRLYTRICK)>0) req.zeny -= req.zeny*10/100; break; case AL_HOLYLIGHT: - if(sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_PRIEST) + if(sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_PRIEST) req.sp *= 5; break; case SL_SMA: case SL_STUN: case SL_STIN: { - int kaina_lv = pc_checkskill(sd,SL_KAINA); + int kaina_lv = pc->checkskill(sd,SL_KAINA); if(kaina_lv==0 || sd->status.base_level<70) break; @@ -13641,7 +13615,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 case MO_COMBOFINISH: case CH_TIGERFIST: case CH_CHAINCRUSH: - if(sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_MONK) + if(sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_MONK) req.sp -= req.sp*25/100; //FIXME: Need real data. this is a custom value. break; case MO_BODYRELOCATION: @@ -13653,9 +13627,9 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 { if( sc->data[SC_BLADESTOP] ) req.spiritball--; - else if( sc->data[SC_COMBO] ) + else if( sc->data[SC_COMBOATTACK] ) { - switch( sc->data[SC_COMBO]->val1 ) + switch( sc->data[SC_COMBOATTACK]->val1 ) { case MO_COMBOFINISH: req.spiritball = 4; @@ -13675,14 +13649,14 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 req.spiritball = sd->spiritball?sd->spiritball:15; break; case SR_GATEOFHELL: - if( sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == SR_FALLENEMPIRE ) + if( sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == SR_FALLENEMPIRE ) req.sp -= req.sp * 10 / 100; break; case SO_SUMMON_AGNI: case SO_SUMMON_AQUA: case SO_SUMMON_VENTUS: case SO_SUMMON_TERA: - req.sp -= req.sp * (5 + 5 * pc_checkskill(sd,SO_EL_SYMPATHY)) / 100; + req.sp -= req.sp * (5 + 5 * pc->checkskill(sd,SO_EL_SYMPATHY)) / 100; break; case SO_PSYCHIC_WAVE: if( sc && sc->data[SC_BLAST_OPTION] ) @@ -13752,15 +13726,15 @@ int skill_castfix_sc (struct block_list *bl, int time) if( time < 0 ) return 0; - + if( bl->type == BL_MOB ) // mobs casttime is fixed nothing to alter. return time; if (sc && sc->count) { if (sc->data[SC_SLOWCAST]) time += time * sc->data[SC_SLOWCAST]->val2 / 100; - if (sc->data[SC_PARALYSIS]) - time += sc->data[SC_PARALYSIS]->val3; + if (sc->data[SC_NEEDLE_OF_PARALYZE]) + time += sc->data[SC_NEEDLE_OF_PARALYZE]->val3; if (sc->data[SC_SUFFRAGIUM]) { time -= time * sc->data[SC_SUFFRAGIUM]->val2 / 100; status_change_end(bl, SC_SUFFRAGIUM, INVALID_TIMER); @@ -13832,8 +13806,12 @@ 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) ) { // All variable cast additive bonuses must come first + if (sc->data[SC_MAGICPOWER] ) + time += 700; if (sc->data[SC_SLOWCAST]) VARCAST_REDUCTION(-sc->data[SC_SLOWCAST]->val2); + if (sc->data[SC_FROSTMISTY]) + VARCAST_REDUCTION(-15); // Variable cast reduction bonuses if (sc->data[SC_SUFFRAGIUM]) { @@ -13851,17 +13829,33 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 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)) VARCAST_REDUCTION(30); //Reduces 30% Variable Cast Time of Water spells. + if (sc->data[SC_TELEKINESIS_INTENSE]) + VARCAST_REDUCTION(sc->data[SC_TELEKINESIS_INTENSE]->val2); + if (sc->data[SC_SOULLINK]){ + if(sc->data[SC_SOULLINK]->val2 == SL_WIZARD || sc->data[SC_SOULLINK]->val2 == SL_BARDDANCER) + switch(skill_id){ + case WZ_FIREPILLAR: + if(skill_lv < 5) + break; + case HW_GRAVITATION: + case MG_SAFETYWALL: + case MG_STONECURSE: + case BA_MUSICALSTRIKE: + case DC_THROWARROW: + VARCAST_REDUCTION(50); + } + } // Fixed cast reduction bonuses if( sc->data[SC__LAZINESS] ) fixcast_r = max(fixcast_r, sc->data[SC__LAZINESS]->val2); if( sc->data[SC_SECRAMENT] ) fixcast_r = max(fixcast_r, sc->data[SC_SECRAMENT]->val2); - if( sd && ( skill_lv = pc_checkskill(sd, WL_RADIUS) ) && skill_id >= WL_WHITEIMPRISON && skill_id <= WL_FREEZE_SP ) - fixcast_r = max(fixcast_r, 5 + skill_lv * 5); + if( sd && ( skill_lv = pc->checkskill(sd, WL_RADIUS) ) && (skill_id >= WL_WHITEIMPRISON && skill_id < WL_FREEZE_SP) ) + fixcast_r = max(fixcast_r, (status_get_int(bl) + status_get_lv(bl)) / 15 + skill_lv * 5); // [{(Caster?s INT / 15) + (Caster?s Base Level / 15) + (Radius Skill Level x 5)}] % // Fixed cast non percentage bonuses if( sc->data[SC_MANDRAGORA] ) fixed += sc->data[SC_MANDRAGORA]->val1 * 1000 / 2; - if (sc->data[SC_IZAYOI] && (skill_id >= NJ_TOBIDOUGU && skill_id <= NJ_ISSEN)) + if( sc->data[SC_IZAYOI] ) fixed = 0; if( sc->data[SC_GUST_OPTION] || sc->data[SC_BLAST_OPTION] || sc->data[SC_WILD_STORM_OPTION] ) fixed -= 1000; @@ -13939,14 +13933,14 @@ int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) } } - if ( sc && sc->data[SC_SPIRIT] ) { + if ( sc && sc->data[SC_SOULLINK] ) { switch (skill_id) { case CR_SHIELDBOOMERANG: - if (sc->data[SC_SPIRIT]->val2 == SL_CRUSADER) + if (sc->data[SC_SOULLINK]->val2 == SL_CRUSADER) time /= 2; break; case AS_SONICBLOW: - if (!map_flag_gvg(bl->m) && !map[bl->m].flag.battleground && sc->data[SC_SPIRIT]->val2 == SL_ASSASIN) + if (!map_flag_gvg(bl->m) && !map[bl->m].flag.battleground && sc->data[SC_SOULLINK]->val2 == SL_ASSASIN) time /= 2; break; } @@ -14101,7 +14095,7 @@ void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) { void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { int c,n=4; - uint8 dir = map_calc_dir(src,bl->x,bl->y); + uint8 dir = iMap->calc_dir(src,bl->x,bl->y); struct square tc; int x=bl->x,y=bl->y; skill->brandishspear_first(&tc,dir,x,y); @@ -14110,7 +14104,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s if(skill_lv > 9){ for(c=1;c<4;c++){ - map_foreachincell(skill->area_sub, + iMap->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); @@ -14126,7 +14120,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s if(skill_lv > 3){ for(c=0;c<5;c++){ - map_foreachincell(skill->area_sub, + iMap->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); @@ -14138,7 +14132,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s } for(c=0;c<10;c++){ if(c==0||c==5) skill->brandishspear_dir(&tc,dir,-1); - map_foreachincell(skill->area_sub, + iMap->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); @@ -14156,7 +14150,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { nullpo_retv(sd); - if ( !( target_sd = map_id2sd(sd->menuskill_val) ) ) //Failed.... + if ( !( target_sd = iMap->id2sd(sd->menuskill_val) ) ) //Failed.... return; if( idx == 0xFFFF ) // No item selected ('Cancel' clicked) @@ -14177,7 +14171,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { material = materials [ target_sd->inventory_data[idx]->wlv - 1 ]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon else material = materials [2]; // Armors consume 1 Steel - if ( pc_search_inventory(sd,material) < 0 ) { + if ( pc->search_inventory(sd,material) < 0 ) { clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0); return; } @@ -14188,7 +14182,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { clif->equiplist(target_sd); - pc_delitem(sd,pc_search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME); + pc->delitem(sd,pc->search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME); clif->item_repaireffect(sd,idx,0); @@ -14204,7 +14198,7 @@ void skill_identify (struct map_session_data *sd, int idx) int flag=1; nullpo_retv(sd); - + sd->state.workinprogress = 0; if(idx >= 0 && idx < MAX_INVENTORY) { if(sd->status.inventory[idx].nameid > 0 && sd->status.inventory[idx].identify == 0 ){ flag=0; @@ -14231,32 +14225,42 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) if(item->nameid > 0 && ditem->type == IT_WEAPON) { - if( item->refine >= sd->menuskill_val - || item->refine >= 10 // if it's no longer refineable - || ditem->flag.no_refine // if the item isn't refinable - || (i = pc_search_inventory(sd, material [ditem->wlv])) < 0 ) - { + if( ditem->flag.no_refine ){ // if the item isn't refinable clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0); return; } + if( item->refine >= sd->menuskill_val || item->refine >= 10 ){ + clif->upgrademessage(sd->fd, 2, item->nameid); + return; + } + if( (i = pc->search_inventory(sd, material [ditem->wlv])) < 0 ){ + clif->upgrademessage(sd->fd, 3, material [ditem->wlv]); + return; + } - per = status_get_refine_chance(ditem->wlv, (int)item->refine); - per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex] - - pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER); - if (per > rnd() % 100) { + per = status_get_refine_chance(ditem->wlv, (int)item->refine) * 10; + + // Aegis leaked formula. [malufett] + if( sd->status.class_ == JOB_MECHANIC_T ) + per += 100; + else + per += 5 * ((signed int)sd->status.job_level - 50); + + pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER); + if (per > rnd() % 1000) { logs->pick_pc(sd, LOG_TYPE_OTHER, -1, item, ditem); item->refine++; logs->pick_pc(sd, LOG_TYPE_OTHER, 1, item, ditem); if(item->equip) { ep = item->equip; - pc_unequipitem(sd,idx,3); + pc->unequipitem(sd,idx,3); } + clif->delitem(sd,idx,1,0); + clif->upgrademessage(sd->fd, 0,item->nameid); + clif->inventorylist(sd); clif->refine(sd->fd,0,idx,item->refine); - clif->delitem(sd,idx,1,3); - clif->additem(sd,idx,1,0); if (ep) - pc_equipitem(sd,idx,ep); + pc->equipitem(sd,idx,ep); clif->misceffect(&sd->bl,3); if(item->refine == 10 && item->card[0] == CARD0_FORGE && @@ -14264,22 +14268,22 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) { // Fame point system [DracoRPG] switch(ditem->wlv){ case 1: - pc_addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point + pc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point break; case 2: - pc_addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point + pc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point break; case 3: - pc_addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point + pc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point break; } } } else { item->refine = 0; if(item->equip) - pc_unequipitem(sd,idx,3); + pc->unequipitem(sd,idx,3); clif->refine(sd->fd,1,idx,item->refine); - pc_delitem(sd,idx,1,0,2, LOG_TYPE_OTHER); + pc->delitem(sd,idx,1,0,0, LOG_TYPE_OTHER); clif->misceffect(&sd->bl,2); clif->emotion(&sd->bl, E_OMG); } @@ -14298,13 +14302,13 @@ int skill_autospell (struct map_session_data *sd, uint16 skill_id) nullpo_ret(sd); skill_lv = sd->menuskill_val; - lv=pc_checkskill(sd,skill_id); + lv=pc->checkskill(sd,skill_id); if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance] if(skill_id==MG_NAPALMBEAT) maxlv=3; else if(skill_id==MG_COLDBOLT || skill_id==MG_FIREBOLT || skill_id==MG_LIGHTNINGBOLT){ - if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SAGE) + if (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_SAGE) maxlv =10; //Soul Linker bonus. [Skotlex] else if(skill_lv==2) maxlv=1; else if(skill_lv==3) maxlv=2; @@ -14341,10 +14345,10 @@ int skill_sit_count (struct block_list *bl, va_list ap) { if(!pc_issit(sd)) return 0; - if(type&1 && pc_checkskill(sd,RG_GANGSTER) > 0) + if(type&1 && pc->checkskill(sd,RG_GANGSTER) > 0) return 1; - if(type&2 && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0)) + if(type&2 && (pc->checkskill(sd,TK_HPTIME) > 0 || pc->checkskill(sd,TK_SPTIME) > 0)) return 1; return 0; @@ -14359,10 +14363,10 @@ int skill_sit_in (struct block_list *bl, va_list ap) { if(!pc_issit(sd)) return 0; - if(type&1 && pc_checkskill(sd,RG_GANGSTER) > 0) + if(type&1 && pc->checkskill(sd,RG_GANGSTER) > 0) sd->state.gangsterparadise=1; - if(type&2 && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0 )) { + if(type&2 && (pc->checkskill(sd,TK_HPTIME) > 0 || pc->checkskill(sd,TK_SPTIME) > 0 )) { sd->state.rest=1; status_calc_regen(bl, &sd->battle_status, &sd->regen); status_calc_regen_rate(bl, &sd->regen, &sd->sc); @@ -14392,15 +14396,15 @@ int skill_sit (struct map_session_data *sd, int type) nullpo_ret(sd); - if((lv = pc_checkskill(sd,RG_GANGSTER)) > 0) { + if((lv = pc->checkskill(sd,RG_GANGSTER)) > 0) { flag|=1; range = skill->get_splash(RG_GANGSTER, lv); } - if((lv = pc_checkskill(sd,TK_HPTIME)) > 0) { + if((lv = pc->checkskill(sd,TK_HPTIME)) > 0) { flag|=2; range = skill->get_splash(TK_HPTIME, lv); } - else if ((lv = pc_checkskill(sd,TK_SPTIME)) > 0) { + else if ((lv = pc->checkskill(sd,TK_SPTIME)) > 0) { flag|=2; range = skill->get_splash(TK_SPTIME, lv); } @@ -14414,11 +14418,11 @@ int skill_sit (struct map_session_data *sd, int type) if (!flag) return 0; if(type) { - if (map_foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) > 1) - map_foreachinrange(skill->sit_in,&sd->bl, range, BL_PC, flag); + if (iMap->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) > 1) + iMap->foreachinrange(skill->sit_in,&sd->bl, range, BL_PC, flag); } else { - if (map_foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) < 2) - map_foreachinrange(skill->sit_out,&sd->bl, range, BL_PC, flag); + if (iMap->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) < 2) + iMap->foreachinrange(skill->sit_out,&sd->bl, range, BL_PC, flag); } return 0; } @@ -14464,7 +14468,7 @@ void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill for( y = src->bl.y - range; y <= src->bl.y + range; ++y ) for( x = src->bl.x - range; x <= src->bl.x + range; ++x ) - map_setcell(src->bl.m, x, y, cell, flag); + map[src->bl.m].setcell(src->bl.m, x, y, cell, flag); } /*========================================== @@ -14603,7 +14607,7 @@ int skill_greed (struct block_list *bl, va_list ap) { nullpo_ret(src = va_arg(ap, struct block_list *)); if(src->type == BL_PC && (sd=(struct map_session_data *)src) && bl->type==BL_ITEM && (fitem=(struct flooritem_data *)bl)) - pc_takeitem(sd, fitem); + pc->takeitem(sd, fitem); return 0; } @@ -14637,11 +14641,11 @@ int skill_detonator(struct block_list *bl, va_list ap) clif->talkiebox(bl,unit->group->valstr); 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); + iMap->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; - unit->group->limit = DIFF_TICK(gettick(),unit->group->tick) + + unit->group->limit = DIFF_TICK(iTimer->gettick(),unit->group->tick) + (unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : 1500) ); break; } @@ -14790,7 +14794,7 @@ int skill_trap_splash (struct block_list *bl, va_list ap) { return 0; nullpo_ret(sg = unit->group); - nullpo_ret(ss = map_id2bl(sg->src_id)); + nullpo_ret(ss = iMap->id2bl(sg->src_id)); if(battle->check_target(src,bl,sg->target_flag) <= 0) return 0; @@ -14835,7 +14839,7 @@ int skill_trap_splash (struct block_list *bl, va_list ap) { 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_ARMOR_PROPERTY,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 @@ -14854,7 +14858,7 @@ int skill_trap_splash (struct block_list *bl, va_list ap) { int skill_enchant_elemental_end (struct block_list *bl, int type) { struct status_change *sc; - const enum sc_type scs[] = { SC_ENCPOISON, SC_ASPERSIO, SC_FIREWEAPON, SC_WATERWEAPON, SC_WINDWEAPON, SC_EARTHWEAPON, SC_SHADOWWEAPON, SC_GHOSTWEAPON, SC_ENCHANTARMS, SC_EXEEDBREAK }; + const enum sc_type scs[] = { SC_ENCHANTPOISON, SC_ASPERSIO, SC_PROPERTYFIRE, SC_PROPERTYWATER, SC_PROPERTYWIND, SC_PROPERTYGROUND, SC_PROPERTYDARK, SC_PROPERTYTELEKINESIS, SC_ENCHANTARMS, SC_EXEEDBREAK }; int i; nullpo_ret(bl); nullpo_ret(sc= status_get_sc(bl)); @@ -14878,7 +14882,7 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce || (bl->type != BL_PC && battle_config.monster_cloak_check_type&1) ) { //Check for walls. int i; - ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 ); + ARR_FIND( 0, 8, i, iMap->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 ); if( i == 8 ) wall = false; } @@ -14909,7 +14913,7 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s if( bl->type == BL_PC ) { //Check for walls. int i; - ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 ); + ARR_FIND( 0, 8, i, iMap->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 ); if( i == 8 ) wall = false; } @@ -14942,7 +14946,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int if(!unit->alive) group->alive_count++; - unit->bl.id=map_get_new_object_id(); + unit->bl.id=iMap->get_new_object_id(); unit->bl.type=BL_SKILL; unit->bl.m=group->map; unit->bl.x=x; @@ -14953,13 +14957,13 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int unit->val2=val2; idb_put(skillunit_db, unit->bl.id, unit); - map_addiddb(&unit->bl); - map_addblock(&unit->bl); + iMap->addiddb(&unit->bl); + iMap->addblock(&unit->bl); // perform oninit actions switch (group->skill_id) { case WZ_ICEWALL: - map_setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,5); + iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,5); clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,5,AREA); skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true); map[unit->bl.m].icewall_num++; @@ -15002,18 +15006,18 @@ int skill_delunit (struct skill_unit* unit) { // invoke onout event if( !unit->range ) - map_foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),4); + iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,iTimer->gettick(),4); // perform ondelete actions switch (group->skill_id) { case HT_ANKLESNARE: { - struct block_list* target = map_id2bl(group->val2); + struct block_list* target = iMap->id2bl(group->val2); if( target ) - status_change_end(target, SC_ANKLE, INVALID_TIMER); + status_change_end(target, SC_ANKLESNARE, INVALID_TIMER); } break; case WZ_ICEWALL: - map_setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,unit->val2); + iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,unit->val2); clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false); map[unit->bl.m].icewall_num--; @@ -15025,7 +15029,7 @@ int skill_delunit (struct skill_unit* unit) { skill->unitsetmapcell(unit,HP_BASILICA,group->skill_lv,CELL_BASILICA,false); break; case RA_ELECTRICSHOCKER: { - struct block_list* target = map_id2bl(group->val2); + struct block_list* target = iMap->id2bl(group->val2); if( target ) status_change_end(target, SC_ELECTRICSHOCKER, INVALID_TIMER); } @@ -15035,7 +15039,7 @@ int skill_delunit (struct skill_unit* unit) { break; case SC_MANHOLE: // Note : Removing the unit don't remove the status (official info) if( group->val2 ) { // Someone Traped - struct status_change *tsc = status_get_sc( map_id2bl(group->val2)); + struct status_change *tsc = status_get_sc( iMap->id2bl(group->val2)); if( tsc && tsc->data[SC__MANHOLE] ) tsc->data[SC__MANHOLE]->val4 = 0; // Remove the Unit ID } @@ -15045,8 +15049,8 @@ int skill_delunit (struct skill_unit* unit) { clif->skill_delunit(unit); unit->group=NULL; - map_delblock(&unit->bl); // don't free yet - map_deliddb(&unit->bl); + iMap->delblock(&unit->bl); // don't free yet + iMap->deliddb(&unit->bl); idb_remove(skillunit_db, unit->bl.id); if(--group->alive_count==0) skill->del_unitgroup(group,ALC_MARK); @@ -15104,7 +15108,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, if(i == MAX_SKILLUNITGROUP) { // array is full, make room by discarding oldest group int j=0; - unsigned maxdiff=0,x,tick=gettick(); + unsigned maxdiff=0,x,tick=iTimer->gettick(); for(i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i];i++) if((x=DIFF_TICK(tick,ud->skillunit[i]->tick))>maxdiff){ maxdiff=x; @@ -15133,7 +15137,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, group->map = src->m; group->limit = limit; group->interval = interval; - group->tick = gettick(); + group->tick = iTimer->gettick(); group->valstr = NULL; ud->skillunit[i] = group; @@ -15160,7 +15164,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin return 0; } - src=map_id2bl(group->src_id); + src=iMap->id2bl(group->src_id); ud = unit_bl2ud(src); if(!src || !ud) { ShowError("skill_delunitgroup: Group's source not found! (src_id: %d skill_id: %d)\n", group->src_id, group->skill_id); @@ -15262,7 +15266,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin } idb_remove(group_db, group->group_id); - map_freeblock(&group->unit->bl); // schedules deallocation of whole array (HACK) + iMap->freeblock(&group->unit->bl); // schedules deallocation of whole array (HACK) group->unit=NULL; group->group_id=0; group->unit_count=0; @@ -15326,7 +15330,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis } if (j == -1) { - ShowWarning ("skill_unitgrouptickset_search: tickset is full\n"); + ShowWarning ("skill_unitgrouptickset_search: tickset is full. ( failed for skill '%s' on unit %d )\n",skill->get_name(group->skill_id),bl->type); j = id % MAX_SKILLUNITGROUPTICKSET; } @@ -15348,7 +15352,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)) && iMap->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 ) @@ -15421,13 +15425,13 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { { struct block_list* src; - if( unit->val1 > 0 && (src = map_id2bl(group->src_id)) != NULL && src->type == BL_PC ) + if( unit->val1 > 0 && (src = iMap->id2bl(group->src_id)) != NULL && src->type == BL_PC ) { // revert unit back into a trap struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = group->item_id?group->item_id:ITEMID_TRAP; item_tmp.identify = 1; - map_addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); + iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); } skill->delunit(unit); } @@ -15441,23 +15445,23 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { 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); + iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,iTimer->gettick(),1); break; case UNT_CALLFAMILY: { struct map_session_data *sd = NULL; if(group->val1) { - sd = map_charid2sd(group->val1); + sd = iMap->charid2sd(group->val1); group->val1 = 0; if (sd && !map[sd->bl.m].flag.nowarp) - pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT); + pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT); } if(group->val2) { - sd = map_charid2sd(group->val2); + sd = iMap->charid2sd(group->val2); group->val2 = 0; if (sd && !map[sd->bl.m].flag.nowarp) - pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT); + pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT); } skill->delunit(unit); } @@ -15469,23 +15473,23 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { 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); + iMap->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; break; case UNT_FEINTBOMB: { - struct block_list *src = map_id2bl(group->src_id); + struct block_list *src = iMap->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); + iMap->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; } case UNT_BANDING: { - struct block_list *src = map_id2bl(group->src_id); + struct block_list *src = iMap->id2bl(group->src_id); struct status_change *sc; if( !src || (sc = status_get_sc(src)) == NULL || !sc->data[SC_BANDING] ) { @@ -15532,7 +15536,7 @@ 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); + iMap->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; @@ -15556,9 +15560,9 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { if( unit->range >= 0 && group->interval != -1 ) { if( battle_config.skill_wall_check ) - map_foreachinshootrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick); + iMap->foreachinshootrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick); else - map_foreachinrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick); + iMap->foreachinrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick); if(unit->range == -1) //Unit disabled, but it should not be deleted yet. group->unit_id = UNT_USED_TRAPS; @@ -15580,11 +15584,11 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { * Executes on all skill units every SKILLUNITTIMER_INTERVAL miliseconds. *------------------------------------------*/ int skill_unit_timer(int tid, unsigned int tick, int id, intptr_t data) { - map_freeblock_lock(); + iMap->freeblock_lock(); skillunit_db->foreach(skillunit_db, skill->unit_timer_sub, tick); - map_freeblock_unlock(); + iMap->freeblock_unlock(); return 0; } @@ -15700,7 +15704,7 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) { memset(skill_unit_temp, 0, sizeof(skill_unit_temp)); } - map_foreachincell(skill->unit_move_sub,bl->m,bl->x,bl->y,BL_SKILL,bl,tick,flag); + iMap->foreachincell(skill->unit_move_sub,bl->m,bl->x,bl->y,BL_SKILL,bl,tick,flag); if( flag&2 && flag&1 ) { //Onplace, check any skill units you have left. int i; @@ -15718,7 +15722,7 @@ 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) { int i,j; - unsigned int tick = gettick(); + unsigned int tick = iTimer->gettick(); int *m_flag; struct skill_unit *unit1; struct skill_unit *unit2; @@ -15766,14 +15770,14 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d if (!(m_flag[i]&0x2)) { if (group->state.song_dance&0x1) //Cancel dissonance effect. skill->dance_overlap(unit1, 0); - map_foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,4); + iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,4); } //Move Cell using "smart" criteria (avoid useless moving around) switch(m_flag[i]) { case 0: //Cell moves independently, safely move it. - map_moveblock(&unit1->bl, unit1->bl.x+dx, unit1->bl.y+dy, tick); + iMap->moveblock(&unit1->bl, unit1->bl.x+dx, unit1->bl.y+dy, tick); break; case 1: //Cell moves unto another cell, look for a replacement cell that won't collide @@ -15784,7 +15788,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d continue; //Move to where this cell would had moved. unit2 = &group->unit[j]; - map_moveblock(&unit1->bl, unit2->bl.x+dx, unit2->bl.y+dy, tick); + iMap->moveblock(&unit1->bl, unit2->bl.x+dx, unit2->bl.y+dy, tick); j++; //Skip this cell as we have used it. break; } @@ -15797,7 +15801,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d if (group->state.song_dance&0x1) //Check for dissonance effect. skill->dance_overlap(unit1, 1); clif->skill_setunit(unit1); - map_foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,1); + iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,1); } } aFree(m_flag); @@ -15819,7 +15823,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, for(i=0;i<MAX_SKILL_PRODUCE_DB;i++){ if(skill_produce_db[i].nameid == nameid ){ if((j=skill_produce_db[i].req_skill)>0 && - pc_checkskill(sd,j) < skill_produce_db[i].req_skill_lv) + pc->checkskill(sd,j) < skill_produce_db[i].req_skill_lv) continue; // must iterate again to check other skills that produce it. [malufett] if( j > 0 && sd->menuskill_id > 0 && sd->menuskill_id != j ) continue; // special case @@ -15830,7 +15834,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, if( i >= MAX_SKILL_PRODUCE_DB ) return 0; - if( pc_checkadditem(sd, nameid, qty) == ADDITEM_OVERAMOUNT ) + if( pc->checkadditem(sd, nameid, qty) == ADDITEM_OVERAMOUNT ) {// cannot carry the produced stuff return 0; } @@ -15853,7 +15857,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, if( (id=skill_produce_db[i].mat_id[j]) <= 0 ) continue; if(skill_produce_db[i].mat_amount[j] <= 0) { - if(pc_search_inventory(sd,id) < 0) + if(pc->search_inventory(sd,id) < 0) return 0; } else { @@ -15905,22 +15909,22 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, int j; if( slot[i]<=0 ) continue; - j = pc_search_inventory(sd,slot[i]); + j = pc->search_inventory(sd,slot[i]); if(j < 0) continue; if(slot[i]==1000){ /* Star Crumb */ - pc_delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE); + pc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE); sc++; } if(slot[i]>=994 && slot[i]<=997 && ele==0){ /* Flame Heart . . . Great Nature */ static const int ele_table[4]={3,1,4,2}; - pc_delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE); + pc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE); ele=ele_table[slot[i]-994]; } } if( skill_id == RK_RUNEMASTERY ) { - int temp_qty, skill_lv = pc_checkskill(sd,skill_id); + int temp_qty, skill_lv = pc->checkskill(sd,skill_id); data = itemdb_search(nameid); if( skill_lv == 10 ) temp_qty = 1 + rnd()%3; @@ -15955,12 +15959,12 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, x=( skill_id == RK_RUNEMASTERY ? 1 : qty)*skill_produce_db[idx].mat_amount[i]; do{ int y=0; - j = pc_search_inventory(sd,id); + j = pc->search_inventory(sd,id); if(j >= 0){ y = sd->status.inventory[j].amount; if(y>x)y=x; - pc_delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE); + pc->delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE); } else ShowError("skill_produce_mix: material item error\n"); @@ -15976,7 +15980,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, case BS_STEEL: case BS_ENCHANTEDSTONE: // Ores & Metals Refining - skill bonuses are straight from kRO website [DracoRPG] - i = pc_checkskill(sd,skill_id); + i = pc->checkskill(sd,skill_id); make_per = sd->status.job_level*20 + status->dex*10 + status->luk*10; //Base chance switch(nameid){ case 998: // Iron @@ -16007,8 +16011,8 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, case AM_TWILIGHT1: case AM_TWILIGHT2: case AM_TWILIGHT3: - make_per = pc_checkskill(sd,AM_LEARNINGPOTION)*50 - + pc_checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20 + make_per = pc->checkskill(sd,AM_LEARNINGPOTION)*50 + + pc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20 + (status->int_/2)*10 + status->dex*10+status->luk*10; if(homun_alive(sd->hd)) {//Player got a homun int skill; @@ -16056,40 +16060,39 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, **/ case RK_RUNEMASTERY: { - int A = 100 * (51 + 2 * pc_checkskill(sd, skill_id)); - int B = 100 * status->dex / 30 + 10 * (status->luk + sd->status.job_level); + int A = 5100 + 200 * pc->checkskill(sd, skill_id); + int B = 10 * status->dex / 3 + (status->luk + sd->status.job_level); int C = 100 * cap_value(sd->itemid,0,100); //itemid depend on makerune() - int D = 0; + int D = 2500; switch (nameid) { //rune rank it_diff 9 craftable rune - case ITEMID_BERKANA: - D = -2000; - break; //Rank S - case ITEMID_NAUTHIZ: - case ITEMID_URUZ: - D = -1500; - break; //Rank A - case ITEMID_ISA: - case ITEMID_WYRD: - D = -1000; - break; //Rank B case ITEMID_RAIDO: case ITEMID_THURISAZ: case ITEMID_HAGALAZ: case ITEMID_OTHILA: - D = -500; - break; //Rank C - default: D = -1500; - break; //not specified =-15% + D -= 500; //Rank C + case ITEMID_ISA: + case ITEMID_WYRD: + D -= 500; //Rank B + case ITEMID_NAUTHIZ: + case ITEMID_URUZ: + D -= 500; //Rank A + case ITEMID_BERKANA: + D -= 500; //Rank S } - make_per = A + B + C + D; + make_per = A + B + C - D; break; } /** * Guilotine Cross **/ case GC_CREATENEWPOISON: - make_per = 3000 + 500 * pc_checkskill(sd,GC_RESEARCHNEWPOISON); - qty = 1+rnd()%pc_checkskill(sd,GC_RESEARCHNEWPOISON); + { + const int min[] = {2, 2, 3, 3, 4, 4, 5, 5, 6, 6}; + const int max[] = {4, 5, 5, 6, 6, 7, 7, 8, 8, 9}; + uint16 lv = pc->checkskill(sd,GC_RESEARCHNEWPOISON); + make_per = 3000 + 500 * lv ; + qty = min[lv] + rand()%(max[lv] - min[lv]); + } break; case GN_CHANGEMATERIAL: for(i=0; i<MAX_SKILL_PRODUCE_DB; i++) @@ -16105,7 +16108,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, difficulty = (620 - 20 * skill_lv);// (620 - 20 * Skill Level) make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) + - (sd->status.base_level-100) + pc_checkskill(sd, AM_LEARNINGPOTION) + pc_checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10) + (sd->status.base_level-100) + pc->checkskill(sd, AM_LEARNINGPOTION) + pc->checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10) switch(nameid){// difficulty factor case 12422: case 12425: @@ -16207,13 +16210,13 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, } } else { // Weapon Forging - skill bonuses are straight from kRO website, other things from a jRO calculator [DracoRPG] make_per = 5000 + sd->status.job_level*20 + status->dex*10 + status->luk*10; // Base - make_per += pc_checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15 - make_per += pc_checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? pc_checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5 + make_per += pc->checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15 + make_per += pc->checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? pc->checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5 make_per -= (ele?2000:0) + sc*1500 + (wlv>1?wlv*1000:0); // Element Stone: -20%, Star Crumb: -15% each, Weapon level malus: -0/-20/-30 - if(pc_search_inventory(sd,989) > 0) make_per+= 1000; // Emperium Anvil: +10 - else if(pc_search_inventory(sd,988) > 0) make_per+= 500; // Golden Anvil: +5 - else if(pc_search_inventory(sd,987) > 0) make_per+= 300; // Oridecon Anvil: +3 - else if(pc_search_inventory(sd,986) > 0) make_per+= 0; // Anvil: +0? + if(pc->search_inventory(sd,989) > 0) make_per+= 1000; // Emperium Anvil: +10 + else if(pc->search_inventory(sd,988) > 0) make_per+= 500; // Golden Anvil: +5 + else if(pc->search_inventory(sd,987) > 0) make_per+= 300; // Oridecon Anvil: +3 + else if(pc->search_inventory(sd,986) > 0) make_per+= 0; // Anvil: +0? if(battle_config.wp_rate != 100) make_per = make_per * battle_config.wp_rate / 100; } @@ -16283,7 +16286,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, clif->produce_effect(sd,0,nameid); clif->misceffect(&sd->bl,3); if(itemdb_wlv(nameid) >= 3 && ((ele? 1 : 0) + sc) >= 3) // Fame point system [DracoRPG] - pc_addfame(sd,10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point + pc->addfame(sd,10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point } else { int fame = 0; tmp_item.amount = 0; @@ -16323,7 +16326,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, } if (fame) - pc_addfame(sd,fame); + pc->addfame(sd,fame); //Visual effects and the like. switch (skill_id) { case AM_PHARMACY: @@ -16362,9 +16365,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, for(j=0; j<5; j++){ if( rnd()%1000 < skill_changematerial_db[i].qty_rate[j] ){ tmp_item.amount = qty * skill_changematerial_db[i].qty[j]; - if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { + if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } k++; } @@ -16376,9 +16379,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, return 1; } } else if (tmp_item.amount) { //Success - if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { + if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } if( skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id == GN_S_PHARMACY ) clif->msg_skill(sd,skill_id,0x627); @@ -16428,9 +16431,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, tmp_item.nameid = compensation[i]; tmp_item.amount = qty; tmp_item.identify = 1; - if( pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) { + if( pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) { clif->additem(sd,0,0,flag); - map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } clif->msg_skill(sd,skill_id,0x628); } @@ -16468,10 +16471,10 @@ int skill_arrow_create (struct map_session_data *sd, int nameid) break; } - if(index < 0 || (j = pc_search_inventory(sd,nameid)) < 0) + if(index < 0 || (j = pc->search_inventory(sd,nameid)) < 0) return 1; - pc_delitem(sd,j,1,0,0,LOG_TYPE_PRODUCE); + pc->delitem(sd,j,1,0,0,LOG_TYPE_PRODUCE); for(i=0;i<MAX_ARROW_RESOURCE;i++) { memset(&tmp_item,0,sizeof(tmp_item)); tmp_item.identify = 1; @@ -16485,9 +16488,9 @@ int skill_arrow_create (struct map_session_data *sd, int nameid) } if(tmp_item.nameid <= 0 || tmp_item.amount <= 0) continue; - if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { + if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } @@ -16497,7 +16500,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) { sc_type type; int chance, i; nullpo_ret(sd); - if( nameid <= 0 || (i = pc_search_inventory(sd,nameid)) < 0 || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) { + if( nameid <= 0 || (i = pc->search_inventory(sd,nameid)) < 0 || pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) { clif->skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0); return 0; } @@ -16517,7 +16520,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 + 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)); return 0; @@ -16553,14 +16556,14 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) { nullpo_ret(sd); skill_id = sd->menuskill_val; - 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) ) + 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; } // Spawn Position - pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); + pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); x = sd->sc.comet_x; y = sd->sc.comet_y; sd->sc.comet_x = sd->sc.comet_y = 0; @@ -16574,8 +16577,8 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) { md->master_id = sd->bl.id; 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_id), mob_timer_delete, md->bl.id, 0); + iTimer->delete_timer(md->deletetimer, mob_timer_delete); + md->deletetimer = iTimer->add_timer (iTimer->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_id); } @@ -16593,8 +16596,8 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { sc = status_get_sc(&sd->bl); status_change_end(&sd->bl, SC_STOP, INVALID_TIMER); - for(i=SC_SPELLBOOK1; i <= SC_MAXSPELLBOOK; i++) if( sc && !sc->data[i] ) break; - if( i > SC_MAXSPELLBOOK ) + for(i=SC_SPELLBOOK1; i <= SC_SPELLBOOK7; i++) if( sc && !sc->data[i] ) break; + if( i > SC_SPELLBOOK7 ) { clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_READING, 0); return 0; @@ -16603,14 +16606,14 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { ARR_FIND(0,MAX_SKILL_SPELLBOOK_DB,i,skill_spellbook_db[i].nameid == nameid); // Search for information of this item if( i == MAX_SKILL_SPELLBOOK_DB ) return 0; - if( !pc_checkskill(sd, (skill_id = skill_spellbook_db[i].skill_id)) ) + 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; } - max_preserve = 4 * pc_checkskill(sd, WL_FREEZE_SP) + status_get_int(&sd->bl) / 10 + sd->status.base_level / 10; + max_preserve = 4 * pc->checkskill(sd, WL_FREEZE_SP) + (status_get_int(&sd->bl) + sd->status.base_level) / 10; point = skill_spellbook_db[i].point; if( sc && sc->data[SC_READING_SB] ) { @@ -16618,16 +16621,16 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_PRESERVATION_POINT, 0); return 0; } - for(i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--){ // This is how official saves spellbook. [malufett] + for(i = SC_SPELLBOOK7; i >= SC_SPELLBOOK1; i--){ // This is how official saves spellbook. [malufett] if( !sc->data[i] ){ sc->data[SC_READING_SB]->val2 += point; // increase points - sc_start4(&sd->bl, (sc_type)i, 100, skill_id, pc_checkskill(sd,skill_id), point, 0, INVALID_TIMER); + sc_start4(&sd->bl, (sc_type)i, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER); break; } } }else{ sc_start2(&sd->bl, SC_READING_SB, 100, 0, point, INVALID_TIMER); - sc_start4(&sd->bl, SC_MAXSPELLBOOK, 100, skill_id, pc_checkskill(sd,skill_id), point, 0, INVALID_TIMER); + sc_start4(&sd->bl, SC_SPELLBOOK7, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER); } return 1; @@ -16696,7 +16699,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv, return 1; } - if( pc_delitem(sd,idx,del_amount,0,1,LOG_TYPE_CONSUME) ) { + if( pc->delitem(sd,idx,del_amount,0,1,LOG_TYPE_CONSUME) ) { clif->skill_fail(sd,SO_EL_ANALYSIS,USESKILL_FAIL_LEVEL,0); return 1; } @@ -16713,9 +16716,9 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv, tmp_item.identify = 1; if( tmp_item.amount ) { - if( (flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME)) ) { + if( (flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME)) ) { clif->additem(sd,0,0,flag); - map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } @@ -16793,7 +16796,7 @@ 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); + iMap->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. @@ -16805,7 +16808,7 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) { * *------------------------------------------*/ int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data) { - struct map_session_data *sd = map_id2sd(id); + struct map_session_data *sd = iMap->id2sd(id); struct skill_cd * cd = NULL; if (data <= 0 || data >= MAX_SKILL) @@ -16863,7 +16866,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick, } if( battle_config.display_status_timers ) - clif->skill_cooldown(sd, idx, tick); + clif->skill_cooldown(sd, skill_id, tick); if( !load ) {// not being loaded initially so ensure the skill delay is recorded if( !(cd = idb_get(skillcd_db,sd->status.char_id)) ) {// create a new skill cooldown object for map storage @@ -16878,12 +16881,12 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick, cd->cursor++; } - sd->blockskill[idx] = 0x1|(0xFE&add_timer(gettick()+tick,skill->blockpc_end,sd->bl.id,idx)); + sd->blockskill[idx] = 0x1|(0xFE&iTimer->add_timer(iTimer->gettick()+tick,skill->blockpc_end,sd->bl.id,idx)); return 0; } int skill_blockhomun_end(int tid, unsigned int tick, int id, intptr_t data) { //[orn] - struct homun_data *hd = (TBL_HOM*) map_id2bl(id); + struct homun_data *hd = (TBL_HOM*) iMap->id2bl(id); if (data <= 0 || data >= MAX_SKILL) return 0; if (hd) hd->blockskill[data] = 0; @@ -16904,11 +16907,11 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) { / return -1; } hd->blockskill[idx] = 1; - return add_timer(gettick() + tick, skill->blockhomun_end, hd->bl.id, idx); + return iTimer->add_timer(iTimer->gettick() + tick, skill->blockhomun_end, hd->bl.id, idx); } int skill_blockmerc_end(int tid, unsigned int tick, int id, intptr_t data) {//[orn] - struct mercenary_data *md = (TBL_MER*)map_id2bl(id); + struct mercenary_data *md = (TBL_MER*)iMap->id2bl(id); if( data <= 0 || data >= MAX_SKILL ) return 0; if( md ) md->blockskill[data] = 0; @@ -16929,7 +16932,7 @@ int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick) return -1; } md->blockskill[idx] = 1; - return add_timer(gettick() + tick, skill->blockmerc_end, md->bl.id, idx); + return iTimer->add_timer(iTimer->gettick() + tick, skill->blockmerc_end, md->bl.id, idx); } /** * Adds a new skill unit entry for this player to recast after map load @@ -17338,7 +17341,7 @@ int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) { return 1; // Can't do it. } break; - case SC_KAGEHUMI: + case SC_KG_KAGEHUMI: switch(skill_id) { case TF_HIDING: case AS_CLOAKING: case GC_CLOAKINGEXCEED: case SC_SHADOWFORM: case MI_HARMONIZE: case CG_MARIONETTE: case AL_TELEPORT: case TF_BACKSLIDING: @@ -17581,6 +17584,7 @@ bool skill_parse_row_unitdb(char* split[], int columns, int current) { else if( strcmpi(split[6],"all")==0 ) skill_db[idx].unit_target = BCT_ALL; else if( strcmpi(split[6],"enemy")==0 ) skill_db[idx].unit_target = BCT_ENEMY; else if( strcmpi(split[6],"self")==0 ) skill_db[idx].unit_target = BCT_SELF; + else if( strcmpi(split[6],"sameguild")==0 ) skill_db[idx].unit_target = BCT_GUILD|BCT_SAMEGUILD; else if( strcmpi(split[6],"noone")==0 ) skill_db[idx].unit_target = BCT_NOONE; else skill_db[idx].unit_target = strtol(split[6],NULL,16); @@ -17796,27 +17800,27 @@ void skill_readdb(void) { safestrncpy(skill_db[0].name, "UNKNOWN_SKILL", sizeof(skill_db[0].name)); safestrncpy(skill_db[0].desc, "Unknown Skill", sizeof(skill_db[0].desc)); - sv->readdb(db_path, DBPATH"skill_db.txt" , ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb); - sv->readdb(db_path, DBPATH"skill_require_db.txt" , ',', 32, 32, MAX_SKILL_DB, skill->parse_row_requiredb); + sv->readdb(iMap->db_path, DBPATH"skill_db.txt" , ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb); + sv->readdb(iMap->db_path, DBPATH"skill_require_db.txt" , ',', 32, 32, MAX_SKILL_DB, skill->parse_row_requiredb); #ifdef RENEWAL_CAST - sv->readdb(db_path, "re/skill_cast_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_castdb); + sv->readdb(iMap->db_path, "re/skill_cast_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_castdb); #else - sv->readdb(db_path, "pre-re/skill_cast_db.txt" , ',', 7, 7, MAX_SKILL_DB, skill->parse_row_castdb); + sv->readdb(iMap->db_path, "pre-re/skill_cast_db.txt" , ',', 7, 7, MAX_SKILL_DB, skill->parse_row_castdb); #endif - sv->readdb(db_path, DBPATH"skill_castnodex_db.txt", ',', 2, 3, MAX_SKILL_DB, skill->parse_row_castnodexdb); - sv->readdb(db_path, DBPATH"skill_unit_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_unitdb); + sv->readdb(iMap->db_path, DBPATH"skill_castnodex_db.txt", ',', 2, 3, MAX_SKILL_DB, skill->parse_row_castnodexdb); + sv->readdb(iMap->db_path, DBPATH"skill_unit_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_unitdb); skill->init_unit_layout(); - sv->readdb(db_path, "produce_db.txt" , ',', 4, 4+2*MAX_PRODUCE_RESOURCE, MAX_SKILL_PRODUCE_DB, skill->parse_row_producedb); - sv->readdb(db_path, "create_arrow_db.txt" , ',', 1+2, 1+2*MAX_ARROW_RESOURCE, MAX_SKILL_ARROW_DB, skill->parse_row_createarrowdb); - sv->readdb(db_path, "abra_db.txt" , ',', 4, 4, MAX_SKILL_ABRA_DB, skill->parse_row_abradb); + sv->readdb(iMap->db_path, "produce_db.txt" , ',', 4, 4+2*MAX_PRODUCE_RESOURCE, MAX_SKILL_PRODUCE_DB, skill->parse_row_producedb); + sv->readdb(iMap->db_path, "create_arrow_db.txt" , ',', 1+2, 1+2*MAX_ARROW_RESOURCE, MAX_SKILL_ARROW_DB, skill->parse_row_createarrowdb); + sv->readdb(iMap->db_path, "abra_db.txt" , ',', 4, 4, MAX_SKILL_ABRA_DB, skill->parse_row_abradb); //Warlock - sv->readdb(db_path, "spellbook_db.txt" , ',', 3, 3, MAX_SKILL_SPELLBOOK_DB, skill->parse_row_spellbookdb); + sv->readdb(iMap->db_path, "spellbook_db.txt" , ',', 3, 3, MAX_SKILL_SPELLBOOK_DB, skill->parse_row_spellbookdb); //Guillotine Cross - sv->readdb(db_path, "magicmushroom_db.txt" , ',', 1, 1, MAX_SKILL_MAGICMUSHROOM_DB, skill->parse_row_magicmushroomdb); - sv->readdb(db_path, "skill_reproduce_db.txt", ',', 1, 1, MAX_SKILL_DB, skill->parse_row_reproducedb); - sv->readdb(db_path, "skill_improvise_db.txt" , ',', 2, 2, MAX_SKILL_IMPROVISE_DB, skill->parse_row_improvisedb); - sv->readdb(db_path, "skill_changematerial_db.txt" , ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb); + sv->readdb(iMap->db_path, "magicmushroom_db.txt" , ',', 1, 1, MAX_SKILL_MAGICMUSHROOM_DB, skill->parse_row_magicmushroomdb); + sv->readdb(iMap->db_path, "skill_reproduce_db.txt", ',', 1, 1, MAX_SKILL_DB, skill->parse_row_reproducedb); + sv->readdb(iMap->db_path, "skill_improvise_db.txt" , ',', 2, 2, MAX_SKILL_IMPROVISE_DB, skill->parse_row_improvisedb); + sv->readdb(iMap->db_path, "skill_changematerial_db.txt" , ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb); } void skill_reload (void) { @@ -17861,13 +17865,13 @@ int do_init_skill (void) { skill_unit_ers = ers_new(sizeof(struct skill_unit_group),"skill.c::skill_unit_ers",ERS_OPT_NONE); 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->timerskill,"skill_timerskill"); - add_timer_func_list(skill->blockpc_end, "skill_blockpc_end"); + iTimer->add_timer_func_list(skill->unit_timer,"skill_unit_timer"); + iTimer->add_timer_func_list(skill->castend_id,"skill_castend_id"); + iTimer->add_timer_func_list(skill->castend_pos,"skill_castend_pos"); + iTimer->add_timer_func_list(skill->timerskill,"skill_timerskill"); + iTimer->add_timer_func_list(skill->blockpc_end, "skill_blockpc_end"); - add_timer_interval(gettick()+SKILLUNITTIMER_INTERVAL,skill->unit_timer,0,0,SKILLUNITTIMER_INTERVAL); + iTimer->add_timer_interval(iTimer->gettick()+SKILLUNITTIMER_INTERVAL,skill->unit_timer,0,0,SKILLUNITTIMER_INTERVAL); return 0; } @@ -17967,6 +17971,7 @@ void skill_defaults(void) { skill->delay_fix = skill_delay_fix; skill->check_condition_castbegin = skill_check_condition_castbegin; skill->check_condition_castend = skill_check_condition_castend; + skill->check_condition_char_sub = skill_check_condition_char_sub; skill->get_requirement = skill_get_requirement; skill->check_pc_partner = skill_check_pc_partner; skill->consume_requirement = skill_consume_requirement; |