TrinityCore
boss_lord_valthalak.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 "blackrock_spire.h"
20#include "InstanceScript.h"
21#include "ScriptedCreature.h"
22
24{
28 SPELL_SHADOW_WRATH = 27286
29};
30
31enum Says
32{
33 EMOTE_FRENZY = 0
34};
35
37{
41};
42
44{
46 {
47 Initialize();
48 }
49
51 {
52 frenzy40 = false;
53 frenzy15 = false;
54 }
55
56 void Reset() override
57 {
58 _Reset();
59 Initialize();
60 }
61
62 void JustEngagedWith(Unit* who) override
63 {
67 }
68
69 void JustDied(Unit* /*killer*/) override
70 {
72 }
73
74 void UpdateAI(uint32 diff) override
75 {
76 if (!UpdateVictim())
77 return;
78
79 events.Update(diff);
80
82 return;
83
84 while (uint32 eventId = events.ExecuteEvent())
85 {
86 switch (eventId)
87 {
91 break;
95 break;
99 break;
100 default:
101 break;
102 }
103
105 return;
106 }
107
108 if (!frenzy40)
109 {
110 if (HealthBelowPct(40))
111 {
114 frenzy40 = true;
115 }
116 }
117
118 if (!frenzy15)
119 {
120 if (HealthBelowPct(15))
121 {
124 frenzy15 = true;
125 }
126 }
127 }
128 private:
131};
132
134{
136}
uint32_t uint32
Definition: Define.h:142
@ DONE
Spells
Definition: PlayerAI.cpp:32
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterBlackrockSpireCreatureAI(ai_name)
@ DATA_LORD_VALTHALAK
Says
@ EMOTE_FRENZY
@ SPELL_SHADOW_BOLT_VOLLEY
@ SPELL_SHADOW_WRATH
@ SPELL_FRENZY
@ SPELL_SUMMON_SPECTRAL_ASSASSIN
void AddSC_boss_lord_valthalak()
@ EVENT_SHADOW_BOLT_VOLLEY
@ EVENT_SHADOW_WRATH
@ EVENT_SUMMON_SPECTRAL_ASSASSIN
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
bool HealthBelowPct(uint32 pct) const
boss_lord_valthalak(Creature *creature)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override