diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 477 | ||||
-rw-r--r-- | src/map/battle.h | 4 | ||||
-rw-r--r-- | src/map/pc.c | 1 | ||||
-rw-r--r-- | src/map/skill.c | 93 | ||||
-rw-r--r-- | src/map/status.c | 37 | ||||
-rw-r--r-- | src/map/status.h | 10 |
6 files changed, 352 insertions, 270 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 8e4fd305c..804f08cb8 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -429,18 +429,19 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin damage = battle->calc_sizefix(sd, damage, EQI_HAND_R, size, flag&8); else damage = battle->calc_sizefix(sd, damage, EQI_HAND_L, size, flag&8); + + if( flag&2 && sd->bonus.arrow_atk ) + damage += sd->bonus.arrow_atk; if( sd->bonus.eatk > 0 ) eatk = sd->bonus.eatk; - if( flag&2 && sd->bonus.arrow_atk ) - eatk += sd->bonus.arrow_atk; } - + if( sc && sc->count ){ if( sc->data[SC_ZENKAI] && watk->ele == sc->data[SC_ZENKAI]->val2 ) eatk += 200; #ifdef RENEWAL_EDP - if( sc->data[SC_EDP] && skill_id != AS_GRIMTOOTH && skill_id != AS_VENOMKNIFE ){ + if( sc->data[SC_EDP] && skill_id != AS_GRIMTOOTH && skill_id != AS_VENOMKNIFE && skill_id != ASC_BREAKER ){ eatk = eatk * sc->data[SC_EDP]->val3 / 100; // 400% damage = damage * sc->data[SC_EDP]->val4 / 100; // 500% damage--; // temporary until we find the correct formula [malufett] @@ -448,19 +449,14 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin #endif } - /* [malufett] - some unknown factors that needs to be discovered. PS: it's something related with ranged attacks - if( eatk ){ - eatk += unknown value; - eatk = eatk * (unknown value) / 100; + if( skill_id != ASC_METEORASSAULT ){ + if( sc && sc->data[SC_SUB_WEAPONPROPERTY] ) // Temporary. [malufett] + damage += damage * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; } - */ - if( sc && sc->data[SC_WATK_ELEMENT] ) - damage = damage + eatk; - else - damage = battle->calc_elefix(src, bl, skill_id, skill_lv, damage + eatk, nk, n_ele, s_ele, s_ele_, false, flag); - + // Temporary. [malufett] + damage = battle->calc_elefix(src, bl, skill_id, skill_lv, damage, nk, n_ele, s_ele, s_ele_, type == EQI_HAND_L, flag); + /** * In RE Shield Bommerang takes weapon element only for damage calculation, * - resist calculation is always against neutral @@ -468,11 +464,12 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin if ( skill_id == CR_SHIELDBOOMERANG ) s_ele = s_ele_ = ELE_NEUTRAL; - if( type == EQI_HAND_R ) - damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 2, flag2); - else - damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 3, flag2); + // attacker side + damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 2|(type == EQI_HAND_L), flag2); + // target side + damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 0, flag2); + return damage; } #endif @@ -488,19 +485,13 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin * &8: Skip target size adjustment (Extremity Fist?) *&16: Arrow attack but BOW, REVOLVER, RIFLE, SHOTGUN, GATLING or GRENADE type weapon not equipped (i.e. shuriken, kunai and venom knives not affected by DEX) */ -/* modifying until malufett is able to adjust the formula */ -//#ifdef RENEWAL -#if 0 +#ifdef RENEWAL int battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2) { int damage, batk; - struct status_change *sc = status_get_sc(src); struct status_data *status = status_get_status_data(src); - if( sc && sc->data[SC_TK_SEVENWIND] && !sc->data[SC_WATK_ELEMENT] ) - batk = battle->calc_elefix(src, bl, skill_id, skill_lv, status->batk, nk, n_ele, s_ele, s_ele_, false, flag); - else - batk = status->batk; + batk = battle->calc_elefix(src, bl, skill_id, skill_lv, status_calc_batk(bl, status_get_sc(src), status->batk, false), nk, n_ele, ELE_NEUTRAL, ELE_NEUTRAL, false, flag); if( type == EQI_HAND_L ) damage = batk + 3 * battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &status->lhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2) / 4; @@ -733,13 +724,19 @@ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, ui case CR_ACIDDEMONSTRATION: return damage; case NJ_SYURIKEN: - if( (skill = pc->checkskill(sd,NJ_TOBIDOUGU)) > 0 && weapon ) + if( (skill = pc->checkskill(sd,NJ_TOBIDOUGU)) > 0 +#ifndef RENEWAL + && weapon +#endif + ) damage += 3 * skill; break; +#ifndef RENEWAL case NJ_KUNAI: if( weapon ) damage += 60; break; +#endif case RA_WUGDASH: case RA_WUGSTRIKE: case RA_WUGBITE: @@ -817,39 +814,26 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 damage += battle_attr_fix(src,target,50*skill_lv,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv); } } - if( sc && sc->data[SC_WATK_ELEMENT] ) +#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 = -/* modifying until malufett can adjust the formula */ -//#ifndef RENEWAL -#if 1 - battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) -#else - battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) -#endif - * sc->data[SC_WATK_ELEMENT]->val2 / 100; - - damage += battle->attr_fix(src, target, damage, sc->data[SC_WATK_ELEMENT]->val1, tstatus->def_ele, tstatus->ele_lv); + 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 = -/* modifying until malufett can adjust the formula */ -//#ifndef RENEWAL -#if 1 - battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) -#else - battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) -#endif - * sc->data[SC_WATK_ELEMENT]->val2 / 100; - damage += battle->attr_fix(src, target, damage, sc->data[SC_WATK_ELEMENT]->val1, tstatus->def_ele, tstatus->ele_lv); + 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); } } - +#endif return damage; } /*========================================== * Calculates card bonuses damage adjustments. + * cflag(cardfix flag): + * &1 - calc for left hand. + * &2 - atker side cardfix(BF_WEAPON) otherwise target side(BF_WEAPON). *------------------------------------------*/ -int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int left, int flag){ +int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int cflag, int wflag){ struct map_session_data *sd, *tsd; short cardfix = 1000, t_class, s_class, s_race2, t_race2; struct status_data *sstatus, *tstatus; @@ -872,15 +856,15 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li switch(attack_type){ case BF_MAGIC: if ( sd && !(nk&NK_NO_CARDFIX_ATK) ) { - cardfix=cardfix*(100+sd->magic_addrace[tstatus->race])/100; + cardfix = cardfix * (100 + sd->magic_addrace[tstatus->race]) / 100; if (!(nk&NK_NO_ELEFIX)) - cardfix=cardfix*(100+sd->magic_addele[tstatus->def_ele])/100; - cardfix=cardfix*(100+sd->magic_addsize[tstatus->size])/100; - cardfix=cardfix*(100+sd->magic_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS])/100; - cardfix=cardfix*(100+sd->magic_atk_ele[s_ele])/100; - for(i=0; i< ARRAYLENGTH(sd->add_mdmg) && sd->add_mdmg[i].rate;i++) { + cardfix = cardfix*(100+sd->magic_addele[tstatus->def_ele]) / 100; + cardfix = cardfix * (100 + sd->magic_addsize[tstatus->size]) / 100; + cardfix = cardfix * (100 + sd->magic_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; + cardfix = cardfix * (100 + sd->magic_atk_ele[s_ele])/100; + for(i=0; i< ARRAYLENGTH(sd->add_mdmg) && sd->add_mdmg[i].rate; i++) { if(sd->add_mdmg[i].class_ == t_class) { - cardfix=cardfix*(100+sd->add_mdmg[i].rate)/100; + cardfix = cardfix * (100 + sd->add_mdmg[i].rate) / 100; break; } } @@ -896,29 +880,29 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li 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&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) + 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; + cardfix = cardfix * (100 - ele_fix) / 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; + 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; + cardfix = cardfix * (100-tsd->subrace[RC_NONDEMIHUMAN]) / 100; for(i=0; i < ARRAYLENGTH(tsd->add_mdef) && tsd->add_mdef[i].rate;i++) { if(tsd->add_mdef[i].class_ == s_class) { - cardfix=cardfix*(100-tsd->add_mdef[i].rate)/100; + cardfix = cardfix * (100-tsd->add_mdef[i].rate) / 100; break; } } //It was discovered that ranged defense also counts vs magic! [Skotlex] - if ( flag&BF_SHORT ) + if ( wflag&BF_SHORT ) cardfix = cardfix * ( 100 - tsd->bonus.near_attack_def_rate ) / 100; else cardfix = cardfix * ( 100 - tsd->bonus.long_attack_def_rate ) / 100; @@ -928,78 +912,78 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li if( tsd->sc.data[SC_PROTECT_MDEF] ) cardfix = cardfix * ( 100 - tsd->sc.data[SC_PROTECT_MDEF]->val1 ) / 100; - if (cardfix != 1000) + if( cardfix != 1000 ) damage = damage * cardfix / 1000; } break; case BF_WEAPON: t_race2 = status_get_race2(target); - if( sd && !(nk&NK_NO_CARDFIX_ATK) && (left&2) ) + if( cflag&2 && 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; + 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&flag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + 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 + 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; + 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; + 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; + 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&flag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + 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+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]) / 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->right_weapon.addrace[RC_NONDEMIHUMAN])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]) / 100; - if( left&1 ) + if( cflag&1 ) { - cardfix_=cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; + 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]; + 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&flag&BF_WEAPONMASK && - sd->left_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->left_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + 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+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; + 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; } @@ -1007,114 +991,122 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li 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&flag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + 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&flag&BF_WEAPONMASK && - sd->left_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->left_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + 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; + 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] + sd->left_weapon.addrace[RC_NONDEMIHUMAN]) / 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; + cardfix = cardfix * (100 + sd->right_weapon.add_dmg[i].rate) / 100; break; } } - if( left&1 ) + 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; + cardfix_ = cardfix_ * (100 + sd->left_weapon.add_dmg[i].rate) / 100; break; } } } - if( flag&BF_LONG ) - cardfix = cardfix * ( 100 + sd->bonus.long_attack_atk_rate ) / 100; - if( (left&1) && cardfix_ != 1000 ) + if( wflag&BF_LONG ) + cardfix = cardfix * (100 + sd->bonus.long_attack_atk_rate) / 100; + + if( (cflag&1) && cardfix_ != 1000 ) damage = damage * cardfix_ / 1000; else if( cardfix != 1000 ) damage = damage * cardfix / 1000; - } else if( tsd && !(nk&NK_NO_CARDFIX_DEF) && !(left&2) ){ - if( !(nk&NK_NO_ELEFIX) ) + break; // end Attacker side + } + // Target side + if( tsd && !(nk&NK_NO_CARDFIX_DEF) ) { - 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&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) - continue; - ele_fix += tsd->subele2[i].rate; - } - cardfix=cardfix*(100-ele_fix)/100; - if( left&1 && s_ele_ != s_ele ) + if( !(nk&NK_NO_ELEFIX) ) { - int ele_fix_lh = tsd->subele[s_ele_]; + 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&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) + 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; + 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; + 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( flag&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.long_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: if( tsd && !(nk&NK_NO_CARDFIX_DEF) ){ @@ -1125,25 +1117,25 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li 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&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) + 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; + cardfix = cardfix * (100 - ele_fix) / 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; + 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; + cardfix = cardfix * (100 - tsd->subrace[RC_NONDEMIHUMAN]) / 100; cardfix = cardfix * ( 100 - tsd->bonus.misc_def_rate ) / 100; - if( flag&BF_SHORT ) + if( wflag&BF_SHORT ) cardfix = cardfix * ( 100 - tsd->bonus.near_attack_def_rate ) / 100; - else // BF_LONG (there's no other choice) + else // BF_LONG (there's no other choice) cardfix = cardfix * ( 100 - tsd->bonus.long_attack_def_rate ) / 100; if (cardfix != 1000) @@ -1265,12 +1257,12 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li #ifdef RENEWAL /** * RE DEF Reduction - * Damage = Attack * (4000+eDEF)/(4000+eDEF*10) - sDEF * Pierce defence gains 1 atk per def/2 **/ - if( def1 == -400 ) /* being hit by a gazillion units, you hit the jackpot and got -400 which creates a division by 0 and subsequently crashes */ - def1 = -399; + if( def1 < -399 ) // it stops at -399 + def1 = 399; // in aegis it set to 1 but in our case it may lead to exploitation so limit it to 399 + //return 1; if( flag&2 ) damage += def1 >> 1; @@ -1279,7 +1271,7 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li if( flag&4 ) damage -= (def1 + vit_def); else - damage = damage * (4000+def1) / (4000+10*def1) - vit_def; + damage = (int)((100.0f - def1 / (def1 + 400.0f) * 90.0f) / 100.0f * damage - vit_def); } #else @@ -1323,9 +1315,12 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li #ifdef RENEWAL /** * RE MDEF Reduction - * Damage = Magic Attack * (1000+eMDEF)/(1000+eMDEF) - sMDEF **/ - damage = damage * (1000 + mdef) / (1000 + mdef * 10) - mdef2; + if( mdef < -99 ) // it stops at -99 + mdef = 99; // in aegis it set to 1 but in our case it may lead to exploitation so limit it to 99 + //return 1; + + damage = (int)((100.0f - mdef / (mdef + 100.0f) * 90.0f) / 100.0f * damage - mdef2); #else if(battle_config.magic_defense_type) damage = damage - mdef*battle_config.magic_defense_type - mdef2; @@ -1868,9 +1863,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case MO_INVESTIGATE: skillratio += 75 * skill_lv; break; - /* modifying until malufett can adjust the formula */ - //#ifndef RENEWAL - #if 1 + #ifndef RENEWAL case MO_EXTREMITYFIST: { //Overflow check. [Skotlex] unsigned int ratio = skillratio + 100*(8 + status->sp/10); @@ -1982,7 +1975,12 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += 100 * (skill_lv+1); break; case GS_PIERCINGSHOT: - skillratio += 20 * skill_lv; +#ifdef RENEWAL + if( sd && sd->weapontype1 == W_RIFLE ) + skillratio += 50 + 30 * skill_lv; + else +#endif + skillratio += 20 * skill_lv; break; case GS_RAPIDSHOWER: skillratio += 10 * skill_lv; @@ -2015,6 +2013,11 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case NJ_KIRIKAGE: skillratio += 100 * (skill_lv-1); break; +#ifdef RENEWAL + case NJ_KUNAI: + skillratio += 50 + 150 * skill_lv; + break; +#endif case KN_CHARGEATK: { int k = (flag-1)/3; //+100% every 3 cells of distance @@ -2077,7 +2080,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block } break; case RK_STORMBLAST: - skillratio += -100 + 100 * (sd ? pc->checkskill(sd,RK_RUNEMASTERY) : 1) + 100 * (status_get_int(src) / 4); + skillratio += -100 + 100 *(sd ? pc->checkskill(sd,RK_RUNEMASTERY) : 1) + status_get_int(src) / 8; break; case RK_PHANTOMTHRUST: skillratio += -100 + 50 * skill_lv + 10 * ( sd ? pc->checkskill(sd,KN_SPEARMASTERY) : 10); @@ -2097,7 +2100,6 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block //ATK [{(Skill Level x 100) + 300} x Caster's Base Level / 120]% + ATK [(AGI x 2) + (Caster's Job Level x 4)]% skillratio += 200 + (100 * skill_lv); RE_LVL_DMOD(120); - skillratio += status_get_agi(src) * 2 + (sd?sd->status.job_level:0) * 4; break; case GC_ROLLINGCUTTER: skillratio += -50 + 50 * skill_lv; @@ -3380,10 +3382,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } } #endif -/* temporarily disabling until malufett can adjust */ -//#ifdef RENEWAL -// ad.damage = battle->calc_cardfix(BF_MAGIC, src, target, nk, s_ele, 0, ad.damage, 0, ad.flag); -//#endif +#ifdef RENEWAL + ad.damage = battle->calc_cardfix(BF_MAGIC, src, target, nk, s_ele, 0, ad.damage, 0, ad.flag); +#endif if(sd) { //Damage bonuses if ((i = pc->skillatk_bonus(sd, skill_id))) @@ -3447,10 +3448,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list ad.damage = 0; } } -/* temporarily making global until malufett can adjust */ -//#ifndef RENEWAL +#ifndef RENEWAL ad.damage = battle->calc_cardfix(BF_MAGIC, src, target, nk, s_ele, 0, ad.damage, 0, ad.flag); -//#endif +#endif } damage_div_fix(ad.damage, ad.div_); @@ -3594,9 +3594,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.damage = 1+rnd()%9999; break; case CR_ACIDDEMONSTRATION: -/* modifying until malufett can adjust the formula */ -//#ifdef RENEWAL -#if 0 +#ifdef RENEWAL {// [malufett] int matk=0, atk; short tdef = status_get_total_def(target); @@ -3665,9 +3663,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * break ; case ASC_BREAKER: { -/* modifying until malufett can adjust the formula */ -//#ifndef RENEWAL -#if 1 +#ifndef RENEWAL md.damage = 500+rnd()%500 + 5*skill_lv * sstatus->int_; nk|=NK_IGNORE_FLEE|NK_NO_ELEFIX; //These two are not properties of the weapon based part. #else @@ -4350,38 +4346,50 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Adds an absolute value to damage. 100 = +100 damage #define ATK_ADD( a ) { wd.damage+= a; if (flag.lh) wd.damage2+= a; } #define ATK_ADD2( a , b ) { wd.damage+= a; if (flag.lh) wd.damage2+= b; } - +#ifdef RENEWAL +#define GET_NORMAL_ATTACK( f ) { wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, f, wd.flag); } +#define GET_NORMAL_ATTACK2( f ) { wd.damage2 = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, f, wd.flag); } +#endif switch (skill_id) { //Calc base damage according to skill case PA_SACRIFICE: wd.damage = sstatus->max_hp* 9/100; wd.damage2 = 0; +#ifdef RENEWAL + wd.damage = battle->calc_elefix(src, target, skill_id, skill_lv, wd.damage, nk, n_ele, s_ele, s_ele_, false, wd.flag); // temporary [malufett] +#endif break; case NJ_ISSEN: // [malufett] -/* modifying until malufett can adjust the formula */ -//#ifndef RENEWAL -#if 1 +#ifndef RENEWAL wd.damage = 40*sstatus->str +skill_lv*(sstatus->hp/10 + 35); wd.damage2 = 0; #else { short totaldef = status_get_total_def(target); i = 0; - wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), wd.flag); + GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); if( sc && sc->data[SC_NJ_BUNSINJYUTSU] && (i=sc->data[SC_NJ_BUNSINJYUTSU]->val2) > 0 ) wd.div_ = ~( i++ + 2 ) + 1; - wd.damage *= sstatus->hp * skill_lv; - wd.damage = wd.damage / sstatus->max_hp + sstatus->hp + i * (wd.damage / sstatus->max_hp + sstatus->hp) / 5; + if( wd.damage ){ + wd.damage *= sstatus->hp * skill_lv; + wd.damage = wd.damage / sstatus->max_hp + sstatus->hp + i * (wd.damage / sstatus->max_hp + sstatus->hp) / 5; + } 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] - wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8, wd.flag); + GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8 ); // first value is still not confirm. - wd.damage = status_get_sp(src) + 10 * status_get_sp(src) * wd.damage / 100 + 8 * wd.damage; + 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; #endif break; @@ -4441,9 +4449,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list #endif ?1:0)| (flag.arrow?2:0)| -/* modifying until malufett can adjust the formula */ -//#ifndef RENEWAL -#if 1 +#ifndef RENEWAL (skill_id == HW_MAGICCRASHER?4:0)| (skill_id == MO_EXTREMITYFIST?8:0)| #endif @@ -4460,13 +4466,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list default: i |= 16; // for ex. shuriken must not be influenced by DEX } -/* modifying until malufett can adjust the formula */ -//#ifdef RENEWAL -#if 0 - wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, i, wd.flag); +#ifdef RENEWAL + GET_NORMAL_ATTACK( i ); wd.damage = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage, wd.div_, 0, flag.weapon); if (flag.lh){ - wd.damage2 = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, i, wd.flag); + GET_NORMAL_ATTACK2( i ); wd.damage2 = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage2, wd.div_, 1, flag.weapon); } #else @@ -4518,6 +4522,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sc->data[SC_UNLIMIT] && wd.flag&BF_LONG ) ATK_ADD( 50 * sc->data[SC_UNLIMIT]->val1 ); } + if( tsc && skill_id != PA_SACRIFICE ){ if( tsc->data[SC_DARKCROW] && wd.flag&BF_SHORT ) ATK_ADD( 30 * tsc->data[SC_DARKCROW]->val1 ); @@ -4529,6 +4534,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } else { + + #ifdef RENEWAL + if( sd && skill_id == NJ_KUNAI ){ + flag.tdef = 1; + ATK_ADD( sd->bonus.arrow_atk ); + } + #endif switch(skill_id){ #ifdef RENEWAL case LK_SPIRALPIERCE: @@ -4553,13 +4565,14 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Constant/misc additions from skills switch (skill_id) { - case MO_EXTREMITYFIST: - ATK_ADD(250 + 150*skill_lv); - break; #ifdef RENEWAL case HW_MAGICCRASHER: ATK_ADD(battle->calc_magic_attack(src, target, skill_id, skill_lv, wflag).damage / 5); break; +#else + case MO_EXTREMITYFIST: + ATK_ADD(250 + 150*skill_lv); + break; #endif case TK_DOWNKICK: case TK_STORMKICK: @@ -4577,8 +4590,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_ADD( battle->calc_magic_attack(src, target, skill_id, skill_lv, wflag).damage ); flag.tdef = 1; #endif +#ifndef RENEWAL case NJ_SYURIKEN: ATK_ADD(4*skill_lv); +#endif break; case HT_FREEZINGTRAP: if(sd) @@ -4588,6 +4603,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list 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; case SR_TIGERCANNON: // (Tiger Cannon skill level x 240) + (Target Base Level x 40) ATK_ADD( skill_lv * 240 + status_get_lv(target) * 40 ); if( sc && sc->data[SC_COMBOATTACK] @@ -4629,18 +4647,20 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list skill_id == LG_SHIELDPRESS || skill_id == RK_HUNDREDSPEAR || skill_id == CR_SHIELDCHARGE ) ) ATK_ADDRATE(sc->data[SC_GLOOMYDAY_SK]->val2); + +#ifndef RENEWAL_EDP if( sc->data[SC_EDP] ){ switch(skill_id){ -#ifndef RENEWAL_EDP - case AS_SPLASHER: case AS_VENOMKNIFE: + case AS_SPLASHER: case AS_GRIMTOOTH: - break; + case ASC_BREAKER: + case AS_VENOMKNIFE: case ASC_METEORASSAULT: break; default: ATK_ADDRATE(sc->data[SC_EDP]->val3); -#endif } } +#endif if(sc->data[SC_STYLE_CHANGE]){ TBL_HOM *hd = BL_CAST(BL_HOM,src); if (hd) ATK_ADD(hd->homunculus.spiritball * 3); @@ -4789,9 +4809,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list #endif if(skill_id==TF_POISON) ATK_ADD(15*skill_lv); -/* temp-fix until malufett adjusts */ -//#ifndef RENEWAL -#if 1 + +#ifndef RENEWAL wd.damage = battle->calc_elefix(src, target, skill_id, skill_lv, wd.damage, nk, n_ele, s_ele, s_ele_, false, flag.arrow); if( flag.lh ) wd.damage2 = battle->calc_elefix(src, target, skill_id, skill_lv, wd.damage2, nk, n_ele, s_ele, s_ele_, true, flag.arrow); @@ -4818,9 +4837,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } } #endif -/* modiftying until malufett adjusts */ -//#ifndef RENEWAL -#if 1 + +#ifndef RENEWAL if (sd) { if (skill_id != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus. ATK_ADD2(wd.div_*sd->right_weapon.star, wd.div_*sd->left_weapon.star); @@ -4846,7 +4864,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } //Card Fix, tsd side if(tsd){ //if player on player then it was already measured above - wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 0, wd.flag); + wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, (flag.lh?1:0), wd.flag); } #endif if( flag.infdef ) { //Plants receive 1 damage when hit @@ -5782,6 +5800,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f case ASC_METEORASSAULT: case RG_RAID: case MC_CARTREVOLUTION: + case HT_CLAYMORETRAP: + case RA_ICEBOUNDTRAP: + case RA_FIRINGTRAP: #endif state |= BCT_ENEMY; strip_enemy = 0; diff --git a/src/map/battle.h b/src/map/battle.h index 2b502beaf..37968f53a 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -535,9 +535,7 @@ struct battle_interface { /* skill range criteria */ int (*range_type) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv); int (*calc_base_damage) -/* temporary until malufett is able to adjust the formula */ -//#ifdef RENEWAL -#if 0 +#ifdef RENEWAL (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2); #else (struct status_data *status, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag); diff --git a/src/map/pc.c b/src/map/pc.c index 0d1a99175..f7f06999f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5048,6 +5048,7 @@ int pc_checkallowskill(struct map_session_data *sd) SC_DANCING, SC_GS_GATLINGFEVER, #ifdef RENEWAL + SC_LKCONCENTRATION, SC_EDP, #endif SC_FEARBREEZE diff --git a/src/map/skill.c b/src/map/skill.c index 509de6f4a..a625fb9c1 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3781,6 +3781,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; case SR_TIGERCANNON: + case GC_COUNTERSLASH: + case GC_ROLLINGCUTTER: flag |= SD_ANIMATION; case LG_MOONSLASHER: clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); @@ -5314,6 +5316,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_kill(bl); break; case SA_REVERSEORCISH: + case ALL_REVERSEORCISH: clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv))); break; @@ -5460,7 +5463,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill->castend_damage_id); clif->skill_nodamage (src,src,skill_id,skill_lv,1); // Initiate 10% of your damage becomes fire element. - sc_start4(src,SC_WATK_ELEMENT,100,3,20,0,0,skill->get_time2(skill_id, skill_lv)); + sc_start4(src,SC_SUB_WEAPONPROPERTY,100,3,20,0,0,skill->get_time2(skill_id, skill_lv)); if( sd ) skill->blockpc_start(sd, skill_id, skill->get_time(skill_id, skill_lv), false); else if( bl->type == BL_MER ) @@ -5634,6 +5637,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui skill->blockpc_start (sd, skill_id, skill->get_time2(skill_id,skill_lv), false); break; + case ALL_ANGEL_PROTECT: + if( dstsd ) + 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 AS_ENCHANTPOISON: // Prevent spamming [Valaris] if (sd && dstsd && dstsd->sc.count) { if (dstsd->sc.data[SC_PROPERTYFIRE] || @@ -7703,6 +7713,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case NPC_TALK: case ALL_WEWISH: + case ALL_CATCRY: + case ALL_DREAM_SUMMERNIGHT: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; case ALL_BUYING_STORE: @@ -10025,6 +10037,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if (!sg) break; if (sce) status_change_end(src, type, INVALID_TIMER); //Was under someone else's Gospel. [Skotlex] + status_change_clear_buffs(src,3); sc_start4(src,type,100,skill_lv,0,sg->group_id,BCT_SELF,skill->get_time(skill_id,skill_lv)); clif->skill_poseffect(src, skill_id, skill_lv, 0, 0, tick); // PA_GOSPEL music packet } @@ -11374,14 +11387,17 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( bl->id == ss->id )// it won't trigger on caster break; case UNT_LANDMINE: - case UNT_CLAYMORETRAP: case UNT_BLASTMINE: case UNT_SHOCKWAVE: case UNT_SANDMAN: case UNT_FLASHER: case UNT_FREEZINGTRAP: case UNT_FIREPILLAR_ACTIVE: - iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); + case UNT_CLAYMORETRAP: + if( sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP ) + iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick); + else + 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 + @@ -14640,16 +14656,23 @@ int skill_detonator(struct block_list *bl, va_list ap) case UNT_CLUSTERBOMB: case UNT_FIRINGTRAP: case UNT_ICEBOUNDTRAP: - if( unit_id == UNT_TALKIEBOX ) { - clif->talkiebox(bl,unit->group->valstr); - unit->group->val2 = -1; - } else - 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; + switch(unit_id){ + case UNT_TALKIEBOX: + clif->talkiebox(bl,unit->group->valstr); + unit->group->val2 = -1; + break; + case UNT_CLAYMORETRAP: + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag|BL_SKILL|~BCT_SELF,bl,unit->group->tick); + break; + default: + 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, UNT_USED_TRAPS); 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) ); + (unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : (unit_id == UNT_FIRINGTRAP ? 0 : 1500)) ); + unit->group->unit_id = UNT_USED_TRAPS; break; } return 0; @@ -14831,12 +14854,6 @@ int skill_trap_splash (struct block_list *bl, va_list ap) { case UNT_ELECTRICSHOCKER: clif->skill_damage(src,bl,tick,0,0,-30000,1,sg->skill_id,sg->skill_lv,5); break; - case UNT_FIRINGTRAP: - case UNT_ICEBOUNDTRAP: - case UNT_CLUSTERBOMB: - if( ss != bl ) - skill->attack(BF_MISC,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1|SD_LEVEL); - break; case UNT_MAGENTATRAP: case UNT_COBALTTRAP: case UNT_MAIZETRAP: @@ -14848,6 +14865,38 @@ int skill_trap_splash (struct block_list *bl, va_list ap) { skill->addtimerskill(ss,tick+50,bl->id,0,0,WM_REVERBERATION_MELEE,sg->skill_lv,BF_WEAPON,0); // for proper skill delay animation when use with Dominion Impulse skill->addtimerskill(ss,tick+250,bl->id,0,0,WM_REVERBERATION_MAGIC,sg->skill_lv,BF_MAGIC,0); break; + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + if( src->id == bl->id ) break; + if( bl->type == BL_SKILL ){ + struct skill_unit *su = (struct skill_unit *)bl; + if( su->group->unit_id == UNT_USED_TRAPS ) + break; + } + case UNT_CLUSTERBOMB: + if( ss != bl ) + skill->attack(BF_MISC,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1|SD_LEVEL); + break; + case UNT_CLAYMORETRAP: + if( src->id == bl->id ) break; + if( bl->type == BL_SKILL ){ + struct skill_unit *su = (struct skill_unit *)bl; + switch( su->group->unit_id ){ + case UNT_CLAYMORETRAP: + case UNT_LANDMINE: + case UNT_BLASTMINE: + case UNT_SHOCKWAVE: + case UNT_SANDMAN: + case UNT_FLASHER: + case UNT_FREEZINGTRAP: + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + clif->changetraplook(bl, UNT_USED_TRAPS); + su->group->limit = DIFF_TICK(iTimer->gettick(),su->group->tick) + 1500; + su->group->unit_id = UNT_USED_TRAPS; + } + break; + } default: skill->attack(skill->get_type(sg->skill_id),ss,src,bl,sg->skill_id,sg->skill_lv,tick,0); break; @@ -16789,16 +16838,18 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) { if (su->alive && (sg = su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP) { switch( sg->unit_id ) { - case UNT_LANDMINE: case UNT_CLAYMORETRAP: + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + iMap->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &su->bl,tick); + break; + case UNT_LANDMINE: case UNT_BLASTMINE: case UNT_SHOCKWAVE: case UNT_SANDMAN: case UNT_FLASHER: case UNT_FREEZINGTRAP: case UNT_CLUSTERBOMB: - case UNT_FIRINGTRAP: - case UNT_ICEBOUNDTRAP: iMap->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick); break; } diff --git a/src/map/status.c b/src/map/status.c index fdee5b954..f209ebea4 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -196,7 +196,7 @@ void initChangeTables(void) { //The main status definitions add_sc( SM_BASH , SC_STUN ); set_sc( SM_PROVOKE , SC_PROVOKE , SI_PROVOKE , SCB_DEF|SCB_DEF2|SCB_BATK|SCB_WATK ); - add_sc( SM_MAGNUM , SC_WATK_ELEMENT ); + add_sc( SM_MAGNUM , SC_SUB_WEAPONPROPERTY ); set_sc( SM_ENDURE , SC_ENDURE , SI_ENDURE , SCB_MDEF|SCB_DSPD ); add_sc( MG_SIGHT , SC_SIGHT ); add_sc( MG_SAFETYWALL , SC_SAFETYWALL ); @@ -348,9 +348,9 @@ void initChangeTables(void) { set_sc( LK_AURABLADE , SC_AURABLADE , SI_AURABLADE , SCB_NONE ); set_sc( LK_PARRYING , SC_PARRYING , SI_PARRYING , SCB_NONE ); #ifndef RENEWAL - set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_CONCENTRATION , SCB_BATK|SCB_WATK|SCB_HIT|SCB_DEF|SCB_DEF2); + set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_LKCONCENTRATION , SCB_BATK|SCB_WATK|SCB_HIT|SCB_DEF|SCB_DEF2); #else - set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_CONCENTRATION , SCB_HIT|SCB_DEF); + set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_LKCONCENTRATION , SCB_HIT|SCB_DEF); #endif set_sc( LK_TENSIONRELAX , SC_TENSIONRELAX , SI_TENSIONRELAX , SCB_REGEN ); set_sc( LK_BERSERK , SC_BERSERK , SI_BERSERK , SCB_DEF|SCB_DEF2|SCB_MDEF|SCB_MDEF2|SCB_FLEE|SCB_SPEED|SCB_ASPD|SCB_MAXHP|SCB_REGEN ); @@ -511,7 +511,7 @@ void initChangeTables(void) { add_sc( MER_CRASH , SC_STUN ); set_sc( MER_PROVOKE , SC_PROVOKE , SI_PROVOKE , SCB_DEF|SCB_DEF2|SCB_BATK|SCB_WATK ); - add_sc( MS_MAGNUM , SC_WATK_ELEMENT ); + add_sc( MS_MAGNUM , SC_SUB_WEAPONPROPERTY ); add_sc( MER_SIGHT , SC_SIGHT ); set_sc( MER_DECAGI , SC_DEC_AGI , SI_DEC_AGI , SCB_AGI|SCB_SPEED ); set_sc( MER_MAGNIFICAT , SC_MAGNIFICAT , SI_MAGNIFICAT , SCB_REGEN ); @@ -757,6 +757,9 @@ void initChangeTables(void) { set_sc( ALL_FULL_THROTTLE , SC_FULL_THROTTLE , SI_FULL_THROTTLE , SCB_SPEED|SCB_STR|SCB_AGI|SCB_VIT|SCB_INT|SCB_DEX|SCB_LUK ); + add_sc( ALL_REVERSEORCISH , SC_ORCISH ); + set_sc( ALL_ANGEL_PROTECT , SC_ANGEL_PROTECT , SI_ANGEL_PROTECT , SCB_REGEN ); + // Storing the target job rather than simply SC_SOULLINK simplifies code later on. SkillStatusChangeTable[SL_ALCHEMIST] = (sc_type)MAPID_ALCHEMIST, SkillStatusChangeTable[SL_MONK] = (sc_type)MAPID_MONK, @@ -3295,7 +3298,6 @@ static unsigned short status_calc_vit(struct block_list *,struct status_change * static unsigned short status_calc_int(struct block_list *,struct status_change *,int); static unsigned short status_calc_dex(struct block_list *,struct status_change *,int); static unsigned short status_calc_luk(struct block_list *,struct status_change *,int); -static unsigned short status_calc_batk(struct block_list *,struct status_change *,int,bool); static unsigned short status_calc_watk(struct block_list *,struct status_change *,int,bool); static unsigned short status_calc_matk(struct block_list *,struct status_change *,int,bool); static signed short status_calc_hit(struct block_list *,struct status_change *,int,bool); @@ -4398,18 +4400,21 @@ static unsigned short status_calc_luk(struct block_list *bl, struct status_chang return (unsigned short)cap_value(luk,0,USHRT_MAX); } -static unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) +unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) { if(!sc || !sc->count) return cap_value(batk,0,USHRT_MAX); if( !viewable ){ /* some statuses that are hidden in the status window */ + if(sc->data[SC_PLUSATTACKPOWER]) + batk += sc->data[SC_PLUSATTACKPOWER]->val1; return (unsigned short)cap_value(batk,0,USHRT_MAX); } - +#ifndef RENEWAL if(sc->data[SC_PLUSATTACKPOWER]) batk += sc->data[SC_PLUSATTACKPOWER]->val1; +#endif if(sc->data[SC_BATKFOOD]) batk += sc->data[SC_BATKFOOD]->val1; if(sc->data[SC_GS_GATLINGFEVER]) @@ -10863,7 +10868,7 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl struct status_change *sc = status_get_sc(bl); if ( bl->type == BL_PC && watk->atk ){ - if ( flag&16 ) + if ( flag&2 ) dstr = status_get_dex(bl); else dstr = status_get_str(bl); @@ -10884,10 +10889,10 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl else max = min; } - - if( bl->type == BL_PC && ((TBL_PC*)bl)->right_weapon.overrefine > 0) - max += rnd()%((TBL_PC*)bl)->right_weapon.overrefine + 1; + if( bl->type == BL_PC && ((TBL_PC*)bl)->right_weapon.overrefine > 0 && !(flag&2) ) + max += rnd()%((TBL_PC*)bl)->right_weapon.overrefine + 1; + max = status_calc_watk(bl, sc, max, false); return max; @@ -11000,11 +11005,15 @@ int status_change_clear_buffs (struct block_list* bl, int type) if( !sc->data[i] || !status_get_sc_type(i) ) continue; - if( type&1 && !(status_get_sc_type(i)&SC_BUFF) ) + if( type&3 && !(status_get_sc_type(i)&SC_BUFF) && !(status_get_sc_type(i)&SC_DEBUFF) ) continue; - if( type&2 && !(status_get_sc_type(i)&SC_DEBUFF) ) - continue; + if( !(type&3) ){ + if( type&1 && !(status_get_sc_type(i)&SC_BUFF) ) + continue; + if( type&2 && !(status_get_sc_type(i)&SC_DEBUFF) ) + continue; + } switch (i) { case SC_DEEP_SLEEP: diff --git a/src/map/status.h b/src/map/status.h index fbce95f17..a469dc71f 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -147,7 +147,7 @@ typedef enum sc_type { SC_VOLCANO, //100, SC_DELUGE, SC_VIOLENTGALE, - SC_WATK_ELEMENT, + SC_SUB_WEAPONPROPERTY, SC_ARMOR, SC_ARMORPROPERTY, SC_NOCHAT, @@ -672,6 +672,7 @@ typedef enum sc_type { SC_HANBOK, SC_MONSTER_TRANSFORM, + SC_ANGEL_PROTECT, SC_MAX, //Automatically updated max, used in for's to check we are within bounds. } sc_type; @@ -993,7 +994,7 @@ enum si_type { SI_INVINCIBLE = 311, SI_CASH_PLUSONLYJOBEXP = 312, SI_PARTYFLEE = 313, -// SI_ANGEL_PROTECT = 314, + SI_ANGEL_PROTECT = 314, // SI_ENDURE_MDEF = 315, SI_ENCHANTBLADE = 316, SI_DEATHBOUND = 317, @@ -1850,11 +1851,12 @@ int status_check_visibility(struct block_list *src, struct block_list *target); int status_change_spread( struct block_list *src, struct block_list *bl ); defType status_calc_def(struct block_list *bl, struct status_change *sc, int, bool); -signed short status_calc_def2(struct block_list *,struct status_change *, int, bool); +signed short status_calc_def2(struct block_list *, struct status_change *, int, bool); defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int, bool); -signed short status_calc_mdef2(struct block_list *,struct status_change *, int, bool); +signed short status_calc_mdef2(struct block_list *, struct status_change *, int, bool); #ifdef RENEWAL +unsigned short status_calc_batk(struct block_list *, struct status_change *, int, bool); unsigned short status_base_matk(const struct status_data* status, int level); int status_get_weapon_atk(struct block_list *src, struct weapon_atk *watk, int flag); int status_get_total_mdef(struct block_list *src); |