TrinityCore
boss_kelidan_the_breaker.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 "blood_furnace.h"
20#include "ObjectAccessor.h"
21#include "ScriptedCreature.h"
22#include "TemporarySummon.h"
23
25{
31
34
37
40
42 SPELL_VORTEX = 37370,
43
46
48};
49
50const float ShadowmoonChannelers[5][4]=
51{
52 {302.0f, -87.0f, -24.4f, 0.157f},
53 {321.0f, -63.5f, -24.6f, 4.887f},
54 {346.0f, -74.5f, -24.6f, 3.595f},
55 {344.0f, -103.5f, -24.5f, 2.356f},
56 {316.0f, -109.0f, -24.6f, 1.257f}
57};
58
60{
61 public:
62 boss_kelidan_the_breaker() : CreatureScript("boss_kelidan_the_breaker") { }
63
65 {
67 {
68 Initialize();
70 }
71
73 {
74 ShadowVolley_Timer = 1000;
75 BurningNova_Timer = 15000;
76 Corruption_Timer = 5000;
77 check_Timer = 0;
78 Firenova = false;
79 addYell = false;
80 }
81
88 bool addYell;
90
91 void Reset() override
92 {
93 _Reset();
94 Initialize();
98 me->SetImmuneToAll(true);
99 }
100
101 void JustEngagedWith(Unit* who) override
102 {
104 Talk(SAY_WAKE);
105 if (me->IsNonMeleeSpellCast(false))
107 DoStartMovement(who);
108 }
109
110 void KilledUnit(Unit* /*victim*/) override
111 {
112 if (rand32() % 2)
113 return;
114
115 Talk(SAY_KILL);
116 }
117
119 {
120 if (who && !addYell)
121 {
122 addYell = true;
124 }
125 for (uint8 i = 0; i<5; ++i)
126 {
128 if (who && channeler && !channeler->IsInCombat())
129 channeler->AI()->AttackStart(who);
130 }
131 }
132
133 void ChannelerDied(Unit* killer)
134 {
135 for (uint8 i = 0; i < 5; ++i)
136 {
138 if (channeler && channeler->IsAlive())
139 return;
140 }
143 me->SetImmuneToAll(false);
144 if (killer)
145 AttackStart(killer);
146 }
147
149 {
151 if (!channeler1)
152 return ObjectGuid::Empty;
153
154 uint8 i;
155 for (i = 0; i < 5; ++i)
156 {
158 if (channeler && channeler->GetGUID() == channeler1->GetGUID())
159 break;
160 }
161 return Channelers[(i + 2) % 5];
162 }
163
165 {
166 for (uint8 i = 0; i < 5; ++i)
167 {
169 if (!channeler || channeler->isDead())
171 if (channeler)
172 Channelers[i] = channeler->GetGUID();
173 else
174 Channelers[i].Clear();
175 }
176 }
177
178 void JustDied(Unit* /*killer*/) override
179 {
180 _JustDied();
181 Talk(SAY_DIE);
182 }
183
184 void UpdateAI(uint32 diff) override
185 {
186 if (!UpdateVictim())
187 {
188 if (check_Timer <= diff)
189 {
190 if (!me->IsNonMeleeSpellCast(false))
192 check_Timer = 5000;
193 }
194 else
195 check_Timer -= diff;
196 return;
197 }
198
199 if (Firenova)
200 {
201 if (Firenova_Timer <= diff)
202 {
203 DoCast(me, SPELL_FIRE_NOVA, true);
204 Firenova = false;
205 ShadowVolley_Timer = 2000;
206 }
207 else
208 Firenova_Timer -=diff;
209
210 return;
211 }
212
213 if (ShadowVolley_Timer <= diff)
214 {
216 ShadowVolley_Timer = 5000 + rand32() % 8000;
217 }
218 else
219 ShadowVolley_Timer -=diff;
220
221 if (Corruption_Timer <= diff)
222 {
224 Corruption_Timer = 30000 + rand32() % 20000;
225 }
226 else
227 Corruption_Timer -=diff;
228
229 if (BurningNova_Timer <= diff)
230 {
231 if (me->IsNonMeleeSpellCast(false))
233
234 Talk(SAY_NOVA);
235
237
238 if (IsHeroic())
240
241 BurningNova_Timer = 20000 + rand32() % 8000;
242 Firenova_Timer= 5000;
243 Firenova = true;
244 }
245 else
246 BurningNova_Timer -=diff;
247 }
248 };
249
250 CreatureAI* GetAI(Creature* creature) const override
251 {
252 return GetBloodFurnaceAI<boss_kelidan_the_breakerAI>(creature);
253 }
254};
255
256/*######
257## npc_shadowmoon_channeler
258######*/
259
261{
264
266 SPELL_CHANNELING = 39123
268
270{
271 public:
272
273 npc_shadowmoon_channeler() : CreatureScript("npc_shadowmoon_channeler") { }
274
276 {
278 {
279 Initialize();
280 }
281
283 {
284 ShadowBolt_Timer = 1000 + rand32() % 1000;
285 MarkOfShadow_Timer = 5000 + rand32() % 2000;
286 check_Timer = 0;
287 }
288
292
293 void Reset() override
294 {
295 Initialize();
296 if (me->IsNonMeleeSpellCast(false))
298 }
299
300 void JustEngagedWith(Unit* who) override
301 {
304 if (me->IsNonMeleeSpellCast(false))
306 DoStartMovement(who);
307 }
308
309 void JustDied(Unit* killer) override
310 {
311 if (!killer)
312 return;
313
316 }
317
318 void UpdateAI(uint32 diff) override
319 {
320 if (!UpdateVictim())
321 {
322 if (check_Timer <= diff)
323 {
324 if (!me->IsNonMeleeSpellCast(false))
325 {
327 {
329 if (Unit* channeled = ObjectAccessor::GetUnit(*me, channeler))
330 DoCast(channeled, SPELL_CHANNELING);
331 }
332 }
333 check_Timer = 5000;
334 }
335 else
336 check_Timer -= diff;
337
338 return;
339 }
340
341 if (MarkOfShadow_Timer <= diff)
342 {
345 MarkOfShadow_Timer = 15000 + rand32() % 5000;
346 }
347 else
348 MarkOfShadow_Timer -=diff;
349
350 if (ShadowBolt_Timer <= diff)
351 {
353 ShadowBolt_Timer = 5000 + rand32() % 1000;
354 }
355 else
356 ShadowBolt_Timer -=diff;
357 }
358 };
359
360 CreatureAI* GetAI(Creature* creature) const override
361 {
362 return GetBloodFurnaceAI<npc_shadowmoon_channelerAI>(creature);
363 }
364};
365
367{
370}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
uint32 rand32()
Definition: Random.cpp:70
#define ENSURE_AI(a, b)
Definition: UnitAI.h:29
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:145
@ DATA_KELIDAN_THE_BREAKER
Definition: blood_furnace.h:33
@ SPELL_SHADOW_BOLT_VOLLEY
@ ACTION_ACTIVATE_ADDS
@ H_SPELL_SHADOW_BOLT_VOLLEY
const float ShadowmoonChannelers[5][4]
void AddSC_boss_kelidan_the_breaker()
void JustEngagedWith(Unit *who) override
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
void SetReactState(ReactStates st)
Definition: Creature.h:160
void SetImmuneToAll(bool apply) override
Definition: Creature.h:167
CreatureAI * AI() const
Definition: Creature.h:214
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
void Clear()
Definition: ObjectGuid.h:286
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
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:627
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3059
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
bool IsAlive() const
Definition: Unit.h:1164
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
bool IsInCombat() const
Definition: Unit.h:1043
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
bool isDead() const
Definition: Unit.h:1166
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:2025
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
bool IsHeroic() const
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void DoTeleportAll(float x, float y, float z, float o)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)