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 "SpellScript.h"
21
32
47
59
61{
63 {
64 }
65
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*/, SpellEffectValue& 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
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
219};
220
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ POWER_MANA
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_DUMMY
double SpellEffectValue
This is a double instead of float to be able to store full range of int32.
#define AuraEffectProcFn(F, I, N)
#define AuraEffectCalcAmountFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:276
T CalculatePct(T base, U pct)
Definition Util.h:72
@ 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
TypeID GetTypeId() const
Definition BaseEntity.h:166
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 GetDamage() const
Definition Unit.h:452
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
void Reset()
Definition EventMap.cpp:25
Unit * GetActionTarget() const
Definition Unit.h:500
DamageInfo * GetDamageInfo() const
Definition Unit.h:511
Unit * GetActor() const
Definition Unit.h:499
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
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:635
int32 GetPower(Powers power) const
Definition Unit.cpp:10028
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void OnPeriodic(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
void CalculateAmount(AuraEffect const *, SpellEffectValue &amount, bool &)
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