* 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
This commit is contained in:
azazel committed 2010-08-26 01:20:57 +06:00
1 parent bb5f7b6492
commit 341e6303ef
166 files changed
+445 -416

No files matched your search

@@ -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)
{
@@ -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());
@@ -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)
{
@@ -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)
{
@@ -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;
@@ -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
@@ -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;
@@ -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);
@@ -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;
@@ -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);
@@ -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;
@@ -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());
}
}
@@ -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);
@@ -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)
@@ -243,7 +243,7 @@ public:
return;
}
if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() < 30)
if (!Enrage && HealthBelowPct(30))
{
DoCast(me, SPELL_FRENZY);
Enrage = true;
@@ -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();
@@ -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;
@@ -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;
@@ -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())
@@ -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();
@@ -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;
@@ -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)
@@ -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);
@@ -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);
@@ -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();
@@ -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);
}
@@ -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);
@@ -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))
@@ -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)
@@ -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;
@@ -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();
@@ -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);
@@ -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;
@@ -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;
@@ -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;
}
}
@@ -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)
{
@@ -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)
{
@@ -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());
@@ -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)
{
@@ -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);
@@ -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;
@@ -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;
@@ -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)
{
@@ -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
@@ -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;
@@ -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;
@@ -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);
@@ -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;
@@ -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)
{
@@ -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)
{
@@ -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);
@@ -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)
{
@@ -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);
@@ -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;
@@ -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;
@@ -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())
{
@@ -116,7 +116,7 @@ public:
{
if (Unit* Archimonde = Unit::GetUnit((*me), ArchimondeGUID))
{
if ((((Archimonde->GetHealth()*100) / Archimonde->GetMaxHealth()) < 2) || !Archimonde->isAlive())
if (Archimonde->HealthBelowPct(2) || !Archimonde->isAlive())
DoCast(me, SPELL_DENOUEMENT_WISP);
else
DoCast(Archimonde, SPELL_ANCIENT_SPARK);
@@ -504,14 +504,14 @@ public:
if (!UpdateVictim())
return;
if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !BelowTenPercent && !Enraged)
if (me->HealthBelowPct(10) && !BelowTenPercent && !Enraged)
BelowTenPercent = true;
if (!Enraged)
{
if (EnrageTimer <= diff)
{
if ((me->GetHealth()*100 / me->GetMaxHealth()) > 10)
if (HealthAbovePct(10))
{
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveIdle();
@@ -551,7 +551,7 @@ public:
return;
//TODO: add his abilities'n-crap here
if (!LowHp && ((me->GetHealth()*100 / me->GetMaxHealth()) < 20))
if (!LowHp && HealthBelowPct(20))
{
DoScriptText(RAND(SAY_TH_RANDOM_LOW_HP1,SAY_TH_RANDOM_LOW_HP2), me);
LowHp = true;
@@ -78,7 +78,7 @@ public:
} else Trample_Timer -= diff;
//Landslide
if (me->GetHealth()*100 / me->GetMaxHealth() < 50)
if (HealthBelowPct(50))
{
if (Landslide_Timer <= diff)
{
@@ -344,7 +344,7 @@ public:
//Specific to PHASE_START || PHASE_END
if (m_uiPhase == PHASE_START)
{
if (me->GetHealth()*100 / me->GetMaxHealth() < 60)
if (HealthBelowPct(60))
{
SetCombatMovement(false);
m_uiPhase = PHASE_BREATH;
@@ -406,7 +406,7 @@ public:
}
else
{
if (me->GetHealth()*100 / me->GetMaxHealth() < 40)
if (HealthBelowPct(40))
{
m_uiPhase = PHASE_END;
if (m_pInstance)
@@ -102,20 +102,20 @@ public:
FrostNova_Timer = 15000;
} else FrostNova_Timer -= diff;
if (!Spectrals60 && me->GetHealth()*100 / me->GetMaxHealth() < 60)
if (!Spectrals60 && HealthBelowPct(60))
{
DoScriptText(SAY_SUMMON60, me);
DoCast(me->getVictim(), SPELL_FROST_SPECTRES);
Spectrals60 = true;
}
if (!Hp && me->GetHealth()*100 / me->GetMaxHealth() < 50)
if (!Hp && HealthBelowPct(50))
{
DoScriptText(SAY_HP, me);
Hp = true;
}
if (!Spectrals30 && me->GetHealth()*100 / me->GetMaxHealth() < 30)
if (!Spectrals30 && HealthBelowPct(30))
{
DoScriptText(SAY_SUMMON30, me);
DoCast(me->getVictim(), SPELL_FROST_SPECTRES);
@@ -41,7 +41,7 @@ public:
uint32 m_auiEncounter[MAX_ENCOUNTER];
uint8 uiGongWaves;
uint16 uiGongWaves;
std::string str_data;
@@ -92,7 +92,7 @@ public:
return;
//If he is 70% start phase 2
if (phase == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 70 && !me->IsNonMeleeSpellCasted(false))
if (phase == 1 && !HealthAbovePct(70) && !me->IsNonMeleeSpellCasted(false))
{
phase=2;
}
@@ -93,7 +93,7 @@ public:
return;
//If we are <30% cast enrage
if (!bIsEnraged && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false))
if (!bIsEnraged && !HealthAbovePct(30) && !me->IsNonMeleeSpellCasted(false))
{
bIsEnraged = true;
DoCast(me, SPELL_ENRAGE);
@@ -57,7 +57,7 @@ public:
uint64 uiAyamiss;
uint64 uiOssirian;
uint8 m_auiEncounter[MAX_ENCOUNTER];
uint16 m_auiEncounter[MAX_ENCOUNTER];
std::string str_data;
void Initialize()
@@ -108,7 +108,7 @@ public:
ToxicVolley_Timer = 10000 + rand()%5000;
} else ToxicVolley_Timer -= diff;
if (me->GetHealth() <= me->GetMaxHealth() * 0.05 && !Death)
if (!HealthAbovePct(5) && !Death)
{
DoCast(me->getVictim(), SPELL_POISON_CLOUD);
Death = true;
@@ -357,9 +357,9 @@ public:
{
//Set angle and cast
if (ClockWise)
me->SetOrientation(DarkGlareAngle + ((float)DarkGlareTick*PI/35));
me->SetOrientation(DarkGlareAngle + DarkGlareTick * M_PI / 35);
else
me->SetOrientation(DarkGlareAngle - ((float)DarkGlareTick*PI/35));
me->SetOrientation(DarkGlareAngle - DarkGlareTick * M_PI / 35);
me->StopMoving();
@@ -666,7 +666,7 @@ public:
//Switch to c'thun model
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_TRANSFORM, false);
me->SetHealth(me->GetMaxHealth());
me->SetFullHealth();
me->SetVisibility(VISIBILITY_ON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
@@ -132,7 +132,7 @@ public:
// Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer.
//We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot.
if (me->GetHealth()*100 / me->GetMaxHealth() > 3)
if (HealthAbovePct(3))
{
if (SpawnHatchlings_Timer <= diff)
{
@@ -132,7 +132,7 @@ public:
FrenzyBack_Timer = 15000;
} else FrenzyBack_Timer -= diff;
if (!Berserk && me->GetHealth()*100 / me->GetMaxHealth() < 31)
if (!Berserk && HealthBelowPct(31))
{
me->InterruptNonMeleeSpells(false);
DoScriptText(EMOTE_GENERIC_BERSERK, me);
@@ -158,7 +158,7 @@ public:
//If she is 20% enrage
if (!Enraged)
{
if (me->GetHealth()*100 / me->GetMaxHealth() <= 20 && !me->IsNonMeleeSpellCasted(false))
if (!HealthAbovePct(20) && !me->IsNonMeleeSpellCasted(false))
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
@@ -174,15 +174,14 @@ public:
Blink_Timer= 20000 + rand()%20000;
} else Blink_Timer -= diff;
int procent = (int) (me->GetHealth()*100 / me->GetMaxHealth() +0.5f);
int procent = (int) (me->GetHealthPct() + 0.5f);
//Summoning 2 Images and teleporting to a random position on 75% health
if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70))
DoSplit(75);
//Summoning 2 Images and teleporting to a random position on 50% health
if ((!Images50 && !IsImage) &&
(procent <= 50 && procent > 45))
if ((!Images50 && !IsImage) && (procent <= 50 && procent > 45))
DoSplit(50);
//Summoning 2 Images and teleporting to a random position on 25% health
@@ -423,7 +423,7 @@ public:
pTarget->setFaction(14);
pTarget->AI()->AttackStart(me->getThreatManager().getHostilTarget());
pTarget->AddAura(SPELL_MUTATE_BUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
pTarget->SetFullHealth();
}
void UpdateAI(const uint32 diff)
@@ -512,7 +512,7 @@ public:
{
pTarget->setFaction(14);
pTarget->AddAura(SPELL_EXPLODEBUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
pTarget->SetFullHealth();
}
void UpdateAI(const uint32 diff)
@@ -251,10 +251,7 @@ public:
continue;
if (sent->isDead())
continue;
uint32 h = sent->GetHealth() + (sent->GetMaxHealth() / 2);
if (h > sent->GetMaxHealth())
h = sent->GetMaxHealth();
sent->SetHealth(h);
sent->ModifyHealth(int32(sent->CountPctFromMaxHealth(50)));
CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability);
}
}
@@ -94,7 +94,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
me->SetHealth(int(me->GetMaxHealth()*.1));
me->SetHealth(me->CountPctFromMaxHealth(10));
me->SetStandState(UNIT_STAND_STATE_SLEEP);
}
@@ -309,7 +309,7 @@ public:
void Reset()
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
me->SetHealth(int(me->GetMaxHealth()*.15));
me->SetHealth(me->CountPctFromMaxHealth(15));
switch (rand()%2)
{
case 0: me->SetStandState(UNIT_STAND_STATE_SIT); break;
@@ -142,7 +142,7 @@ public:
} else Cleave_Timer -= diff;
//Enrage_Timer
if (me->GetHealth()*100 / me->GetMaxHealth() < 26 && !Enraged)
if (HealthBelowPct(26) && !Enraged)
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
@@ -344,7 +344,7 @@ public:
void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
{
if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 20))
if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(20, uiDamage))
{
uiDamage = 0;
+1 -1
View File
@@ -410,7 +410,7 @@ public:
if (quest->GetQuestId() == Q_OOX17)
{
pCreature->setFaction(113);
pCreature->SetHealth(pCreature->GetMaxHealth());
pCreature->SetFullHealth();
pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
DoScriptText(SAY_OOX_START, pCreature);
@@ -96,12 +96,7 @@ public:
if (!Victim || !Victim->HasAura(DUNGEON_MODE(SPELL_LEECH_POISON, H_SPELL_LEECH_POISON)) || !me->isAlive())
return;
uint32 health = me->GetMaxHealth()/10;
if ((me->GetHealth()+health) >= me->GetMaxHealth())
me->SetHealth(me->GetMaxHealth());
else
me->SetHealth(me->GetHealth()+health);
me->ModifyHealth(int32(me->CountPctFromMaxHealth(10)));
}
void JustDied(Unit* /*Killer*/)
@@ -293,7 +293,7 @@ public:
} else uiRenewTimer -= uiDiff;
if (!bHealth && me->GetHealth()*100 / me->GetMaxHealth() <= 25)
if (!bHealth && !HealthAbovePct(25))
{
me->InterruptNonMeleeSpells(true);
DoCastAOE(SPELL_HOLY_NOVA,false);
@@ -159,7 +159,7 @@ public:
if (bEventInProgress)
if (uiResurrectTimer <= uiDiff)
{
me->SetHealth(me->GetMaxHealth());
me->SetFullHealth();
DoCast(me,SPELL_BLACK_KNIGHT_RES,true);
uiPhase++;
uiResurrectTimer = 4000;
@@ -257,7 +257,7 @@ public:
}
}
if (!me->hasUnitState(UNIT_STAT_ROOT) && !me->GetHealth()*100 / me->GetMaxHealth() <= 0)
if (!me->hasUnitState(UNIT_STAT_ROOT) && !me->HealthBelowPct(1))
DoMeleeAttackIfReady();
}
@@ -43,8 +43,8 @@ public:
uint32 m_auiEncounter[MAX_ENCOUNTER];
uint8 uiMovementDone;
uint8 uiGrandChampionsDeaths;
uint16 uiMovementDone;
uint16 uiGrandChampionsDeaths;
uint8 uiArgentSoldierDeaths;
uint64 uiAnnouncerGUID;
@@ -107,7 +107,8 @@ enum SummonActions
ACTION_SHADOW_STRIKE,
ACTION_SCARAB_SUBMERGE,
};
const Position SphereSpawn[6] =
const Position SphereSpawn[6] =
{
{ 786.6439f, 108.2498f, 155.6701f, 0 },
{ 806.8429f, 150.5902f, 155.6701f, 0 },
@@ -115,7 +116,9 @@ enum SummonActions
{ 744.3701f, 119.5211f, 155.6701f, 0 },
{ 710.0211f, 120.8152f, 155.6701f, 0 },
{ 706.6383f, 161.5266f, 155.6701f, 0 },
}; class boss_anubarak_trial : public CreatureScript
};
class boss_anubarak_trial : public CreatureScript
{
public:
boss_anubarak_trial() : CreatureScript("boss_anubarak_trial") { }
@@ -400,7 +403,8 @@ public:
};
class mob_swarm_scarab : public CreatureScript
class mob_swarm_scarab : public CreatureScript
{
public:
mob_swarm_scarab() : CreatureScript("mob_swarm_scarab") { }
@@ -467,7 +471,8 @@ public:
};
class mob_nerubian_burrower : public CreatureScript
class mob_nerubian_burrower : public CreatureScript
{
public:
mob_nerubian_burrower() : CreatureScript("mob_nerubian_burrower") { }
@@ -544,7 +549,8 @@ public:
};
class mob_frost_sphere : public CreatureScript
class mob_frost_sphere : public CreatureScript
{
public:
mob_frost_sphere() : CreatureScript("mob_frost_sphere") { }
@@ -624,7 +630,8 @@ public:
};
class mob_anubarak_spike : public CreatureScript
class mob_anubarak_spike : public CreatureScript
{
public:
mob_anubarak_spike() : CreatureScript("mob_anubarak_spike") { }
@@ -47,7 +47,8 @@ enum eSpells
SPELL_ANTI_AOE = 68595,
SPELL_PVP_TRINKET = 65547,
};
class boss_toc_champion_controller : public CreatureScript
class boss_toc_champion_controller : public CreatureScript
{
public:
boss_toc_champion_controller() : CreatureScript("boss_toc_champion_controller") { }
@@ -447,7 +448,8 @@ enum eDruidSpells
SPELL_THORNS = 66068,
SPELL_NATURE_GRASP = 66071, //1 min cd, self buff
};
class mob_toc_druid : public CreatureScript
class mob_toc_druid : public CreatureScript
{
public:
mob_toc_druid() : CreatureScript("mob_toc_druid") { }
@@ -542,7 +544,8 @@ enum eShamanSpells
AURA_EXHAUSTION = 57723,
AURA_SATED = 57724,
};
class mob_toc_shaman : public CreatureScript
class mob_toc_shaman : public CreatureScript
{
public:
mob_toc_shaman() : CreatureScript("mob_toc_shaman") { }
@@ -634,7 +637,8 @@ enum ePaladinSpells
SPELL_HAND_OF_PROTECTION = 66009,
SPELL_HAMMER_OF_JUSTICE = 66613,
};
class mob_toc_paladin : public CreatureScript
class mob_toc_paladin : public CreatureScript
{
public:
mob_toc_paladin() : CreatureScript("mob_toc_paladin") { }
@@ -682,7 +686,7 @@ public:
if (m_uiHandOfProtectionTimer <= uiDiff)
{
if (Unit *pTarget = DoSelectLowestHpFriendly(40.0f))
if (pTarget->GetHealth() * 100 < pTarget->GetMaxHealth() * 15) // HealthBelowPct(15)
if (pTarget->HealthBelowPct(15))
DoCast(pTarget,SPELL_HAND_OF_PROTECTION);
m_uiHandOfProtectionTimer = urand(0*IN_MILLISECONDS,360*IN_MILLISECONDS);
} else m_uiHandOfProtectionTimer -= uiDiff;
@@ -739,7 +743,9 @@ enum ePriestSpells
SPELL_DISPEL = 65546,
SPELL_PSYCHIC_SCREAM = 65543,
SPELL_MANA_BURN = 66100,
}; class mob_toc_priest : public CreatureScript
};
class mob_toc_priest : public CreatureScript
{
public:
mob_toc_priest() : CreatureScript("mob_toc_priest") { }
@@ -819,7 +825,8 @@ enum eShadowPriestSpells
SPELL_DISPERSION = 65544,
SPELL_SHADOWFORM = 16592,
};
class mob_toc_shadow_priest : public CreatureScript
class mob_toc_shadow_priest : public CreatureScript
{
public:
mob_toc_shadow_priest() : CreatureScript("mob_toc_shadow_priest") { }
@@ -930,7 +937,9 @@ enum eWarlockSpells
SPELL_UNSTABLE_AFFLICTION = 65812,
SPELL_SUMMON_FELHUNTER = 67514,
H_SPELL_UNSTABLE_AFFLICTION = 68155, //15s
}; class mob_toc_warlock : public CreatureScript
};
class mob_toc_warlock : public CreatureScript
{
public:
mob_toc_warlock() : CreatureScript("mob_toc_warlock") { }
@@ -1035,7 +1044,9 @@ enum eMageSpells
SPELL_FROSTBOLT = 65807,
SPELL_ICE_BLOCK = 65802, //5min
SPELL_POLYMORPH = 65801, //15s
}; class mob_toc_mage : public CreatureScript
};
class mob_toc_mage : public CreatureScript
{
public:
mob_toc_mage() : CreatureScript("mob_toc_mage") { }
@@ -1137,7 +1148,8 @@ enum eHunterSpells
SPELL_WYVERN_STING = 65877, //60s
SPELL_CALL_PET = 67777,
};
class mob_toc_hunter : public CreatureScript
class mob_toc_hunter : public CreatureScript
{
public:
mob_toc_hunter() : CreatureScript("mob_toc_hunter") { }
@@ -1251,7 +1263,9 @@ enum eBoomkinSpells
SPELL_MOONFIRE = 65856, //5s
SPELL_STARFIRE = 65854,
SPELL_WRATH = 65862,
}; class mob_toc_boomkin : public CreatureScript
};
class mob_toc_boomkin : public CreatureScript
{
public:
mob_toc_boomkin() : CreatureScript("mob_toc_boomkin") { }
@@ -1353,7 +1367,9 @@ enum eWarriorSpells
SPELL_SUNDER_ARMOR = 65936,
SPELL_SHATTERING_THROW = 65940,
SPELL_RETALIATION = 65932,
}; class mob_toc_warrior : public CreatureScript
};
class mob_toc_warrior : public CreatureScript
{
public:
mob_toc_warrior() : CreatureScript("mob_toc_warrior") { }
@@ -1465,7 +1481,9 @@ enum eDeathKnightSpells
SPELL_ICEBOUND_FORTITUDE = 66023, //1min
SPELL_ICY_TOUCH = 66021, //8sec
SPELL_STRANGULATE = 66018, //2min
}; class mob_toc_dk : public CreatureScript
};
class mob_toc_dk : public CreatureScript
{
public:
mob_toc_dk() : CreatureScript("mob_toc_dk") { }
@@ -1565,7 +1583,9 @@ enum eRogueSpells
SPELL_SHADOWSTEP = 66178, //30sec
SPELL_HEMORRHAGE = 65954,
SPELL_EVISCERATE = 65957,
}; class mob_toc_rogue : public CreatureScript
};
class mob_toc_rogue : public CreatureScript
{
public:
mob_toc_rogue() : CreatureScript("mob_toc_rogue") { }
@@ -1663,7 +1683,8 @@ enum eEnhShamanSpells
SPELL_LAVA_LASH = 65974,
SPELL_STORMSTRIKE = 65970,
};
class mob_toc_enh_shaman : public CreatureScript
class mob_toc_enh_shaman : public CreatureScript
{
public:
mob_toc_enh_shaman() : CreatureScript("mob_toc_enh_shaman") { }
@@ -1796,7 +1817,8 @@ enum eRetroPaladinSpells
SPELL_REPENTANCE = 66008, //60sec cd
SPELL_SEAL_OF_COMMAND = 66004, //no cd
};
class mob_toc_retro_paladin : public CreatureScript
class mob_toc_retro_paladin : public CreatureScript
{
public:
mob_toc_retro_paladin() : CreatureScript("mob_toc_retro_paladin") { }
@@ -261,7 +261,7 @@ struct boss_twin_baseAI : public ScriptedAI
if (caster->ToCreature() == me)
if (spell->Effect[0] == 136) //Effect Heal
if (m_pInstance)
m_pInstance->SetData(DATA_HEALTH_TWIN_SHARED, me->GetHealth() + me->GetMaxHealth()*spell->EffectBasePoints[0]/100);
m_pInstance->SetData(DATA_HEALTH_TWIN_SHARED, me->GetHealth() + me->CountPctFromMaxHealth(spell->EffectBasePoints[0]));
}
void SummonColorballs(uint8 quantity)
@@ -270,7 +270,7 @@ struct boss_twin_baseAI : public ScriptedAI
float y = y0;
for (uint8 i = 0; i < quantity; i++)
{
float x = urand(x0-r,x0+r);
float x = float(urand(uint32(x0 - r), uint32(x0 + r)));
if (urand(0,1))
y = y0 + sqrt(pow(r,2) - pow((x-x0),2));
else
@@ -420,7 +420,8 @@ struct boss_twin_baseAI : public ScriptedAI
/*######
## boss_fjola
######*/
class boss_fjola : public CreatureScript
class boss_fjola : public CreatureScript
{
public:
boss_fjola() : CreatureScript("boss_fjola") { }
@@ -479,7 +480,8 @@ public:
/*######
## boss_eydis
######*/
class boss_eydis : public CreatureScript
class boss_eydis : public CreatureScript
{
public:
boss_eydis() : CreatureScript("boss_eydis") { }
@@ -520,7 +522,8 @@ public:
};
class mob_essence_of_twin : public CreatureScript
class mob_essence_of_twin : public CreatureScript
{
public:
mob_essence_of_twin() : CreatureScript("mob_essence_of_twin") { }
@@ -560,7 +563,7 @@ struct mob_unleashed_ballAI : public ScriptedAI
{
float x0 = ToCCommonLoc[1].GetPositionX(), y0 = ToCCommonLoc[1].GetPositionY(), r = 47.0f;
float y = y0;
float x = urand(x0-r,x0+r);
float x = float(urand(uint32(x0 - r), uint32(x0 + r)));
if (urand(0,1))
y = y0 + sqrt(pow(r,2) - pow((x-x0),2));
else
@@ -594,7 +597,8 @@ struct mob_unleashed_ballAI : public ScriptedAI
}
}
};
class mob_unleashed_dark : public CreatureScript
class mob_unleashed_dark : public CreatureScript
{
public:
mob_unleashed_dark() : CreatureScript("mob_unleashed_dark") { }
@@ -627,7 +631,8 @@ public:
};
class mob_unleashed_light : public CreatureScript
class mob_unleashed_light : public CreatureScript
{
public:
mob_unleashed_light() : CreatureScript("mob_unleashed_light") { }
@@ -63,7 +63,7 @@ public:
uint64 uiNovosCrystal3;
uint64 uiNovosCrystal4;
uint8 m_auiEncounter[MAX_ENCOUNTER];
uint16 m_auiEncounter[MAX_ENCOUNTER];
std::string str_data;
@@ -124,7 +124,7 @@ public:
me->ExitVehicle();
// restore health if any damage done during intro
me->SetHealth(me->GetMaxHealth());
me->SetFullHealth();
if (pInstance)
pInstance->SetData(DATA_TYRANNUS_EVENT, IN_PROGRESS);
@@ -105,7 +105,7 @@ public:
if (!UpdateVictim())
return;
if (!bHealth && HealthBelowPct(50) && !HealthBelowPct(5))
if (!bHealth && HealthBelowPct(50) && !HealthBelowPct(5))
{
CreatureState(me, false);
DoCast(me,SPELL_FREEZE_ANIM);
@@ -140,7 +140,7 @@ public:
void JustSummoned(Creature* pSummon)
{
if (HealthBelowPct(5))
pSummon->DealDamage(pSummon, pSummon->GetHealth() * 0.5 , NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
pSummon->DealDamage(pSummon, pSummon->GetHealth() * 0.5, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
pSummon->AI()->AttackStart(me->getVictim());
}
};
@@ -498,8 +498,7 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader
return;
float distVar = distance >= 20.0f ? 4 : (10.0f/3.0f);
dmg /= distance / distVar;
SetHitDamage(dmg);
SetHitDamage(int32(dmg * distVar / distance));
}
void Register()
@@ -134,7 +134,7 @@ public:
if (me->IsWithinMeleeRange(me->getVictim()))
{
me->Kill(me->getVictim());
me->ModifyHealth(me->GetMaxHealth() * 0.05f);
me->ModifyHealth(int32(me->CountPctFromMaxHealth(5)));
}
}
else
@@ -94,7 +94,7 @@ public:
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))
if (!pTarget->HasAura(SPELL_MUTATING_INJECTION))
DoCast(pTarget, SPELL_MUTATING_INJECTION);
events.ScheduleEvent(EVENT_INJECT, 8000 + 12000 * ((float)me->GetHealth() / me->GetMaxHealth()));
events.ScheduleEvent(EVENT_INJECT, 8000 + uint32(120 * me->GetHealthPct()));
return;
}
}
@@ -142,7 +142,7 @@ public:
uiCrystalSpikesTimer2 = 200;
} else uiCrystalSpikesTimer2 -= diff;
if (!bFrenzy && (me->GetHealth() < me->GetMaxHealth() * 0.25))
if (!bFrenzy && HealthBelowPct(25))
{
DoCast(me, SPELL_FRENZY);
bFrenzy = true;
@@ -569,7 +569,7 @@ public:
Unit* pVesp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_VESPERON) : 0);
//spell will target dragons, if they are still alive at 35%
if (!m_bIsBerserk && (me->GetHealth()*100 / me->GetMaxHealth()) <= 35
if (!m_bIsBerserk && !HealthAbovePct(35)
&& ((pTene && pTene->isAlive()) || (pShad && pShad->isAlive()) || (pVesp && pVesp->isAlive())))
{
DoScriptText(SAY_SARTHARION_BERSERK, me);
@@ -202,7 +202,7 @@ public:
m_uiLightningNova_Timer -= uiDiff;
// Health check
if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*m_uiHealthAmountModifier)))
if (HealthBelowPct(100 - 25 * m_uiHealthAmountModifier))
{
switch(m_uiHealthAmountModifier)
{
@@ -312,7 +312,7 @@ public:
}
// Health check
if (!m_bCanShatterGolem && (me->GetHealth()*100 / me->GetMaxHealth()) < (100-(20*m_uiHealthAmountModifier)))
if (!m_bCanShatterGolem && me->HealthBelowPct(100 - 20 * m_uiHealthAmountModifier))
{
++m_uiHealthAmountModifier;
@@ -190,11 +190,11 @@ public:
{
if (Creature* Brundir = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0))
if (Brundir->isAlive())
Brundir->SetHealth(Brundir->GetMaxHealth());
Brundir->SetFullHealth();
if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0))
if (Molgeim->isAlive())
Molgeim->SetHealth(Molgeim->GetMaxHealth());
Molgeim->SetFullHealth();
DoCast(SPELL_SUPERCHARGE);
}
@@ -315,11 +315,11 @@ public:
{
if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0))
if (Steelbreaker->isAlive())
Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth());
Steelbreaker->SetFullHealth();
if (Creature* Brundir = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0))
if (Brundir->isAlive())
Brundir->SetHealth(Brundir->GetMaxHealth());
Brundir->SetFullHealth();
DoCast(me, SPELL_SUPERCHARGE);
}
@@ -521,11 +521,11 @@ public:
{
if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0))
if (Steelbreaker->isAlive())
Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth());
Steelbreaker->SetFullHealth();
if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0))
if (Molgeim->isAlive())
Molgeim->SetHealth(Molgeim->GetMaxHealth());
Molgeim->SetFullHealth();
DoCast(SPELL_SUPERCHARGE);
}
@@ -131,13 +131,13 @@ public:
if (me->getVictim() && !me->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
me->Kill(me->getVictim());
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 99 && Phase == 1) // TODO: Only land (exit Phase 1) if brought down with harpoon guns! This is important!
if (HealthBelowPct(99) && Phase == 1) // TODO: Only land (exit Phase 1) if brought down with harpoon guns! This is important!
{
Phase = 2;
DoScriptText(SAY_PHASE_2_TRANS, me); // Audio: "Move quickly! She won't remain grounded for long!"
}
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 33 && Phase == 2) // Health under 33%, Razorscale can't fly anymore.
if (HealthBelowPct(33) && Phase == 2) // Health under 33%, Razorscale can't fly anymore.
{
Phase = 3;
DoScriptText(SAY_PHASE_3_TRANS, me); // "Razorscale lands permanently!"
@@ -254,7 +254,7 @@ public:
enterHardMode = true;
// set max health
me->SetHealth(me->GetMaxHealth());
me->SetFullHealth();
// Get his heartbreak buff
me->CastSpell(me, RAID_MODE(SPELL_HEARTBREAK_10, SPELL_HEARTBREAK_25), true);
@@ -611,7 +611,7 @@ public:
// TODO Send raid message
// Increase health with 1 percent
pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01);
pXT002->ModifyHealth(int32(pXT002->CountPctFromMaxHealth(1)));
// Despawns the scrapbot
me->ForcedDespawn();
@@ -318,7 +318,7 @@ public:
} else m_uiAbility_TORGYN_Timer -= diff;
// Health check -----------------------------------------------------------------------------
if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(m_uiHealthAmountMultipler * m_uiHealthAmountModifier)))
if (me->HealthBelowPct(100 - m_uiHealthAmountMultipler * m_uiHealthAmountModifier))
{
uint8 m_uiOrder = m_uiHealthAmountModifier - 1;
++m_uiHealthAmountModifier;
@@ -142,7 +142,7 @@ public:
if (minion && minion->isAlive())
{
minion->CastSpell(me, SPELL_OVERCHARGED, true);
minion->SetHealth(minion->GetMaxHealth());
minion->SetFullHealth();
DoScriptText(EMOTE_OVERCHARGE, me);
events.ScheduleEvent(EVENT_OVERCHARGE, 45000);
}
@@ -238,11 +238,11 @@ public:
return me->GetGUID();
Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0);
if (pGuard1 && pGuard1->isAlive() && (pGuard1->GetHealth()*100 <= pGuard1->GetMaxHealth() * 75))
if (pGuard1 && pGuard1->isAlive() && !pGuard1->HealthAbovePct(75))
return pGuard1->GetGUID();
Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0);
if (pGuard2 && pGuard2->isAlive() && (pGuard2->GetHealth()*100 <= pGuard2->GetMaxHealth() * 75))
if (pGuard2 && pGuard2->isAlive() && !pGuard2->HealthAbovePct(75))
return pGuard2->GetGUID();
return 0;
Loaded 100 of 166 files, more files were not shown because too many files have changed in this diff. Show more