[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 <akkadius1@gmail.com>
This commit is contained in:
KayenEQ 2025-04-10 00:49:55 -04:00 committed by GitHub
parent 90db12483a
commit e983d07228
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 22 deletions

View File

@ -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;

View File

@ -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)