diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-03-12 14:29:32 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2017-03-12 14:29:32 -0300 |
commit | e1083794cde600205c45a016e6d077d1ffa4dea9 (patch) | |
tree | 2294eea87952166c7ea25bd63b7d469fd174d2bb | |
parent | 0eaa58dc8462efae9478a02ce099f2815889d383 (diff) |
Core/Aura: fix SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE unapply case for dead players
Closes #19276
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index fc9b03bc915..c83365c7ae1 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3505,7 +3505,13 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 // save current health state float healthPct = target->GetHealthPct(); - bool alive = target->IsAlive(); + bool zeroHealth = !target->IsAlive(); + + // players in corpse state may mean two different states: + /// 1. player just died but did not release (in this case health == 0) + /// 2. player is corpse running (ie ghost) (in this case health == 1) + if (target->getDeathState() == CORPSE) + zeroHealth = (target->GetHealth() == 0); for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { @@ -3529,8 +3535,8 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_ABILITY 0x00000010 flag) // this check is total bullshit i think - if ((GetMiscValue() == STAT_STAMINA || GetMiscValue() == - 1) && m_spellInfo->HasAttribute(SPELL_ATTR0_ABILITY)) - target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0))); + if ((GetMiscValue() == STAT_STAMINA || GetMiscValue() == -1) && m_spellInfo->HasAttribute(SPELL_ATTR0_ABILITY)) + target->SetHealth(std::max<uint32>(CalculatePct(target->GetMaxHealth(), healthPct), (zeroHealth ? 0 : 1))); } void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const |