TrinityCore
boss_watchkeeper_gargolmar.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/* ScriptData
19SDName: Boss_Watchkeeper_Gargolmar
20SD%Complete: 80
21SDComment: Missing adds to heal him. Surge should be used on target furthest away, not random.
22SDCategory: Hellfire Citadel, Hellfire Ramparts
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "hellfire_ramparts.h"
27#include "ScriptedCreature.h"
28
29enum Says
30{
36 SAY_DIE = 5
37};
38
40{
42 SPELL_SURGE = 34645,
43 SPELL_RETALIATION = 22857
44};
45
47{
51};
52
54{
55 public:
56 boss_watchkeeper_gargolmar() : CreatureScript("boss_watchkeeper_gargolmar") { }
57
59 {
61 {
62 Initialize();
63 }
64
66 {
67 hasTaunted = false;
68 yelledForHeal = false;
69 retaliation = false;
70 }
71
72 void Reset() override
73 {
74 Initialize();
75 _Reset();
76 }
77
78 void JustEngagedWith(Unit* who) override
79 {
84 }
85
86 void MoveInLineOfSight(Unit* who) override
87 {
88 if (!me->GetVictim() && me->CanCreatureAttack(who))
89 {
91 return;
92
93 float attackRadius = me->GetAttackDistance(who);
94 if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who))
95 {
96 //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
97 AttackStart(who);
98 }
99 else if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f))
100 {
102 hasTaunted = true;
103 }
104 }
105 }
106
107 void KilledUnit(Unit* /*victim*/) override
108 {
109 Talk(SAY_KILL);
110 }
111
112 void JustDied(Unit* /*killer*/) override
113 {
114 Talk(SAY_DIE);
115 _JustDied();
116 }
117
118 void UpdateAI(uint32 diff) override
119 {
120 if (!UpdateVictim())
121 return;
122
123 events.Update(diff);
124
125 while (uint32 eventId = events.ExecuteEvent())
126 {
127 switch (eventId)
128 {
132 break;
133 case EVENT_SURGE:
136 DoCast(target, SPELL_SURGE);
138 break;
142 break;
143 default:
144 break;
145 }
146 }
147
148 if (!retaliation)
149 {
150 if (HealthBelowPct(20))
151 {
153 retaliation = true;
154 }
155 }
156
157 if (!yelledForHeal)
158 {
159 if (HealthBelowPct(40))
160 {
161 Talk(SAY_HEAL);
162 yelledForHeal = true;
163 }
164 }
165 }
166
167 private:
171 };
172
173 CreatureAI* GetAI(Creature* creature) const override
174 {
175 return GetHellfireRampartsAI<boss_watchkeeper_gargolmarAI>(creature);
176 }
177};
178
180{
182}
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:52
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
Says
void AddSC_boss_watchkeeper_gargolmar()
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
float GetAttackDistance(Unit const *player) const
Definition: Creature.cpp:2153
bool CanFly() const override
Definition: Creature.h:147
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2686
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
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
Unit * GetVictim() const
Definition: Unit.h:715
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition: Object.cpp:1181
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
float GetDistanceZ(WorldObject const *obj) const
Definition: Object.cpp:1048
CreatureAI * GetAI(Creature *creature) const override
@ DATA_WATCHKEEPER_GARGOLMAR
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
bool HealthBelowPct(uint32 pct) const