From 518969ad2fc4a3ea4d3728ea34396d760170b3cd Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sun, 8 Jun 2025 18:33:57 -0400 Subject: [PATCH] Core/Auras: Ensure aura target of SPELL_AURA_TRIGGER_SPELL_ON_POWER_PCT has required power type Port From (https://github.com/TrinityCore/TrinityCore/commit/fc54ae79a95bc162bd0ceec199561af873576a23) --- Source/Game/Entities/StatSystem.cs | 3 +++ Source/Game/Spells/Auras/AuraEffect.cs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index e776be716..33b2c0e48 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -764,6 +764,9 @@ namespace Game.Entities if (effect.GetAuraType() == AuraType.TriggerSpellOnPowerPct) { int maxPower = GetMaxPower(power); + if (maxPower == 0) + continue; + oldValueCheck = MathFunctions.GetPctOf(oldVal, maxPower); newValueCheck = MathFunctions.GetPctOf(newVal, maxPower); } diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index ba8bd9d50..01092e054 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -4886,7 +4886,11 @@ namespace Game.Spells int effectAmount = GetAmount(); uint triggerSpell = GetSpellEffectInfo().TriggerSpell; - float powerAmountPct = MathFunctions.GetPctOf(target.GetPower((PowerType)GetMiscValue()), target.GetMaxPower((PowerType)GetMiscValue())); + int maxPower = target.GetMaxPower((PowerType)GetMiscValue()); + if (maxPower == 0) + return; + + float powerAmountPct = MathFunctions.GetPctOf(target.GetPower((PowerType)GetMiscValue()), maxPower); switch ((AuraTriggerOnPowerChangeDirection)GetMiscValueB()) {