Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_keristrasza.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 "SpellScript.h"
9#include "SpellAuraEffects.h"
10#include "nexus.h"
11#include "Player.h"
12
26
28{
29 //Yell
35};
36
42
44{
45public:
46 boss_keristrasza() : CreatureScript("boss_keristrasza") { }
47
49 {
50 return new boss_keristraszaAI(creature);
51 }
52
54 {
55 boss_keristraszaAI(Creature* creature) : ScriptedAI(creature)
56 {
57 instance = creature->GetInstanceScript();
58 }
59
61
62 std::list<uint64> intenseColdList;
68 bool bEnrage;
69
87
96
97 void JustDied(Unit* /*killer*/) OVERRIDE
98 {
100
101 if (instance)
103 }
104
105 void KilledUnit(Unit* /*victim*/) OVERRIDE
106 {
107 Talk(SAY_SLAY);
108 }
109
110 bool CheckContainmentSpheres(bool remove_prison = false)
111 {
112 if (!instance)
113 return false;
114
118
119 GameObject* ContainmentSpheres[DATA_CONTAINMENT_SPHERES];
120
121 for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i)
122 {
123 ContainmentSpheres[i] = instance->instance->GetGameObject(auiContainmentSphereGUIDs[i]);
124 if (!ContainmentSpheres[i])
125 return false;
126 if (ContainmentSpheres[i]->GetGoState() != GOState::GO_STATE_ACTIVE)
127 return false;
128 }
129 if (remove_prison)
130 RemovePrison(true);
131 return true;
132 }
133
134 void RemovePrison(bool remove)
135 {
136 if (remove)
137 {
140 if (me->HasAura(SPELL_FROZEN_PRISON))
141 me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON);
142 }
143 else
144 {
148 }
149 }
150
151 void SetGUID(uint64 guid, int32 id/* = 0 */) OVERRIDE
152 {
153 if (id == DATA_INTENSE_COLD)
154 intenseColdList.push_back(guid);
155 }
156
158 {
159 if (!UpdateVictim())
160 return;
161
162 if (!bEnrage && HealthBelowPct(25))
163 {
166 bEnrage = true;
167 }
168
169 if (uiCrystalfireBreathTimer <= diff)
170 {
173 } else uiCrystalfireBreathTimer -= diff;
174
175 if (uiTailSweepTimer <= diff)
176 {
179 } else uiTailSweepTimer -= diff;
180
182 {
184 if (IsHeroic())
186 else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
189 } else uiCrystalChainsCrystalizeTimer -= diff;
190
192 }
193 };
194};
195
197{
198public:
199 containment_sphere() : GameObjectScript("containment_sphere") { }
200
202 {
203 InstanceScript* instance = go->GetInstanceScript();
204
205 Creature* pKeristrasza = Unit::GetCreature(*go, instance ? instance->GetData64(DATA_KERISTRASZA) : 0);
206 if (pKeristrasza && pKeristrasza->IsAlive())
207 {
208 // maybe these are hacks :(
210 go->SetGoState(GOState::GO_STATE_ACTIVE);
211
212 CAST_AI(boss_keristrasza::boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true);
213 }
214 return true;
215 }
216};
217
219{
220 public:
221 spell_intense_cold() : SpellScriptLoader("spell_intense_cold") { }
222
224 {
226
227 void HandlePeriodicTick(AuraEffect const* aurEff)
228 {
229 if (aurEff->GetBase()->GetStackAmount() < 2)
230 return;
231 Unit* caster = GetCaster();
233 if (!caster || !caster->GetAI())
234 return;
235 caster->GetAI()->SetGUID(GetTarget()->GetGUID(), DATA_INTENSE_COLD);
236 }
237
242 };
243
245 {
247 }
248};
249
251{
252 public:
254 {
255 }
256
257 bool OnCheck(Player* player, Unit* target) OVERRIDE
258 {
259 if (!target)
260 return false;
261
262 Creature* creatureTarget = target->ToCreature();
263 if (!creatureTarget || !creatureTarget->AI())
264 return false;
265
266 std::list<uint64> intenseColdList = CAST_AI(boss_keristrasza::boss_keristraszaAI, creatureTarget->AI())->intenseColdList;
267 if (!intenseColdList.empty())
268 for (std::list<uint64>::iterator itr = intenseColdList.begin(); itr != intenseColdList.end(); ++itr)
269 if (player->GetGUID() == *itr)
270 return false;
271
272 return true;
273 }
274};
275
@ IN_MILLISECONDS
Definition Common.h:125
std::int32_t int32
Definition Define.h:73
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
@ GO_STATE_ACTIVE
Definition GameObject.h:576
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
#define CAST_AI(a, b)
@ EFFECT_1
@ GO_FLAG_NOT_SELECTABLE
@ SPELL_AURA_PERIODIC_DAMAGE
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_FLAG_STUNNED
Definition Unit.h:643
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ GAMEOBJECT_FIELD_FLAGS
@ SPELL_ENRAGE
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SAY_ENRAGE
@ DATA_CONTAINMENT_SPHERES
@ DATA_INTENSE_COLD
@ SAY_CRYSTAL_NOVA
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_ENRAGE
@ SPELL_ENRAGE
@ SPELL_CRYSTALIZE
@ SPELL_INTENSE_COLD
@ SPELL_INTENSE_COLD_TRIGGERED
@ SPELL_CRYSTALFIRE_BREATH
@ SPELL_CRYSTAL_CHAINS
@ H_SPELL_CRYSTALFIRE_BREATH
@ SPELL_FROZEN_PRISON
@ SPELL_TAIL_SWEEP
void AddSC_boss_keristrasza()
@ SPELL_TAIL_SWEEP
AchievementCriteriaScript(const char *name)
Aura * GetBase() const
uint8 GetStackAmount() const
Definition SpellAuras.h:133
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureAI * AI() const
Definition Creature.h:483
CreatureScript(const char *name)
GameObjectScript(const char *name)
Creature * ToCreature()
Definition Object.h:207
SpellScriptLoader(const char *name)
virtual void SetGUID(uint64, int32=0)
Definition UnitAI.h:129
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
bool IsAlive() const
Definition Unit.h:2032
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
UnitAI * GetAI()
Definition Unit.h:1393
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
virtual uint64 GetData64(uint32) const
Definition ZoneScript.h:32
bool OnCheck(Player *player, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *, GameObject *go) OVERRIDE
PrepareAuraScript(spell_intense_cold_AuraScript)
AuraScript * GetAuraScript() const OVERRIDE
@ ORMOROKS_CONTAINMET_SPHERE
Definition nexus.h:20
@ ANOMALUS_CONTAINMET_SPHERE
Definition nexus.h:19
@ DATA_KERISTRASZA_EVENT
Definition nexus.h:14
@ TELESTRAS_CONTAINMET_SPHERE
Definition nexus.h:21
@ DATA_KERISTRASZA
Definition nexus.h:17
bool IsHeroic() const
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
const T & DUNGEON_MODE(const T &normal5, const T &heroic5) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SetGUID(uint64 guid, int32 id) OVERRIDE
uint64 auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]
bool CheckContainmentSpheres(bool remove_prison=false)