Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_keleseth.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_Prince_Keleseth
8SD%Complete: 100
9SDComment:
10SDCategory: Utgarde Keep
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "SpellScript.h"
16#include "SpellAuraEffects.h"
17#include "utgarde_keep.h"
18
54
55#define SKELETONSPAWN_Z 42.8668f
56
57float const SkeletonSpawnPoint[1][2] =
58{
59 {156.2559f, 259.2093f},
60};
61
62float AttackLoc[3]= {197.636f, 194.046f, 40.8164f};
63
65{
66 public:
67 npc_frost_tomb() : CreatureScript("npc_frost_tomb") { }
68
70 {
71 npc_frost_tombAI(Creature* creature) : ScriptedAI(creature)
72 {
73 _instance = creature->GetInstanceScript();
74 }
75
76 void IsSummonedBy(Unit* summoner) OVERRIDE
77 {
78 DoCast(summoner, SPELL_FROST_TOMB, true);
79 }
80
81 void UpdateAI(uint32 /*diff*/) OVERRIDE { }
82
83 void JustDied(Unit* /*killer*/) OVERRIDE
84 {
86 keleseth->AI()->SetData(DATA_ON_THE_ROCKS, false);
87 }
88
89 private:
91 };
92
94 {
96 }
97};
98
100{
101 public:
102 boss_keleseth() : CreatureScript("boss_keleseth") { }
103
104 struct boss_kelesethAI : public BossAI
105 {
107
109 {
110 _Reset();
111 events.ScheduleEvent(EVENT_SHADOWBOLT, std::rand() % (3 * IN_MILLISECONDS) + (2 * IN_MILLISECONDS));
112 events.ScheduleEvent(EVENT_FROST_TOMB, std::rand() % (19 * IN_MILLISECONDS) + (14 * IN_MILLISECONDS));
114
115 onTheRocks = true;
116 }
117
119 {
120 _EnterCombat();
122
123 if (!who)
124 return;
125
126 std::list<Creature*> guards;
127 me->GetCreatureListWithEntryInGrid(guards, NPC_RUNEMAGE, 60.0f);
128 me->GetCreatureListWithEntryInGrid(guards, NPC_STRATEGIST, 60.0f);
129 if (!guards.empty())
130 {
131 for (std::list<Creature*>::iterator itr = guards.begin(); itr != guards.end(); ++itr)
132 {
133 if ((*itr)->IsAlive() && (*itr)->IsWithinLOSInMap(me))
134 (*itr)->AI()->AttackStart(who);
135 }
136 }
137 }
138
139 void JustDied(Unit* /*killer*/) OVERRIDE
140 {
141 _JustDied();
143 }
144
145 void SetData(uint32 data, uint32 value) OVERRIDE
146 {
147 if (data == DATA_ON_THE_ROCKS)
148 onTheRocks = value;
149 }
150
152 {
153 if (data == DATA_ON_THE_ROCKS)
154 return onTheRocks;
155
156 return 0;
157 }
158
160 {
161 if (!UpdateVictim())
162 return;
163
164 events.Update(diff);
165
166 if (me->HasUnitState(UNIT_STATE_CASTING))
167 return;
168
169 while (uint32 eventId = events.ExecuteEvent())
170 {
171 switch (eventId)
172 {
176 break;
177 case EVENT_SHADOWBOLT:
179 events.ScheduleEvent(EVENT_SHADOWBOLT, std::rand() % (3 * IN_MILLISECONDS) + (2 * IN_MILLISECONDS));
180 break;
181 case EVENT_FROST_TOMB:
182 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true, -SPELL_FROST_TOMB))
183 {
185 Talk(SAY_FROST_TOMB_EMOTE, target);
186
187 DoCast(target, SPELL_FROST_TOMB_STUN, true);
188 // checked from sniffs - the player casts the spell
189 target->CastSpell(target, SPELL_FROST_TOMB_SUMMON, true);
190 }
191 events.ScheduleEvent(EVENT_FROST_TOMB, std::rand() % (19 * IN_MILLISECONDS) + (14 * IN_MILLISECONDS));
192 break;
193 default:
194 break;
195 }
196 }
197
199 }
200
202 {
203 // I could not found any spell casted for this
204 for (uint8 i = 0; i < 4; ++i)
205 me->SummonCreature(NPC_SKELETON, SkeletonSpawnPoint[0][0], SkeletonSpawnPoint[0][1], SKELETONSPAWN_Z, 0);
206 }
207
208 private:
210 };
211
213 {
214 return GetUtgardeKeepAI<boss_kelesethAI>(creature);
215 }
216};
217
219{
220 public:
221 npc_vrykul_skeleton() : CreatureScript("npc_vrykul_skeleton") { }
222
224 {
225 npc_vrykul_skeletonAI(Creature* creature) : ScriptedAI(creature) { }
226
228 {
229 events.Reset();
230 events.ScheduleEvent(EVENT_DECREPIFY, std::rand() % (6 * IN_MILLISECONDS) + (4 * IN_MILLISECONDS));
231 }
232
233 void DamageTaken(Unit* /*doneBy*/, uint32& damage) OVERRIDE
234 {
235 if (damage >= me->GetHealth())
236 {
237 damage = 0;
238
239 // There are some issues with pets
240 // they will still attack. I would say it is a PetAI bug
242 {
243 // from sniffs
246
247 events.Reset();
248 events.ScheduleEvent(EVENT_RESURRECT, std::rand() % (22 * IN_MILLISECONDS) + (18 * IN_MILLISECONDS));
249
250 me->GetMotionMaster()->MovementExpired(false);
251 me->GetMotionMaster()->MoveIdle();
252 }
253 }
254 }
255
257 {
258 if (!UpdateVictim())
259 return;
260
261 events.Update(diff);
262
263 if (me->HasUnitState(UNIT_STATE_CASTING))
264 return;
265
266 while (uint32 eventId = events.ExecuteEvent())
267 {
268 switch (eventId)
269 {
270 case EVENT_DECREPIFY:
271 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_DECREPIFY))
272 DoCast(target, SPELL_DECREPIFY);
273 events.ScheduleEvent(EVENT_DECREPIFY, std::rand() % (5 * IN_MILLISECONDS) + (1 * IN_MILLISECONDS));
274 break;
275 case EVENT_RESURRECT:
276 events.ScheduleEvent(EVENT_FULL_HEAL, 1 * IN_MILLISECONDS);
277 events.ScheduleEvent(EVENT_SHADOW_FISSURE, 1 * IN_MILLISECONDS);
278 break;
279 case EVENT_FULL_HEAL:
280 DoCast(me, SPELL_FULL_HEAL, true);
281 break;
287 me->GetMotionMaster()->MoveChase(me->GetVictim());
288 events.ScheduleEvent(EVENT_DECREPIFY, std::rand() % (6 * IN_MILLISECONDS) + (4 * IN_MILLISECONDS));
289 break;
290 default:
291 break;
292 }
293 }
294
297 }
298
299 private:
301 };
302
304 {
306 }
307};
308
310{
311 public:
312 spell_frost_tomb() : SpellScriptLoader("spell_frost_tomb") { }
313
315 {
317
318 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
319 {
320 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
321 if (Unit* caster = GetCaster())
322 if (caster->IsAlive())
323 if (Creature* creature = caster->ToCreature())
324 creature->DespawnOrUnsummon(1000);
325 }
326
331 };
332
334 {
335 return new spell_frost_tomb_AuraScript();
336 }
337};
338
340{
341 public:
342 achievement_on_the_rocks() : AchievementCriteriaScript("achievement_on_the_rocks") { }
343
344 bool OnCheck(Player* /*source*/, Unit* target) OVERRIDE
345 {
346 return target && target->IsAIEnabled && target->GetAI()->GetData(DATA_ON_THE_ROCKS);
347 }
348};
349
351{
352 new boss_keleseth();
353 new npc_frost_tomb();
355 new spell_frost_tomb();
357}
@ IN_MILLISECONDS
Definition Common.h:125
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ EFFECT_0
@ SPELL_AURA_MOD_STUN
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STAND_STATE_DEAD
Definition Unit.h:169
@ AURA_REMOVE_BY_DEATH
Definition Unit.h:411
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_ANIM_TIER
@ UNIT_FIELD_FLAGS
@ SPELL_SHADOWBOLT
#define SAY_DEATH
KelsethEncounter
@ SAY_DEATH
@ NPC_FROSTTOMB
@ SPELL_SHADOW_FISSURE
@ SPELL_FROST_TOMB
@ EVENT_SHADOWBOLT
@ SPELL_FROST_TOMB_STUN
@ DATA_ON_THE_ROCKS
@ EVENT_FROST_TOMB
@ EVENT_DECREPIFY
@ NPC_RUNEMAGE
@ NPC_STRATEGIST
@ EVENT_SUMMON_SKELETONS
@ EVENT_FULL_HEAL
@ SAY_FROST_TOMB
@ SPELL_SHADOWBOLT
@ SPELL_DECREPIFY
@ SAY_START_COMBAT
@ EVENT_RESURRECT
@ SPELL_BONE_ARMOR
@ SAY_FROST_TOMB_EMOTE
@ SPELL_FROST_TOMB_SUMMON
@ SAY_SUMMON_SKELETONS
@ EVENT_SHADOW_FISSURE
@ SPELL_FULL_HEAL
@ NPC_SKELETON
float AttackLoc[3]
float const SkeletonSpawnPoint[1][2]
void AddSC_boss_keleseth()
#define SKELETONSPAWN_Z
@ SPELL_SHADOW_FISSURE
AchievementCriteriaScript(const char *name)
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetCaster() const
EventMap events
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)
Creature * ToCreature()
Definition Object.h:207
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
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareAuraScript(spell_frost_tomb_AuraScript)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
AuraScript * GetAuraScript() const OVERRIDE
Creature * me
ScriptedAI(Creature *creature)
void SetData(uint32 data, uint32 value) OVERRIDE
uint32 GetData(uint32 data) const OVERRIDE
void EnterCombat(Unit *who) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
boss_kelesethAI(Creature *creature)
void JustDied(Unit *) OVERRIDE
npc_frost_tombAI(Creature *creature)
void IsSummonedBy(Unit *summoner) OVERRIDE
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void DamageTaken(Unit *, uint32 &damage) OVERRIDE
AI * GetUtgardeKeepAI(Creature *creature)
@ DATA_PRINCE_KELESETH