Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_bjarngrim.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 General Bjarngrim
8SD%Complete: 70%
9SDComment: Waypoint needed, we expect boss to always have 2x Stormforged Lieutenant following
10SDCategory: Halls of Lightning
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "halls_of_lightning.h"
16
29
31{
33 //SPELL_DEFENSIVE_AURA = 41105,
35 SPELL_PUMMEL = 12555,
38
40 //SPELL_BERSEKER_AURA = 41107,
43 SPELL_CLEAVE = 15284,
44
46 //SPELL_BATTLE_AURA = 41106,
48 SPELL_SLAM = 52026,
49
50 //OTHER SPELLS
51 //SPELL_CHARGE_UP = 52098, // only used when starting walk from one platform to the other
52 SPELL_TEMPORARY_ELECTRICAL_CHARGE = 52092, // triggered part of above
53
57};
58
63
65{
66 EQUIP_SWORD = 37871,
67 EQUIP_SHIELD = 35642,
68 EQUIP_MACE = 43623
69};
70
77
78/*######
79## boss_bjarngrim
80######*/
81
83{
84public:
85 boss_bjarngrim() : CreatureScript("boss_bjarngrim") { }
86
88 {
89 return new boss_bjarngrimAI(creature);
90 }
91
93 {
94 boss_bjarngrimAI(Creature* creature) : ScriptedAI(creature)
95 {
96 instance = creature->GetInstanceScript();
99 canBuff = true;
100 }
101
103
106
109
112
117
121
124
126
128 {
129 if (canBuff)
132
133 m_bIsChangingStance = false;
134
136 m_uiCharge_Timer = 1000;
137
138 m_uiChangeStance_Timer = std::rand() % 25000 + 20000;
139
141 m_uiKnockAway_Timer = 20000;
142 m_uiPummel_Timer = 10000;
143 m_uiIronform_Timer = 25000;
144
145 m_uiIntercept_Timer = 5000;
146 m_uiWhirlwind_Timer = 10000;
147 m_uiCleave_Timer = 8000;
148
150 m_uiSlam_Timer = 10000;
151
152 for (uint8 i = 0; i < 2; ++i)
153 {
154 if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*me), m_auiStormforgedLieutenantGUID[i])))
155 {
156 if (!pStormforgedLieutenant->IsAlive())
157 pStormforgedLieutenant->Respawn();
158 }
159 }
160
162 {
166 }
167
169
170 if (instance)
171 instance->SetBossState(DATA_BJARNGRIM, NOT_STARTED);
172 }
173
175 {
177 canBuff = true;
178 else
179 canBuff = false;
180
182 }
183
184 void EnterCombat(Unit* /*who*/) OVERRIDE
185 {
187
188 //must get both lieutenants here and make sure they are with him
189 me->CallForHelp(30.0f);
190
191 if (instance)
192 instance->SetBossState(DATA_BJARNGRIM, IN_PROGRESS);
193 }
194
195 void KilledUnit(Unit* /*victim*/) OVERRIDE
196 {
197 Talk(SAY_SLAY);
198 }
199
200 void JustDied(Unit* /*killer*/) OVERRIDE
201 {
203
204 if (instance)
205 instance->SetBossState(DATA_BJARNGRIM, DONE);
206 }
207
210 {
211 switch (uiStance)
212 {
213 case STANCE_DEFENSIVE:
214 me->RemoveAurasDueToSpell(SPELL_DEFENSIVE_STANCE);
215 break;
216 case STANCE_BERSERKER:
217 me->RemoveAurasDueToSpell(SPELL_BERSEKER_STANCE);
218 break;
219 case STANCE_BATTLE:
220 me->RemoveAurasDueToSpell(SPELL_BATTLE_STANCE);
221 break;
222 }
223 }
224
226 {
227 //Return since we have no target
228 if (!UpdateVictim())
229 return;
230
231 // Change stance
232 if (m_uiChangeStance_Timer <= uiDiff)
233 {
234 //wait for current spell to finish before change stance
235 if (me->IsNonMeleeSpellCasted(false))
236 return;
237
239
240 int uiTempStance = rand()%(3-1);
241
242 if (uiTempStance >= m_uiStance)
243 ++uiTempStance;
244
245 m_uiStance = uiTempStance;
246
247 switch (m_uiStance)
248 {
249 case STANCE_DEFENSIVE:
254 break;
255 case STANCE_BERSERKER:
260 break;
261 case STANCE_BATTLE:
266 break;
267 }
268
269 m_uiChangeStance_Timer = std::rand() % 25000 + 20000;
270 return;
271 }
272 else
273 m_uiChangeStance_Timer -= uiDiff;
274
275 switch (m_uiStance)
276 {
277 case STANCE_DEFENSIVE:
278 {
279 if (m_uiReflection_Timer <= uiDiff)
280 {
282 m_uiReflection_Timer = std::rand() % 9000 + 8000;
283 }
284 else
285 m_uiReflection_Timer -= uiDiff;
286
287 if (m_uiKnockAway_Timer <= uiDiff)
288 {
290 m_uiKnockAway_Timer = std::rand() % 21000 + 20000;
291 }
292 else
293 m_uiKnockAway_Timer -= uiDiff;
294
295 if (m_uiPummel_Timer <= uiDiff)
296 {
298 m_uiPummel_Timer = std::rand() % 11000 + 10000;
299 }
300 else
301 m_uiPummel_Timer -= uiDiff;
302
303 if (m_uiIronform_Timer <= uiDiff)
304 {
306 m_uiIronform_Timer = std::rand() % 26000 + 25000;
307 }
308 else
309 m_uiIronform_Timer -= uiDiff;
310
311 break;
312 }
313 case STANCE_BERSERKER:
314 {
315 if (m_uiIntercept_Timer <= uiDiff)
316 {
317 //not much point is this, better random target and more often?
319 m_uiIntercept_Timer = std::rand() % 46000 + 45000;
320 }
321 else
322 m_uiIntercept_Timer -= uiDiff;
323
324 if (m_uiWhirlwind_Timer <= uiDiff)
325 {
327 m_uiWhirlwind_Timer = std::rand() % 11000 + 10000;
328 }
329 else
330 m_uiWhirlwind_Timer -= uiDiff;
331
332 if (m_uiCleave_Timer <= uiDiff)
333 {
335 m_uiCleave_Timer = std::rand() % 9000 + 8000;
336 }
337 else
338 m_uiCleave_Timer -= uiDiff;
339
340 break;
341 }
342 case STANCE_BATTLE:
343 {
344 if (m_uiMortalStrike_Timer <= uiDiff)
345 {
347 m_uiMortalStrike_Timer = std::rand() % 21000 + 20000;
348 }
349 else
350 m_uiMortalStrike_Timer -= uiDiff;
351
352 if (m_uiSlam_Timer <= uiDiff)
353 {
355 m_uiSlam_Timer = std::rand() % 16000 + 15000;
356 }
357 else
358 m_uiSlam_Timer -= uiDiff;
359
360 break;
361 }
362 }
363
365 }
366 };
367};
368
369/*######
370## npc_stormforged_lieutenant
371######*/
372
374{
375public:
376 npc_stormforged_lieutenant() : CreatureScript("npc_stormforged_lieutenant") { }
377
379 {
380 return new npc_stormforged_lieutenantAI(creature);
381 }
382
384 {
386 {
387 instance = creature->GetInstanceScript();
388 }
389
391
394
396 {
397 m_uiArcWeld_Timer = std::rand() % 21000 + 20000;
398 m_uiRenewSteel_Timer = std::rand() % 11000 + 10000;
399 }
400
402 {
403 if (instance)
404 {
405 if (Creature* pBjarngrim = instance->instance->GetCreature(instance->GetData64(DATA_BJARNGRIM)))
406 {
407 if (pBjarngrim->IsAlive() && !pBjarngrim->GetVictim())
408 pBjarngrim->AI()->AttackStart(who);
409 }
410 }
411 }
412
414 {
415 //Return since we have no target
416 if (!UpdateVictim())
417 return;
418
419 if (m_uiArcWeld_Timer <= uiDiff)
420 {
422 m_uiArcWeld_Timer = std::rand() % 21000 + 20000;
423 }
424 else
425 m_uiArcWeld_Timer -= uiDiff;
426
427 if (m_uiRenewSteel_Timer <= uiDiff)
428 {
429 if (instance)
430 {
431 if (Creature* pBjarngrim = instance->instance->GetCreature(instance->GetData64(DATA_BJARNGRIM)))
432 {
433 if (pBjarngrim->IsAlive())
434 DoCast(pBjarngrim, SPELL_RENEW_STEEL_N);
435 }
436 }
437 m_uiRenewSteel_Timer = std::rand() % 14000 + 10000;
438 }
439 else
440 m_uiRenewSteel_Timer -= uiDiff;
441
443 }
444 };
445};
446
@ EQUIP_UNEQUIP
Definition CreatureAI.h:50
@ EQUIP_NO_CHANGE
Definition CreatureAI.h:49
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
Creatures
@ SPELL_CLEAVE
@ SPELL_WHIRLWIND
@ SAY_SLAY
@ NPC_STORMFORGED_LIEUTENANT
@ SAY_DEATH
@ EMOTE_DEFENSIVE_STANCE
@ SAY_AGGRO
@ EMOTE_BERSEKER_STANCE
@ SAY_BERSEKER_STANCE
@ SAY_SLAY
@ EMOTE_BATTLE_STANCE
@ SAY_BATTLE_STANCE
@ SAY_DEFENSIVE_STANCE
@ SPELL_CLEAVE
@ SPELL_BATTLE_STANCE
@ SPELL_DEFENSIVE_STANCE
@ SPELL_PUMMEL
@ SPELL_TEMPORARY_ELECTRICAL_CHARGE
@ SPELL_BERSEKER_STANCE
@ SPELL_RENEW_STEEL_H
@ SPELL_SLAM
@ SPELL_MORTAL_STRIKE
@ SPELL_IRONFORM
@ SPELL_INTERCEPT
@ SPELL_ARC_WELD
@ SPELL_KNOCK_AWAY
@ SPELL_SPELL_REFLECTION
@ SPELL_WHIRLWIND
@ SPELL_RENEW_STEEL_N
@ STANCE_BERSERKER
@ STANCE_BATTLE
@ STANCE_DEFENSIVE
void AddSC_boss_bjarngrim()
@ EQUIP_SWORD
@ EQUIP_SHIELD
@ EQUIP_MACE
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_MORTAL_STRIKE
@ SPELL_INTERCEPT
@ SPELL_KNOCK_AWAY
Definition boss_gyth.cpp:16
@ SPELL_SPELL_REFLECTION
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_BJARNGRIM
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void DoRemoveStanceAura(uint8 uiStance)
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================