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/*
19 * Timers requires to be revisited, especially Void Bolt, not sure how exactly it is used
20 * SAY_UNK_1 is used (sniffs), but the exact purpose is unknown. SAY_UNK_2 maybe is used, maybe not, exact purpose is unknown
21 */
22
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "SpellAuraEffects.h"
26#include "SpellInfo.h"
27#include "SpellScript.h"
28
41
61
73
74// 18728 - Doom Lord Kazzak
76{
78
79 void JustAppeared() override
80 {
82 }
83
101
102 void OnSpellCast(SpellInfo const* spellInfo) override
103 {
104 switch (spellInfo->Id)
105 {
106 case SPELL_FRENZY:
109 break;
110 case SPELL_BERSERK:
112 break;
113 default:
114 break;
115 }
116 }
117
118 void KilledUnit(Unit* victim) override
119 {
120 if (victim->GetTypeId() != TYPEID_PLAYER)
121 return;
122
123 Talk(SAY_SLAY);
124 }
125
126 void JustDied(Unit* killer) override
127 {
128 WorldBossAI::JustDied(killer);
129
131 }
132
133 void UpdateAI(uint32 diff) override
134 {
135 if (!UpdateVictim())
136 return;
137
138 events.Update(diff);
139
141 return;
142
143 while (uint32 eventId = events.ExecuteEvent())
144 {
145 switch (eventId)
146 {
147 case EVENT_CLEAVE:
149 events.Repeat(10s, 15s);
150 break;
152 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
154 events.Repeat(15s, 30s);
155 break;
156 case EVENT_VOID_BOLT:
159 events.Repeat(2s);
160 break;
162 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [](Unit const* unit) { return unit && unit->IsPlayer() && unit->GetPowerType() == POWER_MANA && !unit->HasAura(SPELL_MARK_OF_KAZZAK); }))
164 events.Repeat(10s, 25s);
165 break;
168 events.Repeat(10s, 25s);
169 break;
170 case EVENT_FRENZY:
172 events.Repeat(60s);
173 break;
176 events.Repeat(20s, 30s);
177 break;
178 case EVENT_BERSERK:
180 break;
181 default:
182 break;
183 }
184 }
185
187 }
188};
189
190// 32960 - Mark of Kazzak
192{
194
195 bool Validate(SpellInfo const* /*spellInfo*/) override
196 {
198 }
199
200 void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
201 {
202 if (Unit* owner = GetUnitOwner())
203 amount = CalculatePct(owner->GetMaxPower(POWER_MANA), 5);
204 }
205
206 void OnPeriodic(AuraEffect const* aurEff)
207 {
208 Unit* target = GetTarget();
209
210 if (target->GetPowerPct(POWER_MANA) < 5.0f)
211 {
212 target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, aurEff);
213 Remove();
214 }
215 }
216
222};
223
224// 21063 - Twisted Reflection
226{
228
229 bool Validate(SpellInfo const* /*spellInfo*/) override
230 {
232 }
233
234 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
235 {
237 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
238 if (!damageInfo || !damageInfo->GetDamage())
239 return;
240
241 eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_TWISTED_REFLECTION_HEAL, aurEff);
242 }
243
248};
249
250// 48473 - Capture Soul
252{
254
255 void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
256 {
257 if (Creature* actor = eventInfo.GetActor()->ToCreature())
258 actor->AI()->Talk(SAY_SOUL, eventInfo.GetActionTarget());
259 }
260
265};
266
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#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_PROC_TRIGGER_SPELL
@ SPELL_AURA_DUMMY
#define AuraEffectProcFn(F, I, N)
#define AuraEffectCalcAmountFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:249
T CalculatePct(T base, U pct)
Definition Util.h:71
@ SPELL_SHADOW_BOLT_VOLLEY
@ SPELL_MARK_OF_KAZZAK_DAMAGE
@ SPELL_TWISTED_REFLECTION
@ 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_BOLT_VOLLEY
@ EVENT_THUNDERCLAP
@ EVENT_VOID_BOLT
@ EVENT_TWISTED_REFLECTION
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Unit * GetTarget() const
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
HookList< EffectProcHandler > OnEffectProc
Unit * GetUnitOwner() const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
uint32 GetDamage() const
Definition Unit.h:478
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
static Creature * ToCreature(Object *o)
Definition Object.h:189
bool IsPlayer() const
Definition Object.h:182
TypeID GetTypeId() const
Definition Object.h:93
Unit * GetActionTarget() const
Definition Unit.h:523
Unit * GetActor()
Definition Unit.h:522
DamageInfo * GetDamageInfo() const
Definition Unit.h:533
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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:783
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:858
Powers GetPowerType() const
Definition Unit.h:945
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4558
Unit * GetVictim() const
Definition Unit.h:873
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
float GetPowerPct(Powers power) const
Definition Unit.h:951
void JustDied(Unit *) override
WorldBossAI(Creature *creature)
void JustEngagedWith(Unit *) override
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void HandleProc(AuraEffect const *, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_doom_lord_kazzak_capture_soul)
bool Validate(SpellInfo const *) override
void CalculateAmount(AuraEffect const *, int32 &amount, bool &)
PrepareAuraScript(spell_doom_lord_kazzak_mark_of_kazzak)
void OnPeriodic(AuraEffect const *aurEff)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_doom_lord_kazzak_twisted_reflection)
void UpdateAI(uint32 diff) override
void JustDied(Unit *killer) override
void JustEngagedWith(Unit *who) override
void OnSpellCast(SpellInfo const *spellInfo) override
void KilledUnit(Unit *victim) override