TrinityCore
boss_talon_king_ikiss.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 "Containers.h"
20#include "ScriptedCreature.h"
21#include "sethekk_halls.h"
22#include "SpellScript.h"
23
24enum Says
25{
31};
32
34{
35 SPELL_BLINK = 38194,
39 SPELL_SLOW = 35032,
43};
44
46{
52};
53
55{
57 {
58 Intro = false;
59 ManaShield = false;
60 }
61
62 void Reset() override
63 {
64 _Reset();
65 Intro = false;
66 ManaShield = false;
67 }
68
69 void MoveInLineOfSight(Unit* who) override
70 {
71 if (!Intro && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f))
72 {
73 Intro = true;
75 }
76
78 }
79
80 void JustEngagedWith(Unit* who) override
81 {
87 if (IsHeroic())
89 }
90
91 void ExecuteEvent(uint32 eventId) override
92 {
93 switch (eventId)
94 {
95 case EVENT_POLYMORPH:
96 // Second top aggro in normal, random target in heroic.
97 if (IsHeroic())
99 else
101 events.ScheduleEvent(EVENT_POLYMORPH, 15s, 17500ms);
102 break;
106 break;
107 case EVENT_SLOW:
110 break;
111 case EVENT_BLINK:
112 if (me->IsNonMeleeSpellCast(false))
118 break;
122 break;
123 default:
124 break;
125 }
126 }
127
128 void DamageTaken(Unit* /*who*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
129 {
130 if (!ManaShield && me->HealthBelowPctDamaged(20, damage))
131 {
133 ManaShield = true;
134 }
135 }
136
137 void JustDied(Unit* /*killer*/) override
138 {
139 _JustDied();
141 }
142
143 void KilledUnit(Unit* who) override
144 {
145 if (who->GetTypeId() == TYPEID_PLAYER)
146 Talk(SAY_SLAY);
147 }
148
149 private:
151 bool Intro;
152};
153
154// 38194 - Blink
156{
157 bool Validate(SpellInfo const* /*spellInfo*/) override
158 {
160 }
161
162 void FilterTargets(std::list<WorldObject*>& targets)
163 {
164 if (targets.empty())
165 return;
166
168 targets.clear();
169 targets.push_back(target);
170 }
171
173 {
174 PreventHitDefaultEffect(effIndex);
176 }
177
178 void Register() override
179 {
182 }
183};
184
186{
189}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
DamageEffectType
Definition: UnitDefines.h:131
Says
@ EMOTE_ARCANE_EXPLOSION
@ SPELL_ARCANE_BUBBLE
@ SPELL_ARCANE_VOLLEY
@ SPELL_MANA_SHIELD
@ SPELL_ARCANE_EXPLOSION
@ SPELL_BLINK_TELEPORT
@ SPELL_POLYMORPH
void AddSC_boss_talon_king_ikiss()
@ EVENT_ARCANE_VOLLEY
@ EVENT_ARCANE_EXPLOSION
@ EVENT_POLYMORPH
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
virtual void MoveInLineOfSight(Unit *)
Definition: CreatureAI.cpp:122
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
TypeID GetTypeId() const
Definition: Object.h:173
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3059
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
@ DATA_TALON_KING_IKISS
Definition: sethekk_halls.h:32
#define RegisterSethekkHallsCreatureAI(ai_name)
Definition: sethekk_halls.h:57
bool IsHeroic() const
void JustEngagedWith(Unit *who) override
void KilledUnit(Unit *who) override
void ExecuteEvent(uint32 eventId) override
void MoveInLineOfSight(Unit *who) override
boss_talon_king_ikiss(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustDied(Unit *) override