Skip to content

Commit

Permalink
Core/Auras: Ensure aura target of SPELL_AURA_TRIGGER_SPELL_ON_POWER_P…
Browse files Browse the repository at this point in the history
…CT has required power type

Closes TrinityCore#30669
  • Loading branch information
Shauren committed Feb 5, 2025
1 parent 9201c0f commit fc54ae7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 5 additions & 1 deletion src/server/game/Spells/Auras/SpellAuraEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
{
Expand Down

0 comments on commit fc54ae7

Please sign in to comment.