Fixes card resistance for renewal (#6179)

* Fixes #5932.
* Resolves the cardfix ratio getting applied twice in renewal.
Thanks to @laziem!
This commit is contained in:
Aleos 2021-08-23 12:34:25 -04:00 committed by GitHub
parent eb8c06743e
commit abe40d1eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5947,9 +5947,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
wd.weaponAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.weaponAtk2, 3, wd.flag);
wd.equipAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.equipAtk2, 3, wd.flag);
}
}
//Card Fix for target (tsd), 2 is not added to the "left" flag meaning "target cards only"
if (tsd) {
if (tsd && skill_id != NJ_ISSEN && skill_id != GN_FIRE_EXPANSION_ACID) { // These skills will do a card fix later
std::bitset<NK_MAX> ignoreele_nk = nk;
ignoreele_nk.set(NK_IGNOREELEMENT);
@ -5964,13 +5965,13 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
wd.masteryAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.masteryAtk2, 1, wd.flag);
}
}
}
// final attack bonuses that aren't affected by cards
battle_attack_sc_bonus(&wd, src, target, skill_id, skill_lv);
if (sd) { //monsters, homuns and pets have their damage computed directly
wd.damage = wd.statusAtk + wd.weaponAtk + wd.equipAtk + wd.masteryAtk + bonus_damage;
if (is_attack_left_handed(src, skill_id))
wd.damage2 = wd.statusAtk2 + wd.weaponAtk2 + wd.equipAtk2 + wd.masteryAtk2 + bonus_damage;
if (wd.flag & BF_SHORT)
ATK_ADDRATE(wd.damage, wd.damage2, sd->bonus.short_attack_atk_rate);
@ -6104,22 +6105,13 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
#endif
}
#ifndef RENEWAL
if(tsd) { // Card Fix for target (tsd), 2 is not added to the "left" flag meaning "target cards only"
#ifdef RENEWAL
switch(skill_id) {
case NJ_ISSEN:
case GN_FIRE_EXPANSION_ACID:
break; //These skills will do a card fix later
default:
#endif
wd.damage += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.damage, 0, wd.flag);
if(is_attack_left_handed(src, skill_id))
wd.damage2 += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.damage2, 1, wd.flag);
#ifdef RENEWAL
break;
}
#endif
}
// only do 1 dmg to plant, no need to calculate rest
if(infdef){