TrinityCore
Loading...
Searching...
No Matches
boss_shirrak_the_dead_watcher.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/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "auchenai_crypts.h"
24#include "ScriptedCreature.h"
25#include "Spell.h"
26#include "SpellInfo.h"
27#include "SpellScript.h"
28
33
35{
36 // Shirrak
40
41 // Focus Fire
42 SPELL_BIRTH = 26262,
46
47 // Scripts
49};
50
57
58// 18371 - Shirrak the Dead Watcher
60{
62
71
72 void UpdateAI(uint32 diff) override
73 {
74 if (!UpdateVictim())
75 return;
76
77 events.Update(diff);
78
80 return;
81
82 while (uint32 eventId = events.ExecuteEvent())
83 {
84 switch (eventId)
85 {
88 events.Repeat(20s, 30s);
89 break;
92 events.Repeat(5s, 10s);
93 break;
95 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 50.0f, true))
97 events.Repeat(15s, 25s);
98 break;
99 default:
100 break;
101 }
102
104 return;
105 }
106
108 }
109};
110
111// 18374 - Focus Fire
113{
115
116 void InitializeAI() override
117 {
119 }
120
121 void JustAppeared() override
122 {
124 .SetValidator([this]
125 {
127 })
128 .Schedule(0s, [this](TaskContext /*task*/)
129 {
131 })
132 .Schedule(0s, [this](TaskContext /*task*/)
133 {
135 })
136 .Schedule(5s, [this](TaskContext /*task*/)
137 {
139 });
140 }
141
142 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
143 {
144 if (spellInfo->Id == SPELL_FOCUS_FIRE_DUMMY)
146 }
147
148 void UpdateAI(uint32 diff) override
149 {
150 _scheduler.Update(diff);
151 }
152
153private:
155};
156
157// 32291 - Focus Fire
159{
161
163 {
164 if (Creature* creature = GetCaster()->ToCreature())
165 creature->AI()->Talk(EMOTE_FOCUSED, GetHitUnit());
166 }
167
172};
173
174// 32301 - Ping Shirrak
194
195// 32264 - Inhibit Magic
197{
199
200 void RemoveOldAura(SpellEffIndex /*effIndex*/)
201 {
203 }
204
206 {
207 int32 castIndex = GetCastIndex();
208 if (castIndex >= 3)
209 return;
210
211 float radiusMod = GetSpellValue()->RadiusMod * 0.66f;
212
214 .SetTriggerFlags(TRIGGERED_FULL_MASK)
215 .AddSpellMod(SPELLVALUE_BASE_POINT1, castIndex + 1)
216 .AddSpellMod(SPELLVALUE_RADIUS_MOD, int32(radiusMod * 10000)));
217 }
218
220 {
221 // we are storing number of casts in a non-effect SPELLVALUE_BASE_POINT1
223 }
224
232};
233
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_APPLY_AURA
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_BASE_POINT1
@ SPELLVALUE_RADIUS_MOD
#define SpellEffectFn(F, I, N)
#define SpellCastFn(F)
#define SpellHitFn(F)
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:249
@ DATA_SHIRRAK_THE_DEAD_WATCHER
#define RegisterAuchenaiCryptsCreatureAI(ai_name)
void AddSC_boss_shirrak_the_dead_watcher()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:128
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
HookList< CastHandler > AfterCast
Unit * GetCaster() const
HookList< HitHandler > AfterHit
Unit * GetHitUnit() const
SpellValue const * GetSpellValue() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
HookList< EffectHandler > OnEffectLaunchTarget
SpellInfo const * GetSpellInfo() const
TaskScheduler & Update(success_t const &callback=EmptyCallback)
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:783
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
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_shirrak_focus_fire)
PrepareSpellScript(spell_shirrak_inhibit_magic)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_shirrak_ping_shirrak)
ScriptedAI(Creature *creature)
float RadiusMod
Definition Spell.h:124
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition Spell.h:122
void UpdateAI(uint32 diff) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override