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 remove_prison = false)
112 {
116
117 for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i)
118 {
120 if (!ContainmentSphere)
121 return false;
122 if (ContainmentSphere->GetGoState() != GO_STATE_ACTIVE)
123 return false;
124 }
125 if (remove_prison)
126 RemovePrison(true);
127 return true;
128 }
129
130 void RemovePrison(bool remove)
131 {
132 if (remove)
133 {
134 me->SetImmuneToAll(false);
137 }
138 else
139 {
140 me->SetImmuneToAll(true);
142 }
143 }
144
145 void SetGUID(ObjectGuid const& guid, int32 id) override
146 {
147 if (id == DATA_INTENSE_COLD)
148 _intenseColdList.push_back(guid);
149 }
150
151 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
152 {
153 if (!_enrage && me->HealthBelowPctDamaged(25, damage))
154 {
158 _enrage = true;
159 }
160 }
161
162 void UpdateAI(uint32 diff) override
163 {
164 if (!UpdateVictim())
165 return;
166
167 events.Update(diff);
168
170 return;
171
172 while (uint32 eventId = events.ExecuteEvent())
173 {
174 switch (eventId)
175 {
179 break;
183 break;
184 case EVENT_TAIL_SWEEP:
186 if (IsHeroic())
188 else if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
191 break;
192 default:
193 break;
194 }
195
197 return;
198 }
199
201 }
202
203private:
207public:
209};
210
212{
213 containment_sphere(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
214
216
217 bool OnGossipHello(Player* /*player*/) override
218 {
220 if (keristrasza && keristrasza->IsAlive())
221 {
222 // maybe these are hacks :(
225
226 ENSURE_AI(boss_keristrasza, keristrasza->AI())->CheckContainmentSpheres(true);
227 }
228 return true;
229 }
230};
231
232// 48095 - Intense Cold
234{
236
237 void HandlePeriodicTick(AuraEffect const* aurEff)
238 {
239 if (aurEff->GetBase()->GetStackAmount() < 2)
240 return;
241 Unit* caster = GetCaster();
243 if (!caster || !caster->GetAI())
244 return;
245 caster->GetAI()->SetGUID(GetTarget()->GetGUID(), DATA_INTENSE_COLD);
246 }
247
252};
253
255{
256 public:
258 {
259 }
260
261 bool OnCheck(Player* player, Unit* target) override
262 {
263 if (!target)
264 return false;
265
266 GuidList _intenseColdList = ENSURE_AI(boss_keristrasza, target->ToCreature()->AI())->_intenseColdList;
267 if (!_intenseColdList.empty())
268 for (GuidList::iterator itr = _intenseColdList.begin(); itr != _intenseColdList.end(); ++itr)
269 if (player->GetGUID() == *itr)
270 return false;
271
272 return true;
273 }
274};
275
uint8_t uint8
Definition Define.h:135
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:235
DamageEffectType
Definition Unit.h:352
@ 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:164
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:126
CreatureAI * AI() const
Definition Creature.h:154
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:186
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:769
bool IsAlive() const
Definition Unit.h:1234
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
UnitAI * GetAI() const
Definition Unit.h:800
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
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
@ ORMOROKS_CONTAINMENT_SPHERE
Definition nexus.h:37
@ 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
bool CheckContainmentSpheres(bool remove_prison=false)
void RemovePrison(bool remove)
void SetGUID(ObjectGuid const &guid, int32 id) override
ObjectGuid ContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]
InstanceScript * instance
bool OnGossipHello(Player *) override
containment_sphere(GameObject *go)