TrinityCore
Loading...
Searching...
No Matches
boss_kazrogal.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 * Combat timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "hyjal.h"
24#include "MotionMaster.h"
25#include "ScriptedCreature.h"
26#include "SpellAuraEffects.h"
27#include "SpellInfo.h"
28#include "SpellScript.h"
29
36
46
54
56{
57 SOUND_DEATH = 11018
58};
59
60// 17888 - Kaz'rogal
61struct boss_kazrogal : public BossAI
62{
63 boss_kazrogal(Creature* creature) : BossAI(creature, DATA_KAZROGAL), _markCount(0), _markTimer(0) { }
64
65 void JustAppeared() override
66 {
69 }
70
71 void Reset() override
72 {
73 _Reset();
74 _markCount = 0;
75 _markTimer = 45s;
76 }
77
87
88 void OnSpellCast(SpellInfo const* spellInfo) override
89 {
90 if (spellInfo->Id == SPELL_MARK_OF_KAZROGAL)
92 }
93
94 // Do not reset SetActive, we want boss to be active all the time
95 void JustReachedHome() override { }
96
97 void KilledUnit(Unit* victim) override
98 {
99 if (victim->GetTypeId() == TYPEID_PLAYER)
100 Talk(SAY_SLAY);
101 }
102
103 void JustDied(Unit* /*killer*/) override
104 {
105 _JustDied();
107 }
108
109 void UpdateAI(uint32 diff) override
110 {
111 if (!UpdateVictim())
112 return;
113
114 events.Update(diff);
115
117 return;
118
119 while (uint32 eventId = events.ExecuteEvent())
120 {
121 switch (eventId)
122 {
125 events.Repeat(6s, 12s);
126 break;
127 case EVENT_WAR_STOMP:
129 events.Repeat(15s, 25s);
130 break;
131 case EVENT_CRIPPLE:
132 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f))
133 DoCast(target, SPELL_CRIPPLE);
134 events.Repeat(15s, 25s);
135 break;
138 ++_markCount;
139 if (_markCount <= 7)
140 _markTimer -= 5s;
142 break;
143 default:
144 break;
145 }
146
148 return;
149 }
150
152 }
153
154private:
157};
158
160{
161 public:
162 bool operator()(WorldObject* target) const
163 {
164 if (Unit* unit = target->ToUnit())
165 return unit->GetPowerType() != POWER_MANA;
166 return true;
167 }
168};
169
170// 31447 - Mark of Kaz'rogal
185
187{
189
190 bool Validate(SpellInfo const* /*spellInfo*/) override
191 {
193 }
194
195 void OnPeriodic(AuraEffect const* aurEff)
196 {
197 Unit* target = GetTarget();
198
199 if (target->GetPower(POWER_MANA) < uint32(aurEff->GetAmount()))
200 {
201 target->CastSpell(target, SPELL_MARK_OF_KAZROGAL_DMG, aurEff);
202 Remove();
203 }
204 }
205
210};
211
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition ScriptMgr.h:1130
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
@ POWER_MANA
@ SPELL_AURA_PERIODIC_MANA_LEECH
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
void AddSC_boss_kazrogal()
KazrogalEvents
@ EVENT_MALEVOLENT_CLEAVE
@ EVENT_CRIPPLE
@ EVENT_WAR_STOMP
@ EVENT_MARK_OF_KAZROGAL
KazrogalTexts
@ SAY_SLAY
@ SAY_MARK
@ SAY_INTRO
KazrogalSpells
@ SPELL_CRIPPLE
@ SPELL_MALEVOLENT_CLEAVE
@ SPELL_WAR_STOMP
@ SPELL_MARK_OF_KAZROGAL_DMG
@ SPELL_MARK_OF_KAZROGAL
KazrogalMisc
@ SOUND_DEATH
int32 GetAmount() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
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
bool operator()(WorldObject *target) const
void MovePath(uint32 pathId, bool repeatable)
static Unit * ToUnit(Object *o)
Definition Object.h:192
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
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:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
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)
PrepareAuraScript(spell_mark_of_kazrogal_aura)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_mark_of_kazrogal)
@ PATH_HORDE_BOSS
Definition hyjal.h:115
@ DATA_KAZROGAL
Definition hyjal.h:32
#define RegisterHyjalCreatureAI(ai_name)
Definition hyjal.h:126
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
boss_kazrogal(Creature *creature)
void JustEngagedWith(Unit *who) override
Milliseconds _markTimer
void JustDied(Unit *) override
void OnSpellCast(SpellInfo const *spellInfo) override
void JustReachedHome() override
void KilledUnit(Unit *victim) override
void UpdateAI(uint32 diff) override
void Reset() override
void JustAppeared() override