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#include "ScriptMgr.h"
19#include "arcatraz.h"
20#include "SpellInfo.h"
21#include "SpellScript.h"
22#include "ScriptedCreature.h"
23
34
57
71
73{
75 NPC_ILLUSION_33 = 21467
76};
77
84
85// 20912 - Harbinger Skyriss
87{
89
90 void JustAppeared() override
91 {
93 }
94
95 void Reset() override
96 {
97 _Reset();
99 }
100
101 void JustEngagedWith(Unit* who) override
102 {
107 if (IsHeroic())
109 }
110
111 void OnSpellCast(SpellInfo const* spell) override
112 {
113 switch (spell->Id)
114 {
115 case SPELL_FEAR:
116 Talk(SAY_FEAR);
117 break;
118 case SPELL_DOMINATION:
120 Talk(SAY_MIND);
121 break;
122 default:
123 break;
124 }
125 }
126
127 void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
128 {
129 if (_phase < PHASE_HEALTH_66 && me->HealthBelowPctDamaged(66, damage))
130 {
131 _phase++;
133 }
134 if (_phase < PHASE_HEALTH_33 && me->HealthBelowPctDamaged(33, damage))
135 {
136 _phase++;
138 }
139 }
140
141 void KilledUnit(Unit* /*victim*/) override
142 {
143 Talk(SAY_SLAY);
144 }
145
146 void JustDied(Unit* /*killer*/) override
147 {
149 _JustDied();
150 }
151
152 void UpdateAI(uint32 diff) override
153 {
154 if (!UpdateVictim())
155 {
156 events.Update(diff);
157
158 while (uint32 eventId = events.ExecuteEvent())
159 {
160 switch (eventId)
161 {
162 case EVENT_INTRO_1:
166 break;
167 case EVENT_INTRO_2:
171 break;
172 case EVENT_INTRO_3:
173 me->SetImmuneToAll(false);
175 break;
176 default:
177 break;
178 }
179 }
180 return;
181 }
182
183 events.Update(diff);
184
186 return;
187
188 while (uint32 eventId = events.ExecuteEvent())
189 {
190 switch (eventId)
191 {
192 case EVENT_MIND_REND:
194 DoCast(target, SPELL_MIND_REND);
195 events.Repeat(8s, 12s);
196 break;
197 case EVENT_FEAR:
199 DoCast(target, SPELL_FEAR);
200 events.Repeat(25s, 35s);
201 break;
202 case EVENT_DOMINATION:
204 DoCast(target, SPELL_DOMINATION);
205 events.Repeat(30s, 40s);
206 break;
207 case EVENT_MANA_BURN:
209 DoCast(target, SPELL_MANA_BURN);
210 events.Repeat(15s, 30s);
211 break;
212 case EVENT_SUMMON_66:
216 break;
217 case EVENT_SUMMON_33:
221 break;
222 default:
223 break;
224 }
225
227 return;
228 }
229
231 }
232
233private:
235};
236
237// 21466, 21467 - Harbinger Skyriss
239{
241
242 void Reset() override
243 {
245 me->SetCorpseDelay(0, true);
246 }
247
248 void JustAppeared() override
249 {
251
253 .SetValidator([this]
254 {
256 })
257 .Schedule(0s, [this](TaskContext /*task*/)
258 {
260 })
261 .Schedule(0s, [this](TaskContext /*task*/)
262 {
264 })
265 .Schedule(0s, [this](TaskContext /*task*/)
266 {
267 switch (me->GetEntry())
268 {
269 case NPC_ILLUSION_66:
271 break;
272 case NPC_ILLUSION_33:
274 break;
275 default:
276 break;
277 }
278 })
279 .Schedule(2s, 10s, [this](TaskContext task)
280 {
283 task.Repeat(8s, 12s);
284 });
285 }
286
287 void UpdateAI(uint32 diff) override
288 {
289 if (!UpdateVictim())
290 return;
291
292 _scheduler.Update(diff, [this]
293 {
295 });
296 }
297
298private:
300};
301
302// 36928 - 66% Health
303// 36930 - 33% Health
318
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
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
#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:126
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:89
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
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 SetHealth(uint32 val)
Definition Unit.cpp:9361
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
PrepareSpellScript(spell_harbinger_skyriss_health)
bool IsHeroic() const
boss_harbinger_skyriss(Creature *creature)
void OnSpellCast(SpellInfo const *spell) override
void JustEngagedWith(Unit *who) override
void KilledUnit(Unit *) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override