From e983d07228c32f0daa2b5f15829722ce62fd18a8 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 10 Apr 2025 00:49:55 -0400 Subject: [PATCH] [Spells] Fear resistance effects edge case fixes and support for SPA 102 as an AA (#4848) * Clean up for fear related bonus variables SPA 181 FearResistChance (% chance to outright resist fear) and SPA 102 Fearless (on live used only on pets for full fear immunity if presents) The way were calculating the bonuses was mixing the variables we used for each together in a way that could cause conflicts when combined with negate spell effect. While doing some live testing was able to confirm SPA102 when cast on pets will terminate the fear on the next tick which is consistent with how we have the mechanic coded. * Update spells.cpp --------- Co-authored-by: Akkadius --- zone/bonuses.cpp | 13 +------------ zone/spells.cpp | 14 ++++---------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 8ef663730..d81c3ddf8 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1165,10 +1165,6 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) } case SE_ResistFearChance: { - if (base_value == 100) // If we reach 100% in a single spell/item then we should be immune to - // negative fear resist effects until our immunity is over - newbon->Fearless = true; - newbon->ResistFearChance += base_value; // these should stack break; } @@ -2474,9 +2470,6 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_ResistFearChance: { - if(effect_value == 100) // If we reach 100% in a single spell/item then we should be immune to negative fear resist effects until our immunity is over - new_bonus->Fearless = true; - new_bonus->ResistFearChance += effect_value; // these should stack break; } @@ -4689,11 +4682,7 @@ void Mob::NegateSpellEffectBonuses(uint16 spell_id) break; case SE_ResistFearChance: - if (negate_spellbonus) { - spellbonuses.Fearless = false; - spellbonuses.ResistFearChance = effect_value; - } - + if (negate_spellbonus) {spellbonuses.ResistFearChance = effect_value; } if (negate_aabonus) { aabonuses.ResistFearChance = effect_value; } if (negate_itembonus) { itembonuses.ResistFearChance = effect_value; } break; diff --git a/zone/spells.cpp b/zone/spells.cpp index 7b2011607..bca4caefa 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5668,18 +5668,12 @@ int16 Mob::CalcResistChanceBonus() int16 Mob::CalcFearResistChance() { - int resistchance = spellbonuses.ResistFearChance + itembonuses.ResistFearChance; - if (IsOfClientBot()) { - resistchance += aabonuses.ResistFearChance; - if (aabonuses.Fearless == true) { - resistchance = 100; - } - } - if (spellbonuses.Fearless == true || itembonuses.Fearless == true) { - resistchance = 100; + int resist_chance = spellbonuses.ResistFearChance + itembonuses.ResistFearChance + aabonuses.ResistFearChance; + if (spellbonuses.Fearless || itembonuses.Fearless || aabonuses.Fearless) { + resist_chance = 100; } - return resistchance; + return resist_chance; } float Mob::GetAOERange(uint16 spell_id)