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#include "ScriptedCreature.h"
19#include "ScriptMgr.h"
20#include "Spell.h"
21#include "SpellScript.h"
22#include "SpellInfo.h"
23#include "auchenai_crypts.h"
24
29
45
52
53// 18371 - Shirrak the Dead Watcher
55{
57
58 void Reset() override
59 {
61 _Reset();
62 }
63
72
73 void UpdateAI(uint32 diff) override
74 {
75 if (!UpdateVictim())
76 return;
77
78 events.Update(diff);
79
81 return;
82
83 while (uint32 eventId = events.ExecuteEvent())
84 {
85 switch (eventId)
86 {
89 events.Repeat(30s);
90 break;
93 events.Repeat(5s, 10s);
94 break;
96 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 50, true))
97 {
99 Talk(EMOTE_FOCUSED, target);
100 }
101 events.Repeat(15s, 25s);
102 break;
103 default:
104 break;
105 }
106
108 return;
109 }
110
112 }
113};
114
115// 18374 - Focus Fire
117{
118 npc_focus_fire(Creature* creature) : ScriptedAI(creature) { }
119
120 void InitializeAI() override
121 {
123 }
124
125 void JustAppeared() override
126 {
128 .SetValidator([this]
129 {
131 })
132 .Schedule(0s, [this](TaskContext /*task*/)
133 {
135 })
136 .Schedule(0s, [this](TaskContext /*task*/)
137 {
139 })
140 .Schedule(5s, [this](TaskContext /*task*/)
141 {
143 });
144 }
145
146 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
147 {
148 if (spellInfo->Id == SPELL_FOCUS_FIRE_DUMMY)
150 }
151
152 void UpdateAI(uint32 diff) override
153 {
154 _scheduler.Update(diff);
155 }
156
157private:
159};
160
161// 32301 - Ping Shirrak
181
182// 32264 - Inhibit Magic
184{
186
187 void RemoveOldAura(SpellEffIndex /*effIndex*/)
188 {
190 }
191
193 {
194 int32 castIndex = GetCastIndex();
195 if (castIndex >= 3)
196 return;
197
198 float radiusMod = GetSpellValue()->RadiusMod * 0.66f;
199
201 .SetTriggerFlags(TRIGGERED_FULL_MASK)
202 .AddSpellMod(SPELLVALUE_BASE_POINT1, castIndex + 1)
203 .AddSpellMod(SPELLVALUE_RADIUS_MOD, int32(radiusMod * 10000)));
204 }
205
207 {
208 // we are storing number of casts in a non-effect SPELLVALUE_BASE_POINT1
210 }
211
219};
220
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)
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ 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:119
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
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:769
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
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_shirrak_inhibit_magic)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_shirrak_ping_shirrak)
float RadiusMod
Definition Spell.h:124
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition Spell.h:122
void UpdateAI(uint32 diff) override
npc_focus_fire(Creature *creature)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override