Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_skarvald_dalronn.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/* ScriptData
7SDName: Boss_Skarvald_Dalronn
8SD%Complete: 95
9SDComment: Needs adjustments to blizzlike timers, Yell Text + Sound to DB
10SDCategory: Utgarde Keep
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "utgarde_keep.h"
16
18{
19 // signed for 24200, but used by 24200, 27390
25
26 // signed for 24201, but used by 24201, 27389
32};
33
35{
36 // Spells of Skarvald and his Ghost
37 SPELL_CHARGE = 43651,
40 SPELL_ENRAGE = 48193,
41 // Spells of Dalronn and his Ghost
47};
48
50{
51public:
52 SkarvaldChargePredicate(Unit* unit) : me(unit) { }
53
54 bool operator() (WorldObject* object) const
55 {
56 return object->GetDistance2d(me) >= 5.0f && object->GetDistance2d(me) <= 30.0f;
57 }
58
59private:
61};
62
64{
65public:
66 boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { }
67
69 {
71 {
72 bool ghost = false;
77 bool Dalronn_isDead = false;
78 bool Enraged = false;
79 }
80
82 {
83 Charge_Timer = 5000;
84 StoneStrike_Timer = 10000;
85 Dalronn_isDead = false;
87 Check_Timer = 5000;
88 Enraged = false;
89
90 ghost = me->GetEntry() == NPC_SKARVALD_GHOST;
91 if (!ghost)
92 _Reset();
93 }
94
95 void EnterCombat(Unit* /*who*/) OVERRIDE
96 {
97 if (!ghost)
98 {
101 }
102 }
103
104 void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE
105 {
106 if (!Enraged && !ghost && me->HealthBelowPctDamaged(15, damage))
107 {
108 Enraged = true;
110 }
111 }
112
113 void DoAction(int32 /*actionId*/) OVERRIDE
114 {
115 summons.DespawnAll();
116 }
117
118 void JustDied(Unit* killer) OVERRIDE
119 {
120 if (!ghost)
121 {
122 if (Creature* dalronn = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALRONN)))
123 {
124 if (dalronn->IsAlive())
125 {
127
129
130 //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true);
131 if (Creature* temp = me->SummonCreature(NPC_SKARVALD_GHOST, *me, TempSummonType::TEMPSUMMON_CORPSE_DESPAWN, 5000))
132 {
134 temp->AI()->AttackStart(killer);
135 }
136 }
137 else
138 {
139 dalronn->AI()->DoAction(0);
140 _JustDied();
142 }
143 }
144 }
145 }
146
148 {
149 if (!ghost && who->GetTypeId() == TypeID::TYPEID_PLAYER)
151 }
152
154 {
155 if (!UpdateVictim())
156 return;
157
158 if (!ghost)
159 {
160 if (Check_Timer)
161 {
162 if (Check_Timer <= diff)
163 {
164 Check_Timer = 5000;
166 if (dalronn && dalronn->isDead())
167 {
168 Dalronn_isDead = true;
169 Response_Timer = 2000;
170 Check_Timer = 0;
171 }
172 }
173 else
174 Check_Timer -= diff;
175 }
177 {
178 if (Response_Timer <= diff)
179 {
181
182 Response_Timer = 0;
183 }
184 else
185 Response_Timer -= diff;
186 }
187 }
188
189 if (Charge_Timer <= diff)
190 {
192 DoCast(target, SPELL_CHARGE);
193 Charge_Timer = 5000+rand()%5000;
194 }
195 else
196 Charge_Timer -= diff;
197
198 if (StoneStrike_Timer <= diff)
199 {
201 StoneStrike_Timer = 5000+rand()%5000;
202 }
203 else
204 StoneStrike_Timer -= diff;
205
206 if (!me->HasUnitState(UNIT_STATE_CASTING))
208 }
209 private:
210 bool ghost;
217 };
218
220 {
222 }
223};
224
226{
227public:
228 boss_dalronn_the_controller() : CreatureScript("boss_dalronn_the_controller") { }
229
231 {
233 {
234 bool ghost = false;
238
242 bool Skarvald_isDead = false;
243 }
244
246 {
247 ShadowBolt_Timer = 1000;
248 Debilitate_Timer = 5000;
249 Summon_Timer = 10000;
250 Check_Timer = 5000;
251 Skarvald_isDead = false;
252 Response_Timer = 0;
253 AggroYell_Timer = 0;
254
255 ghost = me->GetEntry() == NPC_DALRONN_GHOST;
256 if (!ghost)
257 _Reset();
258 }
259
260 void EnterCombat(Unit* /*who*/) OVERRIDE
261 {
262 if (!ghost)
263 {
264 _EnterCombat();
265 AggroYell_Timer = 5000;
266 }
267 }
268
269 void DoAction(int32 /*actionId*/) OVERRIDE
270 {
271 summons.DespawnAll();
272 }
273
274 void JustDied(Unit* killer) OVERRIDE
275 {
276 if (!ghost)
277 {
278 if (Creature* skarvald = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SKARVALD)))
279 {
280 if (skarvald->IsAlive())
281 {
283
285
286 //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true);
287 if (Creature* temp = me->SummonCreature(NPC_DALRONN_GHOST, *me, TempSummonType::TEMPSUMMON_CORPSE_DESPAWN, 5000))
288 {
290 temp->AI()->AttackStart(killer);
291 }
292 }
293 else
294 {
295 skarvald->AI()->DoAction(0);
296 _JustDied();
298 }
299 }
300 }
301 }
302
304 {
305 if (!ghost && who->GetTypeId() == TypeID::TYPEID_PLAYER)
307 }
308
310 {
311 if (!UpdateVictim())
312 return;
313
314 if (AggroYell_Timer)
315 {
316 if (AggroYell_Timer <= diff)
317 {
319
320 AggroYell_Timer = 0;
321 }
322 else
323 AggroYell_Timer -= diff;
324 }
325
326 if (!ghost)
327 {
328 if (Check_Timer)
329 {
330 if (Check_Timer <= diff)
331 {
332 Check_Timer = 5000;
334 if (skarvald && skarvald->isDead())
335 {
336 Skarvald_isDead = true;
337 Response_Timer = 2000;
338 Check_Timer = 0;
339 }
340 }
341 else
342 Check_Timer -= diff;
343 }
344
346 {
347 if (Response_Timer <= diff)
348 {
350 Response_Timer = 0;
351 }
352 else
353 Response_Timer -= diff;
354 }
355 }
356
357 if (ShadowBolt_Timer <= diff)
358 {
359 if (!me->IsNonMeleeSpellCasted(false))
360 {
361 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
362 DoCast(target, SPELL_SHADOW_BOLT);
363 ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells
364 }
365 }
366 else
367 ShadowBolt_Timer -= diff;
368
369 if (Debilitate_Timer <= diff)
370 {
371 if (!me->IsNonMeleeSpellCasted(false))
372 {
373 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
374 DoCast(target, SPELL_DEBILITATE);
375 Debilitate_Timer = 5000+rand()%5000;
376 }
377 }
378 else
379 Debilitate_Timer -= diff;
380
381 if (IsHeroic())
382 {
383 if (Summon_Timer <= diff)
384 {
385 if (!me->IsNonMeleeSpellCasted(false))
386 {
388 Summon_Timer = (rand()%10000) + 20000;
389 }
390 }
391 else
392 Summon_Timer -= diff;
393 }
394
396 }
397 private:
398 bool ghost;
402
407 };
408
410 {
412 }
413};
414
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_CORPSE_DESPAWN
Definition Object.h:72
@ UNIT_DYNFLAG_LOOTABLE
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ OBJECT_FIELD_DYNAMIC_FLAGS
@ SPELL_ENRAGE
@ SPELL_CHARGE
@ SPELL_SHADOW_BOLT
@ YELL_DALRONN_SKA_DIEDFIRST
@ YELL_DALRONN_DAL_DIEDFIRST
@ YELL_SKARVALD_KILL
@ YELL_SKARVALD_DAL_DIED
@ YELL_SKARVALD_AGGRO
@ YELL_DALRONN_SKA_DIED
@ YELL_DALRONN_AGGRO
@ YELL_SKARVALD_SKA_DIEDFIRST
@ YELL_SKARVALD_DAL_DIEDFIRST
@ YELL_DALRONN_KILL
@ SPELL_STONE_STRIKE
@ SPELL_SHADOW_BOLT
@ SPELL_SUMMON_SKARVALD_GHOST
@ SPELL_SUMMON_DALRONN_GHOST
@ H_SPELL_SUMMON_SKELETONS
void AddSC_boss_skarvald_dalronn()
InstanceScript *const instance
SummonList summons
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
bool operator()(WorldObject *object) const
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 isDead() const
Definition Unit.h:2040
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool IsHeroic() const
Creature * me
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
AI * GetUtgardeKeepAI(Creature *creature)
@ NPC_SKARVALD_GHOST
@ NPC_DALRONN_GHOST
@ DATA_DALRONN
@ DATA_SKARVALD_DALRONN
@ DATA_SKARVALD