Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_loken.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 Loken
8SD%Complete: 60%
9SDComment: Missing intro.
10SDCategory: Halls of Lightning
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "SpellScript.h"
16#include "halls_of_lightning.h"
17
31
42
47
48/*######
49## Boss Loken
50######*/
51
53{
54public:
55 boss_loken() : CreatureScript("boss_loken") { }
56
58 {
59 return new boss_lokenAI(creature);
60 }
61
62 struct boss_lokenAI : public ScriptedAI
63 {
64 boss_lokenAI(Creature* creature) : ScriptedAI(creature)
65 {
66 instance = creature->GetInstanceScript();
67 }
68
70
74
76
78 {
82
84
85 if (instance)
86 {
87 instance->SetBossState(DATA_LOKEN, NOT_STARTED);
89 }
90 }
91
92 void EnterCombat(Unit* /*who*/) OVERRIDE
93 {
95
96 if (instance)
97 {
98 instance->SetBossState(DATA_LOKEN, IN_PROGRESS);
100 }
101 }
102
103 void JustDied(Unit* /*killer*/) OVERRIDE
104 {
106
107 if (instance)
108 {
109 instance->SetBossState(DATA_LOKEN, DONE);
110 instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PULSING_SHOCKWAVE_AURA);
111 }
112 }
113
114 void KilledUnit(Unit* /*victim*/) OVERRIDE
115 {
116 Talk(SAY_SLAY);
117 }
118
120 {
121 //Return since we have no target
122 if (!UpdateVictim())
123 return;
124
126 {
128 {
130 me->ClearUnitState(UNIT_STATE_CASTING); // this flag breaks movement
131
134 }
135 else
137 }
138
139 if (m_uiArcLightning_Timer <= uiDiff)
140 {
141 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
143
144 m_uiArcLightning_Timer = std::rand() % 16000 + 15000;
145 }
146 else
147 m_uiArcLightning_Timer -= uiDiff;
148
149 if (m_uiLightningNova_Timer <= uiDiff)
150 {
151 Talk(SAY_NOVA);
154
156 m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura
157 m_uiLightningNova_Timer = std::rand() % 21000 + 20000;
158 }
159 else
160 m_uiLightningNova_Timer -= uiDiff;
161
162 // Health check
164 {
166 {
167 case 1: Talk(SAY_75HEALTH); break;
168 case 2: Talk(SAY_50HEALTH); break;
169 case 3: Talk(SAY_25HEALTH); break;
170 }
171
173 }
174
176 }
177 };
178};
179
210
212{
213 new boss_loken();
215}
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:158
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCHOOL_DAMAGE
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
void AddSC_boss_loken()
@ ACHIEV_TIMELY_DEATH_START_EVENT
@ SAY_DEATH
@ SAY_AGGRO
@ EMOTE_NOVA
@ SAY_25HEALTH
@ SAY_SLAY
@ SAY_NOVA
@ SAY_50HEALTH
@ SAY_75HEALTH
@ SPELL_LIGHTNING_NOVA_H
@ SPELL_LIGHTNING_NOVA_N
@ SPELL_ARC_LIGHTNING
@ SPELL_PULSING_SHOCKWAVE_N
@ SPELL_PULSING_SHOCKWAVE_H
@ SPELL_PULSING_SHOCKWAVE_AURA
@ EMOTE_NOVA
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
HookList< EffectHandler > OnEffectHitTarget
Unit * GetHitUnit()
void SetHitDamage(int32 damage)
Unit * GetCaster()
int32 GetHitDamage()
SpellScriptLoader(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
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1684
CreatureAI * GetAI(Creature *creature) const OVERRIDE
SpellScript * GetSpellScript() const OVERRIDE
@ DATA_LOKEN
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
const T & DUNGEON_MODE(const T &normal5, const T &heroic5) const
void JustDied(Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void KilledUnit(Unit *) OVERRIDE
InstanceScript * instance
boss_lokenAI(Creature *creature)
void Reset() OVERRIDE
uint32 m_uiResumePulsingShockwave_Timer
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================