TrinityCore
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 }
183};
184
186{
187 npc_chaotic_rift(Creature* creature) : ScriptedAI(creature)
188 {
189 Initialize();
191 SetCombatMovement(false);
192 }
193
195 {
198 }
199
201
204
205 void Reset() override
206 {
207 Initialize();
209 DoCast(me, SPELL_ARCANEFORM, false);
210 }
211
212 void UpdateAI(uint32 diff) override
213 {
214 if (!UpdateVictim())
215 return;
216
217 if (uiChaoticEnergyBurstTimer <= diff)
218 {
221 {
222 if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
224 else
226 }
228 }
229 else
231
233 {
236 Wraith->AI()->AttackStart(target);
238 if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
240 else
242 }
243 else
245 }
246};
247
249{
250 public:
252 {
253 }
254
255 bool OnCheck(Player* /*player*/, Unit* target) override
256 {
257 if (!target)
258 return false;
259
260 if (Creature* Anomalus = target->ToCreature())
261 if (Anomalus->AI()->GetData(DATA_CHAOS_THEORY))
262 return true;
263
264 return false;
265 }
266};
267
269{
273}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: ObjectDefines.h:66
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
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:369
void SetDisplayFromModel(uint32 modelIdx)
Definition: Creature.cpp:3412
virtual bool SetBossState(uint32 id, EncounterState state)
virtual ObjectGuid GetGuidData(uint32 type) const override
bool IsEmpty() const
Definition: ObjectGuid.h:321
void Clear()
Definition: ObjectGuid.h:288
static Creature * ToCreature(Object *o)
Definition: Object.h:220
uint32 GetEntry() const
Definition: Object.h:162
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:628
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4709
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3873
bool isDead() const
Definition: Unit.h:1174
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1056
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:2067
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1092
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
constexpr float GetPositionX() const
Definition: Position.h:77
constexpr float GetPositionY() const
Definition: Position.h:78
constexpr float GetPositionZ() const
Definition: Position.h:79
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)