TrinityCore
Loading...
Searching...
No Matches
boss_harbinger_skyriss.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 "arcatraz.h"
24#include "ScriptedCreature.h"
25#include "SpellInfo.h"
26#include "SpellScript.h"
27
38
63
77
79{
81 NPC_ILLUSION_33 = 21467
82};
83
90
91// 20912 - Harbinger Skyriss
93{
95
96 void JustAppeared() override
97 {
99 }
100
101 void Reset() override
102 {
103 _Reset();
105 }
106
107 void JustEngagedWith(Unit* who) override
108 {
110
114 if (IsHeroic())
116 }
117
118 void OnSpellCast(SpellInfo const* spellInfo) override
119 {
120 switch (spellInfo->Id)
121 {
122 case SPELL_FEAR:
123 Talk(SAY_FEAR);
124 break;
125 case SPELL_DOMINATION:
127 Talk(SAY_MIND);
128 break;
129 default:
130 break;
131 }
132 }
133
134 void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
135 {
136 if (_phase < PHASE_HEALTH_66 && me->HealthBelowPctDamaged(66, damage))
137 {
138 _phase++;
140 }
141
142 if (_phase < PHASE_HEALTH_33 && me->HealthBelowPctDamaged(33, damage))
143 {
144 _phase++;
146 }
147 }
148
149 void KilledUnit(Unit* /*victim*/) override
150 {
151 Talk(SAY_SLAY);
152 }
153
154 void JustDied(Unit* /*killer*/) override
155 {
156 _JustDied();
158 }
159
160 void UpdateAI(uint32 diff) override
161 {
162 if (!UpdateVictim())
163 {
164 events.Update(diff);
165
166 while (uint32 eventId = events.ExecuteEvent())
167 {
168 switch (eventId)
169 {
170 case EVENT_INTRO_1:
174 break;
175 case EVENT_INTRO_2:
179 break;
180 case EVENT_INTRO_3:
181 me->SetImmuneToAll(false);
183 break;
184 default:
185 break;
186 }
187 }
188 return;
189 }
190
191 events.Update(diff);
192
194 return;
195
196 while (uint32 eventId = events.ExecuteEvent())
197 {
198 switch (eventId)
199 {
200 case EVENT_MIND_REND:
202 DoCast(target, SPELL_MIND_REND);
203 events.Repeat(8s, 12s);
204 break;
205 case EVENT_FEAR:
207 DoCast(target, SPELL_FEAR);
208 events.Repeat(15s, 25s);
209 break;
210 case EVENT_DOMINATION:
212 DoCast(target, SPELL_DOMINATION);
213 events.Repeat(25s, 35s);
214 break;
215 case EVENT_MANA_BURN:
216 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [](Unit const* unit) { return unit && unit->GetPowerType() == POWER_MANA; }))
217 DoCast(target, SPELL_MANA_BURN);
218 events.Repeat(10s, 20s);
219 break;
220 case EVENT_SUMMON_66:
224 break;
225 case EVENT_SUMMON_33:
229 break;
230 default:
231 break;
232 }
233
235 return;
236 }
237
239 }
240
241private:
243};
244
245// 21466, 21467 - Harbinger Skyriss
247{
249
250 void InitializeAI() override
251 {
252 me->SetCorpseDelay(0, true);
254 }
255
256 void Reset() override
257 {
259 }
260
261 void JustAppeared() override
262 {
264
266 .SetValidator([this]
267 {
269 })
270 .Schedule(0s, [this](TaskContext /*task*/)
271 {
273 })
274 .Schedule(0s, [this](TaskContext /*task*/)
275 {
277 })
278 .Schedule(0s, [this](TaskContext /*task*/)
279 {
280 switch (me->GetEntry())
281 {
282 case NPC_ILLUSION_66:
284 break;
285 case NPC_ILLUSION_33:
287 break;
288 default:
289 break;
290 }
291 })
292 .Schedule(2s, 10s, [this](TaskContext task)
293 {
296 task.Repeat(8s, 12s);
297 });
298 }
299
300 void UpdateAI(uint32 diff) override
301 {
302 if (!UpdateVictim())
303 return;
304
305 _scheduler.Update(diff, [this]
306 {
308 });
309 }
310
311private:
313};
314
315// 36928 - 66% Health
316// 36930 - 33% Health
331
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ POWER_MANA
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:249
DamageEffectType
Definition Unit.h:366
#define RegisterArcatrazCreatureAI(ai_name)
Definition arcatraz.h:88
@ DATA_HARBINGER_SKYRISS
Definition arcatraz.h:34
void AddSC_boss_harbinger_skyriss()
@ SPELL_MIND_REND_IMAGE
@ SPELL_SUMMON_33_ILLUSION
@ SPELL_SIMPLE_TELEPORT
@ SPELL_MIND_REND_IMAGE_H
@ SPELL_SUMMON_66_ILLUSION
@ SPELL_MIND_REND_COSMETIC
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToAll(bool apply) override
Definition Creature.h:135
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:98
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 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
int32 GetEffectValue() const
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
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
virtual void InitializeAI()
Definition UnitAI.cpp:36
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
Powers GetPowerType() const
Definition Unit.h:945
void SetHealth(uint32 val)
Definition Unit.cpp:9338
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
PrepareSpellScript(spell_harbinger_skyriss_health)
bool IsHeroic() const
ScriptedAI(Creature *creature)
boss_harbinger_skyriss(Creature *creature)
void JustEngagedWith(Unit *who) override
void KilledUnit(Unit *) override
void OnSpellCast(SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override