mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core: Logical fixes and improvements in EventMap
This commit is contained in:
@@ -336,21 +336,35 @@ class EventMap
|
||||
// Sets event phase, must be in range 1 - 8
|
||||
void SetPhase(uint32 phase)
|
||||
{
|
||||
if (phase && phase < 8)
|
||||
_phase = (1 << (phase + 24));
|
||||
if (phase && phase <= 8)
|
||||
_phase = (1 << (phase + 23));
|
||||
else if (!phase)
|
||||
_phase = 0;
|
||||
}
|
||||
|
||||
// Activates event phase, must be in range 1 - 8
|
||||
void AddPhase(uint32 phase)
|
||||
{
|
||||
if (phase && phase <= 8)
|
||||
_phase |= (1 << (phase + 23));
|
||||
}
|
||||
|
||||
// Deactivates event phase, must be in range 1 - 8
|
||||
void RemovePhase(uint32 phase)
|
||||
{
|
||||
if (phase && phase <= 8)
|
||||
_phase &= ~(1 << (phase + 23));
|
||||
}
|
||||
|
||||
// Creates new event entry in map with given id, time, group if given (1 - 8) and phase if given (1 - 8)
|
||||
// 0 for group/phase means it belongs to no group or runs in all phases
|
||||
void ScheduleEvent(uint32 eventId, uint32 time, uint32 groupId = 0, uint32 phase = 0)
|
||||
{
|
||||
time += _time;
|
||||
if (groupId && groupId < 9)
|
||||
eventId |= (1 << (groupId + 16));
|
||||
eventId |= (1 << (groupId + 15));
|
||||
if (phase && phase < 8)
|
||||
eventId |= (1 << (phase + 24));
|
||||
eventId |= (1 << (phase + 23));
|
||||
StorageType::const_iterator itr = _eventMap.find(time);
|
||||
while (itr != _eventMap.end())
|
||||
{
|
||||
@@ -443,8 +457,12 @@ class EventMap
|
||||
// Delay all events having the specified Group
|
||||
void DelayEvents(uint32 delay, uint32 groupId)
|
||||
{
|
||||
if (!groupId || groupId > 8)
|
||||
return;
|
||||
|
||||
uint32 nextTime = _time + delay;
|
||||
uint32 groupMask = (1 << (groupId + 16));
|
||||
uint32 groupMask = (1 << (groupId + 15));
|
||||
|
||||
for (StorageType::iterator itr = _eventMap.begin(); itr != _eventMap.end() && itr->first < nextTime;)
|
||||
{
|
||||
if (itr->second & groupMask)
|
||||
@@ -476,7 +494,10 @@ class EventMap
|
||||
// Cancel events belonging to specified group
|
||||
void CancelEventGroup(uint32 groupId)
|
||||
{
|
||||
uint32 groupMask = (1 << (groupId + 16));
|
||||
if (!groupId || groupId > 8)
|
||||
return;
|
||||
|
||||
uint32 groupMask = (1 << (groupId + 15));
|
||||
|
||||
for (StorageType::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
|
||||
{
|
||||
@@ -501,6 +522,12 @@ class EventMap
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns wether the eventmap is in the given phase or not.
|
||||
bool IsInPhase(uint32 phase)
|
||||
{
|
||||
return phase <= 8 && (!phase || _phase & (1 << phase + 23));
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 _time;
|
||||
uint32 _phase;
|
||||
|
||||
@@ -232,7 +232,7 @@ class boss_thekal : public CreatureScript
|
||||
if (me->IsFullHealth() && WasDead)
|
||||
WasDead = false;
|
||||
|
||||
if ((events.GetPhaseMask() == PHASE_ONE) && !WasDead && !HealthAbovePct(5))
|
||||
if ((events.IsInPhase(PHASE_ONE)) && !WasDead && !HealthAbovePct(5))
|
||||
{
|
||||
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
|
||||
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
|
||||
|
||||
@@ -61,9 +61,7 @@ enum Phases
|
||||
{
|
||||
PHASE_ALL = 0,
|
||||
PHASE_INTRO = 1,
|
||||
PHASE_COMBAT = 2,
|
||||
|
||||
PHASE_INTRO_MASK = 1 << PHASE_INTRO,
|
||||
PHASE_COMBAT = 2
|
||||
};
|
||||
|
||||
class boss_baltharus_the_warborn : public CreatureScript
|
||||
@@ -166,15 +164,16 @@ class boss_baltharus_the_warborn : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
|
||||
bool introPhase = events.IsInPhase(PHASE_INTRO);
|
||||
if (!UpdateVictim() && !introPhase)
|
||||
return;
|
||||
|
||||
if (!(events.GetPhaseMask() & PHASE_INTRO_MASK))
|
||||
if (!introPhase)
|
||||
me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH));
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && !introPhase)
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
|
||||
@@ -165,12 +165,7 @@ enum Phases
|
||||
PHASE_INTRO = 1,
|
||||
PHASE_ONE = 2,
|
||||
PHASE_TWO = 3,
|
||||
PHASE_THREE = 4,
|
||||
|
||||
PHASE_INTRO_MASK = 1 << PHASE_INTRO,
|
||||
PHASE_ONE_MASK = 1 << PHASE_ONE,
|
||||
PHASE_TWO_MASK = 1 << PHASE_TWO,
|
||||
PHASE_THREE_MASK = 1 << PHASE_THREE
|
||||
PHASE_THREE = 4
|
||||
};
|
||||
|
||||
enum Misc
|
||||
@@ -325,7 +320,7 @@ class boss_halion : public CreatureScript
|
||||
void EnterEvadeMode()
|
||||
{
|
||||
// Phase 1: We always can evade. Phase 2 & 3: We can evade if and only if the controller tells us to.
|
||||
if ((events.GetPhaseMask() & PHASE_ONE_MASK) || _canEvade)
|
||||
if (events.IsInPhase(PHASE_ONE) || _canEvade)
|
||||
generic_halionAI::EnterEvadeMode();
|
||||
}
|
||||
|
||||
@@ -369,7 +364,7 @@ class boss_halion : public CreatureScript
|
||||
|
||||
void DamageTaken(Unit* attacker, uint32& damage)
|
||||
{
|
||||
if (me->HealthBelowPctDamaged(75, damage) && (events.GetPhaseMask() & PHASE_ONE_MASK))
|
||||
if (me->HealthBelowPctDamaged(75, damage) && events.IsInPhase(PHASE_ONE))
|
||||
{
|
||||
events.SetPhase(PHASE_TWO);
|
||||
Talk(SAY_PHASE_TWO);
|
||||
@@ -383,7 +378,7 @@ class boss_halion : public CreatureScript
|
||||
return;
|
||||
}
|
||||
|
||||
if (events.GetPhaseMask() & PHASE_THREE_MASK)
|
||||
if (events.IsInPhase(PHASE_THREE))
|
||||
{
|
||||
// Don't consider copied damage.
|
||||
if (!me->InSamePhase(attacker))
|
||||
@@ -396,7 +391,7 @@ class boss_halion : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (events.GetPhaseMask() & PHASE_TWO_MASK)
|
||||
if (events.IsInPhase(PHASE_TWO))
|
||||
return;
|
||||
|
||||
generic_halionAI::UpdateAI(diff);
|
||||
@@ -528,7 +523,7 @@ class boss_twilight_halion : public CreatureScript
|
||||
|
||||
void DamageTaken(Unit* attacker, uint32& damage)
|
||||
{
|
||||
if (me->HealthBelowPctDamaged(50, damage) && (events.GetPhaseMask() & PHASE_TWO_MASK))
|
||||
if (me->HealthBelowPctDamaged(50, damage) && events.IsInPhase(PHASE_TWO))
|
||||
{
|
||||
events.SetPhase(PHASE_THREE);
|
||||
me->CastStop();
|
||||
@@ -537,7 +532,7 @@ class boss_twilight_halion : public CreatureScript
|
||||
return;
|
||||
}
|
||||
|
||||
if (events.GetPhaseMask() & PHASE_THREE_MASK)
|
||||
if (events.IsInPhase(PHASE_THREE))
|
||||
{
|
||||
// Don't consider copied damage.
|
||||
if (!me->InSamePhase(attacker))
|
||||
@@ -693,7 +688,7 @@ class npc_halion_controller : public CreatureScript
|
||||
// The isInCombat() check is needed because that check should be false when Halion is
|
||||
// not engaged, while it would return true without as UpdateVictim() checks for
|
||||
// combat state.
|
||||
if (!(_events.GetPhaseMask() & PHASE_INTRO_MASK) && me->isInCombat() && !UpdateVictim())
|
||||
if (!(_events.IsInPhase(PHASE_INTRO)) && me->isInCombat() && !UpdateVictim())
|
||||
{
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
|
||||
@@ -154,9 +154,7 @@ enum Phases
|
||||
{
|
||||
// Anub'arak
|
||||
PHASE_MELEE = 1,
|
||||
PHASE_SUBMERGED = 2,
|
||||
|
||||
PHASE_MASK_MELEE = 1 << PHASE_MELEE
|
||||
PHASE_SUBMERGED = 2
|
||||
};
|
||||
|
||||
class boss_anubarak_trial : public CreatureScript
|
||||
@@ -403,7 +401,7 @@ class boss_anubarak_trial : public CreatureScript
|
||||
|
||||
}
|
||||
|
||||
if (HealthBelowPct(30) && events.GetPhaseMask() & PHASE_MASK_MELEE && !_reachedPhase3)
|
||||
if (HealthBelowPct(30) && events.IsInPhase(PHASE_MELEE) && !_reachedPhase3)
|
||||
{
|
||||
_reachedPhase3 = true;
|
||||
DoCastAOE(SPELL_LEECHING_SWARM);
|
||||
@@ -411,7 +409,7 @@ class boss_anubarak_trial : public CreatureScript
|
||||
Talk(SAY_LEECHING_SWARM);
|
||||
}
|
||||
|
||||
if (events.GetPhaseMask() & PHASE_MASK_MELEE)
|
||||
if (events.IsInPhase(PHASE_MELEE))
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
|
||||
@@ -146,10 +146,7 @@ enum Phases
|
||||
{
|
||||
PHASE_MOBILE = 1,
|
||||
PHASE_STATIONARY = 2,
|
||||
PHASE_SUBMERGED = 3,
|
||||
|
||||
PHASE_MASK_MOBILE = 1 << PHASE_MOBILE,
|
||||
PHASE_MASK_STATIONARY = 1 << PHASE_STATIONARY
|
||||
PHASE_SUBMERGED = 3
|
||||
};
|
||||
|
||||
class boss_gormok : public CreatureScript
|
||||
@@ -624,9 +621,9 @@ struct boss_jormungarAI : public BossAI
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (events.GetPhaseMask() & PHASE_MASK_MOBILE)
|
||||
if (events.IsInPhase(PHASE_MOBILE))
|
||||
DoMeleeAttackIfReady();
|
||||
if (events.GetPhaseMask() & PHASE_MASK_STATIONARY)
|
||||
if (events.IsInPhase(PHASE_STATIONARY))
|
||||
DoSpellAttackIfReady(SpitSpell);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ class boss_bronjahm : public CreatureScript
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
|
||||
{
|
||||
if (events.GetPhaseMask() & (1 << PHASE_1) && !HealthAbovePct(30))
|
||||
if (events.IsInPhase(PHASE_1) && !HealthAbovePct(30))
|
||||
{
|
||||
events.SetPhase(PHASE_2);
|
||||
DoCast(me, SPELL_TELEPORT);
|
||||
|
||||
@@ -52,11 +52,7 @@ enum Phases
|
||||
{
|
||||
PHASE_ONE = 1,
|
||||
PHASE_TWO = 2,
|
||||
PHASE_THREE = 3,
|
||||
|
||||
PHASE_ONE_MASK = 1 << PHASE_ONE,
|
||||
PHASE_TWO_MASK = 1 << PHASE_TWO,
|
||||
PHASE_THREE_MASK = 1 << PHASE_THREE,
|
||||
PHASE_THREE = 3
|
||||
};
|
||||
|
||||
enum MiscData
|
||||
@@ -136,7 +132,7 @@ enum Events
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& /*uiDamage*/)
|
||||
{
|
||||
if (events.GetPhaseMask() & PHASE_ONE_MASK && !HealthAbovePct(66))
|
||||
if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(66))
|
||||
{
|
||||
events.SetPhase(PHASE_TWO);
|
||||
Talk(SAY_PHASE2);
|
||||
@@ -146,7 +142,7 @@ enum Events
|
||||
return;
|
||||
}
|
||||
|
||||
if (events.GetPhaseMask() & PHASE_TWO_MASK && !HealthAbovePct(33))
|
||||
if (events.IsInPhase(PHASE_TWO) && !HealthAbovePct(33))
|
||||
{
|
||||
events.SetPhase(PHASE_THREE);
|
||||
Talk(SAY_PHASE3);
|
||||
@@ -162,12 +158,12 @@ enum Events
|
||||
if (type != EFFECT_MOTION_TYPE || id != POINT_FORGE)
|
||||
return;
|
||||
|
||||
if (events.GetPhaseMask() & PHASE_TWO_MASK)
|
||||
if (events.IsInPhase(PHASE_TWO))
|
||||
{
|
||||
DoCast(me, SPELL_FORGE_BLADE);
|
||||
SetEquipmentSlots(false, EQUIP_ID_SWORD);
|
||||
}
|
||||
if (events.GetPhaseMask() & PHASE_THREE_MASK)
|
||||
if (events.IsInPhase(PHASE_THREE))
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_FORGE_BLADE_HELPER);
|
||||
DoCast(me, SPELL_FORGE_MACE);
|
||||
@@ -226,15 +222,15 @@ enum Events
|
||||
break;
|
||||
case EVENT_JUMP:
|
||||
me->AttackStop();
|
||||
if (events.GetPhaseMask() & PHASE_TWO_MASK)
|
||||
if (events.IsInPhase(PHASE_TWO))
|
||||
me->GetMotionMaster()->MoveJump(northForgePos.GetPositionX(), northForgePos.GetPositionY(), northForgePos.GetPositionZ(), 25.0f, 15.0f);
|
||||
else if (events.GetPhaseMask() & PHASE_THREE_MASK)
|
||||
else if (events.IsInPhase(PHASE_THREE))
|
||||
me->GetMotionMaster()->MoveJump(southForgePos.GetPositionX(), southForgePos.GetPositionY(), southForgePos.GetPositionZ(), 25.0f, 15.0f);
|
||||
break;
|
||||
case EVENT_RESUME_ATTACK:
|
||||
if (events.GetPhaseMask() & PHASE_TWO_MASK)
|
||||
if (events.IsInPhase(PHASE_THREE))
|
||||
events.ScheduleEvent(EVENT_CHILLING_WAVE, 5000, 0, PHASE_TWO);
|
||||
else if (events.GetPhaseMask() & PHASE_THREE_MASK)
|
||||
else if (events.IsInPhase(PHASE_THREE))
|
||||
events.ScheduleEvent(EVENT_DEEP_FREEZE, 10000, 0, PHASE_THREE);
|
||||
AttackStart(me->getVictim());
|
||||
break;
|
||||
|
||||
@@ -94,7 +94,7 @@ enum Phases
|
||||
PHASE_NONE = 0,
|
||||
PHASE_INTRO = 1,
|
||||
PHASE_COMBAT = 2,
|
||||
PHASE_OUTRO = 3,
|
||||
PHASE_OUTRO = 3
|
||||
};
|
||||
|
||||
enum Actions
|
||||
@@ -168,7 +168,7 @@ class boss_tyrannus : public CreatureScript
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
|
||||
if (victim && me->Attack(victim, true) && !(events.GetPhaseMask() & (1 << PHASE_INTRO)))
|
||||
if (victim && me->Attack(victim, true) && !events.IsInPhase(PHASE_INTRO))
|
||||
me->GetMotionMaster()->MoveChase(victim);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ class boss_tyrannus : public CreatureScript
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim() && !(events.GetPhaseMask() & (1 << PHASE_INTRO)))
|
||||
if (!UpdateVictim() && !events.IsInPhase(PHASE_INTRO))
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
@@ -337,7 +337,7 @@ class boss_rimefang : public CreatureScript
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim() && !(_events.GetPhaseMask() & (1 << PHASE_COMBAT)))
|
||||
if (!UpdateVictim() && !_events.IsInPhase(PHASE_COMBAT))
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
@@ -185,9 +185,7 @@ enum Phases
|
||||
{
|
||||
PHASE_INTRO_A = 1,
|
||||
PHASE_INTRO_H = 2,
|
||||
PHASE_COMBAT = 3,
|
||||
|
||||
PHASE_INTRO_MASK = (1 << PHASE_INTRO_A) | (1 << PHASE_INTRO_H),
|
||||
PHASE_COMBAT = 3
|
||||
};
|
||||
|
||||
enum Actions
|
||||
@@ -424,7 +422,7 @@ class boss_deathbringer_saurfang : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
|
||||
if ((!UpdateVictim() && !events.IsInPhase(PHASE_INTRO_A)) || events.IsInPhase(PHASE_INTRO_H))
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
@@ -612,7 +610,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
|
||||
case ACTION_START_EVENT:
|
||||
{
|
||||
// Prevent crashes
|
||||
if (_events.GetPhaseMask() & PHASE_INTRO_MASK)
|
||||
if (_events.IsInPhase(PHASE_INTRO_A) || _events.IsInPhase(PHASE_INTRO_H))
|
||||
return;
|
||||
|
||||
GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_KOR_KRON_REAVER, 20.0f);
|
||||
@@ -821,7 +819,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
|
||||
case ACTION_START_EVENT:
|
||||
{
|
||||
// Prevent crashes
|
||||
if (_events.GetPhaseMask() & PHASE_INTRO_MASK)
|
||||
if (_events.IsInPhase(PHASE_INTRO_A) || _events.IsInPhase(PHASE_INTRO_H))
|
||||
return;
|
||||
|
||||
_events.SetPhase(PHASE_INTRO_A);
|
||||
|
||||
@@ -160,10 +160,7 @@ enum Phases
|
||||
PHASE_ALL = 0,
|
||||
PHASE_INTRO = 1,
|
||||
PHASE_ONE = 2,
|
||||
PHASE_TWO = 3,
|
||||
|
||||
PHASE_INTRO_MASK = 1 << PHASE_INTRO,
|
||||
PHASE_ONE_MASK = 1 << PHASE_ONE,
|
||||
PHASE_TWO = 3
|
||||
};
|
||||
|
||||
enum DeprogrammingData
|
||||
@@ -259,7 +256,7 @@ class boss_lady_deathwhisper : public CreatureScript
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
|
||||
if (victim && me->Attack(victim, true) && !(events.GetPhaseMask() & PHASE_ONE_MASK))
|
||||
if (victim && me->Attack(victim, true) && !events.IsInPhase(PHASE_ONE))
|
||||
me->GetMotionMaster()->MoveChase(victim);
|
||||
}
|
||||
|
||||
@@ -358,7 +355,7 @@ class boss_lady_deathwhisper : public CreatureScript
|
||||
void DamageTaken(Unit* /*damageDealer*/, uint32& damage)
|
||||
{
|
||||
// phase transition
|
||||
if (events.GetPhaseMask() & PHASE_ONE_MASK && damage > me->GetPower(POWER_MANA))
|
||||
if (events.IsInPhase(PHASE_ONE) && damage > me->GetPower(POWER_MANA))
|
||||
{
|
||||
Talk(SAY_PHASE_2);
|
||||
Talk(EMOTE_PHASE_2);
|
||||
@@ -406,12 +403,12 @@ class boss_lady_deathwhisper : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) || !CheckInRoom())
|
||||
if ((!UpdateVictim() && !events.IsInPhase(PHASE_INTRO)) || !CheckInRoom())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && !events.IsInPhase(PHASE_INTRO))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
|
||||
@@ -145,10 +145,7 @@ enum Phases
|
||||
PHASE_ROTFACE = 2,
|
||||
PHASE_COMBAT_1 = 4,
|
||||
PHASE_COMBAT_2 = 5,
|
||||
PHASE_COMBAT_3 = 6,
|
||||
|
||||
PHASE_MASK_COMBAT = (1 << PHASE_COMBAT_1) | (1 << PHASE_COMBAT_2) | (1 << PHASE_COMBAT_3),
|
||||
PHASE_MASK_NOT_SELF = (1 << PHASE_FESTERGUT) | (1 << PHASE_ROTFACE)
|
||||
PHASE_COMBAT_3 = 6
|
||||
};
|
||||
|
||||
enum Points
|
||||
@@ -233,7 +230,7 @@ class boss_professor_putricide : public CreatureScript
|
||||
|
||||
void Reset()
|
||||
{
|
||||
if (!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF))
|
||||
if (!(events.IsInPhase(PHASE_ROTFACE) || events.IsInPhase(PHASE_FESTERGUT)))
|
||||
instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, NOT_STARTED);
|
||||
instance->SetData(DATA_NAUSEA_ACHIEVEMENT, uint32(true));
|
||||
|
||||
@@ -252,7 +249,7 @@ class boss_professor_putricide : public CreatureScript
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
if (events.GetPhaseMask() & PHASE_MASK_NOT_SELF)
|
||||
if (events.IsInPhase(PHASE_ROTFACE) || events.IsInPhase(PHASE_FESTERGUT))
|
||||
return;
|
||||
|
||||
if (!instance->CheckRequiredBosses(DATA_PROFESSOR_PUTRICIDE, who->ToPlayer()))
|
||||
@@ -282,7 +279,7 @@ class boss_professor_putricide : public CreatureScript
|
||||
{
|
||||
_JustReachedHome();
|
||||
me->SetWalk(false);
|
||||
if (events.GetPhaseMask() & PHASE_MASK_COMBAT)
|
||||
if (events.IsInPhase(PHASE_COMBAT_1) || events.IsInPhase(PHASE_COMBAT_2) || events.IsInPhase(PHASE_COMBAT_3))
|
||||
instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, FAIL);
|
||||
}
|
||||
|
||||
@@ -568,7 +565,7 @@ class boss_professor_putricide : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if ((!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF) && !UpdateVictim()) || !CheckInRoom())
|
||||
if ((!(events.IsInPhase(PHASE_ROTFACE) || events.IsInPhase(PHASE_FESTERGUT)) && !UpdateVictim()) || !CheckInRoom())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
@@ -279,20 +279,10 @@ enum Phases
|
||||
PHASE_THREE = 4,
|
||||
PHASE_TRANSITION = 5,
|
||||
PHASE_FROSTMOURNE = 6, // only set on heroic mode when all players are sent into frostmourne
|
||||
PHASE_OUTRO = 7,
|
||||
|
||||
PHASE_MASK_INTRO = 1 << PHASE_INTRO,
|
||||
PHASE_MASK_ONE = 1 << PHASE_ONE,
|
||||
PHASE_MASK_TWO = 1 << PHASE_TWO,
|
||||
PHASE_MASK_THREE = 1 << PHASE_THREE,
|
||||
PHASE_MASK_TRANSITION = 1 << PHASE_TRANSITION,
|
||||
PHASE_MASK_NO_CAST_CHECK = (1 << PHASE_TRANSITION) | (1 << PHASE_FROSTMOURNE) | (1 << PHASE_OUTRO),
|
||||
PHASE_MASK_FROSTMOURNE = 1 << PHASE_FROSTMOURNE,
|
||||
PHASE_MASK_OUTRO = 1 << PHASE_OUTRO,
|
||||
PHASE_MASK_NO_VICTIM = (1 << PHASE_INTRO) | (1 << PHASE_OUTRO) | (1 << PHASE_FROSTMOURNE),
|
||||
PHASE_OUTRO = 7
|
||||
};
|
||||
|
||||
#define PHASE_TWO_THREE (events.GetPhaseMask() & PHASE_MASK_TWO ? PHASE_TWO : PHASE_THREE)
|
||||
#define PHASE_TWO_THREE (events.IsInPhase(PHASE_TWO) ? PHASE_TWO : PHASE_THREE)
|
||||
|
||||
Position const CenterPosition = {503.6282f, -2124.655f, 840.8569f, 0.0f};
|
||||
Position const TirionIntro = {489.2970f, -2124.840f, 840.8569f, 0.0f};
|
||||
@@ -589,7 +579,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
|
||||
void KilledUnit(Unit* victim)
|
||||
{
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && !(events.GetPhaseMask() & PHASE_MASK_OUTRO))
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && !events.IsInPhase(PHASE_OUTRO))
|
||||
Talk(SAY_LK_KILL);
|
||||
}
|
||||
|
||||
@@ -669,7 +659,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
|
||||
{
|
||||
if (events.GetPhaseMask() & PHASE_MASK_ONE && !HealthAbovePct(70))
|
||||
if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(70))
|
||||
{
|
||||
events.SetPhase(PHASE_TRANSITION);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
@@ -678,7 +668,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
return;
|
||||
}
|
||||
|
||||
if (events.GetPhaseMask() & PHASE_MASK_TWO && !HealthAbovePct(40))
|
||||
if (events.IsInPhase(PHASE_TWO) && !HealthAbovePct(40))
|
||||
{
|
||||
events.SetPhase(PHASE_TRANSITION);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
@@ -687,7 +677,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
return;
|
||||
}
|
||||
|
||||
if (events.GetPhaseMask() & PHASE_MASK_THREE && !HealthAbovePct(10))
|
||||
if (events.IsInPhase(PHASE_THREE) && !HealthAbovePct(10))
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->AttackStop();
|
||||
@@ -758,7 +748,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
summon->SetReactState(REACT_PASSIVE);
|
||||
summon->SetSpeed(MOVE_FLIGHT, 0.5f);
|
||||
summon->GetMotionMaster()->MoveRandom(10.0f);
|
||||
if (!(events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE))
|
||||
if (!events.IsInPhase(PHASE_FROSTMOURNE))
|
||||
summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000));
|
||||
return;
|
||||
}
|
||||
@@ -873,14 +863,14 @@ class boss_the_lich_king : public CreatureScript
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
// check phase first to prevent updating victim and entering evade mode when not wanted
|
||||
if (!(events.GetPhaseMask() & PHASE_MASK_NO_VICTIM))
|
||||
if (!(events.IsInPhase(PHASE_OUTRO) || events.IsInPhase(PHASE_INTRO) || events.IsInPhase(PHASE_FROSTMOURNE)))
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
// during Remorseless Winter phases The Lich King is channeling a spell, but we must continue casting other spells
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK))
|
||||
if ((me->HasUnitState(UNIT_STATE_CASTING) && !events.IsInPhase(PHASE_TRANSITION)) || events.IsInPhase(PHASE_OUTRO) || events.IsInPhase(PHASE_FROSTMOURNE))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
@@ -936,7 +926,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
break;
|
||||
case EVENT_INFEST:
|
||||
DoCast(me, SPELL_INFEST);
|
||||
events.ScheduleEvent(EVENT_INFEST, urand(21000, 24000), 0, (events.GetPhaseMask() & PHASE_MASK_ONE) ? PHASE_ONE : PHASE_TWO);
|
||||
events.ScheduleEvent(EVENT_INFEST, urand(21000, 24000), 0, events.IsInPhase(PHASE_ONE) ? PHASE_ONE : PHASE_TWO);
|
||||
break;
|
||||
case EVENT_NECROTIC_PLAGUE:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, NecroticPlagueTargetCheck(me, NECROTIC_PLAGUE_LK, NECROTIC_PLAGUE_PLR)))
|
||||
@@ -1005,7 +995,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
break;
|
||||
case EVENT_START_ATTACK:
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
if (events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE)
|
||||
if (events.IsInPhase(PHASE_FROSTMOURNE))
|
||||
events.SetPhase(PHASE_THREE);
|
||||
break;
|
||||
case EVENT_VILE_SPIRITS:
|
||||
@@ -1253,7 +1243,7 @@ class npc_tirion_fordring_tft : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!UpdateVictim() && !(_events.GetPhaseMask() & (PHASE_MASK_INTRO | PHASE_MASK_OUTRO)))
|
||||
if (!UpdateVictim() && !(_events.IsInPhase(PHASE_OUTRO) || _events.IsInPhase(PHASE_INTRO)))
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
@@ -176,10 +176,7 @@ enum EncounterPhases
|
||||
{
|
||||
PHASE_NORMAL = 0,
|
||||
PHASE_ROLE_PLAY = 1,
|
||||
PHASE_BIG_BANG = 2,
|
||||
|
||||
PHASE_MASK_NO_UPDATE = (1 << PHASE_ROLE_PLAY) | (1 << PHASE_BIG_BANG),
|
||||
PHASE_MASK_NO_CAST_CHECK = 1 << PHASE_ROLE_PLAY,
|
||||
PHASE_BIG_BANG = 2
|
||||
};
|
||||
|
||||
enum AchievmentInfo
|
||||
@@ -542,12 +539,12 @@ class boss_algalon_the_observer : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if ((!(events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) || !CheckInRoom())
|
||||
if ((!(events.IsInPhase(PHASE_ROLE_PLAY) || events.IsInPhase(PHASE_BIG_BANG)) && !UpdateVictim()) || !CheckInRoom())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (!(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK))
|
||||
if (!events.IsInPhase(PHASE_ROLE_PLAY))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
@@ -772,7 +769,7 @@ class npc_living_constellation : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!(_events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim())
|
||||
if (!(_events.IsInPhase(PHASE_ROLE_PLAY) || _events.IsInPhase(PHASE_BIG_BANG)) && !UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
Talk(YELL_DEAD_1);
|
||||
}
|
||||
|
||||
if (events.GetPhaseMask() & (1 << PHASE_EVENT))
|
||||
if (events.IsInPhase(PHASE_EVENT))
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim() && !(events.GetPhaseMask() & (1 << PHASE_EVENT)))
|
||||
if (!UpdateVictim() && !events.IsInPhase(PHASE_EVENT))
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
Reference in New Issue
Block a user