TrinityCore
boss_azgalor.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 "hyjal.h"
20#include "hyjal_trash.h"
21#include "InstanceScript.h"
22#include "ObjectAccessor.h"
23
25{
27 SPELL_DOOM = 31347,
29 SPELL_CLEAVE = 31345,
31
32 SPELL_THRASH = 12787,
35};
36
38{
41 SAY_DOOM = 2, // Not used?
43};
44
45static constexpr uint32 PATH_ESCORT_AZGALOR = 142738;
46
48{
49public:
50 boss_azgalor() : CreatureScript("boss_azgalor") { }
51
52 CreatureAI* GetAI(Creature* creature) const override
53 {
54 return GetHyjalAI<boss_azgalorAI>(creature);
55 }
56
58 {
59 boss_azgalorAI(Creature* creature) : hyjal_trashAI(creature)
60 {
61 Initialize();
62 instance = creature->GetInstanceScript();
63 go = false;
64 }
65
67 {
68 damageTaken = 0;
69 RainTimer = 20000;
70 DoomTimer = 50000;
71 HowlTimer = 30000;
72 CleaveTimer = 10000;
73 EnrageTimer = 600000;
74 enraged = false;
75 }
76
82 bool enraged;
83
84 bool go;
85
86 void Reset() override
87 {
88 Initialize();
89
90 if (IsEvent)
92 }
93
94 void JustEngagedWith(Unit* /*who*/) override
95 {
96 if (IsEvent)
98
100 }
101
102 void KilledUnit(Unit* /*victim*/) override
103 {
105 }
106
107 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
108 {
109 if (waypointId == 7 && instance)
110 {
112 if (target && target->IsAlive())
113 AddThreat(target, 0.0f);
114 }
115 }
116
117 void JustDied(Unit* killer) override
118 {
120 if (IsEvent)
123 }
124
125 void UpdateAI(uint32 diff) override
126 {
127 if (IsEvent)
128 {
129 //Must update EscortAI
130 EscortAI::UpdateAI(diff);
131 if (!go)
132 {
133 go = true;
135 Start(false);
136 SetDespawnAtEnd(false);
137 }
138 }
139
140 //Return since we have no target
141 if (!UpdateVictim())
142 return;
143
144 if (RainTimer <= diff)
145 {
147 RainTimer = 20000 + rand32() % 15000;
148 } else RainTimer -= diff;
149
150 if (DoomTimer <= diff)
151 {
152 DoCast(SelectTarget(SelectTargetMethod::Random, 1, 100, true), SPELL_DOOM);//never on tank
153 DoomTimer = 45000 + rand32() % 5000;
154 } else DoomTimer -= diff;
155
156 if (HowlTimer <= diff)
157 {
159 HowlTimer = 30000;
160 } else HowlTimer -= diff;
161
162 if (CleaveTimer <= diff)
163 {
165 CleaveTimer = 10000 + rand32() % 5000;
166 } else CleaveTimer -= diff;
167
168 if (EnrageTimer < diff && !enraged)
169 {
171 DoCast(me, SPELL_BERSERK, true);
172 enraged = true;
173 EnrageTimer = 600000;
174 } else EnrageTimer -= diff;
175 }
176 };
177
178};
179
181{
182public:
183 npc_lesser_doomguard() : CreatureScript("npc_lesser_doomguard") { }
184
185 CreatureAI* GetAI(Creature* creature) const override
186 {
187 return GetHyjalAI<npc_lesser_doomguardAI>(creature);
188 }
189
191 {
193 {
194 CrippleTimer = 50000;
195 WarstompTimer = 10000;
196 CheckTimer = 5000;
198 }
199
204
205 void Reset() override
206 {
207 CrippleTimer = 50000;
208 WarstompTimer = 10000;
210 CheckTimer = 5000;
211 }
212
213 void JustEngagedWith(Unit* /*who*/) override
214 {
215 }
216
217 void KilledUnit(Unit* /*victim*/) override
218 {
219 }
220
221 void MoveInLineOfSight(Unit* who) override
222
223 {
224 if (me->IsWithinDist(who, 50) && !me->IsInCombat() && me->IsValidAttackTarget(who))
225 AttackStart(who);
226 }
227
228 void JustDied(Unit* /*killer*/) override
229 {
230 }
231
232 void UpdateAI(uint32 diff) override
233 {
234 if (CheckTimer <= diff)
235 {
236 if (!AzgalorGUID.IsEmpty())
237 {
239 if (!boss || boss->isDead())
240 {
242 return;
243 }
244 }
245 CheckTimer = 5000;
246 } else CheckTimer -= diff;
247
248 //Return since we have no target
249 if (!UpdateVictim())
250 return;
251
252 if (WarstompTimer <= diff)
253 {
255 WarstompTimer = 10000 + rand32() % 5000;
256 } else WarstompTimer -= diff;
257
258 if (CrippleTimer <= diff)
259 {
261 CrippleTimer = 25000 + rand32() % 5000;
262 } else CrippleTimer -= diff;
263 }
264 };
265
266};
267
269{
270 new boss_azgalor();
272}
Texts
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
@ 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
static constexpr uint32 PATH_ESCORT_AZGALOR
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 DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
virtual bool SetBossState(uint32 id, EncounterState state)
virtual ObjectGuid GetGuidData(uint32 type) const override
bool IsEmpty() const
Definition: ObjectGuid.h:319
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 IsAlive() const
Definition: Unit.h:1164
bool IsInCombat() const
Definition: Unit.h:1043
bool isDead() const
Definition: Unit.h:1166
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition: Object.cpp:2991
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1142
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_THRALL
Definition: hyjal.h:37
@ DATA_AZGALOR
Definition: hyjal.h:33
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void SetDespawnAtEnd(bool despawn)
void LoadPath(uint32 pathId)
void UpdateAI(uint32 diff) override
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *) override
void JustEngagedWith(Unit *) override
boss_azgalorAI(Creature *creature)
void WaypointReached(uint32 waypointId, uint32) override
void JustDied(Unit *killer) override
void JustDied(Unit *) override
uint32 damageTaken
Definition: hyjal_trash.h:43
InstanceScript * instance
Definition: hyjal_trash.h:34