mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Scripts/Nexus: Update Anomalus to new model (#26424)
(cherry picked from commit dadbd4cdab)
This commit is contained in:
@@ -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") { }
|
||||
boss_anomalus(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
Initialize();
|
||||
instance = me->GetInstanceScript();
|
||||
}
|
||||
|
||||
struct boss_anomalusAI : public ScriptedAI
|
||||
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;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (me->GetDistance(me->GetHomePosition()) > 60.0f)
|
||||
{
|
||||
// Not blizzlike, hack to avoid an exploit
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
|
||||
if (me->HasAura(SPELL_RIFT_SHIELD))
|
||||
{
|
||||
if (!uiChaoticRiftGUID.IsEmpty())
|
||||
{
|
||||
Creature* Rift = ObjectAccessor::GetCreature(*me, uiChaoticRiftGUID);
|
||||
if (Rift && Rift->isDead())
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
|
||||
uiChaoticRiftGUID.Clear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetNexusAI<boss_anomalusAI>(creature);
|
||||
// Not blizzlike, hack to avoid an exploit
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
|
||||
if (me->HasAura(SPELL_RIFT_SHIELD))
|
||||
{
|
||||
if (!uiChaoticRiftGUID.IsEmpty())
|
||||
{
|
||||
Creature* Rift = ObjectAccessor::GetCreature(*me, uiChaoticRiftGUID);
|
||||
if (Rift && Rift->isDead())
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
|
||||
uiChaoticRiftGUID.Clear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
class npc_chaotic_rift : public CreatureScript
|
||||
struct npc_chaotic_rift : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
npc_chaotic_rift() : CreatureScript("npc_chaotic_rift") { }
|
||||
npc_chaotic_rift(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
Initialize();
|
||||
instance = me->GetInstanceScript();
|
||||
SetCombatMovement(false);
|
||||
}
|
||||
|
||||
struct npc_chaotic_riftAI : public ScriptedAI
|
||||
void Initialize()
|
||||
{
|
||||
uiChaoticEnergyBurstTimer = 1000;
|
||||
uiSummonCrazedManaWraithTimer = 5000;
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
uint32 uiChaoticEnergyBurstTimer;
|
||||
uint32 uiSummonCrazedManaWraithTimer;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
Initialize();
|
||||
me->SetDisplayFromModel(1);
|
||||
DoCast(me, SPELL_ARCANEFORM, false);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiChaoticEnergyBurstTimer <= diff)
|
||||
{
|
||||
npc_chaotic_riftAI(Creature* creature) : ScriptedAI(creature)
|
||||
Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS));
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
|
||||
{
|
||||
Initialize();
|
||||
instance = me->GetInstanceScript();
|
||||
SetCombatMovement(false);
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
uiChaoticEnergyBurstTimer = 1000;
|
||||
uiSummonCrazedManaWraithTimer = 5000;
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
uint32 uiChaoticEnergyBurstTimer;
|
||||
uint32 uiSummonCrazedManaWraithTimer;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
Initialize();
|
||||
me->SetDisplayFromModel(1);
|
||||
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 (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
|
||||
DoCast(target, SPELL_CHARGED_CHAOTIC_ENERGY_BURST);
|
||||
else
|
||||
DoCast(target, SPELL_CHAOTIC_ENERGY_BURST);
|
||||
}
|
||||
uiChaoticEnergyBurstTimer = 1000;
|
||||
}
|
||||
if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
|
||||
DoCast(target, SPELL_CHARGED_CHAOTIC_ENERGY_BURST);
|
||||
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;
|
||||
}
|
||||
else
|
||||
uiSummonCrazedManaWraithTimer -= diff;
|
||||
DoCast(target, SPELL_CHAOTIC_ENERGY_BURST);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetNexusAI<npc_chaotic_riftAI>(creature);
|
||||
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;
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -71,4 +71,6 @@ inline AI* GetNexusAI(T* obj)
|
||||
return GetInstanceAI<AI>(obj, NexusScriptName);
|
||||
}
|
||||
|
||||
#define RegisterNexusCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetNexusAI)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user