* 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
2010-08-26 01:20:57 +06:00
parent bb5f7b6492
commit 341e6303ef
166 changed files with 445 additions and 416 deletions
@@ -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())