All pastes #991070 Raw Edit

macman

public diff v1 · immutable
#991070 ·published 2008-04-20 18:27 UTC
rendered paste body
Index: src/game/SpellAuras.cpp===================================================================--- src/game/SpellAuras.cpp	(revision 5672)+++ src/game/SpellAuras.cpp	(working copy)@@ -3556,6 +3556,10 @@         return;     } +    //save current and max HP before applying aura+    uint32 curHPValue = m_target->GetHealth();+    uint32 maxHPValue = m_target->GetMaxHealth();+     for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)     {         if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1)@@ -3568,6 +3572,15 @@             }         }     }+    +    //recalculate current HP/MP after applying aura modifications (only for druid's shapeshifting)+    Unit* caster = GetCaster();+    if ((m_modifier.m_miscvalue == STAT_STAMINA) && (maxHPValue > 0) && (m_target->getClass() == CLASS_DRUID) && (caster->getClass() == CLASS_DRUID))+    {+        // newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed+        uint32 newHPValue = (m_target->GetMaxHealth() * curHPValue) / maxHPValue;+        m_target->SetHealth(newHPValue);+    } }  void Aura::HandleAuraModResistenceOfIntellectPercent(bool apply, bool Real)