TrinityCore
Loading...
Searching...
No Matches
boss_anomalus.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "InstanceScript.h"
20#include "nexus.h"
21#include "ObjectAccessor.h"
22#include "ScriptedCreature.h"
23#include "TemporarySummon.h"
24
26{
27 SPELL_SPARK = 47751,
30 SPELL_CHARGE_RIFT = 47747, // Works wrong (affect players, not rifts)
31 SPELL_CREATE_RIFT = 47743, // Don't work, using WA
32 SPELL_ARCANE_ATTRACTION = 57063, // No idea, when it's used
33};
34
35enum Adds
36{
38 NPC_CHAOTIC_RIFT = 26918
39};
40
42{
47 SAY_RIFT_EMOTE = 4, // Needs to be added to script
48 SAY_SHIELD_EMOTE = 5 // Needs to be added to script
49};
50
52{
55 SPELL_ARCANEFORM = 48019, // Chaotic Rift visual
56};
57
59{
60 { 652.64f, -273.70f, -8.75f, 0.0f },
61 { 634.45f, -265.94f, -8.44f, 0.0f },
62 { 620.73f, -281.17f, -9.02f, 0.0f },
63 { 626.10f, -304.67f, -9.44f, 0.0f },
64 { 639.87f, -314.11f, -9.49f, 0.0f },
65 { 651.72f, -297.44f, -9.37f, 0.0f }
66};
67
68enum Misc
69{
71};
72
74{
75 boss_anomalus(Creature* creature) : ScriptedAI(creature)
76 {
77 Initialize();
79 }
80
82 {
83 Phase = 0;
84 uiSparkTimer = 5000;
86 chaosTheory = true;
87 }
88
90
95
96 void Reset() override
97 {
98 Initialize();
99
101 }
102
103 void JustEngagedWith(Unit* /*who*/) override
104 {
106
108 }
109
110 void JustDied(Unit* /*killer*/) override
111 {
113
115 }
116
117 uint32 GetData(uint32 type) const override
118 {
119 if (type == DATA_CHAOS_THEORY)
120 return chaosTheory ? 1 : 0;
121
122 return 0;
123 }
124
125 void SummonedCreatureDies(Creature* summoned, Unit* /*who*/) override
126 {
127 if (summoned->GetEntry() == NPC_CHAOTIC_RIFT)
128 chaosTheory = false;
129 }
130
131 void UpdateAI(uint32 diff) override
132 {
133 if (!UpdateVictim())
134 return;
135
136 if (me->GetDistance(me->GetHomePosition()) > 60.0f)
137 {
138 // Not blizzlike, hack to avoid an exploit
140 return;
141 }
142
144 {
146 {
148 if (Rift && Rift->isDead())
149 {
152 }
153 return;
154 }
155 }
156 else
158
159 if ((Phase == 0) && HealthBelowPct(50))
160 {
161 Phase = 1;
165 {
166 //DoCast(Rift, SPELL_CHARGE_RIFT);
168 Rift->AI()->AttackStart(target);
169 uiChaoticRiftGUID = Rift->GetGUID();
170 Talk(SAY_RIFT);
171 }
172 }
173
174 if (uiSparkTimer <= diff)
175 {
177 DoCast(target, SPELL_SPARK);
178 uiSparkTimer = 5000;
179 }
180 else
181 uiSparkTimer -= diff;
182
184 }
185};
186
188{
189 npc_chaotic_rift(Creature* creature) : ScriptedAI(creature)
190 {
191 Initialize();
193 SetCombatMovement(false);
194 }
195
197 {
200 }
201
203
206
207 void Reset() override
208 {
209 Initialize();
211 DoCast(me, SPELL_ARCANEFORM, false);
212 }
213
214 void UpdateAI(uint32 diff) override
215 {
216 if (!UpdateVictim())
217 return;
218
219 if (uiChaoticEnergyBurstTimer <= diff)
220 {
223 {
224 if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
226 else
228 }
230 }
231 else
233
235 {
238 Wraith->AI()->AttackStart(target);
240 if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
242 else
244 }
245 else
247 }
248};
249
251{
252 public:
254 {
255 }
256
257 bool OnCheck(Player* /*player*/, Unit* target) override
258 {
259 if (!target)
260 return false;
261
262 if (Creature* Anomalus = target->ToCreature())
263 if (Anomalus->AI()->GetData(DATA_CHAOS_THEORY))
264 return true;
265
266 return false;
267 }
268};
269
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ NPC_CRAZED_MANA_WRAITH
@ NPC_CHAOTIC_RIFT
@ DATA_CHAOS_THEORY
@ SAY_DEATH
@ SAY_RIFT_EMOTE
@ SAY_AGGRO
@ SAY_SHIELD
@ SAY_SHIELD_EMOTE
@ 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
Yells
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void SetDisplayId(uint32 modelId) override
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:295
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:186
virtual bool SetBossState(uint32 id, EncounterState state)
virtual ObjectGuid GetGuidData(uint32 type) const override
bool IsEmpty() const
Definition ObjectGuid.h:172
void Clear()
Definition ObjectGuid.h:150
static Creature * ToCreature(Object *o)
Definition Object.h:186
uint32 GetEntry() const
Definition Object.h:81
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool isDead() const
Definition Unit.h:1236
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1992
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1123
bool OnCheck(Player *, Unit *target) override
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ DATA_ANOMALUS
Definition nexus.h:32
#define RegisterNexusCreatureAI(ai_name)
Definition nexus.h:74
float GetPositionZ() const
Definition Position.h:81
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void SetCombatMovement(bool allowMovement)
bool HealthBelowPct(uint32 pct) const
uint32 GetData(uint32 type) const override
void JustEngagedWith(Unit *) override
void SummonedCreatureDies(Creature *summoned, Unit *) override
ObjectGuid uiChaoticRiftGUID
void UpdateAI(uint32 diff) override
void Reset() override
boss_anomalus(Creature *creature)
InstanceScript * instance
void JustDied(Unit *) override
void Reset() override
InstanceScript * instance
uint32 uiSummonCrazedManaWraithTimer
void UpdateAI(uint32 diff) override
uint32 uiChaoticEnergyBurstTimer
npc_chaotic_rift(Creature *creature)