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:
@@ -246,7 +246,7 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (!Avatar_summoned && ((me->GetHealth()*100) / me->GetMaxHealth() < 25))
|
||||
if (!Avatar_summoned && HealthBelowPct(25))
|
||||
{
|
||||
if (me->IsNonMeleeSpellCasted(false))
|
||||
me->InterruptNonMeleeSpells(true);
|
||||
|
||||
@@ -134,19 +134,19 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (((me->GetHealth()*100) / me->GetMaxHealth() < 90) && !summon90)
|
||||
if (HealthBelowPct(90) && !summon90)
|
||||
{
|
||||
SythSummoning();
|
||||
summon90 = true;
|
||||
}
|
||||
|
||||
if (((me->GetHealth()*100) / me->GetMaxHealth() < 50) && !summon50)
|
||||
if (HealthBelowPct(50) && !summon50)
|
||||
{
|
||||
SythSummoning();
|
||||
summon50 = true;
|
||||
}
|
||||
|
||||
if (((me->GetHealth()*100) / me->GetMaxHealth() < 10) && !summon10)
|
||||
if (HealthBelowPct(10) && !summon10)
|
||||
{
|
||||
SythSummoning();
|
||||
summon10 = true;
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
} else Sheep_Timer -= diff;
|
||||
|
||||
//may not be correct time to cast
|
||||
if (!ManaShield && ((me->GetHealth()*100) / me->GetMaxHealth() < 20))
|
||||
if (!ManaShield && HealthBelowPct(20))
|
||||
{
|
||||
DoCast(me, SPELL_MANA_SHIELD);
|
||||
ManaShield = true;
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
if (sacrificed)
|
||||
{
|
||||
me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS, H_SPELL_EMPOWERING_SHADOWS), Vorpil);
|
||||
Vorpil->SetHealth(Vorpil->GetHealth() + Vorpil->GetMaxHealth()/25);
|
||||
Vorpil->ModifyHealth(int32(Vorpil->CountPctFromMaxHealth(4)));
|
||||
DoCast(me, SPELL_SHADOW_NOVA, true);
|
||||
me->Kill(me);
|
||||
return;
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
spawnVoidTraveler();
|
||||
summonTraveler_Timer = 10000;
|
||||
//enrage at 20%
|
||||
if ((me->GetHealth()*5) < me->GetMaxHealth())
|
||||
if (HealthBelowPct(20))
|
||||
summonTraveler_Timer = 5000;
|
||||
} else summonTraveler_Timer -=diff;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
SonicBoom = false;
|
||||
|
||||
//database should have `RegenHealth`=0 to prevent regen
|
||||
uint32 hp = (me->GetMaxHealth()*40)/100;
|
||||
uint32 hp = me->CountPctFromMaxHealth(40);
|
||||
if (hp) me->SetHealth(hp);
|
||||
me->ResetPlayerDamageReq();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
if (pTarget->HasAura(SPELL_SONIC_BOOM_CAST) && me->IsWithinDistInMap(pTarget, 34.0f))
|
||||
{
|
||||
//This will be wrong calculation. Also, comments suggest it must deal damage
|
||||
pTarget->SetHealth(uint32(pTarget->GetMaxHealth() - pTarget->GetMaxHealth() * 0.8));
|
||||
pTarget->SetHealth(pTarget->CountPctFromMaxHealth(20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ EndScriptData */
|
||||
#define GETGO(obj, guid) GameObject* obj = pInstance->instance->GetGameObject(guid)
|
||||
#define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*me, guid)
|
||||
#define GETCRE(cre, guid) Creature* cre = Unit::GetCreature(*me, guid)
|
||||
#define HPPCT(unit) unit->GetHealth()*100 / unit->GetMaxHealth()
|
||||
|
||||
/************* Quotes and Sounds ***********************/
|
||||
// Gossip for when a player clicks Akama
|
||||
@@ -967,17 +966,17 @@ public:
|
||||
switch(Phase)
|
||||
{
|
||||
case PHASE_NORMAL:
|
||||
if (HPPCT(me) < 65)
|
||||
if (HealthBelowPct(65))
|
||||
EnterPhase(PHASE_FLIGHT_SEQUENCE);
|
||||
break;
|
||||
|
||||
case PHASE_NORMAL_2:
|
||||
if (HPPCT(me) < 30)
|
||||
if (HealthBelowPct(30))
|
||||
EnterPhase(PHASE_TALK_SEQUENCE);
|
||||
break;
|
||||
|
||||
case PHASE_NORMAL_MAIEV:
|
||||
if (HPPCT(me) < 1)
|
||||
if (HealthBelowPct(1))
|
||||
EnterPhase(PHASE_TALK_SEQUENCE);
|
||||
break;
|
||||
|
||||
@@ -1193,7 +1192,7 @@ public:
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (Illidan && Illidan->getVictim() == me)
|
||||
damage = me->GetMaxHealth()/10;
|
||||
damage = me->CountPctFromMaxHealth(10);
|
||||
if (damage >= me->GetHealth())
|
||||
damage = 0;
|
||||
}
|
||||
@@ -1230,7 +1229,7 @@ public:
|
||||
case PHASE_TALK_SEQUENCE:
|
||||
if (Timer[EVENT_MAIEV_STEALTH])
|
||||
{
|
||||
me->SetHealth(me->GetMaxHealth());
|
||||
me->SetFullHealth();
|
||||
me->SetVisibility(VISIBILITY_ON);
|
||||
Timer[EVENT_MAIEV_STEALTH] = 0;
|
||||
}
|
||||
@@ -1308,7 +1307,7 @@ public:
|
||||
{
|
||||
case EVENT_MAIEV_STEALTH:
|
||||
{
|
||||
me->SetHealth(me->GetMaxHealth());
|
||||
me->SetFullHealth();
|
||||
me->SetVisibility(VISIBILITY_ON);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
Timer[EVENT_MAIEV_STEALTH] = 0;
|
||||
@@ -1349,7 +1348,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
if (me->GetHealth()*100 / me->GetMaxHealth() < 50)
|
||||
if (HealthBelowPct(50))
|
||||
{
|
||||
me->SetVisibility(VISIBILITY_OFF);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
@@ -1759,7 +1758,7 @@ public:
|
||||
case PHASE_FIGHT_ILLIDAN:
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (Illidan && HPPCT(Illidan) < 90)
|
||||
if (Illidan && Illidan->HealthBelowPct(90))
|
||||
EnterPhase(PHASE_TALK);
|
||||
else
|
||||
{
|
||||
@@ -1783,7 +1782,7 @@ public:
|
||||
}
|
||||
Timer = 10000 + rand()%6000;
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (Illidan && HPPCT(Illidan) < 10)
|
||||
if (Illidan && Illidan->HealthBelowPct(10))
|
||||
EnterPhase(PHASE_RETURN);
|
||||
}
|
||||
break;
|
||||
@@ -1795,7 +1794,7 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (me->GetHealth()*100 / me->GetMaxHealth() < 20)
|
||||
if (HealthBelowPct(20))
|
||||
DoCast(me, SPELL_HEALING_POTION);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !Enraged)
|
||||
if (HealthBelowPct(10) && !Enraged)
|
||||
{
|
||||
Enraged = true;
|
||||
DoCast(me, SPELL_ENRAGE, true);
|
||||
|
||||
@@ -502,7 +502,7 @@ public:
|
||||
me->RemoveAllAuras();
|
||||
me->DeleteThreatList();
|
||||
me->CombatStop();
|
||||
//me->SetHealth(me->GetMaxHealth());
|
||||
//me->SetFullHealth();
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
}
|
||||
@@ -713,7 +713,7 @@ public:
|
||||
if (!EventBegun)
|
||||
return;
|
||||
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 15 && !HasYelledOnce)
|
||||
if (HealthBelowPct(15) && !HasYelledOnce)
|
||||
{
|
||||
DoScriptText(SAY_LOW_HEALTH, me);
|
||||
HasYelledOnce = true;
|
||||
|
||||
@@ -439,7 +439,7 @@ struct boss_illidari_councilAI : public ScriptedAI
|
||||
if (Creature* pUnit = Unit::GetCreature(*me, Council[i]))
|
||||
if (pUnit != me && damage < pUnit->GetHealth())
|
||||
{
|
||||
pUnit->SetHealth(pUnit->GetHealth() - damage);
|
||||
pUnit->ModifyHealth(-int32(damage));
|
||||
pUnit->LowerPlayerDamageReq(damage);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -275,7 +275,7 @@ public:
|
||||
} else Enrage_Timer -= diff;
|
||||
|
||||
//Blessing of Tides Trigger
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) <= 75 && !BlessingOfTides)
|
||||
if (!HealthAbovePct(75) && !BlessingOfTides)
|
||||
{
|
||||
BlessingOfTides = true;
|
||||
bool continueTriggering = false;
|
||||
|
||||
@@ -396,7 +396,7 @@ public:
|
||||
if (Phase == 1)
|
||||
{
|
||||
//Start phase 2
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 70)
|
||||
if (HealthBelowPct(70))
|
||||
{
|
||||
//Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable.
|
||||
Phase = 2;
|
||||
@@ -556,7 +556,7 @@ public:
|
||||
if (pInstance && pInstance->GetData(DATA_CANSTARTPHASE3))
|
||||
{
|
||||
//set life 50%
|
||||
me->SetHealth(me->GetMaxHealth()/2);
|
||||
me->SetHealth(me->CountPctFromMaxHealth(50));
|
||||
|
||||
me->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER);
|
||||
|
||||
|
||||
+1
-1
@@ -561,7 +561,7 @@ public:
|
||||
} else SwitchToHuman_Timer -= diff;
|
||||
}
|
||||
|
||||
if (!IsFinalForm && (me->GetHealth()*100 / me->GetMaxHealth()) < 15)
|
||||
if (!IsFinalForm && HealthBelowPct(15))
|
||||
{
|
||||
//at this point he divides himself in two parts
|
||||
CastConsumingMadness();
|
||||
|
||||
+3
-3
@@ -154,7 +154,7 @@ public:
|
||||
|
||||
if (!Summon75)
|
||||
{
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 75)
|
||||
if (HealthBelowPct(75))
|
||||
{
|
||||
SummonMechanichs();
|
||||
Summon75 = true;
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
|
||||
if (!Summon50)
|
||||
{
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 50)
|
||||
if (HealthBelowPct(50))
|
||||
{
|
||||
SummonMechanichs();
|
||||
Summon50 = true;
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
if (!Summon25)
|
||||
{
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 25)
|
||||
if (HealthBelowPct(25))
|
||||
{
|
||||
SummonMechanichs();
|
||||
Summon25 = true;
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if ((me->GetHealth()*100) / me->GetMaxHealth() <= 20)
|
||||
if (!HealthAbovePct(20))
|
||||
{
|
||||
if (!Root)
|
||||
{
|
||||
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
} else MightyBlow_Timer -= diff;
|
||||
|
||||
//Entering Phase 2
|
||||
if (!Phase2 && (me->GetHealth()*100 / me->GetMaxHealth()) < 50)
|
||||
if (!Phase2 && HealthBelowPct(50))
|
||||
{
|
||||
Phase2 = true;
|
||||
DoScriptText(SAY_ENRAGE, me);
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ class boss_omor_the_unscarred : public CreatureScript
|
||||
else
|
||||
OrbitalStrike_Timer -= diff;
|
||||
|
||||
if ((me->GetHealth()*100) / me->GetMaxHealth() < 20)
|
||||
if (HealthBelowPct(20))
|
||||
{
|
||||
if (DemonicShield_Timer <= diff)
|
||||
{
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ class boss_nazan : public CreatureScript
|
||||
if (flight) // phase 1 - the flight
|
||||
{
|
||||
Creature *Vazruden = Unit::GetCreature(*me,VazrudenGUID);
|
||||
if (Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth())))
|
||||
if (Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && Vazruden->HealthAbovePct(20)))
|
||||
{
|
||||
flight = false;
|
||||
BellowingRoar_Timer = 6000;
|
||||
|
||||
+2
-2
@@ -139,7 +139,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
|
||||
else
|
||||
Surge_Timer -= diff;
|
||||
|
||||
if ((me->GetHealth()*100) / me->GetMaxHealth() < 20)
|
||||
if (HealthBelowPct(20))
|
||||
{
|
||||
if (Retaliation_Timer <= diff)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
|
||||
|
||||
if (!YelledForHeal)
|
||||
{
|
||||
if ((me->GetHealth()*100) / me->GetMaxHealth() < 40)
|
||||
if (HealthBelowPct(40))
|
||||
{
|
||||
DoScriptText(SAY_HEAL, me);
|
||||
YelledForHeal = true;
|
||||
|
||||
@@ -443,7 +443,7 @@ class boss_magtheridon : public CreatureScript
|
||||
else
|
||||
Blaze_Timer -= diff;
|
||||
|
||||
if (!Phase3 && me->GetHealth()*10 < me->GetMaxHealth()*3
|
||||
if (!Phase3 && HealthBelowPct(30)
|
||||
&& !me->IsNonMeleeSpellCasted(false) // blast nova
|
||||
&& !me->hasUnitState(UNIT_STAT_STUNNED)) // shadow cage and earthquake
|
||||
{
|
||||
@@ -568,7 +568,7 @@ class mob_hellfire_channeler : public CreatureScript
|
||||
|
||||
if (DarkMending_Timer <= diff)
|
||||
{
|
||||
if ((me->GetHealth()*100 / me->GetMaxHealth()) < 50)
|
||||
if (HealthBelowPct(50))
|
||||
DoCast(me, SPELL_DARK_MENDING);
|
||||
DarkMending_Timer = 10000 +(rand() % 10000);
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
|
||||
else
|
||||
DeathCoil_Timer -= diff;
|
||||
|
||||
if ((me->GetHealth()*100) / me->GetMaxHealth() <= 20)
|
||||
if (!HealthAbovePct(20))
|
||||
Phase = true;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
return;
|
||||
|
||||
//Spell Enrage, when hp <= 20% gain enrage
|
||||
if (((me->GetHealth()*100)/ me->GetMaxHealth()) <= 20)
|
||||
if (!HealthAbovePct(20))
|
||||
{
|
||||
if (Enrage_Timer <= diff)
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if ((me->GetHealth()*100) / me->GetMaxHealth() < 30)
|
||||
if (HealthBelowPct(30))
|
||||
{
|
||||
me->setFaction(FACTION_FRIENDLY);
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
|
||||
void DamageTaken(Unit *done_by, uint32 & damage)
|
||||
{
|
||||
if (done_by->GetTypeId() == TYPEID_PLAYER && (me->GetHealth() - damage)*100 / me->GetMaxHealth() < 30)
|
||||
if (done_by->GetTypeId() == TYPEID_PLAYER && me->HealthBelowPctDamaged(30, damage))
|
||||
{
|
||||
if (!bReset && CAST_PLR(done_by)->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
@@ -718,7 +718,7 @@ public:
|
||||
else
|
||||
m_uiChainLightningTimer -= uiDiff;
|
||||
|
||||
if (me->GetHealth()*100 < me->GetMaxHealth()*30)
|
||||
if (HealthBelowPct(30))
|
||||
{
|
||||
if (m_uiHealTimer <= uiDiff)
|
||||
{
|
||||
|
||||
@@ -818,7 +818,7 @@ public:
|
||||
|
||||
if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) // start: support for quest 10190
|
||||
{
|
||||
if (!Weak && me->GetHealth() < (me->GetMaxHealth() / 100 * WeakPercent)
|
||||
if (!Weak && HealthBelowPct(WeakPercent)
|
||||
&& pPlayer->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
DoScriptText(EMOTE_WEAK, me);
|
||||
@@ -827,11 +827,11 @@ public:
|
||||
if (Weak && !Drained && me->HasAura(SPELL_RECHARGING_BATTERY))
|
||||
{
|
||||
Drained = true;
|
||||
HpPercent = float(me->GetHealth()) / float(me->GetMaxHealth());
|
||||
HpPercent = me->GetHealthPct();
|
||||
|
||||
me->UpdateEntry(NPC_DRAINED_PHASE_HUNTER_ENTRY);
|
||||
|
||||
me->SetHealth(me->GetMaxHealth() * HpPercent);
|
||||
me->SetHealth(me->CountPctFromMaxHealth(HpPercent));
|
||||
me->LowerPlayerDamageReq(me->GetMaxHealth() - me->GetHealth());
|
||||
me->SetInCombatWith(pPlayer);
|
||||
}
|
||||
|
||||
@@ -1102,7 +1102,7 @@ public:
|
||||
return;
|
||||
|
||||
//TODO: add more abilities
|
||||
if (me->GetHealth()*100 / me->GetMaxHealth() <= 30)
|
||||
if (!HealthAbovePct(30))
|
||||
{
|
||||
if (m_uiHealingTimer <= uiDiff)
|
||||
{
|
||||
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
void DamageTaken(Unit *done_by, uint32 &damage)
|
||||
{
|
||||
if (done_by->GetTypeId() == TYPEID_PLAYER)
|
||||
if ((me->GetHealth()-damage)*100 / me->GetMaxHealth() < 20)
|
||||
if (me->HealthBelowPctDamaged(20, damage))
|
||||
{
|
||||
CAST_PLR(done_by)->GroupEventHappens(QUEST_10004,me);
|
||||
damage = 0;
|
||||
@@ -511,7 +511,7 @@ public:
|
||||
Attack = false;
|
||||
}
|
||||
|
||||
if ((me->GetHealth()*100)/me->GetMaxHealth() < 5 && !Done)
|
||||
if (HealthBelowPct(5) && !Done)
|
||||
{
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->RemoveAllAuras();
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
void DamageTaken(Unit *done_by, uint32 &damage)
|
||||
{
|
||||
if (done_by->GetTypeId() == TYPEID_PLAYER)
|
||||
if ((me->GetHealth()-damage)*100 / me->GetMaxHealth() < 30)
|
||||
if (me->HealthBelowPctDamaged(30, damage))
|
||||
{
|
||||
if (Group* pGroup = CAST_PLR(done_by)->GetGroup())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user