aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroffl <offl@users.noreply.github.com>2021-07-13 15:39:28 +0300
committerShauren <shauren.trinity@gmail.com>2022-03-11 16:27:07 +0100
commit9ca1b8f127fe72e87c30f43846b433561681278e (patch)
treecdd6c58c62693ce1dc81f5937d49db04d1bb2e86 /src
parent6435b8cbc9ff77327891a03dbd89dbf445585933 (diff)
Scripts/The Eye: Reorder Kael'thas' scripts
(cherry picked from commit e4b42314c0cb6f60b7cef9d6d3e0725e7dd3c6c4)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp232
1 files changed, 116 insertions, 116 deletions
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index 926d9328396..b35812c58c6 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -312,122 +312,6 @@ Position const TransitionPos[6] =
{ 792.419f, -0.504778f, 50.0505f, 3.130386f }
};
-struct advisorbase_ai : public ScriptedAI
-{
- advisorbase_ai(Creature* creature) : ScriptedAI(creature)
- {
- Initialize();
- instance = creature->GetInstanceScript();
- }
-
- void Initialize()
- {
- _hasRessurrected = false;
- _inFakeDeath = false;
- DelayRes_Target.Clear();
- }
-
- void Reset() override
- {
- Initialize();
-
- me->SetStandState(UNIT_STAND_STATE_STAND);
- me->AddUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
- me->RemoveUnitFlag(UnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED));
-
- //reset encounter
- if (instance->GetBossState(DATA_KAELTHAS) == IN_PROGRESS)
- if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KAELTHAS)))
- Kaelthas->AI()->EnterEvadeMode();
- }
-
- void MoveInLineOfSight(Unit* who) override
- {
- if (!who || _inFakeDeath || me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
- return;
-
- ScriptedAI::MoveInLineOfSight(who);
- }
-
- void AttackStart(Unit* who) override
- {
- if (!who || _inFakeDeath || me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
- return;
-
- ScriptedAI::AttackStart(who);
- }
-
- void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
- {
- if (spellInfo->Id == SPELL_RESSURECTION)
- {
- _hasRessurrected = true;
- me->RemoveUnitFlag(UnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED));
- me->SetStandState(UNIT_STAND_STATE_STAND);
- events.ScheduleEvent(EVENT_DELAYED_RESSURECTION, 2s);
- }
- }
-
- void DamageTaken(Unit* /*killer*/, uint32 &damage) override
- {
- if (damage >= me->GetHealth() && !_inFakeDeath && !_hasRessurrected)
- {
- //prevent death
- damage = 0;
- _inFakeDeath = true;
-
- me->InterruptNonMeleeSpells(false);
- me->SetHealth(0);
- me->RemoveAllAurasOnDeath();
- me->ModifyAuraState(AURA_STATE_WOUNDED_20_PERCENT, false);
- me->ModifyAuraState(AURA_STATE_WOUNDED_25_PERCENT, false);
- me->ModifyAuraState(AURA_STATE_WOUNDED_35_PERCENT, false);
- me->ModifyAuraState(AURA_STATE_WOUND_HEALTH_20_80, false);
- me->AddUnitFlag(UnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED));
- me->SetTarget(ObjectGuid::Empty);
- me->SetStandState(UNIT_STAND_STATE_DEAD);
- me->GetMotionMaster()->Clear();
- JustDied(nullptr);
- }
- }
-
- void JustDied(Unit* /*killer*/) override
- {
- if (Creature* kael = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KAELTHAS)))
- kael->AI()->DoAction(ACTION_ACTIVE_ADVISOR);
- }
-
- void UpdateAI(uint32 diff) override
- {
- if (_hasRessurrected)
- events.Update(diff);
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- if (eventId == EVENT_DELAYED_RESSURECTION)
- {
- _inFakeDeath = false;
-
- Unit* Target = ObjectAccessor::GetUnit(*me, DelayRes_Target);
- if (!Target)
- Target = me->GetVictim();
-
- ResetThreatList();
- AttackStart(Target);
- me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MoveChase(Target);
- AddThreat(Target, 0.0f);
- }
- }
- }
- public:
- EventMap events;
- InstanceScript* instance;
- bool _hasRessurrected;
- bool _inFakeDeath;
- ObjectGuid DelayRes_Target;
-};
-
struct boss_kaelthas : public BossAI
{
boss_kaelthas(Creature* creature) : BossAI(creature, DATA_KAELTHAS)
@@ -862,6 +746,122 @@ private:
ObjectGuid _advisorGuid[MAX_ADVISORS];
};
+struct advisorbase_ai : public ScriptedAI
+{
+ advisorbase_ai(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ instance = creature->GetInstanceScript();
+ }
+
+ void Initialize()
+ {
+ _hasRessurrected = false;
+ _inFakeDeath = false;
+ DelayRes_Target.Clear();
+ }
+
+ void Reset() override
+ {
+ Initialize();
+
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ me->AddUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
+ me->RemoveUnitFlag(UnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED));
+
+ //reset encounter
+ if (instance->GetBossState(DATA_KAELTHAS) == IN_PROGRESS)
+ if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KAELTHAS)))
+ Kaelthas->AI()->EnterEvadeMode();
+ }
+
+ void MoveInLineOfSight(Unit* who) override
+ {
+ if (!who || _inFakeDeath || me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
+ return;
+
+ ScriptedAI::MoveInLineOfSight(who);
+ }
+
+ void AttackStart(Unit* who) override
+ {
+ if (!who || _inFakeDeath || me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
+ return;
+
+ ScriptedAI::AttackStart(who);
+ }
+
+ void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
+ {
+ if (spellInfo->Id == SPELL_RESSURECTION)
+ {
+ _hasRessurrected = true;
+ me->RemoveUnitFlag(UnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED));
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ events.ScheduleEvent(EVENT_DELAYED_RESSURECTION, 2s);
+ }
+ }
+
+ void DamageTaken(Unit* killer, uint32 &damage) override
+ {
+ if (damage >= me->GetHealth() && !_inFakeDeath && !_hasRessurrected)
+ {
+ //prevent death
+ damage = 0;
+ _inFakeDeath = true;
+
+ me->InterruptNonMeleeSpells(false);
+ me->SetHealth(0);
+ me->RemoveAllAurasOnDeath();
+ me->ModifyAuraState(AURA_STATE_WOUNDED_20_PERCENT, false);
+ me->ModifyAuraState(AURA_STATE_WOUNDED_25_PERCENT, false);
+ me->ModifyAuraState(AURA_STATE_WOUNDED_35_PERCENT, false);
+ me->ModifyAuraState(AURA_STATE_WOUND_HEALTH_20_80, false);
+ me->AddUnitFlag(UnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED));
+ me->SetTarget(ObjectGuid::Empty);
+ me->SetStandState(UNIT_STAND_STATE_DEAD);
+ me->GetMotionMaster()->Clear();
+ JustDied(killer);
+ }
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ if (Creature* kael = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KAELTHAS)))
+ kael->AI()->DoAction(ACTION_ACTIVE_ADVISOR);
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (_hasRessurrected)
+ events.Update(diff);
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ if (eventId == EVENT_DELAYED_RESSURECTION)
+ {
+ _inFakeDeath = false;
+
+ Unit* Target = ObjectAccessor::GetUnit(*me, DelayRes_Target);
+ if (!Target)
+ Target = me->GetVictim();
+
+ ResetThreatList();
+ AttackStart(Target);
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveChase(Target);
+ AddThreat(Target, 0.0f);
+ }
+ }
+ }
+ public:
+ EventMap events;
+ InstanceScript* instance;
+ bool _hasRessurrected;
+ bool _inFakeDeath;
+ ObjectGuid DelayRes_Target;
+};
+
struct boss_thaladred_the_darkener : public advisorbase_ai
{
boss_thaladred_the_darkener(Creature* creature) : advisorbase_ai(creature)