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 }
107};
108
109// 18374 - Focus Fire
111{
113
114 void InitializeAI() override
115 {
117 }
118
119 void JustAppeared() override
120 {
122 .SetValidator([this]
123 {
125 })
126 .Schedule(0s, [this](TaskContext const& /*task*/)
127 {
129 })
130 .Schedule(0s, [this](TaskContext const& /*task*/)
131 {
133 })
134 .Schedule(5s, [this](TaskContext const& /*task*/)
135 {
137 });
138 }
139
140 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
141 {
142 if (spellInfo->Id == SPELL_FOCUS_FIRE_DUMMY)
144 }
145
146 void UpdateAI(uint32 diff) override
147 {
148 _scheduler.Update(diff);
149 }
150
151private:
153};
154
155// 32291 - Focus Fire
157{
159 {
160 if (Creature* creature = GetCaster()->ToCreature())
161 creature->AI()->Talk(EMOTE_FOCUSED, GetHitUnit());
162 }
163
168};
169
170// 32301 - Ping Shirrak
172{
173 bool Validate(SpellInfo const* /*spellInfo*/) override
174 {
176 }
177
178 void HandleScript(SpellEffIndex /*effIndex*/)
179 {
181 }
182
187};
188
189// 32264 - Inhibit Magic
191{
192 void RemoveOldAura(SpellEffIndex /*effIndex*/)
193 {
195 }
196
198 {
199 int32 castIndex = GetCastIndex();
200 if (castIndex >= 3)
201 return;
202
203 float radiusMod = GetSpellValue()->RadiusMod * 0.66f;
204
206 .SetTriggerFlags(TRIGGERED_FULL_MASK)
207 .AddSpellMod(SPELLVALUE_BASE_POINT1, castIndex + 1)
208 .AddSpellMod(SPELLVALUE_RADIUS_MOD, radiusMod));
209 }
210
212 {
213 // we are storing number of casts in a non-effect SPELLVALUE_BASE_POINT1
215 }
216
224};
225
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_APPLY_AURA
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ 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:290
@ 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:63
void SetReactState(ReactStates st)
Definition Creature.h:180
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
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 & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool Validate(SpellInfo const *) override
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
float RadiusMod
Definition Spell.h:245
SpellEffectValue EffectBasePoints[MAX_SPELL_EFFECTS]
Definition Spell.h:242
void UpdateAI(uint32 diff) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override