TrinityCore
Loading...
Searching...
No Matches
boss_lord_kazzak_anniversary.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 "GridNotifiers.h"
20#include "ScriptedCreature.h"
21#include "SpellAuras.h"
22#include "SpellScript.h"
23
35
42
50
51// 121818 - Lord Kazzak
53{
55
56 void JustAppeared() override
57 {
59 }
60
61 void Reset() override
62 {
64 _frenzyTriggered = false;
65 }
66
67 void KilledUnit(Unit* victim) override
68 {
69 if (victim->IsPlayer())
70 Talk(SAY_KILL, victim);
71 }
72
83
84 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo*/) override
85 {
86 if (!_frenzyTriggered && me->HealthBelowPctDamaged(30, damage))
87 {
88 _frenzyTriggered = true;
91 }
92 }
93
94 void UpdateAI(uint32 diff) override
95 {
96 if (!UpdateVictim())
97 return;
98
99 events.Update(diff);
100
102 return;
103
104 while (uint32 eventId = events.ExecuteEvent())
105 {
106 switch (eventId)
107 {
109 {
112 break;
113 }
114 case EVENT_VOID_BOLT:
115 {
116 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
117 DoCast(target, SPELL_VOID_BOLT);
119 break;
120 }
122 {
125 break;
126 }
128 {
129 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
131 events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 1min + 50s, 1min + 55s);
132 break;
133 }
134 default:
135 break;
136 }
137
139 return;
140 }
141 }
142
143private:
145};
146
147// 243737 - Mark of Kazzak
168
169// 243723 - Mark of Kazzak
209
210// 243726 - Mark of Kazzak
212{
213 void FilterTargets(std::list<WorldObject*>& targets) const
214 {
215 ObjectGuid const* explosionTargetGUID = std::any_cast<ObjectGuid>(&GetSpell()->m_customArg);
216 if (!explosionTargetGUID)
217 return;
218
219 targets.remove_if([explosionTargetGUID](WorldObject const* target) -> bool
220 {
221 return target->GetGUID() == *explosionTargetGUID;
222 });
223 }
224
229};
230
231// 243715 - Thunderclap
233{
234 void HandleAfterHit() const
235 {
236 if (Aura* aura = GetHitAura())
237 aura->SetStackAmount(static_cast<uint8>(GetSpellInfo()->StackAmount));
238 }
239
244};
245
246// 243715 - Thunderclap
259
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition ScriptMgr.h:1381
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ TARGET_UNIT_DEST_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_DEATH
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_PERIODIC_DUMMY
@ 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 SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellHitFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_lord_kazzak_anniversary()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsPlayer() const
Definition BaseEntity.h:173
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Aura * GetHitAura(bool dynObjAura=false, bool withRemoved=false) const
Unit * GetCaster() const
HookList< HitHandler > AfterHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
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:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void JustEngagedWith(Unit *) override
void Reset() override
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void FilterTargets(std::list< WorldObject * > &targets) const
void HandlePeriodic(AuraEffect const *aurEff) const
void OnRemove(AuraEffect const *aurEff, AuraEffectHandleModes) const
TriggerCastFlags TriggerFlags
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override