From 089c3056cf6600ee38349740e133b9e1000eb533 Mon Sep 17 00:00:00 2001 From: Playtester <3785983+Playtester@users.noreply.github.com> Date: Sun, 14 Apr 2024 19:12:40 +0200 Subject: [PATCH] Updated/Simplified Damage Bonus Stacking (#8252) - Freezing Trap, Sand Attack, Gunslinger Mine, Flip Tatami and Excruciating Palm no longer are affected by +% dmg cards - The skills that ignore +% dmg cards are now exactly those skills that also ignore EDP and the EDP/Magnum Break elemental damage bonus - Non-players are now always affected by ATKpercent - Simplified the code accordingly - Fixes #8250 --- db/pre-re/skill_db.yml | 8 ++++++++ src/map/battle.cpp | 45 +++++++++--------------------------------- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/db/pre-re/skill_db.yml b/db/pre-re/skill_db.yml index b4b0bee5afd..402b1bf263e 100644 --- a/db/pre-re/skill_db.yml +++ b/db/pre-re/skill_db.yml @@ -4408,6 +4408,7 @@ Body: TargetType: Ground DamageFlags: Splash: true + IgnoreAtkCard: true Flags: IsTrap: true AlterRangeResearchTrap: true @@ -5184,6 +5185,8 @@ Body: MaxLevel: 1 Type: Weapon TargetType: Attack + DamageFlags: + IgnoreAtkCard: true Flags: IsQuest: true Range: 1 @@ -14295,6 +14298,7 @@ Body: TargetType: Ground DamageFlags: Splash: true + IgnoreAtkCard: true IgnoreFlee: true Flags: AlterRangeSnakeEye: true @@ -14510,6 +14514,8 @@ Body: MaxLevel: 5 Type: Weapon TargetType: Self + DamageFlags: + IgnoreAtkCard: true Hit: Single HitCount: 1 Element: Weapon @@ -17180,6 +17186,7 @@ Body: TargetType: Attack DamageFlags: Splash: true + IgnoreAtkCard: true Flags: IsQuest: true Range: -1 @@ -32584,6 +32591,7 @@ Body: TargetType: Ground DamageFlags: Splash: true + IgnoreAtkCard: true Flags: IsTrap: true AlterRangeResearchTrap: true diff --git a/src/map/battle.cpp b/src/map/battle.cpp index e456158512d..62e5c466f42 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -3359,12 +3359,11 @@ static bool attack_ignores_def(struct Damage* wd, struct block_list *src, struct /** * This function lists which skills are unaffected by refine bonus, masteries, Star Crumbs and Spirit Spheres * This function is also used to determine if atkpercent applies - * @param src: Source of the attack * @param skill_id: Skill being used * @param chk_flag: The bonus that is currently being checked for, see e_bonus_chk_flag * @return true = bonus applies; false = bonus does not apply */ -static bool battle_skill_stacks_masteries_vvs(struct block_list &src, uint16 skill_id, e_bonus_chk_flag chk_flag) +static bool battle_skill_stacks_masteries_vvs(uint16 skill_id, e_bonus_chk_flag chk_flag) { switch (skill_id) { // PC skills that are unaffected @@ -3389,33 +3388,7 @@ static bool battle_skill_stacks_masteries_vvs(struct block_list &src, uint16 ski break; case LK_SPIRALPIERCE: // Spiral Pierce is influenced only by refine bonus and Star Crumbs for players - if (src.type == BL_PC && chk_flag != BCHK_REFINE && chk_flag != BCHK_STAR) - return false; - break; - } - - return true; -} - -/** - * This function lists which skills are unaffected by EDP and the elemental bonus from Magnum Break / EDP - * Unit skills (e.g. Bomb and Freezing Trap) are never affected. - * @param skill_id: Skill being used - * @return true = bonus applies; false = bonus does not apply - */ -static bool battle_skill_stacks_edp_element(uint16 skill_id) -{ - switch (skill_id) { - case TF_SPRINKLESAND: - case AS_SPLASHER: - case ASC_METEORASSAULT: - case ASC_BREAKER: - case AS_VENOMKNIFE: - case AM_ACIDTERROR: - return false; - default: - //Unit skills - if (skill_get_unit_id(skill_id)) + if (chk_flag != BCHK_REFINE && chk_flag != BCHK_STAR) return false; break; } @@ -3789,12 +3762,12 @@ static void battle_calc_element_damage(struct Damage* wd, struct block_list *src // These mastery bonuses are non-elemental and should apply even if the attack misses // They are still increased by the EDP/Magnum Break bonus damage (WATK_ELEMENT) // In renewal these bonuses do not apply when the attack misses - if (sd && battle_skill_stacks_masteries_vvs(*src, skill_id, BCHK_STAR)) { + if (sd && battle_skill_stacks_masteries_vvs(skill_id, BCHK_STAR)) { // Star Crumb bonus damage ATK_ADD2(wd->damage, wd->damage2, sd->right_weapon.star, sd->left_weapon.star); } // Check if general mastery bonuses apply (above check is only for Star Crumb) - if (battle_skill_stacks_masteries_vvs(*src, skill_id, BCHK_ALL)) { + if (battle_skill_stacks_masteries_vvs(skill_id, BCHK_ALL)) { // Spirit Sphere bonus damage ATK_ADD(wd->damage, wd->damage2, battle_get_spiritball_damage(*wd, *src, skill_id)); @@ -3824,10 +3797,10 @@ static void battle_calc_element_damage(struct Damage* wd, struct block_list *src } } - // These bonuses do not apply to skills that ignore element, unit skills and skills that have their own base damage formula + // These bonuses do not apply to skills that ignore +% damage cards // If damage was reduced below 0 and was not increased again to a positive value through mastery bonuses, these bonuses are ignored // Any of these are only applied to your right hand weapon in pre-renewal - if (!nk[NK_IGNOREELEMENT] && (wd->damage > 0 || wd->damage2 > 0) && sc && battle_skill_stacks_edp_element(skill_id)) { + if (!nk[NK_IGNOREELEMENT] && !nk[NK_IGNOREATKCARD] && (wd->damage > 0 || wd->damage2 > 0) && sc) { // EDP bonus damage // This has to be applied after mastery bonuses but still before the elemental extra damage @@ -3873,7 +3846,7 @@ static void battle_calc_attack_masteries(struct Damage* wd, struct block_list *s } // Check if mastery damage applies to current skill - if (sd && battle_skill_stacks_masteries_vvs(*src, skill_id, BCHK_ALL)) + if (sd && battle_skill_stacks_masteries_vvs(skill_id, BCHK_ALL)) { //Add mastery damage uint16 skill; @@ -4459,7 +4432,7 @@ static void battle_calc_multi_attack(struct Damage* wd, struct block_list *src,s */ static unsigned short battle_get_atkpercent(struct block_list& bl, uint16 skill_id, status_change& sc) { - if (!battle_skill_stacks_masteries_vvs(bl, skill_id, BCHK_ALL)) + if (bl.type == BL_PC && !battle_skill_stacks_masteries_vvs(skill_id, BCHK_ALL)) return 100; int atkpercent = 100; @@ -6709,7 +6682,7 @@ static void battle_calc_attack_post_defense(struct Damage* wd, struct block_list #ifndef RENEWAL //Refine bonus if (sd) { - if (battle_skill_stacks_masteries_vvs(*src, skill_id, BCHK_REFINE)) { + if (battle_skill_stacks_masteries_vvs(skill_id, BCHK_REFINE)) { ATK_ADD2(wd->damage, wd->damage2, sstatus->rhw.atk2, sstatus->lhw.atk2); } wd->basedamage += sstatus->rhw.atk2;