From ce5085a000ee7babb05b9e6a86410e13a75d7606 Mon Sep 17 00:00:00 2001 From: malufett Date: Fri, 28 Jun 2013 09:51:58 -0700 Subject: Fixed Bug#6991 -Where cardfix is not working properly. Thanks Kyeme Renewal Update: -updated/completed mastery fix damage factor(skills and sc). -initial implementation for new NPC skills (note: not yet functional dbs not yet updated). --- src/map/battle.c | 178 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 98 insertions(+), 80 deletions(-) (limited to 'src/map/battle.c') diff --git a/src/map/battle.c b/src/map/battle.c index d67684e7b..1242d62ae 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -367,8 +367,8 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag status_change_end(target, SC_THORNS_TRAP, INVALID_TIMER); if( tsc->data[SC_FIRE_CLOAK_OPTION]) damage -= damage * tsc->data[SC_FIRE_CLOAK_OPTION]->val2 / 100; - if( tsc->data[SC_CRYSTALIZE] && target->type != BL_MOB) - status_change_end(target, SC_CRYSTALIZE, INVALID_TIMER); + if( tsc->data[SC_COLD] && target->type != BL_MOB) + status_change_end(target, SC_COLD, INVALID_TIMER); if( tsc->data[SC_EARTH_INSIGNIA]) damage += damage/2; if( tsc->data[SC_VOLCANIC_ASH]) damage += damage/2; //150% break; @@ -379,7 +379,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag if( tsc->data[SC_VENOMIMPRESS]) ratio += tsc->data[SC_VENOMIMPRESS]->val2; break; case ELE_WIND: - if( tsc->data[SC_CRYSTALIZE] && target->type != BL_MOB) damage += damage/2; + if( tsc->data[SC_COLD] && target->type != BL_MOB) damage += damage/2; if( tsc->data[SC_WATER_INSIGNIA]) damage += damage/2; break; case ELE_WATER: @@ -704,17 +704,21 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int *------------------------------------------*/ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int div, bool left, bool weapon){ int skill, i; - struct map_session_data *sd; struct status_change *sc; + struct map_session_data *sd; + struct status_data *tstatus; nullpo_ret(src); nullpo_ret(target); - - sd = BL_CAST(BL_PC, src); + sc = status_get_sc(src); + sd = BL_CAST(BL_PC, src); + tstatus = status_get_status_data(target); if ( !sd ) return damage; + + damage = battle->add_mastery(sd, target, damage, left); switch( skill_id ){ // specific skill masteries case MO_INVESTIGATE: @@ -737,29 +741,48 @@ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, ui damage += 60; break; #endif - case RA_WUGDASH: + case RA_WUGDASH://(Caster Current Weight x 10 / 8) + if( sd->weight ) + damage += sd->weight / 8 ; case RA_WUGSTRIKE: case RA_WUGBITE: damage += 30*pc->checkskill(sd, RA_TOOTHOFWUG); break; - } - - if ( sc && sc->data[SC_MIRACLE] ) i = 2; //Star anger - else - ARR_FIND(0, MAX_PC_FEELHATE, i, status_get_class(target) == sd->hate_mob[i]); - if ( i < MAX_PC_FEELHATE && (skill=pc->checkskill(sd,sg_info[i].anger_id)) && weapon ){ - int ratio = sd->status.base_level + status_get_dex(src) + status_get_luk(src); - if ( i == 2 ) ratio += status_get_str(src); //Star Anger - if (skill < 4 ) - ratio /= (12 - 3 * skill); - damage += damage * ratio / 100; + case HT_FREEZINGTRAP: + damage += 40 * pc->checkskill(sd, RA_RESEARCHTRAP); + break; } - if( sc ){ + if( sc ){ // sc considered as masteries if(sc->data[SC_GN_CARTBOOST]) damage += 10 * sc->data[SC_GN_CARTBOOST]->val1; if(sc->data[SC_CAMOUFLAGE]) damage += 30 * ( 10 - sc->data[SC_CAMOUFLAGE]->val4 ); +#ifdef RENEWAL + if(sc->data[SC_NIBELUNGEN] && weapon) + damage += sc->data[SC_NIBELUNGEN]->val2; + if(sc->data[SC_IMPOSITIO]) + damage += sc->data[SC_IMPOSITIO]->val2; + if(sc->data[SC_DRUMBATTLE]){ + if(tstatus->size == SZ_SMALL) + damage += sc->data[SC_DRUMBATTLE]->val2; + else if(tstatus->size == SZ_MEDIUM) + damage += 10 * sc->data[SC_DRUMBATTLE]->val1; + //else no bonus for large target + } + if(sc->data[SC_GS_MADNESSCANCEL]) + damage += 100; + if(sc->data[SC_GS_GATLINGFEVER]){ + if(tstatus->size == SZ_SMALL) + damage += 10 * sc->data[SC_GS_GATLINGFEVER]->val1; + else if(tstatus->size == SZ_MEDIUM) + damage += -5 * sc->data[SC_GS_GATLINGFEVER]->val1; + else + damage += sc->data[SC_GS_GATLINGFEVER]->val1; + } + //if(sc->data[SC_SPECIALZONE]) + // damage += sc->data[SC_SPECIALZONE]->val2 >> 4; +#endif } // general skill masteries @@ -770,18 +793,35 @@ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, ui damage += div * sd->spiritball * 3; if( skill_id != CR_SHIELDBOOMERANG ) // Only Shield boomerang doesn't takes the Star Crumbs bonus. damage += div * (left ? sd->left_weapon.star : sd->right_weapon.star); + + if(sd->status.party_id && (skill=pc->checkskill(sd,TK_POWER)) > 0){ + if( (i = party_foreachsamemap(party->sub_count, sd, 0)) > 1 ) + damage += 2 * skill * i * (damage /*+ unknown value*/) / 100 /*+ unknown value*/; + } #else if( skill_id != ASC_BREAKER && weapon ) // Adv Katar Mastery is does not applies to ASC_BREAKER, but other masteries DO apply >_> if( sd->status.weapon == W_KATAR && (skill=pc->checkskill(sd,ASC_KATAR)) > 0 ) damage += damage * (10 + 2 * skill) / 100; #endif + // percentage factor masteries + if ( sc && sc->data[SC_MIRACLE] ) + i = 2; //Star anger + else + ARR_FIND(0, MAX_PC_FEELHATE, i, status_get_class(target) == sd->hate_mob[i]); + if ( i < MAX_PC_FEELHATE && (skill=pc->checkskill(sd,sg_info[i].anger_id)) && weapon ){ + int ratio = sd->status.base_level + status_get_dex(src) + status_get_luk(src); + if ( i == 2 ) ratio += status_get_str(src); //Star Anger + if (skill < 4 ) + ratio /= (12 - 3 * skill); + damage += damage * ratio / 100; + } - damage = battle->add_mastery(sd, target, damage, left); - - if((skill = pc->checkskill(sd,AB_EUCHARISTICA)) > 0 && - (status_get_status_data(target)->race == RC_DEMON || status_get_status_data(target)->def_ele == ELE_DARK) ) - damage += damage * skill / 100; + if( sd->status.class_ == JOB_ARCH_BISHOP_T || sd->status.class_ == JOB_ARCH_BISHOP ){ + if((skill = pc->checkskill(sd,AB_EUCHARISTICA)) > 0 && + (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) ) + damage += damage * skill / 100; + } return damage; } @@ -918,16 +958,15 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li break; case BF_WEAPON: t_race2 = status_get_race2(target); - if( cflag&2 && sd && !(nk&NK_NO_CARDFIX_ATK) ) - { + if( sd ){ short cardfix_ = 1000; - if(sd->state.arrow_atk) - { + if( !(nk&NK_NO_CARDFIX_ATK) || !(cflag&2) ) + break; + if( sd->state.arrow_atk ){ cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->arrow_addrace[tstatus->race]) / 100; - if (!(nk&NK_NO_ELEFIX)) - { + if( !(nk&NK_NO_ELEFIX) ){ int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->arrow_addele[tstatus->def_ele]; - for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { + for(i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++){ if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && @@ -942,13 +981,10 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li cardfix = cardfix * (100 + sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS] + sd->arrow_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]+sd->arrow_addrace[RC_NONDEMIHUMAN]) / 100; - } - else - { // Melee attack - if( !battle_config.left_cardfix_to_right ) - { + }else{ // Melee attack + if( !battle_config.left_cardfix_to_right ){ cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race])/100; - if (!(nk&NK_NO_ELEFIX)) { + if( !(nk&NK_NO_ELEFIX) ){ int ele_fix = sd->right_weapon.addele[tstatus->def_ele]; for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; @@ -966,10 +1002,9 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li if( tstatus->race != RC_DEMIHUMAN ) cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]) / 100; - if( cflag&1 ) - { - cardfix_=cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; - if (!(nk&NK_NO_ELEFIX)) { + if( cflag&1 ){ + cardfix_ = cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; + if (!(nk&NK_NO_ELEFIX)){ int ele_fix_lh = sd->left_weapon.addele[tstatus->def_ele]; for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++) { if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; @@ -985,13 +1020,11 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li cardfix_ = cardfix_ * (100+sd->left_weapon.addrace2[t_race2]) / 100; cardfix_ = cardfix_ * (100+sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) - cardfix_=cardfix_*(100+sd->left_weapon.addrace[RC_NONDEMIHUMAN])/100; + cardfix_ = cardfix_*(100+sd->left_weapon.addrace[RC_NONDEMIHUMAN])/100; } - } - else - { + }else{ int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->left_weapon.addele[tstatus->def_ele]; - for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { + for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++){ if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && @@ -999,7 +1032,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li continue; ele_fix += sd->right_weapon.addele2[i].rate; } - for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++) { + for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++){ if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; if(!(sd->left_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && sd->left_weapon.addele2[i].flag&wflag&BF_RANGEMASK && @@ -1018,21 +1051,16 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li } } - for( i = 0; i < ARRAYLENGTH(sd->right_weapon.add_dmg) && sd->right_weapon.add_dmg[i].rate; i++ ) - { - if( sd->right_weapon.add_dmg[i].class_ == t_class ) - { + for( i = 0; i < ARRAYLENGTH(sd->right_weapon.add_dmg) && sd->right_weapon.add_dmg[i].rate; i++ ){ + if( sd->right_weapon.add_dmg[i].class_ == t_class ){ cardfix = cardfix * (100 + sd->right_weapon.add_dmg[i].rate) / 100; break; } } - if( cflag&1 ) - { - for( i = 0; i < ARRAYLENGTH(sd->left_weapon.add_dmg) && sd->left_weapon.add_dmg[i].rate; i++ ) - { - if( sd->left_weapon.add_dmg[i].class_ == t_class ) - { + if( cflag&1 ){ + for( i = 0; i < ARRAYLENGTH(sd->left_weapon.add_dmg) && sd->left_weapon.add_dmg[i].rate; i++ ){ + if( sd->left_weapon.add_dmg[i].class_ == t_class ){ cardfix_ = cardfix_ * (100 + sd->left_weapon.add_dmg[i].rate) / 100; break; } @@ -1050,10 +1078,8 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li break; // end Attacker side } // Target side - if( tsd && !(nk&NK_NO_CARDFIX_DEF) ) - { - if( !(nk&NK_NO_ELEFIX) ) - { + if( tsd && !(nk&NK_NO_CARDFIX_DEF) ){ + if( !(nk&NK_NO_ELEFIX) ){ int ele_fix = tsd->subele[s_ele]; for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) { @@ -1064,12 +1090,10 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li continue; ele_fix += tsd->subele2[i].rate; } - cardfix=cardfix*(100-ele_fix)/100; - if( cflag&1 && s_ele_ != s_ele ) - { + cardfix = cardfix * (100-ele_fix) / 100; + if( cflag&1 && s_ele_ != s_ele ){ int ele_fix_lh = tsd->subele[s_ele_]; - for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) - { + for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++){ if(tsd->subele2[i].ele != s_ele_) continue; if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && tsd->subele2[i].flag&wflag&BF_RANGEMASK && @@ -1087,8 +1111,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li if( sstatus->race != RC_DEMIHUMAN ) cardfix = cardfix * (100-tsd->subrace[RC_NONDEMIHUMAN]) / 100; - for( i = 0; i < ARRAYLENGTH(tsd->add_def) && tsd->add_def[i].rate;i++ ) - { + for( i = 0; i < ARRAYLENGTH(tsd->add_def) && tsd->add_def[i].rate;i++ ){ if( tsd->add_def[i].class_ == s_class ) { cardfix = cardfix * (100 - tsd->add_def[i].rate) / 100; @@ -1489,7 +1512,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += 300 + 100 * skill_lv + status_get_int(src); RE_LVL_DMOD(100); break; - case WL_FROSTMISTY: // MATK [{( Skill Level x 100 ) + 200 } x ( Caster�s Base Level / 100 )] % + case WL_FROSTMISTY: // MATK [{( Skill Level x 100 ) + 200 } x ( Caster?s Base Level / 100 )] % skillratio += 100 + 100 * skill_lv; RE_LVL_DMOD(100); break; @@ -2712,7 +2735,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag damage += damage / 2; // 1.5 times more damage while in Deep Sleep. status_change_end(bl,SC_DEEP_SLEEP,INVALID_TIMER); } - if( tsd && sd && sc->data[SC_CRYSTALIZE] && flag&BF_WEAPON ){ + if( tsd && sd && sc->data[SC_COLD] && flag&BF_WEAPON ){ switch(tsd->status.weapon){ case W_MACE: case W_2HMACE: @@ -3358,7 +3381,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list //Constant/misc additions from skills if (skill_id == WZ_FIREPILLAR) MATK_ADD(50); - if( sd && (i=pc->checkskill(sd,AB_EUCHARISTICA)) > 0 && + if( sd && ( sd->status.class_ == JOB_ARCH_BISHOP_T || sd->status.class_ == JOB_ARCH_BISHOP ) && + (i=pc->checkskill(sd,AB_EUCHARISTICA)) > 0 && (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) ) MATK_ADDRATE(i); } @@ -4492,11 +4516,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if(flag.cri && sd->bonus.crit_atk_rate) ATK_ADDRATE(sd->bonus.crit_atk_rate); - +#ifndef RENEWAL if(sd->status.party_id && (temp=pc->checkskill(sd,TK_POWER)) > 0){ if( (i = party_foreachsamemap(party->sub_count, sd, 0)) > 1 ) // exclude the player himself [Inkfish] ATK_ADDRATE(2*temp*i); } +#endif } break; } //End default case @@ -4595,14 +4620,6 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_ADD(4*skill_lv); #endif break; - case HT_FREEZINGTRAP: - if(sd) - ATK_ADD( 40 * pc->checkskill(sd, RA_RESEARCHTRAP) ); - break; - case RA_WUGDASH ://(Caster Current Weight x 10 / 8) - if( sd && sd->weight ) - ATK_ADD( sd->weight / 8 ); - break; case GC_COUNTERSLASH: ATK_ADD( status_get_agi(src) * 2 + (sd?sd->status.job_level:0) * 4 ); break; @@ -4848,6 +4865,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_ADD(wd.div_*sd->spiritball*3); } //Card Fix, sd side + wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 2, wd.flag); if( flag.lh ) wd.damage2 = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); -- cgit v1.2.3-70-g09d2 From c1401ff17207e9c2aac551066f0bd90928dd90bb Mon Sep 17 00:00:00 2001 From: malufett Date: Mon, 1 Jul 2013 17:11:24 +0800 Subject: Follow up 074662a4b30e5d380fda32fd7df2d3ae2de759e0 -where target def card is not working properly Renewal Update: -Updated MO_EXTREMITYFIST to its official RE damage formula. -Special thanks to Awesome Yommy..:D Signed-off-by: malufett --- src/map/battle.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/map/battle.c') diff --git a/src/map/battle.c b/src/map/battle.c index 1242d62ae..37d3ec13e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -958,7 +958,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li break; case BF_WEAPON: t_race2 = status_get_race2(target); - if( sd ){ + if( sd && !tsd ){ short cardfix_ = 1000; if( !(nk&NK_NO_CARDFIX_ATK) || !(cflag&2) ) break; @@ -4401,20 +4401,21 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_ADD(-totaldef); if( is_boss(target) ) ATK_RATE(50); - flag.idef = 1; } break; case NJ_SYURIKEN: // [malufett] GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); wd.damage += battle->calc_masteryfix(src, target, skill_id, skill_lv, 4 * skill_lv + (sd ? sd->bonus.arrow_atk : 0), wd.div_, 0, flag.weapon) - status_get_total_def(target); - flag.idef = 1; break; case MO_EXTREMITYFIST: // [malufett] - GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8 ); - // first value is still not confirm. - if( wd.damage ) - wd.damage = status_get_sp(src) + 10 * status_get_sp(src) * wd.damage / 100 + 8 * wd.damage + 250 + 150 * skill_lv; - flag.tdef = 1; + { + short totaldef = status_get_total_def(target); + GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8 ); + if( wd.damage ){ + wd.damage = (250 + 150 * skill_lv) + (10 * (status_get_sp(src)+1) * wd.damage / 100) + (8 * wd.damage); + ATK_ADD(-totaldef); + } + } #endif break; #ifndef RENEWAL @@ -4514,9 +4515,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if (sd->bonus.atk_rate) ATK_ADDRATE(sd->bonus.atk_rate); +#ifndef RENEWAL if(flag.cri && sd->bonus.crit_atk_rate) ATK_ADDRATE(sd->bonus.crit_atk_rate); -#ifndef RENEWAL + if(sd->status.party_id && (temp=pc->checkskill(sd,TK_POWER)) > 0){ if( (i = party_foreachsamemap(party->sub_count, sd, 0)) > 1 ) // exclude the player himself [Inkfish] ATK_ADDRATE(2*temp*i); @@ -4814,8 +4816,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( flag.lh) wd.damage2 = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage2, wd.div_, 1, flag.weapon); #else - if( flag.cri ) - ATK_ADDRATE(40); + if( sd && flag.cri ) + ATK_ADDRATE(sd->bonus.crit_atk_rate >= 100 ? sd->bonus.crit_atk_rate : 40); #endif } //Here ends flag.hit section, the rest of the function applies to both hitting and missing attacks else if(wd.div_ < 0) //Since the attack missed... @@ -4869,10 +4871,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 2, wd.flag); if( flag.lh ) wd.damage2 = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); -#ifdef RENEWAL - if( flag.cri ) - ATK_ADDRATE(sd->bonus.crit_atk_rate>=100?sd->bonus.crit_atk_rate-60:40); -#endif + if( skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN ) { //Refine bonus applies after cards and elements. short index= sd->equip_index[EQI_HAND_L]; -- cgit v1.2.3-70-g09d2 From 8f1bd982faf74fdb61126e97c75905976201cca5 Mon Sep 17 00:00:00 2001 From: malufett Date: Mon, 1 Jul 2013 23:01:40 +0800 Subject: Follow up ce5085a000ee7babb05b9e6a86410e13a75d7606 -Thanks kyeme and Ind.:D Signed-off-by: malufett --- src/map/battle.c | 275 +++++++++++++++++++++++++++---------------------------- 1 file changed, 137 insertions(+), 138 deletions(-) (limited to 'src/map/battle.c') diff --git a/src/map/battle.c b/src/map/battle.c index 37d3ec13e..6281cec34 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -958,35 +958,14 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li break; case BF_WEAPON: t_race2 = status_get_race2(target); - if( sd && !tsd ){ - short cardfix_ = 1000; - if( !(nk&NK_NO_CARDFIX_ATK) || !(cflag&2) ) - break; - if( sd->state.arrow_atk ){ - cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->arrow_addrace[tstatus->race]) / 100; - if( !(nk&NK_NO_ELEFIX) ){ - int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->arrow_addele[tstatus->def_ele]; - for(i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++){ - if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) - continue; - ele_fix += sd->right_weapon.addele2[i].rate; - } - cardfix = cardfix * (100 + ele_fix) / 100; - } - cardfix = cardfix * (100 + sd->right_weapon.addsize[tstatus->size]+sd->arrow_addsize[tstatus->size]) / 100; - cardfix = cardfix * (100 + sd->right_weapon.addrace2[t_race2]) / 100; - cardfix = cardfix * (100 + sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS] + sd->arrow_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; - if( tstatus->race != RC_DEMIHUMAN ) - cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]+sd->arrow_addrace[RC_NONDEMIHUMAN]) / 100; - }else{ // Melee attack - if( !battle_config.left_cardfix_to_right ){ - cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race])/100; + if( cflag&2 ){ + if( sd && !(nk&NK_NO_CARDFIX_ATK) ){ + short cardfix_ = 1000; + if( sd->state.arrow_atk ){ + cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->arrow_addrace[tstatus->race]) / 100; if( !(nk&NK_NO_ELEFIX) ){ - int ele_fix = sd->right_weapon.addele[tstatus->def_ele]; - for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { + int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->arrow_addele[tstatus->def_ele]; + for(i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++){ if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && @@ -994,141 +973,161 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li continue; ele_fix += sd->right_weapon.addele2[i].rate; } - cardfix = cardfix * (100+ele_fix) / 100; + cardfix = cardfix * (100 + ele_fix) / 100; } - cardfix = cardfix * (100+sd->right_weapon.addsize[tstatus->size]) / 100; - cardfix = cardfix * (100+sd->right_weapon.addrace2[t_race2]) / 100; - cardfix = cardfix * (100+sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; + cardfix = cardfix * (100 + sd->right_weapon.addsize[tstatus->size]+sd->arrow_addsize[tstatus->size]) / 100; + cardfix = cardfix * (100 + sd->right_weapon.addrace2[t_race2]) / 100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS] + sd->arrow_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) - cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]) / 100; - - if( cflag&1 ){ - cardfix_ = cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; - if (!(nk&NK_NO_ELEFIX)){ - int ele_fix_lh = sd->left_weapon.addele[tstatus->def_ele]; - for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++) { - if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->left_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && - sd->left_weapon.addele2[i].flag&wflag&BF_RANGEMASK && - sd->left_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) + cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]+sd->arrow_addrace[RC_NONDEMIHUMAN]) / 100; + }else{ // Melee attack + if( !battle_config.left_cardfix_to_right ){ + cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race])/100; + if( !(nk&NK_NO_ELEFIX) ){ + int ele_fix = sd->right_weapon.addele[tstatus->def_ele]; + for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { + if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; + if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) continue; - ele_fix_lh += sd->left_weapon.addele2[i].rate; + ele_fix += sd->right_weapon.addele2[i].rate; } - cardfix = cardfix * (100+ele_fix_lh) / 100; + cardfix = cardfix * (100+ele_fix) / 100; } - cardfix_ = cardfix_ * (100+sd->left_weapon.addsize[tstatus->size]) / 100; - cardfix_ = cardfix_ * (100+sd->left_weapon.addrace2[t_race2]) / 100; - cardfix_ = cardfix_ * (100+sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; + cardfix = cardfix * (100+sd->right_weapon.addsize[tstatus->size]) / 100; + cardfix = cardfix * (100+sd->right_weapon.addrace2[t_race2]) / 100; + cardfix = cardfix * (100+sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) - cardfix_ = cardfix_*(100+sd->left_weapon.addrace[RC_NONDEMIHUMAN])/100; - } - }else{ - int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->left_weapon.addele[tstatus->def_ele]; - for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++){ - if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) - continue; - ele_fix += sd->right_weapon.addele2[i].rate; - } - for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++){ - if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->left_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && - sd->left_weapon.addele2[i].flag&wflag&BF_RANGEMASK && - sd->left_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) - continue; - ele_fix += sd->left_weapon.addele2[i].rate; - } - - cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->left_weapon.addrace[tstatus->race]) / 100; - cardfix = cardfix * (100 + ele_fix) / 100; - cardfix = cardfix * (100 + sd->right_weapon.addsize[tstatus->size] + sd->left_weapon.addsize[tstatus->size])/100; - cardfix = cardfix * (100 + sd->right_weapon.addrace2[t_race2] + sd->left_weapon.addrace2[t_race2])/100; - cardfix = cardfix * (100 + sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS] + sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; - if( tstatus->race != RC_DEMIHUMAN ) - cardfix = cardfix * (100+sd->right_weapon.addrace[RC_NONDEMIHUMAN] + sd->left_weapon.addrace[RC_NONDEMIHUMAN]) / 100; - } - } + cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]) / 100; + + if( cflag&1 ){ + cardfix_ = cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; + if (!(nk&NK_NO_ELEFIX)){ + int ele_fix_lh = sd->left_weapon.addele[tstatus->def_ele]; + for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++) { + if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; + if(!(sd->left_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) + continue; + ele_fix_lh += sd->left_weapon.addele2[i].rate; + } + cardfix = cardfix * (100+ele_fix_lh) / 100; + } + cardfix_ = cardfix_ * (100+sd->left_weapon.addsize[tstatus->size]) / 100; + cardfix_ = cardfix_ * (100+sd->left_weapon.addrace2[t_race2]) / 100; + cardfix_ = cardfix_ * (100+sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; + if( tstatus->race != RC_DEMIHUMAN ) + cardfix_ = cardfix_*(100+sd->left_weapon.addrace[RC_NONDEMIHUMAN])/100; + } + }else{ + int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->left_weapon.addele[tstatus->def_ele]; + for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++){ + if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; + if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) + continue; + ele_fix += sd->right_weapon.addele2[i].rate; + } + for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++){ + if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; + if(!(sd->left_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) + continue; + ele_fix += sd->left_weapon.addele2[i].rate; + } - for( i = 0; i < ARRAYLENGTH(sd->right_weapon.add_dmg) && sd->right_weapon.add_dmg[i].rate; i++ ){ - if( sd->right_weapon.add_dmg[i].class_ == t_class ){ - cardfix = cardfix * (100 + sd->right_weapon.add_dmg[i].rate) / 100; - break; + cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->left_weapon.addrace[tstatus->race]) / 100; + cardfix = cardfix * (100 + ele_fix) / 100; + cardfix = cardfix * (100 + sd->right_weapon.addsize[tstatus->size] + sd->left_weapon.addsize[tstatus->size])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace2[t_race2] + sd->left_weapon.addrace2[t_race2])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS] + sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; + if( tstatus->race != RC_DEMIHUMAN ) + cardfix = cardfix * (100+sd->right_weapon.addrace[RC_NONDEMIHUMAN] + sd->left_weapon.addrace[RC_NONDEMIHUMAN]) / 100; + } } - } - if( cflag&1 ){ - for( i = 0; i < ARRAYLENGTH(sd->left_weapon.add_dmg) && sd->left_weapon.add_dmg[i].rate; i++ ){ - if( sd->left_weapon.add_dmg[i].class_ == t_class ){ - cardfix_ = cardfix_ * (100 + sd->left_weapon.add_dmg[i].rate) / 100; + for( i = 0; i < ARRAYLENGTH(sd->right_weapon.add_dmg) && sd->right_weapon.add_dmg[i].rate; i++ ){ + if( sd->right_weapon.add_dmg[i].class_ == t_class ){ + cardfix = cardfix * (100 + sd->right_weapon.add_dmg[i].rate) / 100; break; } } - } - if( wflag&BF_LONG ) - cardfix = cardfix * (100 + sd->bonus.long_attack_atk_rate) / 100; + if( cflag&1 ){ + for( i = 0; i < ARRAYLENGTH(sd->left_weapon.add_dmg) && sd->left_weapon.add_dmg[i].rate; i++ ){ + if( sd->left_weapon.add_dmg[i].class_ == t_class ){ + cardfix_ = cardfix_ * (100 + sd->left_weapon.add_dmg[i].rate) / 100; + break; + } + } + } - if( (cflag&1) && cardfix_ != 1000 ) - damage = damage * cardfix_ / 1000; - else if( cardfix != 1000 ) - damage = damage * cardfix / 1000; + if( wflag&BF_LONG ) + cardfix = cardfix * (100 + sd->bonus.long_attack_atk_rate) / 100; - break; // end Attacker side - } - // Target side - if( tsd && !(nk&NK_NO_CARDFIX_DEF) ){ - if( !(nk&NK_NO_ELEFIX) ){ - int ele_fix = tsd->subele[s_ele]; - for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) - { - if(tsd->subele2[i].ele != s_ele) continue; - if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && - tsd->subele2[i].flag&wflag&BF_RANGEMASK && - tsd->subele2[i].flag&wflag&BF_SKILLMASK)) - continue; - ele_fix += tsd->subele2[i].rate; - } - cardfix = cardfix * (100-ele_fix) / 100; - if( cflag&1 && s_ele_ != s_ele ){ - int ele_fix_lh = tsd->subele[s_ele_]; - for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++){ - if(tsd->subele2[i].ele != s_ele_) continue; + if( (cflag&1) && cardfix_ != 1000 ) + damage = damage * cardfix_ / 1000; + else if( cardfix != 1000 ) + damage = damage * cardfix / 1000; + } + }else{ + // Target side + if( tsd && !(nk&NK_NO_CARDFIX_DEF) ){ + if( !(nk&NK_NO_ELEFIX) ){ + int ele_fix = tsd->subele[s_ele]; + for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) + { + if(tsd->subele2[i].ele != s_ele) continue; if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && tsd->subele2[i].flag&wflag&BF_RANGEMASK && tsd->subele2[i].flag&wflag&BF_SKILLMASK)) continue; - ele_fix_lh += tsd->subele2[i].rate; + ele_fix += tsd->subele2[i].rate; + } + cardfix = cardfix * (100-ele_fix) / 100; + if( cflag&1 && s_ele_ != s_ele ){ + int ele_fix_lh = tsd->subele[s_ele_]; + for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++){ + if(tsd->subele2[i].ele != s_ele_) continue; + if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && + tsd->subele2[i].flag&wflag&BF_RANGEMASK && + tsd->subele2[i].flag&wflag&BF_SKILLMASK)) + continue; + ele_fix_lh += tsd->subele2[i].rate; + } + cardfix = cardfix * (100 - ele_fix_lh) / 100; } - cardfix = cardfix * (100 - ele_fix_lh) / 100; } - } - cardfix = cardfix * (100-tsd->subsize[sstatus->size]) / 100; - cardfix = cardfix * (100-tsd->subrace2[s_race2]) / 100; - cardfix = cardfix * (100-tsd->subrace[sstatus->race]) / 100; - cardfix = cardfix * (100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS]) / 100; - if( sstatus->race != RC_DEMIHUMAN ) - cardfix = cardfix * (100-tsd->subrace[RC_NONDEMIHUMAN]) / 100; - - for( i = 0; i < ARRAYLENGTH(tsd->add_def) && tsd->add_def[i].rate;i++ ){ - if( tsd->add_def[i].class_ == s_class ) - { - cardfix = cardfix * (100 - tsd->add_def[i].rate) / 100; - break; + cardfix = cardfix * (100-tsd->subsize[sstatus->size]) / 100; + cardfix = cardfix * (100-tsd->subrace2[s_race2]) / 100; + cardfix = cardfix * (100-tsd->subrace[sstatus->race]) / 100; + cardfix = cardfix * (100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS]) / 100; + if( sstatus->race != RC_DEMIHUMAN ) + cardfix = cardfix * (100-tsd->subrace[RC_NONDEMIHUMAN]) / 100; + + for( i = 0; i < ARRAYLENGTH(tsd->add_def) && tsd->add_def[i].rate;i++ ){ + if( tsd->add_def[i].class_ == s_class ) + { + cardfix = cardfix * (100 - tsd->add_def[i].rate) / 100; + break; + } } - } - if( wflag&BF_SHORT ) - cardfix = cardfix * (100 - tsd->bonus.near_attack_def_rate) / 100; - else // BF_LONG (there's no other choice) - cardfix = cardfix * (100 - tsd->bonus.near_attack_def_rate) / 100; + if( wflag&BF_SHORT ) + cardfix = cardfix * (100 - tsd->bonus.near_attack_def_rate) / 100; + else // BF_LONG (there's no other choice) + cardfix = cardfix * (100 - tsd->bonus.near_attack_def_rate) / 100; - if( tsd->sc.data[SC_PROTECT_DEF] ) - cardfix = cardfix * (100 - tsd->sc.data[SC_PROTECT_DEF]->val1) / 100; + if( tsd->sc.data[SC_PROTECT_DEF] ) + cardfix = cardfix * (100 - tsd->sc.data[SC_PROTECT_DEF]->val1) / 100; - if( cardfix != 1000 ) - damage = damage * cardfix / 1000; + if( cardfix != 1000 ) + damage = damage * cardfix / 1000; + } } break; case BF_MISC: -- cgit v1.2.3-70-g09d2 From b40fa517dc796f8067791eab85a23a9b714db2a8 Mon Sep 17 00:00:00 2001 From: malufett Date: Mon, 1 Jul 2013 23:12:15 +0800 Subject: Fixed Bug#7452 -where SC_SUB_WEAPONPROPERTY is now properly. Signed-off-by: malufett --- src/map/battle.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/map/battle.c') diff --git a/src/map/battle.c b/src/map/battle.c index 6281cec34..6c06dd5fb 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -857,12 +857,12 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 #ifndef RENEWAL if( sc && sc->data[SC_SUB_WEAPONPROPERTY] ) { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex] - damage = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; - damage += battle->attr_fix(src, target, damage, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv); - if( left ){ - damage = battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; - damage += battle->attr_fix(src, target, damage, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv); - } + int temp = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; + damage += battle->attr_fix(src, target, temp, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv); + if( left ){ + temp = battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; + damage += battle->attr_fix(src, target, temp, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv); + } } #endif return damage; -- cgit v1.2.3-70-g09d2 From 8de3c1118a6a7a235cc7a3e77f24b0c4c5c397ae Mon Sep 17 00:00:00 2001 From: shennetsind Date: Mon, 1 Jul 2013 17:03:58 -0300 Subject: Fixed Bug #7216 Special Thanks to Shikazu, wouldn't have been able to identify this issue without his help! http://hercules.ws/board/index.php?app=tracker&showissue=7216 Signed-off-by: shennetsind --- src/map/atcommand.c | 2 ++ src/map/atcommand.h | 2 +- src/map/battle.c | 1 + src/map/battle.h | 2 +- src/map/battleground.c | 1 + src/map/battleground.h | 2 +- src/map/buyingstore.c | 2 +- src/map/buyingstore.h | 2 +- src/map/chrif.c | 2 ++ src/map/chrif.h | 2 +- src/map/clif.c | 2 ++ src/map/clif.h | 2 +- src/map/guild.c | 1 + src/map/guild.h | 2 +- src/map/homunculus.c | 2 ++ src/map/homunculus.h | 2 +- src/map/instance.c | 2 ++ src/map/instance.h | 2 +- src/map/irc-bot.c | 2 ++ src/map/irc-bot.h | 2 +- src/map/itemdb.c | 2 ++ src/map/itemdb.h | 2 +- src/map/log.c | 1 + src/map/log.h | 2 +- src/map/mail.c | 2 ++ src/map/mail.h | 2 +- src/map/map.c | 2 ++ src/map/map.h | 2 +- src/map/party.c | 2 ++ src/map/party.h | 2 +- src/map/pc.c | 2 ++ src/map/pc.h | 2 +- src/map/script.c | 2 ++ src/map/script.h | 2 +- src/map/searchstore.c | 1 + src/map/searchstore.h | 2 +- src/map/skill.c | 3 +++ src/map/skill.h | 2 +- src/map/storage.c | 3 +++ src/map/storage.h | 4 ++-- src/map/trade.c | 2 ++ src/map/trade.h | 2 +- src/map/vending.c | 2 ++ src/map/vending.h | 2 +- 44 files changed, 63 insertions(+), 24 deletions(-) (limited to 'src/map/battle.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b778aab6c..f35bf8a12 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -51,6 +51,8 @@ #include #include +struct atcommand_interface atcommand_s; + static char* msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others) static char atcmd_output[CHAT_SIZE_MAX]; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index f09b1f2b8..12439ab32 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -86,7 +86,7 @@ struct atcommand_interface { void (*final_msg) (void); /* atcommand binding */ struct atcmd_binding_data* (*get_bind_byname) (const char* name); -} atcommand_s; +}; struct atcommand_interface *atcommand; diff --git a/src/map/battle.c b/src/map/battle.c index 37d3ec13e..0ace7e941 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -39,6 +39,7 @@ int attr_fix_table[4][ELE_MAX][ELE_MAX]; struct Battle_Config battle_config; +struct battle_interface battle_s; static struct eri *delay_damage_ers; //For battle delay damage structures. int battle_getcurrentskill(struct block_list *bl) { //Returns the current/last skill in use by this bl. diff --git a/src/map/battle.h b/src/map/battle.h index 37968f53a..9a8c18fd7 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -556,7 +556,7 @@ struct battle_interface { struct block_list* (*get_enemy_area) (struct block_list *src, int x, int y, int range, int type, int ignore_id); /* damages area, originally for royal guard's reflect damage */ int (*damage_area) ( struct block_list *bl, va_list ap); -} battle_s; +}; struct battle_interface *battle; diff --git a/src/map/battleground.c b/src/map/battleground.c index 3f0b9ee41..4bf0843d5 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -28,6 +28,7 @@ static DBMap* bg_team_db; // int bg_id -> struct battleground_data* static unsigned int bg_team_counter = 0; // Next bg_id +struct battleground_interface bg_s; struct battleground_data* bg_team_search(int bg_id) { // Search a BG Team using bg_id if( !bg_id ) return NULL; diff --git a/src/map/battleground.h b/src/map/battleground.h index f76d84d0c..88d75f953 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -101,7 +101,7 @@ struct battleground_interface { void (*queue_check) (struct bg_arena *arena); /* */ void (*config_read) (void); -} bg_s; +}; struct battleground_interface *bg; diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 7041042df..73c50b0bf 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -37,7 +37,7 @@ enum e_buyingstore_failure static unsigned int buyingstore_nextid = 0; static const short buyingstore_blankslots[MAX_SLOTS] = { 0 }; // used when checking whether or not an item's card slots are blank - +struct buyingstore_interface buyingstore_s; /// Returns unique buying store id static unsigned int buyingstore_getuid(void) diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index a416317be..ae5fcb9e5 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -29,7 +29,7 @@ struct buyingstore_interface { void (*trade) (struct map_session_data* sd, int account_id, unsigned int buyer_id, const uint8* itemlist, unsigned int count); bool (*search) (struct map_session_data* sd, unsigned short nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); -} buyingstore_s; +}; struct buyingstore_interface *buyingstore; diff --git a/src/map/chrif.c b/src/map/chrif.c index 80c82354c..c2067dbd1 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -48,6 +48,8 @@ static const int packet_len_table[0x3d] = { // U - used, F - free -1,10, 8, 2, 2,14,19,19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27 }; +struct chrif_interface chrif_s; + //Used Packets: //2af8: Outgoing, chrif_connect -> 'connect to charserver / auth @ charserver' //2af9: Incoming, chrif_connectack -> 'answer of the 2af8 login(ok / fail)' diff --git a/src/map/chrif.h b/src/map/chrif.h index 1af652cea..a6a5fc6bf 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -79,7 +79,7 @@ struct chrif_interface { int (*flush_fifo) (void); void (*skillid2idx) (int fd); -} chrif_s; +}; struct chrif_interface *chrif; diff --git a/src/map/clif.c b/src/map/clif.c index 0ad6fbd44..f925fcf55 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -53,6 +53,8 @@ #include #include +struct clif_interface clif_s; + //#define DUMP_UNKNOWN_PACKET //#define DUMP_INVALID_PACKET diff --git a/src/map/clif.h b/src/map/clif.h index c23db873e..a0946a48a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1149,7 +1149,7 @@ struct clif_interface { void (*pPartyBookingRefuseVolunteer) (int fd, struct map_session_data *sd); void (*pPartyBookingCancelVolunteer) (int fd, struct map_session_data *sd); #endif -} clif_s; +}; struct clif_interface *clif; diff --git a/src/map/guild.c b/src/map/guild.c index e093fdf92..aa1d8c7a9 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -30,6 +30,7 @@ #include #include +struct guild_interface guild_s; static DBMap* guild_db; // int guild_id -> struct guild* static DBMap* castle_db; // int castle_id -> struct guild_castle* diff --git a/src/map/guild.h b/src/map/guild.h index 9841f5451..1f61df09e 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -104,7 +104,7 @@ struct guild_interface { void (*flags_clear) (void); /* guild aura */ void (*aura_refresh) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); -} guild_s; +}; struct guild_interface *guild; diff --git a/src/map/homunculus.c b/src/map/homunculus.c index efb5c0eb3..0d1b6ebcb 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -40,6 +40,8 @@ #include #include +struct homunculus_interface homunculus_s; + //Returns the viewdata for homunculus struct view_data* homunculus_get_viewdata(int class_) { if (homdb_checkid(class_)) diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 86d437e73..4b35c0992 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -133,7 +133,7 @@ struct homunculus_interface { void (*exp_db_read) (void); void (*addspiritball) (struct homun_data *hd, int max); void (*delspiritball) (struct homun_data *hd, int count, int type); -} homunculus_s; +}; struct homunculus_interface *homun; diff --git a/src/map/instance.c b/src/map/instance.c index 6b80f5d75..9207c1d53 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -25,6 +25,8 @@ #include #include +struct instance_interface instance_s; + /// Checks whether given instance id is valid or not. bool instance_is_valid(int instance_id) { if( instance_id < 0 || instance_id >= instance->instances ) {// out of range diff --git a/src/map/instance.h b/src/map/instance.h index e86586e44..164aaf662 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -62,7 +62,7 @@ struct instance_interface { void (*check_kick) (struct map_session_data *sd); void (*set_timeout) (int instance_id, unsigned int progress_timeout, unsigned int idle_timeout); bool (*valid) (int instance_id); -} instance_s; +}; struct instance_interface *instance; diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 7f03ed8d4..0be8074c8 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -19,6 +19,8 @@ #include #include +struct irc_bot_interface irc_bot_s; + char send_string[200]; int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) { diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index 911a15b0e..1fd4b58ab 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -52,7 +52,7 @@ struct irc_bot_interface { void (*pong) (int fd, char *cmd, char *source, char *target, char *msg); void (*join) (int fd, char *cmd, char *source, char *target, char *msg); void (*privmsg) (int fd, char *cmd, char *source, char *target, char *msg); -} irc_bot_s; +}; struct irc_bot_interface *ircbot; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 5fae29500..4e0477b75 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -24,6 +24,8 @@ static DBMap* itemdb_other;// int nameid -> struct item_data* struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex] +struct itemdb_interface itemdb_s; + /** * Search for item name * name = item alias, so we should find items aliases first. if not found then look for "jname" (full name) diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 5e870a5f2..dcd0ae644 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -302,7 +302,7 @@ struct itemdb_interface { int (*group_item) (struct item_group *group); int (*chain_item) (unsigned short chain_id, int *rate); void (*package_item) (struct map_session_data *sd, struct item_package *package); -} itemdb_s; +}; struct itemdb_interface *itemdb; diff --git a/src/map/log.c b/src/map/log.c index ae516b84e..79e3b87e6 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -18,6 +18,7 @@ #include #include +struct log_interface log_s; /// filters for item logging typedef enum e_log_filter { diff --git a/src/map/log.h b/src/map/log.h index 462a12ff5..376483fe7 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -78,7 +78,7 @@ struct log_interface { int (*config_read) (const char* cfgName); void (*config_done) (void); -} log_s; +}; struct log_interface *logs; diff --git a/src/map/mail.c b/src/map/mail.c index 9a8d4e521..021a51cde 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -15,6 +15,8 @@ #include #include +struct mail_interface mail_s; + void mail_clear(struct map_session_data *sd) { sd->mail.nameid = 0; diff --git a/src/map/mail.h b/src/map/mail.h index 99742c7bd..b2b9048cb 100644 --- a/src/map/mail.h +++ b/src/map/mail.h @@ -17,7 +17,7 @@ struct mail_interface { int (*openmail) (struct map_session_data *sd); void (*deliveryfail) (struct map_session_data *sd, struct mail_message *msg); bool (*invalid_operation) (struct map_session_data *sd); -} mail_s; +}; struct mail_interface *mail; diff --git a/src/map/map.c b/src/map/map.c index 389c031bd..10d413676 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -132,6 +132,8 @@ int enable_grf = 0; //To enable/disable reading maps from GRF files, bypassing m struct eri *map_iterator_ers; char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made +struct map_interface iMap_s; + /*========================================== * server player count (of all mapservers) *------------------------------------------*/ diff --git a/src/map/map.h b/src/map/map.h index 3b53b71cc..6002e56da 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -906,7 +906,7 @@ struct map_interface { void (*clean) (int i); void (*do_shutdown) (void); -} iMap_s; +}; struct map_interface *iMap; diff --git a/src/map/party.c b/src/map/party.c index 154f84207..30740b058 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -33,6 +33,8 @@ static DBMap* party_db; // int party_id -> struct party_data* (releases data) static DBMap* party_booking_db; // int char_id -> struct party_booking_ad_info* (releases data) // Party Booking [Spiria] static unsigned long party_booking_nextid = 1; +struct party_interface party_s; + int party_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data); /*========================================== diff --git a/src/map/party.h b/src/map/party.h index f215baa56..3ce47141c 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -123,7 +123,7 @@ struct party_interface { void (*booking_search) (struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount); #endif bool (*booking_delete) (struct map_session_data *sd); -} party_s; +}; struct party_interface *party; diff --git a/src/map/pc.c b/src/map/pc.c index 3e823bb97..3ddae9222 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -89,6 +89,8 @@ struct item_cd { short nameid[MAX_ITEMDELAYS];//skill id }; +struct pc_interface pc_s; + //Converts a class to its array index for CLASS_COUNT defined arrays. //Note that it does not do a validity check for speed purposes, where parsing //player input make sure to use a pcdb_checkid first! diff --git a/src/map/pc.h b/src/map/pc.h index 8be2b7344..0bc1f7325 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -951,7 +951,7 @@ struct pc_interface { #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) int (*level_penalty_mod) (struct map_session_data *sd, struct mob_data * md, int type); #endif -} pc_s; +}; struct pc_interface *pc; diff --git a/src/map/script.c b/src/map/script.c index 858c66874..ee1143f05 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -176,6 +176,8 @@ int potion_hp=0, potion_per_hp=0, potion_sp=0, potion_per_sp=0; int potion_target=0; +struct script_interface script_s; + c_op get_com(unsigned char *script,int *pos); int get_num(unsigned char *script,int *pos); diff --git a/src/map/script.h b/src/map/script.h index 902125681..25a891897 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -393,7 +393,7 @@ struct script_interface { bool (*queue_remove) (int idx, int var); int (*queue_create) (void); void (*queue_clear) (int idx); -} script_s; +}; struct script_interface *script; diff --git a/src/map/searchstore.c b/src/map/searchstore.c index d346a0de6..c7f4f9fed 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -39,6 +39,7 @@ enum e_searchstore_effecttype { typedef bool (*searchstore_search_t)(struct map_session_data* sd, unsigned short nameid); typedef bool (*searchstore_searchall_t)(struct map_session_data* sd, const struct s_search_store_search* s); +struct searchstore_interface searchstore_s; /// retrieves search function by type static inline searchstore_search_t searchstore_getsearchfunc(unsigned char type) { diff --git a/src/map/searchstore.h b/src/map/searchstore.h index 61e65c7d2..42d47c7c0 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -52,7 +52,7 @@ struct searchstore_interface { bool (*queryremote) (struct map_session_data* sd, int account_id); void (*clearremote) (struct map_session_data* sd); bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short* card, unsigned char refine); -} searchstore_s; +}; struct searchstore_interface *searchstore; diff --git a/src/map/skill.c b/src/map/skill.c index 4bd27f578..dc89f3170 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -104,6 +104,9 @@ struct s_skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT]; int firewall_unit_pos; int icewall_unit_pos; int earthstrain_unit_pos; + +struct skill_interface skill_s; + //Since only mob-casted splash skills can hit ice-walls static inline int splash_target(struct block_list* bl) { #ifndef RENEWAL diff --git a/src/map/skill.h b/src/map/skill.h index 338537975..fceef5556 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1936,7 +1936,7 @@ struct skill_interface { int (*changematerial) (struct map_session_data *sd, int n, unsigned short *item_list); int (*get_elemental_type) (uint16 skill_id, uint16 skill_lv); void (*cooldown_save) (struct map_session_data * sd); -} skill_s; +}; struct skill_interface *skill; diff --git a/src/map/storage.c b/src/map/storage.c index 5b3c75d58..7a4649a98 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -24,6 +24,9 @@ #include #include +struct storage_interface storage_s; +struct guild_storage_interface gstorage_s; + /*========================================== * Sort items in the warehouse *------------------------------------------*/ diff --git a/src/map/storage.h b/src/map/storage.h index fc05ef06c..83243a622 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -26,7 +26,7 @@ struct storage_interface { int (*gettocart) (struct map_session_data *sd,int index,int amount); void (*close) (struct map_session_data *sd); void (*pc_quit) (struct map_session_data *sd, int flag); -} storage_s; +}; struct storage_interface *storage; struct guild_storage_interface { @@ -46,7 +46,7 @@ struct guild_storage_interface { int (*pc_quit) (struct map_session_data *sd,int flag); int (*save) (int account_id, int guild_id, int flag); int (*saved) (int guild_id); //Ack from char server that guild store was saved. -} gstorage_s; +}; struct guild_storage_interface *gstorage; diff --git a/src/map/trade.c b/src/map/trade.c index c44f04884..13b5f5431 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -24,6 +24,8 @@ //Max distance from traders to enable a trade to take place. #define TRADE_DISTANCE 2 +struct trade_interface trade_s; + /*========================================== * Initiates a trade request. *------------------------------------------*/ diff --git a/src/map/trade.h b/src/map/trade.h index 8bf918ad2..e8ac4a8c4 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -17,7 +17,7 @@ struct trade_interface { void (*ok) (struct map_session_data *sd); void (*cancel) (struct map_session_data *sd); void (*commit) (struct map_session_data *sd); -} trade_s; +}; struct trade_interface *trade; diff --git a/src/map/vending.c b/src/map/vending.c index 898008a3a..2784d46a2 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -21,6 +21,8 @@ #include #include +struct vending_interface vending_s; + /// Returns an unique vending shop id. static inline unsigned int getid(void) { return vending->next_id++; diff --git a/src/map/vending.h b/src/map/vending.h index 0148deb71..1b4381ccd 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -29,7 +29,7 @@ struct vending_interface { void (*purchase) (struct map_session_data* sd, int aid, unsigned int uid, const uint8* data, int count); bool (*search) (struct map_session_data* sd, unsigned short nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); -} vending_s; +}; struct vending_interface * vending; -- cgit v1.2.3-70-g09d2