TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boss_vazruden_the_herald.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/* ScriptData
19Name: Boss_Vazruden_the_Herald
20%Complete: 90
21Comment:
22Category: Hellfire Citadel, Hellfire Ramparts
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "hellfire_ramparts.h"
27#include "MotionMaster.h"
28#include "ObjectAccessor.h"
29#include "Player.h"
30#include "ScriptedCreature.h"
31#include "SpellInfo.h"
32#include "TemporarySummon.h"
33
34enum Says
35{
37
42
43 EMOTE = 0
44};
45
47{
57};
58
59const float VazrudenMiddle[3] = { -1406.5f, 1746.5f, 81.2f };
60
61const float VazrudenRing[2][3] =
62{
63 { -1430.0f, 1705.0f, 112.0f },
64 { -1377.0f, 1760.0f, 112.0f }
65};
66
67struct boss_nazan : public BossAI
68{
69 boss_nazan(Creature* creature) : BossAI(creature, DATA_NAZAN)
70 {
71 Initialize();
72 flight = true;
75 }
76
78 {
79 Fireball_Timer = 4000;
80 Fly_Timer = 45000;
81 Turn_Timer = 0;
82 }
83
84 void Reset() override
85 {
86 Initialize();
87 _Reset();
88 }
89
90 void JustEngagedWith(Unit* /*who*/) override { }
91
92 void IsSummonedBy(WorldObject* summoner) override
93 {
94 if (summoner->GetEntry() == NPC_VAZRUDEN_HERALD)
95 VazrudenGUID = summoner->GetGUID();
96 }
97
98 void JustSummoned(Creature* summoned) override
99 {
100 if (summoned && summoned->GetEntry() == NPC_LIQUID_FIRE)
101 {
102 summoned->SetLevel(me->GetLevel());
103 summoned->SetFaction(me->GetFaction());
105 summoned->CastSpell(summoned, SPELL_FIRE_NOVA_VISUAL, true);
106 }
107 }
108
109 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
110 {
111 if (spellInfo->Id == uint32(SPELL_FIREBALL))
113 }
114
115 void UpdateAI(uint32 diff) override
116 {
117 if (!UpdateVictim())
118 return;
119
120 if (Fireball_Timer <= diff)
121 {
123 DoCast(victim, SPELL_FIREBALL, true);
124 Fireball_Timer = urand(4000, 7000);
125 }
126 else
127 Fireball_Timer -= diff;
128
129 if (flight) // phase 1 - the flight
130 {
132 if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20)))
133 {
134 flight = false;
135 BellowingRoar_Timer = 6000;
136 ConeOfFire_Timer = 12000;
137 me->SetDisableGravity(false);
138 me->SetWalk(true);
141 AttackStart(victim);
143 Talk(EMOTE);
144 return;
145 }
146 else
147 Fly_Timer -= diff;
148
149 if (Turn_Timer <= diff)
150 {
151 uint32 waypoint = (Fly_Timer/10000)%2;
154 Turn_Timer = 10000;
155 }
156 else
157 Turn_Timer -= diff;
158 }
159 else // phase 2 - land fight
160 {
161 if (ConeOfFire_Timer <= diff)
162 {
164 ConeOfFire_Timer = 12000;
165 Fireball_Timer = 4000;
166 }
167 else
168 ConeOfFire_Timer -= diff;
169
170 if (IsHeroic())
171 {
172 if (BellowingRoar_Timer <= diff)
173 {
175 BellowingRoar_Timer = 45000;
176 }
177 else
178 BellowingRoar_Timer -= diff;
179 }
180
182 }
183 }
184
185 private:
191 bool flight;
193};
194
195struct boss_vazruden : public BossAI
196{
198 {
199 Initialize();
200 }
201
203 {
204 Revenge_Timer = 4000;
205 UnsummonCheck = 2000;
206 WipeSaid = false;
207 }
208
209 void Reset() override
210 {
211 Initialize();
212 _Reset();
213 }
214
215 void JustEngagedWith(Unit* who) override
216 {
219 }
220
221 void KilledUnit(Unit* who) override
222 {
223 if (who && who->GetEntry() != NPC_VAZRUDEN)
224 Talk(SAY_KILL);
225 }
226
227 void JustDied(Unit* killer) override
228 {
229 if (killer && killer != me)
230 Talk(SAY_DIE);
231 _JustDied();
232 }
233
234 void UpdateAI(uint32 diff) override
235 {
236 if (!UpdateVictim())
237 {
238 if (UnsummonCheck < diff && me->IsAlive())
239 {
240 if (!WipeSaid)
241 {
242 Talk(SAY_WIPE);
243 WipeSaid = true;
244 }
246 }
247 else
248 UnsummonCheck -= diff;
249 return;
250 }
251
252 if (Revenge_Timer <= diff)
253 {
254 if (Unit* victim = me->GetVictim())
256 Revenge_Timer = 5000;
257 }
258 else
259 Revenge_Timer -= diff;
260
262 }
263
264 private:
268};
269
271{
273 {
274 Initialize();
275 summoned = false;
276 sentryDown = false;
277 }
278
280 {
281 phase = 0;
282 waypoint = 0;
283 check = 0;
284 }
285
286 void Reset() override
287 {
288 Initialize();
289 UnsummonAdds();
290 }
291
293 {
294 if (summoned)
295 {
297 if (!Nazan)
298 Nazan = me->FindNearestCreature(NPC_NAZAN, 5000);
299 if (Nazan)
300 {
301 Nazan->DisappearAndDie();
303 }
304
306 if (!Vazruden)
307 Vazruden = me->FindNearestCreature(NPC_VAZRUDEN, 5000);
308 if (Vazruden)
309 {
310 Vazruden->DisappearAndDie();
312 }
313 summoned = false;
315 me->SetVisible(true);
316 }
317 }
318
320 {
321 if (!summoned)
322 {
324 VazrudenGUID = Vazruden->GetGUID();
326 {
327 NazanGUID = Nazan->GetGUID();
328 if (Player* player = Nazan->SelectNearestPlayer(60.0f))
329 Nazan->AI()->AttackStart(player);
330 }
331 summoned = true;
332 me->SetVisible(false);
334 }
335 }
336
337 void JustEngagedWith(Unit* /*who*/) override
338 {
339 if (phase == 0)
340 {
341 phase = 1;
342 check = 0;
344 }
345 }
346
347 void JustSummoned(Creature* summon) override
348 {
349 if (!summon)
350 return;
351 Unit* victim = me->GetVictim();
352 if (summon->GetEntry() == NPC_NAZAN)
353 {
354 summon->SetDisableGravity(true);
355 summon->SetSpeedRate(MOVE_FLIGHT, 2.5f);
356 if (victim)
357 AttackStartNoMove(victim);
358 }
359 else
360 if (victim)
361 summon->AI()->AttackStart(victim);
362 }
363
364 void SentryDownBy(Unit* killer)
365 {
366 if (sentryDown)
367 {
368 AttackStartNoMove(killer);
369 sentryDown = false;
370 }
371 else
372 sentryDown = true;
373 }
374
375 void UpdateAI(uint32 diff) override
376 {
377 switch (phase)
378 {
379 case 0: // circle around the platform
380 return;
381 break;
382 case 1: // go to the middle and begin the fight
383 if (check <= diff)
384 {
386 {
389 check = 1000;
390 }
391 else
392 {
393 SummonAdds();
394 phase = 2;
395 return;
396 }
397 }
398 else
399 check -= diff;
400 break;
401 default: // adds do the job now
402 if (check <= diff)
403 {
406 if ((Nazan && Nazan->IsAlive()) || (Vazruden && Vazruden->IsAlive()))
407 {
408 if ((Nazan && Nazan->GetVictim()) || (Vazruden && Vazruden->GetVictim()))
409 return;
410 else
411 {
412 UnsummonAdds();
414 return;
415 }
416 }
417 if (!(Nazan && Nazan->IsAlive()) && !(Vazruden && Vazruden->IsAlive()))
418 {
420 }
421 check = 2000;
422 }
423 else
424 check -= diff;
425 break;
426 }
427 }
428
429 private:
437};
438
440{
442 {
443 Initialize();
444 }
445
447 {
448 KidneyShot_Timer = urand(3000, 7000);
449 }
450
451 void Reset() override
452 {
453 Initialize();
454 }
455
456 void JustEngagedWith(Unit* /*who*/) override { }
457
458 void JustDied(Unit* killer) override
459 {
460 if (!killer)
461 return;
462
464 ENSURE_AI(boss_vazruden_the_herald, herald->AI())->SentryDownBy(killer);
465 }
466
467 void UpdateAI(uint32 diff) override
468 {
469 if (!UpdateVictim())
470 return;
471
472 if (KidneyShot_Timer <= diff)
473 {
474 if (Unit* victim = me->GetVictim())
475 DoCast(victim, SPELL_KIDNEY_SHOT);
476 KidneyShot_Timer = 20000;
477 }
478 else
479 KidneyShot_Timer -= diff;
480
482 }
483
484 private:
486};
487
489{
494}
uint32_t uint32
Definition: Define.h:133
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:63
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:66
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define ENSURE_AI(a, b)
Definition: UnitAI.h:28
@ MOVE_FLIGHT
Definition: UnitDefines.h:352
@ UNIT_STATE_ROOT
Definition: Unit.h:230
static float waypoint[6][3]
Definition: boss_alar.cpp:54
Says
const float VazrudenRing[2][3]
@ SPELL_BELLOWING_ROAR
@ SPELL_SUMMON_LIQUID_FIRE
@ SPELL_SUMMON_LIQUID_FIRE_H
@ SPELL_FIRE_NOVA_VISUAL
void AddSC_boss_vazruden_the_herald()
const float VazrudenMiddle[3]
void JustEngagedWith(Unit *who) override
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:48
bool UpdateVictim()
Definition: CreatureAI.cpp:240
Creature *const me
Definition: CreatureAI.h:81
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:214
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimTier=true) override
Definition: Creature.cpp:2952
bool SetWalk(bool enable) override
Definition: Creature.cpp:2941
CreatureAI * AI() const
Definition: Creature.h:154
void DisappearAndDie()
Definition: Creature.h:73
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void Clear()
Definition: ObjectGuid.h:151
uint32 GetEntry() const
Definition: Object.h:80
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:77
Definition: Player.h:915
uint32 Id
Definition: SpellInfo.h:293
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:62
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:104
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:30
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:114
Definition: Unit.h:769
void ClearUnitState(uint32 f)
Definition: Unit.h:875
void SetVisible(bool x)
Definition: Unit.cpp:8509
bool HealthAbovePct(int32 pct) const
Definition: Unit.h:917
void SetFaction(uint32 faction) override
Definition: Unit.h:972
MotionMaster * GetMotionMaster()
Definition: Unit.h:1667
bool IsAlive() const
Definition: Unit.h:1234
void AddUnitState(uint32 f)
Definition: Unit.h:873
uint32 GetFaction() const override
Definition: Unit.h:971
Unit * GetVictim() const
Definition: Unit.h:857
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition: Unit.cpp:8674
void SetLevel(uint8 lvl, bool sendUpdate=true)
Definition: Unit.cpp:9334
uint8 GetLevel() const
Definition: Unit.h:887
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1160
Player * SelectNearestPlayer(float distance) const
Definition: Object.cpp:2161
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2831
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
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2099
@ DATA_VAZRUDEN
@ DATA_NAZAN
@ NPC_VAZRUDEN
@ NPC_NAZAN
@ NPC_VAZRUDEN_HERALD
@ NPC_LIQUID_FIRE
#define RegisterHellfireRampartsCreatureAI(ai_name)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
float GetPositionZ() const
Definition: Position.h:81
float GetOrientation() const
Definition: Position.h:82
float GetPositionX() const
Definition: Position.h:79
float GetPositionY() const
Definition: Position.h:80
bool IsHeroic() const
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
void AttackStart(Unit *) override
void AttackStartNoMove(Unit *target)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
void UpdateAI(uint32 diff) override
boss_nazan(Creature *creature)
void JustEngagedWith(Unit *) override
void JustSummoned(Creature *summoned) override
void Reset() override
void SpellHitTarget(WorldObject *target, SpellInfo const *spellInfo) override
void IsSummonedBy(WorldObject *summoner) override
void UpdateAI(uint32 diff) override
void JustSummoned(Creature *summon) override
void JustEngagedWith(Unit *) override
boss_vazruden_the_herald(Creature *creature)
void JustDied(Unit *killer) override
void KilledUnit(Unit *who) override
void JustEngagedWith(Unit *who) override
boss_vazruden(Creature *creature)
void UpdateAI(uint32 diff) override
npc_hellfire_sentry(Creature *creature)
void JustDied(Unit *killer) override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override