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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user