Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_anomalus.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "nexus.h"
9
11{
12 SPELL_SPARK = 47751,
15 SPELL_CHARGE_RIFT = 47747, //Works wrong (affect players, not rifts)
16 SPELL_CREATE_RIFT = 47743, //Don't work, using WA
17 SPELL_ARCANE_ATTRACTION = 57063, //No idea, when it's used
18};
19
20enum Adds
21{
24};
25
27{
32};
33
35{
38 SPELL_ARCANEFORM = 48019, //Chaotic Rift visual
39};
40
42{
43 { 652.64f, -273.70f, -8.75f, 0.0f },
44 { 634.45f, -265.94f, -8.44f, 0.0f },
45 { 620.73f, -281.17f, -9.02f, 0.0f },
46 { 626.10f, -304.67f, -9.44f, 0.0f },
47 { 639.87f, -314.11f, -9.49f, 0.0f },
48 { 651.72f, -297.44f, -9.37f, 0.0f }
49};
50
51enum Misc
52{
54};
55
57{
58public:
59 boss_anomalus() : CreatureScript("boss_anomalus") {}
60
62 {
63 boss_anomalusAI(Creature* creature) : ScriptedAI(creature)
64 {
65 instance = me->GetInstanceScript();
66
67 Phase = 0;
68 uiSparkTimer = 0;
71 chaosTheory = false;
72 }
73
75 {
76 Phase = 0;
77 uiSparkTimer = 5000;
79 chaosTheory = true;
80
81 if (instance)
83 }
84
85 void EnterCombat(Unit* /*who*/) OVERRIDE
86 {
88
89 if (instance)
91 }
92
93 void JustDied(Unit* /*killer*/) OVERRIDE
94 {
96
97 if (instance)
99 }
100
102 {
103 if (type == DATA_CHAOS_THEORY)
104 return chaosTheory ? 1 : 0;
105
106 return 0;
107 }
108
109 void SummonedCreatureDies(Creature* summoned, Unit* /*who*/) OVERRIDE
110 {
111 if (summoned->GetEntry() == NPC_CHAOTIC_RIFT)
112 chaosTheory = false;
113 }
114
116 {
117 if (!UpdateVictim())
118 return;
119
120 if (me->GetDistance(me->GetHomePosition()) > 60.0f)
121 {
122 // Not blizzlike, hack to avoid an exploit
124 return;
125 }
126
127 if (me->HasAura(SPELL_RIFT_SHIELD))
128 {
130 {
132 if (Rift && Rift->isDead())
133 {
134 me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
136 }
137 return;
138 }
139 }
140 else
142
143 if ((Phase == 0) && HealthBelowPct(50))
144 {
145 Phase = 1;
148 if (Creature* Rift = me->SummonCreature(NPC_CHAOTIC_RIFT, RiftLocation[std::rand() % 5], TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
149 {
150 //DoCast(Rift, SPELL_CHARGE_RIFT);
151 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
152 Rift->AI()->AttackStart(target);
153 uiChaoticRiftGUID = Rift->GetGUID();
154 Talk(SAY_RIFT);
155 }
156 }
157
158 if (uiSparkTimer <= diff)
159 {
160 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
161 DoCast(target, SPELL_SPARK);
162 uiSparkTimer = 5000;
163 }
164 else
165 uiSparkTimer -= diff;
166
168 }
169
170 private:
172
178 };
179
181 {
182 return new boss_anomalusAI(creature);
183 }
184};
185
187{
188public:
189 npc_chaotic_rift() : CreatureScript("npc_chaotic_rift") {}
190
192 {
194 {
195 instance = me->GetInstanceScript();
196 SetCombatMovement(false);
199 }
200
202 {
205 me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
206 DoCast(me, SPELL_ARCANEFORM, false);
207 }
208
210 {
211 if (!UpdateVictim())
212 return;
213
214 if (uiChaoticEnergyBurstTimer <= diff)
215 {
217 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
218 {
219 if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
221 else
223 }
225 }
226 else
228
230 {
231 if (Creature* Wraith = me->SummonCreature(NPC_CRAZED_MANA_WRAITH, me->GetPositionX() + 1, me->GetPositionY() + 1, me->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
232 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
233 Wraith->AI()->AttackStart(target);
235 if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
237 else
239 }
240 else
242 }
243 private:
245
248 };
249
251 {
252 return new npc_chaotic_riftAI(creature);
253 }
254};
255
257{
258public:
259 achievement_chaos_theory() : AchievementCriteriaScript("achievement_chaos_theory") { }
260
261 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
262 {
263 if (!target)
264 return false;
265
266 if (Creature* Anomalus = target->ToCreature())
267 if (Anomalus->AI()->GetData(DATA_CHAOS_THEORY))
268 return true;
269
270 return false;
271 }
272};
273
275{
276 new boss_anomalus();
277 new npc_chaotic_rift();
279}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ NPC_CRAZED_MANA_WRAITH
@ NPC_CHAOTIC_RIFT
@ DATA_CHAOS_THEORY
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SHIELD
@ SAY_RIFT
void AddSC_boss_anomalus()
@ SPELL_SPARK
@ SPELL_CHARGE_RIFT
@ SPELL_RIFT_SHIELD
@ H_SPELL_SPARK
@ SPELL_ARCANE_ATTRACTION
@ SPELL_CREATE_RIFT
Position const RiftLocation[6]
RiftSpells
@ SPELL_CHARGED_CHAOTIC_ENERGY_BURST
@ SPELL_CHAOTIC_ENERGY_BURST
@ SPELL_ARCANEFORM
#define SAY_DEATH
#define SAY_AGGRO
AchievementCriteriaScript(const char *name)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
Creature * ToCreature()
Definition Object.h:207
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
Definition Unit.h:1367
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
bool isDead() const
Definition Unit.h:2040
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_ANOMALUS_EVENT
Definition nexus.h:12
@ DATA_ANOMALUS
Definition nexus.h:16
void SetCombatMovement(bool allowMovement)
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
boss_anomalusAI(Creature *creature)
void JustDied(Unit *) OVERRIDE
uint32 GetData(uint32 type) const OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SummonedCreatureDies(Creature *summoned, Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================