TrinityCore
Loading...
Searching...
No Matches
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 "SpellAuraEffects.h"
21#include "SpellScript.h"
22
33
48
60
62{
64 {
65 }
66
79
80 void JustAppeared() override
81 {
83 }
84
85 void JustEngagedWith(Unit* /*who*/) override
86 {
88 }
89
90 void KilledUnit(Unit* victim) override
91 {
92 // When Kazzak kills a player (not pets/totems), he regens some health
93 if (victim->GetTypeId() != TYPEID_PLAYER)
94 return;
95
97
99 }
100
101 void JustDied(Unit* /*killer*/) override
102 {
104 }
105
106 void UpdateAI(uint32 diff) override
107 {
108 // Return since we have no target
109 if (!UpdateVictim())
110 return;
111
112 _events.Update(diff);
113
115 return;
116
117 while (uint32 eventId = _events.ExecuteEvent())
118 {
119 switch (eventId)
120 {
124 break;
125 case EVENT_CLEAVE:
128 break;
132 break;
133 case EVENT_VOID_BOLT:
136 break;
138 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
141 break;
142 case EVENT_ENRAGE:
146 break;
148 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
151 break;
152 case EVENT_BERSERK:
154 break;
155 default:
156 break;
157 }
158 }
159
161 }
162
163private:
165};
166
167// 32960 - Mark of Kazzak
169{
171
172 bool Validate(SpellInfo const* /*spell*/) override
173 {
175 }
176
177 void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
178 {
179 if (Unit* owner = GetUnitOwner())
180 amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
181 }
182
183 void OnPeriodic(AuraEffect const* aurEff)
184 {
185 Unit* target = GetTarget();
186
187 if (target->GetPower(POWER_MANA) == 0)
188 {
189 target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, aurEff);
190 // Remove aura
191 SetDuration(0);
192 }
193 }
194
200};
201
202// 21063 - Twisted Reflection
204{
206
207 bool Validate(SpellInfo const* /*spellInfo*/) override
208 {
210 }
211
212 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
213 {
215 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
216 if (!damageInfo || !damageInfo->GetDamage())
217 return;
218
219 eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_TWISTED_REFLECTION_HEAL, aurEff);
220 }
221
226};
227
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1139
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ POWER_MANA
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_DUMMY
#define AuraEffectProcFn(F, I, N)
#define AuraEffectCalcAmountFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
T CalculatePct(T base, U pct)
Definition Util.h:71
@ SPELL_MARK_OF_KAZZAK_DAMAGE
@ SPELL_TWISTED_REFLECTION
@ SPELL_SHADOW_VOLLEY
@ SPELL_VOID_BOLT
@ SPELL_THUNDERCLAP
@ SPELL_MARK_OF_KAZZAK
@ SPELL_CAPTURE_SOUL
@ SPELL_TWISTED_REFLECTION_HEAL
void AddSC_boss_doomlordkazzak()
@ EVENT_MARK_OF_KAZZAK
@ EVENT_SHADOW_VOLLEY
@ EVENT_THUNDERCLAP
@ EVENT_VOID_BOLT
@ EVENT_TWISTED_REFLECTION
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
void SetDuration(int32 duration, bool withMods=false)
Unit * GetTarget() const
HookList< EffectProcHandler > OnEffectProc
Unit * GetUnitOwner() const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
uint32 GetDamage() const
Definition Unit.h:464
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
TypeID GetTypeId() const
Definition Object.h:93
Unit * GetActionTarget() const
Definition Unit.h:509
Unit * GetActor()
Definition Unit.h:508
DamageInfo * GetDamageInfo() const
Definition Unit.h:519
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
uint32 GetPower(Powers power) const
Definition Unit.h:934
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void OnPeriodic(AuraEffect const *aurEff)
void CalculateAmount(AuraEffect const *, int32 &amount, bool &)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_mark_of_kazzak)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_twisted_reflection)
void JustDied(Unit *) override
boss_doomlord_kazzak(Creature *creature)
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *victim) override
void JustEngagedWith(Unit *) override