Created
January 10, 2010 21:47
-
-
Save pasdVn/273797 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2fd3411348b7f8f4efd22fe06133c1185db32fd8 Mon Sep 17 00:00:00 2001 | |
From: pasdVn <[email protected]> | |
Date: Wed, 24 Mar 2010 17:23:36 +0100 | |
Subject: [PATCH 2/6] workaround: pet scaling aura health/mana update | |
scale health/mana proportional when (re)applying pet scaling auras (stamina/intellect) | |
--- | |
src/game/SpellAuras.cpp | 18 ++++++++++++++++++ | |
1 files changed, 18 insertions(+), 0 deletions(-) | |
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp | |
index 562f13b..bd54b3c 100644 | |
--- a/src/game/SpellAuras.cpp | |
+++ b/src/game/SpellAuras.cpp | |
@@ -5232,10 +5232,28 @@ void Aura::HandleAuraModStat(bool apply, bool /*Real*/) | |
// -1 or -2 is all stats ( misc < -2 checked in function beginning ) | |
if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue == i) | |
{ | |
+ // pet scaling aura workaround | |
+ float energyPct = 0.0f; | |
+ if (GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_PET_SCALING_AURA) | |
+ { | |
+ if (m_modifier.m_miscvalue == STAT_STAMINA) | |
+ energyPct = float(m_target->GetHealth())/m_target->GetMaxHealth(); | |
+ else if (m_modifier.m_miscvalue == STAT_INTELLECT && m_target->GetMaxPower(POWER_MANA) > 0) | |
+ energyPct = float(m_target->GetPower(POWER_MANA))/m_target->GetMaxPower(POWER_MANA); | |
+ } | |
+ | |
//m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); | |
GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); | |
if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->isPet()) | |
GetTarget()->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply); | |
+ | |
+ if (energyPct) | |
+ { | |
+ if (m_modifier.m_miscvalue == STAT_STAMINA) | |
+ GetTarget()->SetHealth(GetTarget()->GetMaxHealth()*energyPct); | |
+ else if (m_modifier.m_miscvalue == STAT_INTELLECT) | |
+ GetTarget()->SetPower(POWER_MANA,GetTarget()->GetMaxPower(POWER_MANA)*energyPct); | |
+ } | |
} | |
} | |
} | |
-- | |
1.6.5.1.1367.gcd48 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment