aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/boss_emeriss.cpp2
-rw-r--r--src/server/scripts/World/boss_taerar.cpp2
-rw-r--r--src/server/scripts/World/boss_ysondre.cpp2
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp4
-rw-r--r--src/server/scripts/World/npcs_special.cpp10
5 files changed, 10 insertions, 10 deletions
diff --git a/src/server/scripts/World/boss_emeriss.cpp b/src/server/scripts/World/boss_emeriss.cpp
index eedd7a90f22..db19ccbbeb4 100644
--- a/src/server/scripts/World/boss_emeriss.cpp
+++ b/src/server/scripts/World/boss_emeriss.cpp
@@ -112,7 +112,7 @@ public:
//CorruptionofEarth_Timer
//CorruptionofEarth at 75%, 50% and 25%
- if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted)))
+ if (!HealthAbovePct(100 - 25 * m_uiCorruptionsCasted))
{
++m_uiCorruptionsCasted; // prevent casting twice on same hp
DoScriptText(SAY_CASTCORRUPTION, me);
diff --git a/src/server/scripts/World/boss_taerar.cpp b/src/server/scripts/World/boss_taerar.cpp
index cef9db43e1c..8e5e66629e6 100644
--- a/src/server/scripts/World/boss_taerar.cpp
+++ b/src/server/scripts/World/boss_taerar.cpp
@@ -162,7 +162,7 @@ public:
m_uiBellowingRoar_Timer -= uiDiff;
//Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again)
- if (!m_bShades && (me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned)))
+ if (!m_bShades && !HealthAbovePct(100 - 25 * m_uiShadesSummoned))
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
{
diff --git a/src/server/scripts/World/boss_ysondre.cpp b/src/server/scripts/World/boss_ysondre.cpp
index 97cbbecf0e6..0371d516776 100644
--- a/src/server/scripts/World/boss_ysondre.cpp
+++ b/src/server/scripts/World/boss_ysondre.cpp
@@ -128,7 +128,7 @@ public:
m_uiLightningWave_Timer -= uiDiff;
//Summon Druids
- if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier)))
+ if (!HealthAbovePct(100 - 25 * m_uiSummonDruidModifier))
{
DoScriptText(SAY_SUMMONDRUIDS, me);
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index 0b1317f9b99..19f7c990eae 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -97,7 +97,7 @@ public:
SpellEntry const *info = NULL;
//Select a healing spell if less than 30% hp
- if (me->GetHealth()*100 / me->GetMaxHealth() < 30)
+ if (HealthBelowPct(30))
info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
//No healing spell available, select a hostile spell
@@ -128,7 +128,7 @@ public:
SpellEntry const *info = NULL;
//Select a healing spell if less than 30% hp ONLY 33% of the time
- if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0)
+ if (HealthBelowPct(30) && rand() % 3 == 0)
info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index f5f56ab6783..f205f2ab099 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -723,15 +723,15 @@ public:
{ //lower max health
case 12923:
case 12938: //Injured Soldier
- me->SetHealth(uint32(me->GetMaxHealth()*.75));
+ me->SetHealth(me->CountPctFromMaxHealth(75));
break;
case 12924:
case 12936: //Badly injured Soldier
- me->SetHealth(uint32(me->GetMaxHealth()*.50));
+ me->SetHealth(me->CountPctFromMaxHealth(50));
break;
case 12925:
case 12937: //Critically injured Soldier
- me->SetHealth(uint32(me->GetMaxHealth()*.25));
+ me->SetHealth(me->CountPctFromMaxHealth(25));
break;
}
}
@@ -782,7 +782,7 @@ public:
//lower HP on every world tick makes it a useful counter, not officlone though
if (me->isAlive() && me->GetHealth() > 6)
{
- me->SetHealth(uint32(me->GetHealth()-5));
+ me->ModifyHealth(-5);
}
if (me->isAlive() && me->GetHealth() <= 6)
@@ -924,7 +924,7 @@ public:
me->SetStandState(UNIT_STAND_STATE_KNEEL);
//expect database to have RegenHealth=0
- me->SetHealth(int(me->GetMaxHealth()*0.7f));
+ me->SetHealth(me->CountPctFromMaxHealth(70));
}
void EnterCombat(Unit * /*who*/) {}