Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_anubarak.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 "azjol_nerub.h"
9
11{
15 SPELL_POUND = 53472,
19 SPELL_IMPALE_SPIKE = 53539, //this is not the correct visual effect
20 //SPELL_IMPALE_TARGET = 53458,
21};
22
31
32// not in db
42
43enum Misc
44{
46};
47
56
58{
59 { 550.7f, 282.8f, 224.3f, 0.0f },
60 { 551.1f, 229.4f, 224.3f, 0.0f },
61};
62
64{
65 { 550.348633f, 316.006805f, 234.2947f, 0.0f },
66 { 550.188660f, 324.264557f, 237.7412f, 0.0f },
67};
68
70{
71public:
72 boss_anub_arak() : CreatureScript("boss_anub_arak") { }
73
75 {
77 {
78 instance = creature->GetInstanceScript();
79 }
80
82
97
101
103
105 {
110
113 Channeling = false;
115
117 me->RemoveAura(SPELL_SUBMERGE);
118
119 Summons.DespawnAll();
120
121 if (instance)
122 {
123 instance->SetBossState(DATA_ANUBARAK, NOT_STARTED);
125 }
126 }
127
129 {
130 Position targetPos;
131 target->GetPosition(&targetPos);
132
134 {
135 ImpaleTarget = impaleTarget->GetGUID();
136 impaleTarget->SetReactState(REACT_PASSIVE);
137 impaleTarget->SetDisplayId(DISPLAY_INVISIBLE);
139 return impaleTarget;
140 }
141
142 return NULL;
143 }
144
145 void EnterCombat(Unit* /*who*/) OVERRIDE
146 {
148 DelayTimer = 0;
149 if (instance)
151 }
152
154 {
155 if (instance)
156 instance->SetBossState(DATA_ANUBARAK, IN_PROGRESS);
157 }
158
160 {
161 if (!UpdateVictim())
162 return;
163
164 if (DelayTimer && DelayTimer > 5000)
166 else DelayTimer+=diff;
167
168 switch (Phase)
169 {
171 if (ImpaleTimer <= diff)
172 {
173 switch (ImpalePhase)
174 {
176 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
177 {
178 if (Creature* impaleTarget = DoSummonImpaleTarget(target))
179 impaleTarget->CastSpell(impaleTarget, SPELL_IMPALE_SHAKEGROUND, true);
182 }
183 break;
185 if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget))
186 {
187 impaleTarget->CastSpell(impaleTarget, SPELL_IMPALE_SPIKE, false);
188 impaleTarget->RemoveAurasDueToSpell(SPELL_IMPALE_SHAKEGROUND);
189 }
192 break;
193 case IMPALE_PHASE_DMG:
194 if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget))
195 me->CastSpell(impaleTarget, SPELL_IMPALE_DMG, true);
198 break;
199 }
200 } else ImpaleTimer -= diff;
201
202 if (!GuardianSummoned)
203 {
204 for (uint8 i = 0; i < 2; ++i)
205 {
207 {
208 Guardian->AddThreat(me->GetVictim(), 0.0f);
210 }
211 }
212 GuardianSummoned = true;
213 }
214
216 {
217 if (VenomancerTimer <= diff)
218 {
219 if (UndergroundPhase > 1)
220 {
221 for (uint8 i = 0; i < 2; ++i)
222 {
224 {
225 Venomancer->AddThreat(me->GetVictim(), 0.0f);
226 DoZoneInCombat(Venomancer);
227 }
228 }
229 VenomancerSummoned = true;
230 }
231 } else VenomancerTimer -= diff;
232 }
233
234 if (!DatterSummoned)
235 {
236 if (DatterTimer <= diff)
237 {
238 if (UndergroundPhase > 2)
239 {
240 for (uint8 i = 0; i < 2; ++i)
241 {
243 {
244 Datter->AddThreat(me->GetVictim(), 0.0f);
245 DoZoneInCombat(Datter);
246 }
247 }
248 DatterSummoned = true;
249 }
250 } else DatterTimer -= diff;
251
252 if (me->HasAura(SPELL_LEECHING_SWARM))
253 me->RemoveAurasDueToSpell(SPELL_LEECHING_SWARM);
254 }
255
256 if (UndergroundTimer <= diff)
257 {
258 me->RemoveAura(SPELL_SUBMERGE);
261 } else UndergroundTimer -= diff;
262 break;
263
264 case PHASE_MELEE:
265 if (((UndergroundPhase == 0 && HealthBelowPct(75))
266 || (UndergroundPhase == 1 && HealthBelowPct(50))
267 || (UndergroundPhase == 2 && HealthBelowPct(25)))
268 && !me->HasUnitState(UNIT_STATE_CASTING))
269 {
270 GuardianSummoned = false;
271 VenomancerSummoned = false;
272 DatterSummoned = false;
273
277
278 ImpalePhase = 0;
280
281 DoCast(me, SPELL_SUBMERGE, false);
283
286 }
287
288 if (Channeling == true)
289 {
290 for (uint8 i = 0; i < 8; ++i)
292 Channeling = false;
293 }
294 else if (CarrionBeetlesTimer <= diff)
295 {
296 Channeling = true;
299 } else CarrionBeetlesTimer -= diff;
300
301 if (LeechingSwarmTimer <= diff)
302 {
305 } else LeechingSwarmTimer -= diff;
306
307 if (PoundTimer <= diff)
308 {
309 if (Unit* target = me->GetVictim())
310 {
311 if (Creature* pImpaleTarget = DoSummonImpaleTarget(target))
312 me->CastSpell(pImpaleTarget, SPELL_POUND, false);
313 }
314 PoundTimer = 16500;
315 } else PoundTimer -= diff;
316
318 break;
319 }
320 }
321
322 void JustDied(Unit* /*killer*/) OVERRIDE
323 {
325 Summons.DespawnAll();
326 if (instance)
327 instance->SetBossState(DATA_ANUBARAK, DONE);
328 }
329
331 {
332 if (victim->GetTypeId() != TypeID::TYPEID_PLAYER)
333 return;
334
335 Talk(SAY_SLAY);
336 }
337
339 {
340 Summons.Summon(summon);
341 }
342 };
343
345 {
346 return new boss_anub_arakAI(creature);
347 }
348};
349
351{
352 new boss_anub_arak();
353}
@ IN_MILLISECONDS
Definition Common.h:125
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:158
std::uint8_t uint8
Definition Define.h:79
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
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_CORPSE_DESPAWN
Definition Object.h:72
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:69
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ REACT_PASSIVE
Definition Unit.h:1156
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_DISABLE_MOVE
Definition Unit.h:627
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
Creatures
@ DATA_ANUBARAK
Definition azjol_nerub.h:18
@ SAY_SLAY
@ SAY_INTRO
const Position SpawnPoint[2]
@ CREATURE_GUARDIAN
@ CREATURE_IMPALE_TARGET
@ DISPLAY_INVISIBLE
@ CREATURE_DATTER
@ CREATURE_VENOMANCER
@ ACHIEV_TIMED_START_EVENT
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_SUBMERGE
@ SAY_LOCUST
const Position SpawnPointGuardian[2]
@ SPELL_LEECHING_SWARM
@ SPELL_CARRION_BEETLES
@ SPELL_IMPALE_SHAKEGROUND
@ SPELL_SUBMERGE
@ SPELL_IMPALE_DMG
@ SPELL_SUMMON_CARRION_BEETLES
@ SPELL_POUND
@ SPELL_IMPALE_SPIKE
@ IMPALE_PHASE_DMG
@ IMPALE_PHASE_TARGET
@ IMPALE_PHASE_ATTACK
@ PHASE_MELEE
@ PHASE_UNDERGROUND
void AddSC_boss_anub_arak()
#define SAY_DEATH
#define SAY_AGGRO
@ PHASE_MELEE
@ DISPLAY_INVISIBLE
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
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
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition Unit.cpp:4463
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ ACHIEV_TIMED_START_EVENT
void GetPosition(float &x, float &y) const
Definition Object.h:333
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
Creature * DoSummonImpaleTarget(Unit *target)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void KilledUnit(Unit *victim) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
boss_anub_arakAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE