TrinityCore
boss_amnennar_the_coldbringer.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 "razorfen_downs.h"
20#include "ScriptedCreature.h"
21
22enum Say
23{
27 SAY_HP = 3,
28 SAY_KILL = 4
29};
30
32{
37};
38
40{
44};
45
47{
48public:
49 boss_amnennar_the_coldbringer() : CreatureScript("boss_amnennar_the_coldbringer") { }
50
52 {
54 {
55 Initialize();
56 }
57
59 {
60 hp60Spectrals = false;
61 hp30Spectrals = false;
62 hp50 = false;
63 }
64
65 void Reset() override
66 {
67 _Reset();
68 Initialize();
69 }
70
71 void JustEngagedWith(Unit* who) override
72 {
78 }
79
80 void KilledUnit(Unit* who) override
81 {
82 if (who->GetTypeId() == TYPEID_PLAYER)
84 }
85
86 void JustDied(Unit* /*killer*/) override
87 {
88 _JustDied();
89 }
90
91 void UpdateAI(uint32 diff) override
92 {
93 if (!UpdateVictim())
94 return;
95
96 events.Update(diff);
97
99 return;
100
101 while (uint32 eventId = events.ExecuteEvent())
102 {
103 switch (eventId)
104 {
108 break;
109 case EVENT_FROSTBOLT:
112 break;
113 case EVENT_FROST_NOVA:
116 break;
117 }
118
120 return;
121 }
122
123 if (!hp60Spectrals && HealthBelowPct(60))
124 {
127 hp60Spectrals = true;
128 }
129
130 if (!hp50 && HealthBelowPct(50))
131 {
132 Talk(SAY_HP);
133 hp50 = true;
134 }
135
136 if (!hp30Spectrals && HealthBelowPct(30))
137 {
140 hp30Spectrals = true;
141 }
142 }
143
144 private:
147 bool hp50;
148 };
149
150 CreatureAI* GetAI(Creature* creature) const override
151 {
152 return GetRazorfenDownsAI<boss_amnennar_the_coldbringerAI>(creature);
153 }
154};
155
157{
159}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_amnennar_the_coldbringer()
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
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
TypeID GetTypeId() const
Definition: Object.h:173
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
CreatureAI * GetAI(Creature *creature) const override
@ DATA_AMNENNAR_THE_COLD_BRINGER
bool HealthBelowPct(uint32 pct) const