TrinityCore
boss_general_angerforge.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_depths.h"
20#include "ScriptedCreature.h"
21
23{
26 SPELL_CLEAVE = 20691
27};
28
30{
35 EVENT_ADDS = 5
36};
37
39{
41 PHASE_TWO = 2
42};
43
45{
46 public:
47 boss_general_angerforge() : CreatureScript("boss_general_angerforge") { }
48
50 {
52
53 void JustEngagedWith(Unit* who) override
54 {
60 }
61
62 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
63 {
65 {
69 }
70 }
71
72 void SummonAdd(Unit* victim)
73 {
74 if (Creature* SummonedAdd = DoSpawnCreature(8901, float(irand(-14, 14)), float(irand(-14, 14)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120s))
75 SummonedAdd->AI()->AttackStart(victim);
76 }
77
78 void SummonMedic(Unit* victim)
79 {
80 if (Creature* SummonedMedic = DoSpawnCreature(8894, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120s))
81 SummonedMedic->AI()->AttackStart(victim);
82 }
83
84 void UpdateAI(uint32 diff) override
85 {
86 if (!UpdateVictim())
87 return;
88
89 events.Update(diff);
90
91 while (uint32 eventId = events.ExecuteEvent())
92 {
93 switch (eventId)
94 {
98 break;
99 case EVENT_HAMSTRING:
102 break;
103 case EVENT_CLEAVE:
106 break;
107 case EVENT_MEDIC:
108 for (uint8 i = 0; i < 2; ++i)
110 break;
111 case EVENT_ADDS:
112 for (uint8 i = 0; i < 3; ++i)
115 break;
116 default:
117 break;
118 }
119 }
120 }
121 };
122
123 CreatureAI* GetAI(Creature* creature) const override
124 {
125 return GetBlackrockDepthsAI<boss_general_angerforgeAI>(creature);
126 }
127};
128
130{
132}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: ObjectDefines.h:64
Spells
Definition: PlayerAI.cpp:32
int32 irand(int32 min, int32 max)
Definition: Random.cpp:35
DamageEffectType
Definition: UnitDefines.h:131
@ BOSS_GENERAL_ANGERFORGE
void AddSC_boss_general_angerforge()
void _JustEngagedWith(Unit *who)
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
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
Unit * GetVictim() const
Definition: Unit.h:715
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
CreatureAI * GetAI(Creature *creature) const override
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override