TrinityCore
boss_doomlord_kazzak.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 "ScriptedCreature.h"
20#include "SpellScript.h"
21
23{
30 SAY_RAND = 6
31};
32
34{
36 SPELL_CLEAVE = 31779,
41 SPELL_ENRAGE = 32964,
46};
47
49{
58};
59
61{
63 {
64 }
65
66 void Reset() override
67 {
68 _events.Reset();
77 }
78
79 void JustAppeared() override
80 {
82 }
83
84 void JustEngagedWith(Unit* /*who*/) override
85 {
87 }
88
89 void KilledUnit(Unit* victim) override
90 {
91 // When Kazzak kills a player (not pets/totems), he regens some health
92 if (victim->GetTypeId() != TYPEID_PLAYER)
93 return;
94
96
98 }
99
100 void JustDied(Unit* /*killer*/) override
101 {
103 }
104
105 void UpdateAI(uint32 diff) override
106 {
107 // Return since we have no target
108 if (!UpdateVictim())
109 return;
110
111 _events.Update(diff);
112
114 return;
115
116 while (uint32 eventId = _events.ExecuteEvent())
117 {
118 switch (eventId)
119 {
123 break;
124 case EVENT_CLEAVE:
127 break;
131 break;
132 case EVENT_VOID_BOLT:
135 break;
137 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
140 break;
141 case EVENT_ENRAGE:
145 break;
147 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
150 break;
151 case EVENT_BERSERK:
153 break;
154 default:
155 break;
156 }
157 }
158 }
159
160private:
162};
163
164// 32960 - Mark of Kazzak
166{
167 bool Validate(SpellInfo const* /*spell*/) override
168 {
170 }
171
172 void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
173 {
174 if (Unit* owner = GetUnitOwner())
175 amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
176 }
177
178 void OnPeriodic(AuraEffect const* aurEff)
179 {
180 Unit* target = GetTarget();
181
182 if (target->GetPower(POWER_MANA) == 0)
183 {
184 target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, aurEff);
185 // Remove aura
186 SetDuration(0);
187 }
188 }
189
190 void Register() override
191 {
194 }
195};
196
197// 21063 - Twisted Reflection
199{
200 bool Validate(SpellInfo const* /*spellInfo*/) override
201 {
203 }
204
205 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
206 {
208 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
209 if (!damageInfo || !damageInfo->GetDamage())
210 return;
211
212 eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_TWISTED_REFLECTION_HEAL, aurEff);
213 }
214
215 void Register() override
216 {
218 }
219};
220
222{
226}
Texts
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
@ POWER_MANA
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_DUMMY
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:2160
#define AuraEffectCalcAmountFn(F, I, N)
Definition: SpellScript.h:2058
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
@ UNIT_STATE_CASTING
Definition: Unit.h:270
T CalculatePct(T base, U pct)
Definition: Util.h:72
@ SPELL_CLEAVE
@ SPELL_ENRAGE
@ SPELL_MARK_OF_KAZZAK_DAMAGE
@ SPELL_TWISTED_REFLECTION
@ SPELL_SHADOW_VOLLEY
@ SPELL_VOID_BOLT
@ SPELL_THUNDERCLAP
@ SPELL_MARK_OF_KAZZAK
@ SPELL_CAPTURE_SOUL
@ SPELL_BERSERK
@ SPELL_TWISTED_REFLECTION_HEAL
@ EMOTE_FRENZY
@ SAY_SURPREME
void AddSC_boss_doomlordkazzak()
@ EVENT_MARK_OF_KAZZAK
@ EVENT_ENRAGE
@ EVENT_SHADOW_VOLLEY
@ EVENT_THUNDERCLAP
@ EVENT_VOID_BOLT
@ EVENT_TWISTED_REFLECTION
@ EVENT_BERSERK
@ EVENT_CLEAVE
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition: SpellScript.h:2057
void SetDuration(int32 duration, bool withMods=false)
Unit * GetTarget() const
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:2155
Unit * GetUnitOwner() const
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 GetDamage() const
Definition: Unit.h:446
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:173
Unit * GetActionTarget() const
Definition: Unit.h:494
DamageInfo * GetDamageInfo() const
Definition: Unit.h:505
Unit * GetActor() const
Definition: Unit.h:493
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
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:627
int32 GetPower(Powers power) const
Definition: Unit.cpp:9401
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void OnPeriodic(AuraEffect const *aurEff)
void CalculateAmount(AuraEffect const *, int32 &amount, bool &)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void JustDied(Unit *) override
boss_doomlord_kazzak(Creature *creature)
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *victim) override
void JustEngagedWith(Unit *) override