Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_azgalor.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 "hyjal.h"
9#include "hyjal_trash.h"
10
12{
14 SPELL_DOOM = 31347,
16 SPELL_CLEAVE = 31345,
18
19 SPELL_THRASH = 12787,
22};
23
25{
28 SAY_DOOM = 2, // Not used?
30};
31
33{
34public:
35 boss_azgalor() : CreatureScript("boss_azgalor") { }
36
38 {
39 return new boss_azgalorAI(creature);
40 }
41
43 {
44 boss_azgalorAI(Creature* creature) : hyjal_trashAI(creature)
45 {
46 instance = creature->GetInstanceScript();
47 go = false;
48 }
49
55 bool enraged;
56
57 bool go;
58
60 {
61 damageTaken = 0;
62 RainTimer = 20000;
63 DoomTimer = 50000;
64 HowlTimer = 30000;
65 CleaveTimer = 10000;
66 EnrageTimer = 600000;
67 enraged = false;
68
69 if (instance && IsEvent)
71 }
72
73 void EnterCombat(Unit* /*who*/) OVERRIDE
74 {
75 if (instance && IsEvent)
78 }
79
80 void KilledUnit(Unit* /*victim*/) OVERRIDE
81 {
83 }
84
86 {
87 if (waypointId == 7 && instance)
88 {
89 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
90 if (target && target->IsAlive())
91 me->AddThreat(target, 0.0f);
92 }
93 }
94
95 void JustDied(Unit* killer) OVERRIDE
96 {
98 if (instance && IsEvent)
101 }
102
104 {
105 if (IsEvent)
106 {
107 //Must update npc_escortAI
109 if (!go)
110 {
111 go = true;
112 if (instance)
113 {
114 AddWaypoint(0, 5492.91f, -2404.61f, 1462.63f);
115 AddWaypoint(1, 5531.76f, -2460.87f, 1469.55f);
116 AddWaypoint(2, 5554.58f, -2514.66f, 1476.12f);
117 AddWaypoint(3, 5554.16f, -2567.23f, 1479.90f);
118 AddWaypoint(4, 5540.67f, -2625.99f, 1480.89f);
119 AddWaypoint(5, 5508.16f, -2659.2f, 1480.15f);
120 AddWaypoint(6, 5489.62f, -2704.05f, 1482.18f);
121 AddWaypoint(7, 5457.04f, -2726.26f, 1485.10f);
122 Start(false, true);
123 SetDespawnAtEnd(false);
124 }
125 }
126 }
127
128 //Return since we have no target
129 if (!UpdateVictim())
130 return;
131
132 if (RainTimer <= diff)
133 {
135 RainTimer = 20000+rand()%15000;
136 } else RainTimer -= diff;
137
138 if (DoomTimer <= diff)
139 {
140 DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true), SPELL_DOOM);//never on tank
141 DoomTimer = 45000+rand()%5000;
142 } else DoomTimer -= diff;
143
144 if (HowlTimer <= diff)
145 {
147 HowlTimer = 30000;
148 } else HowlTimer -= diff;
149
150 if (CleaveTimer <= diff)
151 {
153 CleaveTimer = 10000+rand()%5000;
154 } else CleaveTimer -= diff;
155
156 if (EnrageTimer < diff && !enraged)
157 {
158 me->InterruptNonMeleeSpells(false);
159 DoCast(me, SPELL_BERSERK, true);
160 enraged = true;
161 EnrageTimer = 600000;
162 } else EnrageTimer -= diff;
163
165 }
166 };
167};
168
170{
171public:
172 npc_lesser_doomguard() : CreatureScript("npc_lesser_doomguard") { }
173
175 {
176 return new npc_lesser_doomguardAI(creature);
177 }
178
180 {
182 {
183 instance = creature->GetInstanceScript();
184 if (instance)
185 AzgalorGUID = instance->GetData64(DATA_AZGALOR);
186 }
187
193
195 {
196 CrippleTimer = 50000;
197 WarstompTimer = 10000;
199 CheckTimer = 5000;
200 }
201
202 void EnterCombat(Unit* /*who*/) OVERRIDE
203 {
204 }
205
206 void KilledUnit(Unit* /*victim*/) OVERRIDE
207 {
208 }
209
210 void WaypointReached(uint32 /*waypointId*/) OVERRIDE
211 {
212 }
213
215
216 {
217 if (me->IsWithinDist(who, 50) && !me->IsInCombat() && me->IsValidAttackTarget(who))
218 AttackStart(who);
219 }
220
221 void JustDied(Unit* /*killer*/) OVERRIDE
222 {
223 }
224
226 {
227 if (CheckTimer <= diff)
228 {
229 if (AzgalorGUID)
230 {
232 if (!boss || (boss && boss->isDead()))
233 {
234 me->setDeathState(DeathState::JUST_DIED);
235 me->RemoveCorpse();
236 return;
237 }
238 }
239 CheckTimer = 5000;
240 } else CheckTimer -= diff;
241
242 //Return since we have no target
243 if (!UpdateVictim())
244 return;
245
246 if (WarstompTimer <= diff)
247 {
249 WarstompTimer = 10000+rand()%5000;
250 } else WarstompTimer -= diff;
251
252 if (CrippleTimer <= diff)
253 {
255 CrippleTimer = 25000+rand()%5000;
256 } else CrippleTimer -= diff;
257
259 }
260 };
261};
262
264{
265 new boss_azgalor();
267}
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
@ JUST_DIED
Definition Unit.h:504
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_CLEAVE
@ SAY_ONAGGRO
@ SAY_ONSLAY
@ SAY_ONDEATH
@ SPELL_CLEAVE
@ SPELL_CRIPPLE
@ SPELL_RAIN_OF_FIRE
@ SPELL_DOOM
@ SPELL_WARSTOMP
@ SPELL_HOWL_OF_AZGALOR
@ SPELL_THRASH
@ SPELL_BERSERK
void AddSC_boss_azgalor()
@ SAY_ONAGGRO
@ SAY_ONSLAY
@ SAY_ONDEATH
@ SAY_DOOM
#define SPELL_BERSERK
@ SPELL_RAIN_OF_FIRE
@ SPELL_THRASH
@ SPELL_WARSTOMP
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
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
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
bool IsAlive() const
Definition Unit.h:2032
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
bool isDead() const
Definition Unit.h:2040
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_THRALL
Definition hyjal.h:26
@ DATA_AZGALOREVENT
Definition hyjal.h:20
@ DATA_AZGALOR
Definition hyjal.h:19
Creature * me
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void KilledUnit(Unit *) OVERRIDE
void JustDied(Unit *killer) OVERRIDE
boss_azgalorAI(Creature *creature)
void JustDied(Unit *)
uint32 damageTaken
Definition hyjal_trash.h:34
InstanceScript * instance
Definition hyjal_trash.h:25
hyjal_trashAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SetDespawnAtEnd(bool despawn)
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)
void AttackStart(Unit *who) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================