TrinityCore
Loading...
Searching...
No Matches
boss_keristrasza.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "GameObject.h"
20#include "GameObjectAI.h"
21#include "InstanceScript.h"
22#include "nexus.h"
23#include "ObjectAccessor.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26#include "SpellAuraEffects.h"
27#include "SpellScript.h"
28
41
48
50{
51 // Yell
57 SAY_FRENZY = 5
58};
59
65
66struct boss_keristrasza : public BossAI
67{
69 {
70 Initialize();
71 }
72
74 {
75 _enrage = false;
76 _intenseCold = true;
77 }
78
79 void Reset() override
80 {
81 Initialize();
82 _intenseColdList.clear();
83
85 _Reset();
86 }
87
98
99 void JustDied(Unit* /*killer*/) override
100 {
102 _JustDied();
103 }
104
105 void KilledUnit(Unit* who) override
106 {
107 if (who->GetTypeId() == TYPEID_PLAYER)
108 Talk(SAY_SLAY);
109 }
110
111 bool CheckContainmentSpheres(bool removePrison = false)
112 {
114 {
116 if (!containmentSpheres || containmentSpheres->GetGoState() != GO_STATE_ACTIVE)
117 return false;
118 }
119 if (removePrison)
120 RemovePrison(true);
121 return true;
122 }
123
124 void RemovePrison(bool remove)
125 {
126 if (remove)
127 {
128 me->SetImmuneToAll(false);
131 }
132 else
133 {
134 me->SetImmuneToAll(true);
136 }
137 }
138
139 void SetGUID(ObjectGuid const& guid, int32 id) override
140 {
141 if (id == DATA_INTENSE_COLD)
142 _intenseColdList.push_back(guid);
143 }
144
145 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
146 {
147 if (!_enrage && me->HealthBelowPctDamaged(25, damage))
148 {
152 _enrage = true;
153 }
154 }
155
156 void UpdateAI(uint32 diff) override
157 {
158 if (!UpdateVictim())
159 return;
160
161 events.Update(diff);
162
164 return;
165
166 while (uint32 eventId = events.ExecuteEvent())
167 {
168 switch (eventId)
169 {
173 break;
177 break;
178 case EVENT_TAIL_SWEEP:
180 if (IsHeroic())
182 else if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
185 break;
186 default:
187 break;
188 }
189
191 return;
192 }
193
195 }
196
197private:
200
201public:
203};
204
206{
207 containment_sphere(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
208
210
211 bool OnGossipHello(Player* /*player*/) override
212 {
214 if (keristrasza && keristrasza->IsAlive())
215 {
216 // maybe these are hacks :(
219
220 ENSURE_AI(boss_keristrasza, keristrasza->AI())->CheckContainmentSpheres(true);
221 }
222 return true;
223 }
224};
225
226// 48095 - Intense Cold
228{
230
231 void HandlePeriodicTick(AuraEffect const* aurEff)
232 {
233 if (aurEff->GetBase()->GetStackAmount() < 2)
234 return;
235 Unit* caster = GetCaster();
237 if (!caster || !caster->GetAI())
238 return;
239 caster->GetAI()->SetGUID(GetTarget()->GetGUID(), DATA_INTENSE_COLD);
240 }
241
246};
247
249{
250 public:
252 {
253 }
254
255 bool OnCheck(Player* player, Unit* target) override
256 {
257 if (!target)
258 return false;
259
260 GuidList const& _intenseColdList = ENSURE_AI(boss_keristrasza, target->ToCreature()->AI())->_intenseColdList;
261 if (!_intenseColdList.empty())
262 for (GuidList::const_iterator itr = _intenseColdList.begin(); itr != _intenseColdList.end(); ++itr)
263 if (player->GetGUID() == *itr)
264 return false;
265
266 return true;
267 }
268};
269
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:261
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_1
@ GO_FLAG_NOT_SELECTABLE
@ GO_STATE_ACTIVE
@ SPELL_AURA_PERIODIC_DAMAGE
#define AuraEffectPeriodicFn(F, I, N)
#define ENSURE_AI(a, b)
Definition UnitAI.h:28
@ UNIT_STATE_CASTING
Definition Unit.h:249
DamageEffectType
Definition Unit.h:366
@ DATA_CONTAINMENT_SPHERES
@ DATA_INTENSE_COLD
@ SAY_CRYSTAL_NOVA
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_FRENZY
@ SAY_ENRAGE
@ SPELL_ENRAGE
@ SPELL_INTENSE_COLD
@ SPELL_INTENSE_COLD_TRIGGERED
@ SPELL_CRYSTALFIRE_BREATH
@ SPELL_CRYSTAL_CHAINS
@ SPELL_FROZEN_PRISON
@ SPELL_TAIL_SWEEP
@ SPELL_CRYSTALLIZE
void AddSC_boss_keristrasza()
@ EVENT_TAIL_SWEEP
@ EVENT_CRYSTAL_FIRE_BREATH
@ EVENT_CRYSTAL_CHAINS_CRYSTALLIZE
Yells
Aura * GetBase() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
uint8 GetStackAmount() const
Definition SpellAuras.h:189
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToAll(bool apply) override
Definition Creature.h:135
CreatureAI * AI() const
Definition Creature.h:163
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
GameObject *const me
void SetGoState(GOState state)
GOState GetGoState() const
Definition GameObject.h:178
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:171
virtual ObjectGuid GetGuidData(uint32 type) const override
static Creature * ToCreature(Object *o)
Definition Object.h:189
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void SetGUID(ObjectGuid const &, int32=0)
Definition UnitAI.h:157
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:783
bool IsAlive() const
Definition Unit.h:1247
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4558
UnitAI * GetAI() const
Definition Unit.h:814
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3807
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:932
bool OnCheck(Player *player, Unit *target) override
void HandlePeriodicTick(AuraEffect const *aurEff)
void Register() override
PrepareAuraScript(spell_intense_cold)
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
#define RegisterNexusGameObjectAI(ai_name)
Definition nexus.h:75
@ ANOMALUS_CONTAINMENT_SPHERE
Definition nexus.h:36
@ TELESTRAS_CONTAINMENT_SPHERE
Definition nexus.h:38
@ DATA_KERISTRASZA
Definition nexus.h:34
#define RegisterNexusCreatureAI(ai_name)
Definition nexus.h:74
bool IsHeroic() const
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
void Reset() override
void KilledUnit(Unit *who) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_keristrasza(Creature *creature)
void JustDied(Unit *) override
void RemovePrison(bool remove)
void SetGUID(ObjectGuid const &guid, int32 id) override
bool CheckContainmentSpheres(bool removePrison=false)
InstanceScript * instance
bool OnGossipHello(Player *) override
containment_sphere(GameObject *go)