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 "SpellInfo.h"
26#include "SpellScript.h"
27
40
60
72
73// 18728 - Doom Lord Kazzak
75{
77
78 void JustAppeared() override
79 {
81 }
82
100
101 void OnSpellCast(SpellInfo const* spellInfo) override
102 {
103 switch (spellInfo->Id)
104 {
105 case SPELL_FRENZY:
108 break;
109 case SPELL_BERSERK:
111 break;
112 default:
113 break;
114 }
115 }
116
117 void KilledUnit(Unit* victim) override
118 {
119 if (victim->GetTypeId() != TYPEID_PLAYER)
120 return;
121
122 Talk(SAY_SLAY);
123 }
124
125 void JustDied(Unit* killer) override
126 {
127 WorldBossAI::JustDied(killer);
128
130 }
131
132 void UpdateAI(uint32 diff) override
133 {
134 if (!UpdateVictim())
135 return;
136
137 events.Update(diff);
138
140 return;
141
142 while (uint32 eventId = events.ExecuteEvent())
143 {
144 switch (eventId)
145 {
146 case EVENT_CLEAVE:
148 events.Repeat(10s, 15s);
149 break;
151 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
153 events.Repeat(15s, 30s);
154 break;
155 case EVENT_VOID_BOLT:
158 events.Repeat(2s);
159 break;
161 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [](Unit const* unit) { return unit && unit->IsPlayer() && unit->GetPowerIndex(POWER_MANA) < MAX_POWERS_PER_CLASS && !unit->HasAura(SPELL_MARK_OF_KAZZAK); }))
163 events.Repeat(10s, 25s);
164 break;
167 events.Repeat(10s, 25s);
168 break;
169 case EVENT_FRENZY:
171 events.Repeat(60s);
172 break;
175 events.Repeat(20s, 30s);
176 break;
177 case EVENT_BERSERK:
179 break;
180 default:
181 break;
182 }
183 }
184 }
185};
186
187// 32960 - Mark of Kazzak
189{
190 bool Validate(SpellInfo const* /*spellInfo*/) override
191 {
193 }
194
195 void CalculateAmount(AuraEffect const* /*aurEff*/, SpellEffectValue& amount, bool& /*canBeRecalculated*/)
196 {
197 if (Unit* owner = GetUnitOwner())
198 amount = CalculatePct(owner->GetMaxPower(POWER_MANA), 5);
199 }
200
201 void OnPeriodic(AuraEffect const* aurEff)
202 {
203 Unit* target = GetTarget();
204
205 if (target->GetPowerPct(POWER_MANA) < 5.0f)
206 {
207 target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, aurEff);
208 Remove();
209 }
210 }
211
217};
218
219// 21063 - Twisted Reflection
221{
222 bool Validate(SpellInfo const* /*spellInfo*/) override
223 {
225 }
226
227 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
228 {
230 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
231 if (!damageInfo || !damageInfo->GetDamage())
232 return;
233
234 eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_TWISTED_REFLECTION_HEAL, aurEff);
235 }
236
241};
242
243// 48473 - Capture Soul
245{
246 void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
247 {
248 if (Creature* actor = eventInfo.GetActor()->ToCreature())
249 actor->AI()->Talk(SAY_SOUL, eventInfo.GetActionTarget());
250 }
251
256};
257
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
#define MAX_POWERS_PER_CLASS
@ POWER_MANA
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ 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:290
T CalculatePct(T base, U pct)
Definition Util.h:72
@ 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
HookList< EffectProcHandler > OnEffectProc
Unit * GetUnitOwner() const
bool IsPlayer() const
Definition BaseEntity.h:173
TypeID GetTypeId() const
Definition BaseEntity.h:166
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 GetDamage() const
Definition Unit.h:466
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
Creature * ToCreature()
Definition Object.h:121
Unit * GetActionTarget() const
Definition Unit.h:514
DamageInfo * GetDamageInfo() const
Definition Unit.h:524
Unit * GetActor() const
Definition Unit.h:513
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:722
virtual uint32 GetPowerIndex(Powers power) const =0
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
float GetPowerPct(Powers power) const
Definition Unit.h:832
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
void JustDied(Unit *) override
void JustEngagedWith(Unit *) override
WorldBossAI(Creature *creature) noexcept
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
void HandleProc(AuraEffect const *, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void CalculateAmount(AuraEffect const *, SpellEffectValue &amount, bool &)
void OnPeriodic(AuraEffect const *aurEff)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
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