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,22 +5947,22 @@ 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) {
std::bitset<NK_MAX> ignoreele_nk = nk;
//Card Fix for target (tsd), 2 is not added to the "left" flag meaning "target cards only"
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);
wd.statusAtk += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.statusAtk, 0, wd.flag);
wd.weaponAtk += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.weaponAtk, 0, wd.flag);
wd.equipAtk += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.equipAtk, 0, wd.flag);
wd.masteryAtk += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.masteryAtk, 0, wd.flag);
if (is_attack_left_handed(src, skill_id)) {
wd.statusAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.statusAtk2, 1, wd.flag);
wd.weaponAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.weaponAtk2, 1, wd.flag);
wd.equipAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.equipAtk2, 1, wd.flag);
wd.masteryAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.masteryAtk2, 1, wd.flag);
}
ignoreele_nk.set(NK_IGNOREELEMENT);
wd.statusAtk += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.statusAtk, 0, wd.flag);
wd.weaponAtk += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.weaponAtk, 0, wd.flag);
wd.equipAtk += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.equipAtk, 0, wd.flag);
wd.masteryAtk += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.masteryAtk, 0, wd.flag);
if (is_attack_left_handed(src, skill_id)) {
wd.statusAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.statusAtk2, 1, wd.flag);
wd.weaponAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.weaponAtk2, 1, wd.flag);
wd.equipAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, nk, right_element, left_element, wd.equipAtk2, 1, wd.flag);
wd.masteryAtk2 += battle_calc_cardfix(BF_WEAPON, src, target, ignoreele_nk, right_element, left_element, wd.masteryAtk2, 1, wd.flag);
}
}
@ -5971,7 +5971,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
if (sd) { //monsters, homuns and pets have their damage computed directly
wd.damage = wd.statusAtk + wd.weaponAtk + wd.equipAtk + wd.masteryAtk + bonus_damage;
wd.damage2 = wd.statusAtk2 + wd.weaponAtk2 + wd.equipAtk2 + wd.masteryAtk2 + 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);
if(wd.flag&BF_LONG && (skill_id != RA_WUGBITE && skill_id != RA_WUGSTRIKE)) //Long damage rate addition doesn't use weapon + equip attack
@ -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
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);
}
#endif
// only do 1 dmg to plant, no need to calculate rest
if(infdef){