TrinityCore
Loading...
Searching...
No Matches
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/*
19 * Timers requires update
20 * Guardians are despawned in core, that should not happen here
21 */
22
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "razorfen_downs.h"
26
36
45
56
64
65// 7358 - Amnennar the Coldbringer
67{
69
70 void Reset() override
71 {
72 _Reset();
74 }
75
84
85 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
86 {
87 if (_phase < PHASE_HEALTH_75 && me->HealthBelowPctDamaged(75, damage))
88 {
89 _phase++;
91 }
92
93 if (_phase < PHASE_HEALTH_60 && me->HealthBelowPctDamaged(60, damage))
94 {
95 _phase++;
97 }
98
99 if (_phase < PHASE_HEALTH_30 && me->HealthBelowPctDamaged(30, damage))
100 {
101 _phase++;
103 }
104 }
105
106 void KilledUnit(Unit* who) override
107 {
108 if (who->GetTypeId() == TYPEID_PLAYER)
109 Talk(SAY_SLAY);
110 }
111
112 // Despawn is handled by spell, don't store anything
113 void JustSummoned(Creature* /*summon*/) override { }
114
115 void EnterEvadeMode(EvadeReason why) override
116 {
119 }
120
121 void JustDied(Unit* /*killer*/) override
122 {
123 _JustDied();
125 }
126
127 void UpdateAI(uint32 diff) override
128 {
129 if (!UpdateVictim())
130 return;
131
132 events.Update(diff);
133
135 return;
136
137 while (uint32 eventId = events.ExecuteEvent())
138 {
139 switch (eventId)
140 {
143 events.Repeat(12s);
144 break;
145 case EVENT_FROSTBOLT:
147 events.Repeat(8s);
148 break;
149 case EVENT_FROST_NOVA:
151 events.Repeat(15s);
152 break;
153
154 case EVENT_HEALTH_75:
156 break;
157 case EVENT_HEALTH_60:
161 break;
162 case EVENT_HEALTH_30:
166 break;
167 default:
168 break;
169 }
170
172 return;
173 }
174
176 }
177
178private:
180};
181
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
void AddSC_boss_amnennar_the_coldbringer()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
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
TypeID GetTypeId() const
Definition Object.h:93
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
Definition Unit.h:769
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
#define RegisterRazorfenDownsCreatureAI(ai_name)
@ DATA_AMNENNAR_THE_COLD_BRINGER
void EnterEvadeMode(EvadeReason why) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override