aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroffl <11556157+offl@users.noreply.github.com>2021-04-16 20:14:58 +0300
committerGitHub <noreply@github.com>2021-04-16 20:14:58 +0300
commitdadbd4cdab0e22c9851ce41c9e4b62e7456d1b27 (patch)
tree547df4e5f931ea152c7882dba1fd9b247f6c0cdd
parent82969a691cfc0fc14bd90888a79dfe0dc5cea9e7 (diff)
Scripts/Nexus: Update Anomalus to new model (#26424)
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp332
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/nexus.h2
2 files changed, 157 insertions, 177 deletions
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
index de64d2055bd..411319c7452 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
@@ -70,203 +70,181 @@ enum Misc
DATA_CHAOS_THEORY = 1
};
-class boss_anomalus : public CreatureScript
+struct boss_anomalus : public ScriptedAI
{
- public:
- boss_anomalus() : CreatureScript("boss_anomalus") { }
-
- struct boss_anomalusAI : public ScriptedAI
+ boss_anomalus(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ instance = me->GetInstanceScript();
+ }
+
+ void Initialize()
+ {
+ Phase = 0;
+ uiSparkTimer = 5000;
+ uiChaoticRiftGUID.Clear();
+ chaosTheory = true;
+ }
+
+ InstanceScript* instance;
+
+ uint8 Phase;
+ uint32 uiSparkTimer;
+ ObjectGuid uiChaoticRiftGUID;
+ bool chaosTheory;
+
+ void Reset() override
+ {
+ Initialize();
+
+ instance->SetBossState(DATA_ANOMALUS, NOT_STARTED);
+ }
+
+ void JustEngagedWith(Unit* /*who*/) override
+ {
+ Talk(SAY_AGGRO);
+
+ instance->SetBossState(DATA_ANOMALUS, IN_PROGRESS);
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ Talk(SAY_DEATH);
+
+ instance->SetBossState(DATA_ANOMALUS, DONE);
+ }
+
+ uint32 GetData(uint32 type) const override
+ {
+ if (type == DATA_CHAOS_THEORY)
+ return chaosTheory ? 1 : 0;
+
+ return 0;
+ }
+
+ void SummonedCreatureDies(Creature* summoned, Unit* /*who*/) override
+ {
+ if (summoned->GetEntry() == NPC_CHAOTIC_RIFT)
+ chaosTheory = false;
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (me->GetDistance(me->GetHomePosition()) > 60.0f)
{
- boss_anomalusAI(Creature* creature) : ScriptedAI(creature)
- {
- Initialize();
- instance = me->GetInstanceScript();
- }
-
- void Initialize()
- {
- Phase = 0;
- uiSparkTimer = 5000;
- uiChaoticRiftGUID.Clear();
- chaosTheory = true;
- }
-
- InstanceScript* instance;
-
- uint8 Phase;
- uint32 uiSparkTimer;
- ObjectGuid uiChaoticRiftGUID;
- bool chaosTheory;
-
- void Reset() override
- {
- Initialize();
-
- instance->SetBossState(DATA_ANOMALUS, NOT_STARTED);
- }
-
- void JustEngagedWith(Unit* /*who*/) override
- {
- Talk(SAY_AGGRO);
-
- instance->SetBossState(DATA_ANOMALUS, IN_PROGRESS);
- }
-
- void JustDied(Unit* /*killer*/) override
- {
- Talk(SAY_DEATH);
-
- instance->SetBossState(DATA_ANOMALUS, DONE);
- }
-
- uint32 GetData(uint32 type) const override
- {
- if (type == DATA_CHAOS_THEORY)
- return chaosTheory ? 1 : 0;
-
- return 0;
- }
-
- void SummonedCreatureDies(Creature* summoned, Unit* /*who*/) override
- {
- if (summoned->GetEntry() == NPC_CHAOTIC_RIFT)
- chaosTheory = false;
- }
+ // Not blizzlike, hack to avoid an exploit
+ EnterEvadeMode();
+ return;
+ }
- void UpdateAI(uint32 diff) override
+ if (me->HasAura(SPELL_RIFT_SHIELD))
+ {
+ if (uiChaoticRiftGUID)
{
- if (!UpdateVictim())
- return;
-
- if (me->GetDistance(me->GetHomePosition()) > 60.0f)
+ Creature* Rift = ObjectAccessor::GetCreature(*me, uiChaoticRiftGUID);
+ if (Rift && Rift->isDead())
{
- // Not blizzlike, hack to avoid an exploit
- EnterEvadeMode();
- return;
- }
-
- if (me->HasAura(SPELL_RIFT_SHIELD))
- {
- if (uiChaoticRiftGUID)
- {
- Creature* Rift = ObjectAccessor::GetCreature(*me, uiChaoticRiftGUID);
- if (Rift && Rift->isDead())
- {
- me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
- uiChaoticRiftGUID.Clear();
- }
- return;
- }
- }
- else
+ me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
uiChaoticRiftGUID.Clear();
-
- if ((Phase == 0) && HealthBelowPct(50))
- {
- Phase = 1;
- Talk(SAY_SHIELD);
- DoCast(me, SPELL_RIFT_SHIELD);
- if (Creature* Rift = me->SummonCreature(NPC_CHAOTIC_RIFT, RiftLocation[urand(0, 5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1s))
- {
- //DoCast(Rift, SPELL_CHARGE_RIFT);
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
- Rift->AI()->AttackStart(target);
- uiChaoticRiftGUID = Rift->GetGUID();
- Talk(SAY_RIFT);
- }
- }
-
- if (uiSparkTimer <= diff)
- {
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
- DoCast(target, SPELL_SPARK);
- uiSparkTimer = 5000;
}
- else
- uiSparkTimer -= diff;
-
- DoMeleeAttackIfReady();
+ return;
}
- };
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetNexusAI<boss_anomalusAI>(creature);
}
-};
+ else
+ uiChaoticRiftGUID.Clear();
-class npc_chaotic_rift : public CreatureScript
-{
- public:
- npc_chaotic_rift() : CreatureScript("npc_chaotic_rift") { }
-
- struct npc_chaotic_riftAI : public ScriptedAI
+ if ((Phase == 0) && HealthBelowPct(50))
{
- npc_chaotic_riftAI(Creature* creature) : ScriptedAI(creature)
+ Phase = 1;
+ Talk(SAY_SHIELD);
+ DoCast(me, SPELL_RIFT_SHIELD);
+ if (Creature* Rift = me->SummonCreature(NPC_CHAOTIC_RIFT, RiftLocation[urand(0, 5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1s))
{
- Initialize();
- instance = me->GetInstanceScript();
- SetCombatMovement(false);
+ //DoCast(Rift, SPELL_CHARGE_RIFT);
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
+ Rift->AI()->AttackStart(target);
+ uiChaoticRiftGUID = Rift->GetGUID();
+ Talk(SAY_RIFT);
}
+ }
- void Initialize()
- {
- uiChaoticEnergyBurstTimer = 1000;
- uiSummonCrazedManaWraithTimer = 5000;
- }
-
- InstanceScript* instance;
-
- uint32 uiChaoticEnergyBurstTimer;
- uint32 uiSummonCrazedManaWraithTimer;
+ if (uiSparkTimer <= diff)
+ {
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
+ DoCast(target, SPELL_SPARK);
+ uiSparkTimer = 5000;
+ }
+ else
+ uiSparkTimer -= diff;
- void Reset() override
- {
- Initialize();
- me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
- DoCast(me, SPELL_ARCANEFORM, false);
- }
+ DoMeleeAttackIfReady();
+ }
+};
- void UpdateAI(uint32 diff) override
+struct npc_chaotic_rift : public ScriptedAI
+{
+ npc_chaotic_rift(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ instance = me->GetInstanceScript();
+ SetCombatMovement(false);
+ }
+
+ void Initialize()
+ {
+ uiChaoticEnergyBurstTimer = 1000;
+ uiSummonCrazedManaWraithTimer = 5000;
+ }
+
+ InstanceScript* instance;
+
+ uint32 uiChaoticEnergyBurstTimer;
+ uint32 uiSummonCrazedManaWraithTimer;
+
+ void Reset() override
+ {
+ Initialize();
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
+ DoCast(me, SPELL_ARCANEFORM, false);
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (uiChaoticEnergyBurstTimer <= diff)
+ {
+ Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS));
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
- if (!UpdateVictim())
- return;
-
- if (uiChaoticEnergyBurstTimer <= diff)
- {
- Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS));
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
- {
- if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
- DoCast(target, SPELL_CHARGED_CHAOTIC_ENERGY_BURST);
- else
- DoCast(target, SPELL_CHAOTIC_ENERGY_BURST);
- }
- uiChaoticEnergyBurstTimer = 1000;
- }
- else
- uiChaoticEnergyBurstTimer -= diff;
-
- if (uiSummonCrazedManaWraithTimer <= diff)
- {
- if (Creature* Wraith = me->SummonCreature(NPC_CRAZED_MANA_WRAITH, me->GetPositionX() + 1, me->GetPositionY() + 1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1s))
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
- Wraith->AI()->AttackStart(target);
- Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS));
- if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
- uiSummonCrazedManaWraithTimer = 5000;
- else
- uiSummonCrazedManaWraithTimer = 10000;
- }
+ if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
+ DoCast(target, SPELL_CHARGED_CHAOTIC_ENERGY_BURST);
else
- uiSummonCrazedManaWraithTimer -= diff;
+ DoCast(target, SPELL_CHAOTIC_ENERGY_BURST);
}
- };
+ uiChaoticEnergyBurstTimer = 1000;
+ }
+ else
+ uiChaoticEnergyBurstTimer -= diff;
- CreatureAI* GetAI(Creature* creature) const override
+ if (uiSummonCrazedManaWraithTimer <= diff)
{
- return GetNexusAI<npc_chaotic_riftAI>(creature);
+ if (Creature* Wraith = me->SummonCreature(NPC_CRAZED_MANA_WRAITH, me->GetPositionX() + 1, me->GetPositionY() + 1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1s))
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
+ Wraith->AI()->AttackStart(target);
+ Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS));
+ if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
+ uiSummonCrazedManaWraithTimer = 5000;
+ else
+ uiSummonCrazedManaWraithTimer = 10000;
}
+ else
+ uiSummonCrazedManaWraithTimer -= diff;
+ }
};
class achievement_chaos_theory : public AchievementCriteriaScript
@@ -291,7 +269,7 @@ class achievement_chaos_theory : public AchievementCriteriaScript
void AddSC_boss_anomalus()
{
- new boss_anomalus();
- new npc_chaotic_rift();
+ RegisterNexusCreatureAI(boss_anomalus);
+ RegisterNexusCreatureAI(npc_chaotic_rift);
new achievement_chaos_theory();
}
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h
index e5367ad1c53..50f76af5c93 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h
+++ b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h
@@ -71,4 +71,6 @@ inline AI* GetNexusAI(T* obj)
return GetInstanceAI<AI>(obj, NexusScriptName);
}
+#define RegisterNexusCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetNexusAI)
+
#endif