All pastes #950891 Raw Edit

macman

public diff v1 · immutable
·published 2008-03-20 22:11 UTC
rendered paste body
Index: src/game/SpellAuras.cpp===================================================================--- src/game/SpellAuras.cpp	(revision 5467)+++ src/game/SpellAuras.cpp	(working copy)@@ -3457,6 +3457,10 @@         return;     } +    //save current and max HP and MP 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)@@ -3467,6 +3471,15 @@                 ((Player*)m_target)->ApplyPosStatPercentMod(Stats(i), m_modifier.m_amount, apply );                 ((Player*)m_target)->ApplyNegStatPercentMod(Stats(i), m_modifier.m_amount, apply );             }+            if (m_modifier.m_miscvalue == STAT_STAMINA || m_modifier.m_miscvalue == -1)+            {+                //this doesn't work as i expected, i'm not sure why+                //m_target->SetHealth(m_target->GetHealth() * (100.0 + float(m_modifier.m_amount))/100.0);+                +                // 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);+            }         }     } }