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:
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
//CorruptionofEarth_Timer
|
||||
//CorruptionofEarth at 75%, 50% and 25%
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted)))
|
||||
if (!HealthAbovePct(100 - 25 * m_uiCorruptionsCasted))
|
||||
{
|
||||
++m_uiCorruptionsCasted; // prevent casting twice on same hp
|
||||
DoScriptText(SAY_CASTCORRUPTION, me);
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
m_uiBellowingRoar_Timer -= uiDiff;
|
||||
|
||||
//Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again)
|
||||
if (!m_bShades && (me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned)))
|
||||
if (!m_bShades && !HealthAbovePct(100 - 25 * m_uiShadesSummoned))
|
||||
{
|
||||
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
m_uiLightningWave_Timer -= uiDiff;
|
||||
|
||||
//Summon Druids
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier)))
|
||||
if (!HealthAbovePct(100 - 25 * m_uiSummonDruidModifier))
|
||||
{
|
||||
DoScriptText(SAY_SUMMONDRUIDS, me);
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
SpellEntry const *info = NULL;
|
||||
|
||||
//Select a healing spell if less than 30% hp
|
||||
if (me->GetHealth()*100 / me->GetMaxHealth() < 30)
|
||||
if (HealthBelowPct(30))
|
||||
info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
|
||||
|
||||
//No healing spell available, select a hostile spell
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
SpellEntry const *info = NULL;
|
||||
|
||||
//Select a healing spell if less than 30% hp ONLY 33% of the time
|
||||
if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0)
|
||||
if (HealthBelowPct(30) && rand() % 3 == 0)
|
||||
info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
|
||||
|
||||
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
|
||||
|
||||
@@ -723,15 +723,15 @@ public:
|
||||
{ //lower max health
|
||||
case 12923:
|
||||
case 12938: //Injured Soldier
|
||||
me->SetHealth(uint32(me->GetMaxHealth()*.75));
|
||||
me->SetHealth(me->CountPctFromMaxHealth(75));
|
||||
break;
|
||||
case 12924:
|
||||
case 12936: //Badly injured Soldier
|
||||
me->SetHealth(uint32(me->GetMaxHealth()*.50));
|
||||
me->SetHealth(me->CountPctFromMaxHealth(50));
|
||||
break;
|
||||
case 12925:
|
||||
case 12937: //Critically injured Soldier
|
||||
me->SetHealth(uint32(me->GetMaxHealth()*.25));
|
||||
me->SetHealth(me->CountPctFromMaxHealth(25));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -782,7 +782,7 @@ public:
|
||||
//lower HP on every world tick makes it a useful counter, not officlone though
|
||||
if (me->isAlive() && me->GetHealth() > 6)
|
||||
{
|
||||
me->SetHealth(uint32(me->GetHealth()-5));
|
||||
me->ModifyHealth(-5);
|
||||
}
|
||||
|
||||
if (me->isAlive() && me->GetHealth() <= 6)
|
||||
@@ -924,7 +924,7 @@ public:
|
||||
|
||||
me->SetStandState(UNIT_STAND_STATE_KNEEL);
|
||||
//expect database to have RegenHealth=0
|
||||
me->SetHealth(int(me->GetMaxHealth()*0.7f));
|
||||
me->SetHealth(me->CountPctFromMaxHealth(70));
|
||||
}
|
||||
|
||||
void EnterCombat(Unit * /*who*/) {}
|
||||
|
||||
Reference in New Issue
Block a user