TrinityCore
Loading...
Searching...
No Matches
boss_skarmorak.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 "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "InstanceScript.h"
21#include "ScriptMgr.h"
22#include "ScriptedCreature.h"
23#include "SpellAuraEffects.h"
24#include "SpellMgr.h"
25#include "SpellScript.h"
26#include "the_stonevault.h"
27
56
64
74
79
80// 210156 - Skarmorak
81struct boss_skarmorak : public BossAI
82{
83 boss_skarmorak(Creature* creature) : BossAI(creature, DATA_SKARMORAK) { }
84
85 void KilledUnit(Unit* victim) override
86 {
87 if (!victim->IsPlayer())
88 return;
89
91 }
92
93 void JustDied(Unit* /*killer*/) override
94 {
95 _JustDied();
97
99 }
100
110
121
122 void DoAction(int32 action) override
123 {
124 if (action != ACTION_FORTIFIED_SHELL)
125 return;
126
128
130 }
131
132 void OnChannelFinished(SpellInfo const* spell) override
133 {
134 if (spell->Id != SPELL_VOID_DISCHARGE)
135 return;
136
139 }
140
154
206};
207
208// 423228 - Fortified Shell
210{
211 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
212 {
214 if (!instance)
215 return;
216
217 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
218 return;
219
220 Creature* skarmorak = instance->GetCreature(DATA_SKARMORAK);
221 if (!skarmorak)
222 return;
223
224 skarmorak->AI()->DoAction(ACTION_FORTIFIED_SHELL);
225 }
226
231};
232
233// 429976 - Fortified Shell
235{
236 static constexpr std::array<uint8, 3> SkarmorakEnergizeCycle = { 16, 17, 17 };
237
238 void PeriodicTick(AuraEffect const* aurEff) const
239 {
240 uint8 cycleIdx = aurEff->GetTickNumber() % SkarmorakEnergizeCycle.size();
242 }
243
248};
249
250// 426181 - Fortified Shell
284
285// 439600 - Fortified Shell
307
308// 422233 - Crystalline Smash
330
331// 422294 - Crystal Shards
333{
334 bool Validate(SpellInfo const* /*spellInfo*/) override
335 {
337 }
338
339 void HandleShard1(SpellEffIndex /*effIndex*/) const
340 {
341 Unit* caster = GetCaster();
344 .TriggeringSpell = GetSpell()
345 });
346 }
347
348 void HandleShard2(SpellEffIndex /*effIndex*/) const
349 {
350 Unit* caster = GetCaster();
353 .TriggeringSpell = GetSpell()
354 });
355 }
356
357 void HandleShard3(SpellEffIndex /*effIndex*/) const
358 {
359 Unit* caster = GetCaster();
362 .TriggeringSpell = GetSpell()
363 });
364 }
365
372};
373
374// 423538 - Unstable Crash
376{
377 bool Validate(SpellInfo const* /*spellInfo*/) override
378 {
380 }
381
390
395};
396
397// 443838 - Unstable Crash
418
419// 423572 - Unstable Energy
440
441// 435813 - Unstable Energy
462
464{
465 bool Validate(SpellInfo const* /*spellInfo*/) override
466 {
468 }
469
470 void HandlePeriodic(AuraEffect const* aurEff) const
471 {
472 Unit* target = GetTarget();
473
474 if (Unit* caster = GetCaster())
477 .TriggeringAura = aurEff
478 });
479 }
480
485};
486
487// 443405 - Unstable Fragments
489{
491
492 void OnUnitEnter(Unit* unit) override
493 {
494 if (!unit->IsPlayer())
495 return;
496
497 Unit* caster = at->GetCaster();
498 if (!caster)
499 return;
500
502 at->Remove();
503 }
504};
505
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition ScriptMgr.h:1381
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_EFFECT_APPLY_AURA
@ POWER_ENERGY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_ENEMY_SPELL
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_skarmorak()
SkarmorakEvents
@ EVENT_CRYSTALLINE_SMASH
@ EVENT_VOID_DISCHARGE
@ EVENT_UNSTABLE_CRASH
@ EVENT_CHECK_ENERGY
SkarmorakTexts
@ SAY_DEATH
@ SAY_WIPE
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_FORTIFIED_SHELL
@ SAY_VOID_DISCHARGE
SkarmorakSpells
@ SPELL_FORTIFIED_SHELL_INDICATOR
@ SPELL_UNSTABLE_FRAGMENT_MOD_DAMAGE
@ SPELL_FORTIFIED_SHELL_VISUAL
@ SPELL_FORTIFIED_SHELL_PERIODIC_ABSORB_STACK
@ SPELL_UNSTABLE_ENERGY_AREA
@ SPELL_FORTIFIED_SHELL_CRYSTAL_VISUAL
@ SPELL_VOID_DISCHARGE
@ SPELL_UNSTABLE_FRAGMENTS
@ SPELL_CRYSTALLINE_SMASH_DAMAGE
@ SPELL_UNSTABLE_CRASH
@ SPELL_VOID_DISCHARGE_STACKS
@ SPELL_FORTIFIED_SHELL_SELECTOR
@ SPELL_ENERGY_CONTROLLER
@ SPELL_CRYSTAL_SHARDS_2
@ SPELL_UNSTABLE_ENERGY
@ SPELL_SHATTERED_SHELL
@ SPELL_UNSTABLE_CRASH_FRAGMENT_SELECTOR
@ SPELL_FORTIFIED_SHELL_ENERGIZE
@ SPELL_CRYSTAL_SHARDS_DUMMY
@ SPELL_UNSTABLE_FRAGMENT_DAMAGE
@ SPELL_CRYSTALLINE_ERUPTION
@ SPELL_CRYSTAL_SHARDS_3
@ SPELL_CRYSTAL_SHARDS_1
@ SPELL_FORTIFIED_SHELL_ABSORB
@ SPELL_FORTIFIED_SHELL
SkarmorakActions
@ ACTION_FORTIFIED_SHELL
AreaTrigger *const at
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
Unit * GetCaster() const
uint32 GetTickNumber() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void CancelEvent(uint32 eventId)
Definition EventMap.cpp:135
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void DoAction(int32 param)
Definition UnitAI.h:73
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
Definition Unit.h:635
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:8697
int32 GetPower(Powers power) const
Definition Unit.cpp:10028
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void HandleShard2(SpellEffIndex) const
void HandleShard1(SpellEffIndex) const
bool Validate(SpellInfo const *) override
void HandleShard3(SpellEffIndex) const
bool Validate(SpellInfo const *) override
void HandleHitTarget(SpellEffIndex) const
void AfterRemove(AuraEffect const *, AuraEffectHandleModes) const
void PeriodicTick(AuraEffect const *aurEff) const
static constexpr std::array< uint8, 3 > SkarmorakEnergizeCycle
void HandlePeriodic(AuraEffect const *aurEff) const
bool Validate(SpellInfo const *) override
void HandleDummyVisual(SpellEffIndex) const
void HandleCrystalVisual(SpellEffIndex) const
bool Validate(SpellInfo const *) override
void HandleHitTarget(SpellEffIndex) const
bool Validate(SpellInfo const *) override
void HandlePeriodic(AuraEffect const *aurEff) const
bool Validate(SpellInfo const *) override
void HandleHitTarget(SpellEffIndex) const
bool Validate(SpellInfo const *) override
TriggerCastFlags TriggerFlags
void OnUnitEnter(Unit *unit) override
void HandleFortifiedShellEnded()
void DoAction(int32 action) override
void EnterEvadeMode(EvadeReason) override
void JustDied(Unit *) override
boss_skarmorak(Creature *creature)
void KilledUnit(Unit *victim) override
void OnChannelFinished(SpellInfo const *spell) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
@ DATA_SKARMORAK
#define RegisterTheStonevaultCreatureAI(ai_name)