diff options
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
56 files changed, 97 insertions, 100 deletions
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 77719cc80a2..95f523268d4 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -418,7 +418,7 @@ public: } else ThunderClap_Timer -= diff; //FireballVolley_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + if (HealthBelowPct(51)) { if (FireballVolley_Timer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp index 135b774ad95..2b483b4ae43 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp @@ -105,7 +105,7 @@ public: } else Cleave_Timer -= diff; //Adds_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 21) + if (HealthBelowPct(21)) { if (Adds_Timer <= diff) { @@ -119,7 +119,7 @@ public: } //Summon Medics - if (!Medics && me->GetHealth()*100 / me->GetMaxHealth() < 21) + if (!Medics && HealthBelowPct(21)) { SummonMedics(me->getVictim()); SummonMedics(me->getVictim()); diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp index da7ba6fa7d5..bf81f6144d9 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp @@ -77,7 +77,7 @@ public: } else GroundTremor_Timer -= diff; //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + if (HealthBelowPct(51)) { if (Frenzy_Timer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp index 3ce46b15d9d..90fc17043dd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp @@ -77,7 +77,7 @@ public: } else FieryBurst_Timer -= diff; //WarStomp_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + if (HealthBelowPct(51)) { if (WarStomp_Timer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp index 8f427c66fed..0d6fda9430f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp @@ -240,7 +240,7 @@ public: } else DemonArmor_Timer -= diff; //Summon Voidwalkers - if (!Voidwalkers && me->GetHealth()*100 / me->GetMaxHealth() < 51) + if (!Voidwalkers && HealthBelowPct(51)) { DoCast(me->getVictim(), SPELL_SUMMON_VOIDWALKERS, true); Voidwalkers = true; diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp index 7382b9acafc..fe2d8682e2c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp @@ -184,8 +184,7 @@ public: } else Flamebreath_Timer -= diff; //Summon Rend - if (!SummonedRend && me->GetHealth()*100 / me->GetMaxHealth() < 11 - && me->GetHealth() > 0) + if (!SummonedRend && HealthBelowPct(11) && me->GetHealth() > 0) { //summon Rend and Change model to normal Gyth //Interrupt any spell casting diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp index 42031639071..f7dd65fcf68 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp @@ -83,7 +83,7 @@ public: } else MightyBlow_Timer -= diff; //Summon Gizrul - if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 25) + if (!Summoned && HealthBelowPct(25)) { me->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000); Summoned = true; diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp index 1ec09bdf429..257a1cfad8f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp @@ -108,7 +108,7 @@ public: } else Knockaway_Timer -= diff; //Summon two Beserks - if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 51) + if (!Summoned && HealthBelowPct(51)) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true); diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp index 4c20fa56c6e..334745acb73 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp @@ -288,7 +288,7 @@ public: } else Frenzy_Timer -= diff; //Enrage if not already enraged and below 20% - if (!Enraged && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) + if (!Enraged && HealthBelowPct(20)) { DoCast(me, SPELL_ENRAGE); Enraged = true; diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp index 441012f8eb6..9035619eeed 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp @@ -218,7 +218,7 @@ public: } else ClassCall_Timer -= diff; //Phase3 begins when we are below X health - if (!Phase3 && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) + if (!Phase3 && HealthBelowPct(20)) { Phase3 = true; DoScriptText(SAY_RAISE_SKELETONS, me); diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp index 59dc92df6f5..f5329889d8f 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp @@ -141,7 +141,7 @@ public: { DoCast(me, SPELL_ESSENCEOFTHERED); DoZoneInCombat(); - me->SetHealth(int(me->GetMaxHealth()*.3)); + me->SetHealth(me->CountPctFromMaxHealth(30)); } void UpdateAI(const uint32 diff) @@ -184,7 +184,7 @@ public: return; // Yell if hp lower than 15% - if (me->GetHealth()*100 / me->GetMaxHealth() < 15 && !HasYelled) + if (HealthBelowPct(15) && !HasYelled) { DoScriptText(SAY_HALFLIFE, me); HasYelled = true; diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index b0bc9cc3711..6fbc83e05a3 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -121,7 +121,7 @@ public: } else uiNimbleReflexesTimer -= uiDiff; /*END ACID-AI*/ - if (uiHealth == 0 && me->GetHealth()*100 / me->GetMaxHealth() <= 66 || uiHealth == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 33) + if (uiHealth == 0 && !HealthAbovePct(66) || uiHealth == 1 && !HealthAbovePct(33)) { ++uiHealth; DoCastAOE(SPELL_SMITE_STOMP,false); @@ -130,7 +130,7 @@ public: if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_SMITE_CHEST))) { me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(1,-3.00+pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ()); + me->GetMotionMaster()->MovePoint(1, pGo->GetPositionX() - 3.0f, pGo->GetPositionY(), pGo->GetPositionZ()); } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 2216bfd17ee..00d80f06771 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -169,7 +169,7 @@ public: AddTimer = 10000; } else AddTimer -= diff; - if (me->GetHealth()*100 / me->GetMaxHealth() <= 15) + if (!HealthAbovePct(15)) { Enraged = true; DoCast(me, SPELL_ENRAGE); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index d82617124d6..af4f061fe3d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -151,7 +151,7 @@ public: if (!UpdateVictim()) return; - if (Phase == 1 && (me->GetHealth()*100)/me->GetMaxHealth() < 95) + if (Phase == 1 && HealthBelowPct(95)) { Phase = 2; if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) @@ -162,7 +162,7 @@ public: DoScriptText(RAND(SAY_APPEAR1,SAY_APPEAR2,SAY_APPEAR3), pAttumen); } } - else if (Phase == 2 && (me->GetHealth()*100)/me->GetMaxHealth() < 25) + else if (Phase == 2 && HealthBelowPct(25)) { if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) Mount(pAttumen); @@ -295,7 +295,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) } else { - if ((me->GetHealth()*100)/me->GetMaxHealth() < 25) + if (HealthBelowPct(25)) { Creature *pMidnight = Unit::GetCreature(*me, Midnight); if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 78391612fd7..f2bd6edc774 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -243,7 +243,7 @@ public: return; } - if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() < 30) + if (!Enrage && HealthBelowPct(30)) { DoCast(me, SPELL_FRENZY); Enrage = true; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index 886853663be..45dc02db4d7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -341,8 +341,7 @@ public: SearingCindersTimer = 10000; } else SearingCindersTimer -= diff; - uint32 Prozent; - Prozent = (me->GetHealth()*100) / me->GetMaxHealth(); + uint32 Prozent = uint32(me->GetHealthPct()); if (Prozent < 75 && FlyCount == 0) // first take off 75% TakeOff(); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index a84da32fb03..b70fc098d0e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -397,7 +397,7 @@ public: if (phase == 1) { - if ((me->GetHealth()*100) / me->GetMaxHealth() < 60) + if (HealthBelowPct(60)) { me->InterruptNonMeleeSpells(false); @@ -432,7 +432,7 @@ public: } else if (phase == 2) { - if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) + if (HealthBelowPct(30)) { InfernalTimer = 15000; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index a517c94b0c3..44fec322a99 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -416,7 +416,7 @@ public: SuperCastTimer = urand(35000,40000); } else SuperCastTimer -= diff; - if (!ElementalsSpawned && me->GetHealth()*100 / me->GetMaxHealth() < 40) + if (!ElementalsSpawned && HealthBelowPct(40)) { ElementalsSpawned = true; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index f95437dd83b..2c71770311d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -988,7 +988,7 @@ void PretendToDie(Creature* pCreature) void Resurrect(Creature *pTarget) { pTarget->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTarget->SetHealth(pTarget->GetMaxHealth()); + pTarget->SetFullHealth(); pTarget->SetStandState(UNIT_STAND_STATE_STAND); pTarget->CastSpell(pTarget, SPELL_RES_VISUAL, true); if (pTarget->getVictim()) diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 56117dd4733..0b900103e4e 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -334,7 +334,7 @@ public: } else FlameStrikeTimer -= diff; // Below 50% - if (me->GetMaxHealth() * 0.5f > me->GetHealth()) + if (HealthBelowPct(50)) { me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); me->StopMoving(); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index c4c63c038a0..7f3b23142e2 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -461,7 +461,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if (!UsedPotion && (me->GetHealth()*100 / me->GetMaxHealth()) < 25) + if (!UsedPotion && HealthBelowPct(25)) { DoCast(me, SPELL_HEALING_POTION); UsedPotion = true; @@ -803,7 +803,7 @@ public: } } else Polymorph_Timer -= diff; - if (((me->GetHealth()*100 / me->GetMaxHealth()) < 35) && !HasIceBlocked) + if (HealthBelowPct(35) && !HasIceBlocked) { DoCast(me, SPELL_ICE_BLOCK); HasIceBlocked = true; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index 1bd20622d13..a1c4caaaea1 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -132,7 +132,7 @@ public: if (!Enraged) { //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(INTERVAL_MODIFIER*IntervalHealthAmount))) + if (!HealthAbovePct(100 - INTERVAL_MODIFIER * IntervalHealthAmount)) { //increase amount, unless we're at 10%, then we switch and return if (IntervalHealthAmount == INTERVAL_SWITCH) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp index 9dd5f0ffd1f..36569a63d45 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp @@ -67,7 +67,7 @@ public: return; //If we are <2% hp cast Armageddom - if (me->GetHealth()*100 / me->GetMaxHealth() <= 2) + if (!HealthAbovePct(2)) { me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_ARMAGEDDOM); diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp index be8eb00b34b..965c8f517d2 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp @@ -130,7 +130,7 @@ public: } else Immolate_Timer -= diff; //Cast Erruption and let them die - if (me->GetHealth() <= me->GetMaxHealth() * 0.10) + if (!HealthAbovePct(10)) { DoCast(me->getVictim(), SPELL_ERUPTION); me->setDeathState(JUST_DIED); diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp index b785b51de93..446bab0a1b2 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp @@ -96,7 +96,7 @@ public: m_uiPyroblastTimer -= uiDiff; // Enrage - if (!m_bEnraged && me->GetHealth()*100 < me->GetMaxHealth()*10) + if (!m_bEnraged && HealthBelowPct(10)) { DoCast(me, SPELL_ENRAGE); m_bEnraged = true; @@ -159,7 +159,7 @@ public: void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) { - if (me->GetHealth()*100 < me->GetMaxHealth()*50) + if (HealthBelowPct(50)) { if (m_pInstance) { @@ -168,7 +168,7 @@ public: if (pGolemagg->isAlive()) { DoScriptText(EMOTE_LOWHP, me); - me->SetHealth(me->GetMaxHealth()); + me->SetFullHealth(); } else uiDamage = me->GetHealth(); diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp index 17379de47a1..5e7bae31f10 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp @@ -97,7 +97,7 @@ public: return; //Cast Ageis if less than 50% hp - if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + if (HealthBelowPct(50)) { DoCast(me, SPELL_AEGIS); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 5eaa74a5211..d42923cd901 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -393,9 +393,9 @@ public: bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) + if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->IsFullHealth()) { - if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) + if (pPlayer->HealthBelowPct(10)) return true; if (pPlayer->isInCombat() || pCreature->isInCombat()) @@ -496,8 +496,7 @@ public: EnterEvadeMode(); return; } - else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER - && me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth()) + else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER && me->getVictim()->HealthBelowPct(10)) { me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp index 8acd4e782ac..8d1fe7d6117 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp @@ -86,7 +86,7 @@ public: return; //If we are <50% hp cast Arcane Bubble - if (!bShielded && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + if (!bShielded && !HealthAbovePct(50)) { //wait if we already casting if (me->IsNonMeleeSpellCasted(false)) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp index 3a0b3eaa5a9..f421e447408 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp @@ -64,7 +64,7 @@ public: return; //If we are <50% hp cast Soul Siphon rank 1 - if (me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !me->IsNonMeleeSpellCasted(false)) + if (!HealthAbovePct(50) && !me->IsNonMeleeSpellCasted(false)) { //SoulSiphon_Timer if (SoulSiphon_Timer <= diff) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp index 9634bafb642..30a6c729796 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp @@ -82,7 +82,7 @@ public: return; //If we are <35% hp - if (!HpYell && ((me->GetHealth()*100) / me->GetMaxHealth() <= 35)) + if (!HpYell && !HealthAbovePct(35)) { DoScriptText(SAY_HEALTH, me); HpYell = true; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index ca36128561e..096f58fe809 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -267,11 +267,11 @@ public: switch(Phase) { case 1: - if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 67) + if (me->HealthBelowPctDamaged(67, damage)) Disappear(); break; case 2: - if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 34) + if (me->HealthBelowPctDamaged(34, damage)) Disappear(); break; case 3: @@ -280,7 +280,7 @@ public: die = true; withbody = true; wait = 300; - damage = me->GetHealth() - me->GetMaxHealth()/100; + damage = me->GetHealth() - me->CountPctFromMaxHealth(1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->StopMoving(); //me->GetMotionMaster()->MoveIdle(); @@ -585,7 +585,7 @@ public: withhead = true; me->RemoveAllAuras(); me->SetName("Headless Horseman"); - me->SetHealth(me->GetMaxHealth()); + me->SetFullHealth(); SaySound(SAY_REJOINED); DoCast(me, SPELL_HEAD); caster->GetMotionMaster()->Clear(false); @@ -607,7 +607,7 @@ public: { withhead = false; returned = false; - damage = me->GetHealth() - me->GetMaxHealth()/100; + damage = me->GetHealth() - me->CountPctFromMaxHealth(1); me->RemoveAllAuras(); me->SetName("Headless Horseman, Unhorsed"); @@ -727,7 +727,7 @@ public: if (regen <= diff) { regen = 1000; //"body calls head" - if (me->GetHealth()/me->GetMaxHealth() == 1 && !returned) + if (me->IsFullHealth() && !returned) { if (Phase > 1) --Phase; @@ -891,7 +891,7 @@ void mob_head::mob_headAI::Disappear() me->RemoveAllAuras(); body->RemoveAurasDueToSpell(SPELL_IMMUNE);//hack, SpellHit doesn't calls if body has immune aura DoCast(body, SPELL_FLYING_HEAD); - me->SetHealth(me->GetMaxHealth()); + me->SetFullHealth(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->GetMotionMaster()->MoveIdle(); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index d94ece456c0..ff9171994b5 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -89,7 +89,7 @@ public: return; //If we are <30% hp goes Enraged - if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + if (!Enrage && !HealthAbovePct(30) && !me->IsNonMeleeSpellCasted(false)) { DoScriptText(EMOTE_ENRAGE, me); DoScriptText(SAY_ENRAGE, me); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp index d149eb280bd..bb6b3e9f26c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp @@ -78,7 +78,7 @@ public: return; //If we are <25% hp cast Heal - if (me->GetHealth()*100 / me->GetMaxHealth() <= 25 && !me->IsNonMeleeSpellCasted(false) && Heal_Timer <= diff) + if (!HealthAbovePct(25) && !me->IsNonMeleeSpellCasted(false) && Heal_Timer <= diff) { DoCast(me, SPELL_HEAL); Heal_Timer = 30000; @@ -103,7 +103,7 @@ public: } else Sleep_Timer -= diff; //PowerWordShield_Timer - if (!PowerWordShield && me->GetHealth()*100 / me->GetMaxHealth() <= 25) + if (!PowerWordShield && !HealthAbovePct(25)) { DoCast(me, SPELL_POWERWORDSHIELD); PowerWordShield = true; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index 23c6562e9c2..57335665e71 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -91,13 +91,13 @@ public: return; //If we are low on hp Do sayings - if (!Yell60 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 60)) + if (!Yell60 && !HealthAbovePct(60)) { DoScriptText(SAY_HEALTH1, me); Yell60 = true; } - if (!Yell30 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 30)) + if (!Yell30 && !HealthAbovePct(30)) { DoScriptText(SAY_HEALTH2, me); Yell30 = true; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 7ae7311b4eb..aa7ae7f762c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -299,7 +299,7 @@ public: } //Cast Deep sleep when health is less than 50% - if (!m_bCanResurrectCheck && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + if (!m_bCanResurrectCheck && !HealthAbovePct(50)) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); @@ -319,7 +319,7 @@ public: { Creature* pTarget = NULL; - if (me->GetHealth() <= me->GetMaxHealth()*0.75f) + if (!HealthAbovePct(75)) pTarget = me; if (m_pInstance) @@ -327,7 +327,7 @@ public: if (Creature* pMograine = Unit::GetCreature((*me), m_pInstance->GetData64(DATA_MOGRAINE))) { // checking m_bCanResurrectCheck prevents her healing Mograine while he is "faking death" - if (m_bCanResurrectCheck && pMograine->isAlive() && pMograine->GetHealth() <= pMograine->GetMaxHealth()*0.75f) + if (m_bCanResurrectCheck && pMograine->isAlive() && !pMograine->HealthAbovePct(75)) pTarget = pMograine; } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 677a02b0187..8b306f1f148 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -120,7 +120,7 @@ public: //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer. //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot. - if (me->GetHealth()*100 / me->GetMaxHealth() > 3) + if (HealthAbovePct(3)) { if (Teleport_Timer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp index 0bac76be60b..1915ac60f9e 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp @@ -96,7 +96,7 @@ public: m_uiBackhand_Timer -= uiDiff; //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 26) + if (HealthBelowPct(26)) { if (m_uiFrenzy_Timer <= uiDiff) { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp index 1f24d0511db..2524113d668 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp @@ -105,7 +105,7 @@ public: } else Minion_Timer -= diff; //Summon 2 Bone Mages - if (!Mages && me->GetHealth()*100 / me->GetMaxHealth() < 26) + if (!Mages && HealthBelowPct(26)) { //Cast SummonMages(me->getVictim()); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp index 51e9df14349..e320d3aca3b 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp @@ -84,7 +84,7 @@ public: m_uiBlastWave_Timer -= uiDiff; //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 25) + if (HealthBelowPct(25)) { if (m_uiFrenzy_Timer <= uiDiff) { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp index baf040dbaa4..01f29ee504f 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp @@ -156,7 +156,7 @@ public: } else m_uiHolyStrike_Timer -= uiDiff; //BalnazzarTransform - if (me->GetHealth()*100 / me->GetMaxHealth() < 40) + if (HealthBelowPct(40)) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index 6e4eb25fb12..4906c9837a6 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -131,7 +131,7 @@ public: if (HolyLight_Timer <= diff) { - if (me->GetHealth()*5 < me->GetMaxHealth()) + if (HealthBelowPct(20)) { DoCast(me, SPELL_HOLY_LIGHT); HolyLight_Timer = 20000; @@ -140,7 +140,7 @@ public: if (DivineShield_Timer <= diff) { - if (me->GetHealth()*20 < me->GetMaxHealth()) + if (HealthBelowPct(5)) { DoCast(me, SPELL_DIVINE_SHIELD); DivineShield_Timer = 40000; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index a5e68861f66..05933fae7b7 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -244,7 +244,7 @@ public: case 7: me->Kill(Madrigosa); DoScriptText(YELL_MADR_DEATH, Madrigosa); - me->SetHealth(me->GetMaxHealth()); + me->SetFullHealth(); me->AttackStop(); IntroPhaseTimer = 4000; ++IntroPhase; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 78051871384..dd55ae7d404 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -166,7 +166,7 @@ public: me->SetVisibility(VISIBILITY_ON); me->SetStandState(UNIT_STAND_STATE_SLEEP); } - me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. + me->SetFullHealth();//dunno why it does not resets health at evade.. ArcaneBuffetTimer = 8000; FrostBreathTimer = 15000; WildMagicTimer = 10000; @@ -598,7 +598,7 @@ public: void Reset() { - me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. + me->SetFullHealth();//dunno why it does not resets health at evade.. me->setActive(true); if (pInstance) { diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 8fa378037f7..c6c742f9688 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -154,7 +154,7 @@ class boss_archaedas : public CreatureScript } else WallMinionTimer -= diff; //If we are <66 summon the guardians - if (!guardiansAwake && me->GetHealth()*100 / me->GetMaxHealth() <= 66) { + if (!guardiansAwake && !HealthAbovePct(66)) { ActivateMinion(pInstance->GetData64(5),true); // EarthenGuardian1 ActivateMinion(pInstance->GetData64(6),true); // EarthenGuardian2 ActivateMinion(pInstance->GetData64(7),true); // EarthenGuardian3 @@ -167,7 +167,7 @@ class boss_archaedas : public CreatureScript } //If we are <33 summon the vault walkers - if (!vaultWalkersAwake && me->GetHealth()*100 / me->GetMaxHealth() <= 33) { + if (!vaultWalkersAwake && !HealthAbovePct(33)) { ActivateMinion(pInstance->GetData64(1),true); // VaultWalker1 ActivateMinion(pInstance->GetData64(2),true); // VaultWalker2 ActivateMinion(pInstance->GetData64(3),true); // VaultWalker3 diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp index da4b6a67cc9..5b9ce931cd1 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp @@ -67,7 +67,7 @@ class boss_ironaya : public CreatureScript return; //If we are <50% hp do knockaway ONCE - if (!hasCastedKnockaway && me->GetHealth()*2 < me->GetMaxHealth()) + if (!hasCastedKnockaway && HealthBelowPct(50)) { DoCast(me->getVictim(), SPELL_KNOCKAWAY, true); @@ -91,7 +91,7 @@ class boss_ironaya : public CreatureScript Arcing_Timer = 13000; } else Arcing_Timer -= diff; - if (!hasCastedWstomp && me->GetHealth()*4 < me->GetMaxHealth()) + if (!hasCastedWstomp && HealthBelowPct(25)) { DoCast(me, SPELL_WSTOMP); hasCastedWstomp = true; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 5b43bbbfd10..c604659148c 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -244,7 +244,7 @@ class boss_halazzi : public CreatureScript if (Phase == PHASE_LYNX) if (CheckTimer <= diff) { - if (me->GetHealth() * 4 < me->GetMaxHealth() * (3 - TransformCount)) + if (HealthBelowPct(25 * (3 - TransformCount))) EnterPhase(PHASE_SPLIT); CheckTimer = 1000; } else CheckTimer -= diff; @@ -273,12 +273,12 @@ class boss_halazzi : public CreatureScript if (Phase == PHASE_HUMAN) if (CheckTimer <= diff) { - if (((me->GetHealth()*100) / me->GetMaxHealth() <= 20)/*me->GetHealth() * 10 < me->GetMaxHealth()*/) + if (!HealthAbovePct(20) /*HealthBelowPct(10)*/) EnterPhase(PHASE_MERGE); else { Unit *Lynx = Unit::GetUnit(*me, LynxGUID); - if (Lynx && ((Lynx->GetHealth()*100) / Lynx->GetMaxHealth() <= 20)/*Lynx->GetHealth() * 10 < Lynx->GetMaxHealth()*/) + if (Lynx && !Lynx->HealthAbovePct(20) /*Lynx->HealthBelowPct(10)*/) EnterPhase(PHASE_MERGE); } CheckTimer = 1000; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index e5a98ee686d..5823b135a2d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -344,7 +344,7 @@ class boss_janalai : public CreatureScript return; //enrage if under 25% hp before 5 min. - if (!enraged && me->GetHealth() * 4 < me->GetMaxHealth()) + if (!enraged && HealthBelowPct(25)) EnrageTimer = 0; if (EnrageTimer <= diff) @@ -394,7 +394,7 @@ class boss_janalai : public CreatureScript if (!noeggs) { - if (100 * me->GetHealth() < 35 * me->GetMaxHealth()) + if (HealthBelowPct(35)) { DoScriptText(SAY_ALL_EGGS, me); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 964ae32fb59..719264a4d6b 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -191,7 +191,7 @@ class boss_zuljin : public CreatureScript Phase = 0; - health_20 = me->GetMaxHealth()*0.2f; + health_20 = me->CountPctFromMaxHealth(20); Intro_Timer = 37000; Berserk_Timer = 600000; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 26c10986ad5..0afd99d0c5f 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -109,7 +109,7 @@ class boss_jeklik : public CreatureScript if (me->getVictim() && me->isAlive()) { - if ((me->GetHealth()*100 / me->GetMaxHealth() > 50)) + if (HealthAbovePct(50)) { if (Charge_Timer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 90adeb5743a..1199acfda15 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -244,7 +244,7 @@ class boss_mandokir : public CreatureScript } else Fear_Timer -=diff; //Mortal Strike if target below 50% hp - if (me->getVictim() && me->getVictim()->GetHealth() < me->getVictim()->GetMaxHealth()*0.5) + if (me->getVictim() && me->getVictim()->HealthBelowPct(50)) { if (MortalStrike_Timer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index 0bbe81f900f..083df57f385 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -139,7 +139,7 @@ class boss_thekal : public CreatureScript pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->setFaction(14); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); + pLorKhan->SetFullHealth(); m_pInstance->SetData(TYPE_LORKHAN, DONE); } @@ -154,7 +154,7 @@ class boss_thekal : public CreatureScript pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->setFaction(14); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); + pZath->SetFullHealth(); m_pInstance->SetData(TYPE_ZATH, DONE); } @@ -176,7 +176,7 @@ class boss_thekal : public CreatureScript Silence_Timer = 20000 + rand()%5000; } else Silence_Timer -= diff; - if (!PhaseTwo && !WasDead && me->GetHealth() <= me->GetMaxHealth() * 0.05) + if (!PhaseTwo && !WasDead && !HealthAbovePct(5)) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_SLEEP); @@ -197,7 +197,7 @@ class boss_thekal : public CreatureScript me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); me->SetStandState(UNIT_STAND_STATE_STAND); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetHealth(int(me->GetMaxHealth()*1.0)); + me->SetFullHealth(); const CreatureInfo *cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); @@ -207,7 +207,7 @@ class boss_thekal : public CreatureScript } else Resurrect_Timer -= diff; } - if ((me->GetHealth()*100 / me->GetMaxHealth() == 100) && WasDead) + if (me->IsFullHealth() && WasDead) { WasDead = false; } @@ -244,7 +244,7 @@ class boss_thekal : public CreatureScript SummonTigers_Timer = 10000 + rand()%4000; } else SummonTigers_Timer -= diff; - if ((me->GetHealth()*100 / me->GetMaxHealth() < 11) && !Enraged) + if (HealthBelowPct(11) && !Enraged) { DoCast(me, SPELL_ENRAGE); Enraged = true; @@ -376,7 +376,7 @@ class mob_zealot_lorkhan : public CreatureScript pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pThekal->setFaction(14); - pThekal->SetHealth(int(pThekal->GetMaxHealth()*1.0)); + pThekal->SetFullHealth(); } } @@ -388,7 +388,7 @@ class mob_zealot_lorkhan : public CreatureScript pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pZath->setFaction(14); - pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); + pZath->SetFullHealth(); } } } @@ -396,7 +396,7 @@ class mob_zealot_lorkhan : public CreatureScript Check_Timer = 5000; } else Check_Timer -= diff; - if (me->GetHealth() <= me->GetMaxHealth() * 0.05) + if (!HealthAbovePct(5)) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_SLEEP); @@ -526,7 +526,7 @@ class mob_zealot_zath : public CreatureScript pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pLorKhan->setFaction(14); - pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); + pLorKhan->SetFullHealth(); } } @@ -538,7 +538,7 @@ class mob_zealot_zath : public CreatureScript pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pThekal->setFaction(14); - pThekal->SetHealth(int(pThekal->GetMaxHealth()*1.0)); + pThekal->SetFullHealth(); } } } @@ -546,7 +546,7 @@ class mob_zealot_zath : public CreatureScript Check_Timer = 5000; } else Check_Timer -= diff; - if (me->GetHealth() <= me->GetMaxHealth() * 0.05) + if (!HealthAbovePct(5)) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_SLEEP); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index cee1ea50032..3dfe5056891 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -100,7 +100,7 @@ class boss_venoxis : public CreatureScript if (!UpdateVictim()) return; - if ((me->GetHealth()*100 / me->GetMaxHealth() > 50)) + if (HealthAbovePct(50)) { if (Dispell_Timer <= diff) { @@ -180,7 +180,7 @@ class boss_venoxis : public CreatureScript VenomSpit_Timer = 15000 + rand()%5000; } else VenomSpit_Timer -= diff; - if (PhaseTwo && (me->GetHealth()*100 / me->GetMaxHealth() < 11)) + if (PhaseTwo && HealthBelowPct(11)) { if (!InBerserk) { diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index 6dab06ff8b8..ee9d1530dac 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -271,7 +271,7 @@ public: // healer if (spellFlashLight) - if (me->GetHealth()*100 / me->GetMaxHealth() < 70) + if (HealthBelowPct(70)) if (timerFlashLight <= diff) { DoCast(me, SPELL_FLASH_OF_LIGHT); diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index 63a7a5b7167..17368bb6794 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -133,7 +133,7 @@ public: void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage)) { //Take 0 damage uiDamage = 0; @@ -207,7 +207,7 @@ public: void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage)) { uiDamage = 0; diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp index dcab41fbc9e..031ee584246 100644 --- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp @@ -96,7 +96,7 @@ public: void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage)) { uiDamage = 0; diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp index 3dce0f98411..01e103843f7 100644 --- a/src/server/scripts/EasternKingdoms/wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/wetlands.cpp @@ -113,7 +113,7 @@ public: void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) { - if (me->GetHealth()*100 < me->GetMaxHealth()*20) + if (HealthBelowPct(20)) { if (Player* pPlayer = GetPlayerForEscort()) { |
