diff options
| author | azazel <none@none> | 2010-08-26 01:20:57 +0600 |
|---|---|---|
| committer | azazel <none@none> | 2010-08-26 01:20:57 +0600 |
| commit | 341e6303effccfdbfb6b67ae0d8fe6933f56ed3b (patch) | |
| tree | eff917fec707c7097a7b408ce15842ff24d8ddb4 /src/server/scripts/Outland/TempestKeep | |
| parent | bb5f7b64927713911331f81f9c0a5abc33e0c3ab (diff) | |
Core:
* add helping methods for manipulating unit's health and use it where applicable
* fix some conversion warnings and cleanup code (formatting, CRLF, tabs to spaces)
--HG--
branch : trunk
Diffstat (limited to 'src/server/scripts/Outland/TempestKeep')
6 files changed, 12 insertions, 12 deletions
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 05a1b86f79c..d913ec28aeb 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -265,7 +265,7 @@ class boss_alar : public CreatureScript return; case WE_REVIVE: me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - me->SetHealth(me->GetMaxHealth()); + me->SetFullHealth(); me->SetSpeed(MOVE_RUN, DefaultMoveSpeedRate); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoZoneInCombat(); @@ -502,7 +502,7 @@ class mob_ember_of_alar : public CreatureScript { if (Unit* Alar = Unit::GetUnit((*me), pInstance->GetData64(DATA_ALAR))) { - int AlarHealth = Alar->GetHealth() - Alar->GetMaxHealth()*0.03f; + int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3)); if (AlarHealth > 0) Alar->SetHealth(AlarHealth); else diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index ebccc21e969..abfc717df4a 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -384,7 +384,7 @@ class boss_high_astromancer_solarian : public CreatureScript VoidBolt_Timer -= diff; } //When Solarian reaches 20% she will transform into a huge void walker. - if (Phase != 4 && ((me->GetHealth()*100 / me->GetMaxHealth())<20)) + if (Phase != 4 && me->HealthBelowPct(20)) { Phase = 4; //To make sure she wont be invisible or not selecatble diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 265d1fea682..d6e049852ed 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -201,7 +201,7 @@ struct advisorbase_ai : public ScriptedAI // double health for phase 3 me->SetMaxHealth(me->GetMaxHealth() * 2); m_bDoubled_Health = true; - me->SetHealth(me->GetMaxHealth()); + me->SetFullHealth(); me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_RES_VISUAL, false); @@ -809,7 +809,7 @@ class boss_kaelthas : public CreatureScript //Phase 4 specific spells if (Phase == 4) { - if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + if (HealthBelowPct(50)) { if (m_pInstance) m_pInstance->SetData(DATA_KAELTHASEVENT, 4); @@ -1501,7 +1501,7 @@ class mob_phoenix_tk : public CreatureScript //spell Burn should possible do this, but it doesn't, so do this for now. uint32 dmg = urand(4500,5500); if (me->GetHealth() > dmg) - me->SetHealth(uint32(me->GetHealth()-dmg)); + me->ModifyHealth(-int32(dmg)); Cycle_Timer = 2000; } else diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp index a1da2ab0d03..8ef81e1de73 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp @@ -180,7 +180,7 @@ class boss_pathaleon_the_calculator : public CreatureScript ArcaneExplosion_Timer -= diff; } - if (!Enraged && me->GetHealth()*100 / me->GetMaxHealth() < 21) + if (!Enraged && HealthBelowPct(21)) { DoCast(me, SPELL_FRENZY); DoScriptText(SAY_ENRAGE, me); diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 3799f1e1621..66204a30f0f 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -190,7 +190,7 @@ class npc_millhouse_manastorm : public CreatureScript if (!UpdateVictim()) return; - if (!LowHp && ((me->GetHealth()*100 / me->GetMaxHealth()) < 20)) + if (!LowHp && HealthBelowPct(20)) { DoScriptText(SAY_LOWHP, me); LowHp = true; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index 87113dfe706..a4bbbd9d049 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -125,9 +125,9 @@ class boss_harbinger_skyriss : public CreatureScript if (!summon) return; if (IsImage66) - summon->SetHealth((summon->GetMaxHealth()*33)/100); + summon->SetHealth(summon->CountPctFromMaxHealth(33)); else - summon->SetHealth((summon->GetMaxHealth()*66)/100); + summon->SetHealth(summon->CountPctFromMaxHealth(66)); if (me->getVictim()) if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) summon->AI()->AttackStart(pTarget); @@ -196,12 +196,12 @@ class boss_harbinger_skyriss : public CreatureScript if (!UpdateVictim()) return; - if (!IsImage66 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 66)) + if (!IsImage66 && !HealthAbovePct(66)) { DoSplit(66); IsImage66 = true; } - if (!IsImage33 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 33)) + if (!IsImage33 && !HealthAbovePct(33)) { DoSplit(33); IsImage33 = true; |
