diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-02-05 20:35:13 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-02-05 20:35:13 +0100 |
commit | fc54ae79a95bc162bd0ceec199561af873576a23 (patch) | |
tree | bc3491530fbec8edbd96c906a149c1bad07ffe01 | |
parent | 9201c0f035308af07ef416a7a10fbaa98176badb (diff) |
Core/Auras: Ensure aura target of SPELL_AURA_TRIGGER_SPELL_ON_POWER_PCT has required power type
Closes #30669
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 3 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 00c9b9dde4e..4b3e7921046 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9876,6 +9876,9 @@ void Unit::TriggerOnPowerChangeAuras(Powers power, int32 oldVal, int32 newVal) if (effect->GetAuraType() == SPELL_AURA_TRIGGER_SPELL_ON_POWER_PCT) { int32 maxPower = GetMaxPower(power); + if (!maxPower) + continue; + oldValueCheck = GetPctOf(oldVal, maxPower); newValueCheck = GetPctOf(newVal, maxPower); } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index bc414da722f..90a5d78cee3 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5327,7 +5327,11 @@ void AuraEffect::HandleTriggerSpellOnPowerPercent(AuraApplication const* aurApp, int32 effectAmount = GetAmount(); uint32 triggerSpell = GetSpellEffectInfo().TriggerSpell; - float powerAmountPct = GetPctOf(target->GetPower(Powers(GetMiscValue())), target->GetMaxPower(Powers(GetMiscValue()))); + int32 maxPower = target->GetMaxPower(Powers(GetMiscValue())); + if (!maxPower) + return; + + float powerAmountPct = GetPctOf(target->GetPower(Powers(GetMiscValue())), maxPower); switch (AuraTriggerOnPowerChangeDirection(GetMiscValueB())) { |