aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/EventAI
diff options
context:
space:
mode:
authorazazel <none@none>2010-08-26 01:20:57 +0600
committerazazel <none@none>2010-08-26 01:20:57 +0600
commit341e6303effccfdbfb6b67ae0d8fe6933f56ed3b (patch)
treeeff917fec707c7097a7b408ce15842ff24d8ddb4 /src/server/game/AI/EventAI
parentbb5f7b64927713911331f81f9c0a5abc33e0c3ab (diff)
Core:
* add helping methods for manipulating unit's health and use it where applicable * fix some conversion warnings and cleanup code (formatting, CRLF, tabs to spaces) --HG-- branch : trunk
Diffstat (limited to 'src/server/game/AI/EventAI')
-rw-r--r--src/server/game/AI/EventAI/CreatureEventAI.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index ec236890fa8..ec0b12a0b42 100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -141,7 +141,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
if (!me->isInCombat() || !me->GetMaxHealth())
return false;
- uint32 perc = (me->GetHealth()*100) / me->GetMaxHealth();
+ uint32 perc = uint32(me->GetHealthPct());
if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin)
return false;
@@ -195,7 +195,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
if (!me->isInCombat() || !me->getVictim() || !me->getVictim()->GetMaxHealth())
return false;
- uint32 perc = (me->getVictim()->GetHealth()*100) / me->getVictim()->GetMaxHealth();
+ uint32 perc = uint32(me->getVictim()->GetHealthPct());
if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin)
return false;
@@ -821,7 +821,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
{
if (action.invincibility_hp_level.is_percent)
- m_InvinceabilityHpLevel = me->GetMaxHealth()*action.invincibility_hp_level.hp_level/100;
+ m_InvinceabilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level);
else
m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
break;