Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_watchkeeper_gargolmar.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Boss_Watchkeeper_Gargolmar
8SD%Complete: 80
9SDComment: Missing adds to heal him. Surge should be used on target furthest away, not random.
10SDCategory: Hellfire Citadel, Hellfire Ramparts
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "hellfire_ramparts.h"
16
17enum Says
18{
25};
26
34
41
43{
44 public:
45 boss_watchkeeper_gargolmar() : CreatureScript("boss_watchkeeper_gargolmar") { }
46
48 {
50
52 {
53 hasTaunted = false;
54 yelledForHeal = false;
55 retaliation = false;
56 _Reset();
57 }
58
59 void EnterCombat(Unit* /*who*/) OVERRIDE
60 {
62 events.ScheduleEvent(EVENT_MORTAL_WOUND, 5000);
63 events.ScheduleEvent(EVENT_SURGE, 4000);
65 }
66
68
69 {
70 if (!me->GetVictim() && me->CanCreatureAttack(who))
71 {
72 if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
73 return;
74
75 float attackRadius = me->GetAttackDistance(who);
76 if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who))
77 {
78 //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
79 AttackStart(who);
80 }
81 else if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f))
82 {
84 hasTaunted = true;
85 }
86 }
87 }
88
89 void KilledUnit(Unit* /*victim*/) OVERRIDE
90 {
92 }
93
94 void JustDied(Unit* /*killer*/) OVERRIDE
95 {
97 _JustDied();
98 }
99
101 {
102 if (!UpdateVictim())
103 return;
104
105 events.Update(diff);
106
107 while (uint32 eventId = events.ExecuteEvent())
108 {
109 switch (eventId)
110 {
113 events.ScheduleEvent(EVENT_MORTAL_WOUND, std::rand() % 13000 + 5000);
114 break;
115 case EVENT_SURGE:
117 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
118 DoCast(target, SPELL_SURGE);
119 events.ScheduleEvent(EVENT_SURGE, std::rand() % 13000 + 5000);
120 break;
123 events.ScheduleEvent(EVENT_RETALIATION, 30000);
124 break;
125 default:
126 break;
127 }
128 }
129
130 if (!retaliation)
131 {
132 if (HealthBelowPct(20))
133 {
134 events.ScheduleEvent(EVENT_RETALIATION, 1000);
135 retaliation = true;
136 }
137 }
138
139 if (!yelledForHeal)
140 {
141 if (HealthBelowPct(40))
142 {
143 Talk(SAY_HEAL);
144 yelledForHeal = true;
145 }
146 }
147
149 }
150
151 private:
155 };
156
158 {
159 return new boss_watchkeeper_gargolmarAI(creature);
160 }
161};
162
167
#define CREATURE_Z_ATTACK_RANGE
Definition Creature.h:422
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
#define SAY_AGGRO
#define SAY_KILL
@ SAY_SURGE
@ H_SPELL_MORTAL_WOUND
@ SPELL_MORTAL_WOUND
@ EVENT_MORTAL_WOUND
void AddSC_boss_watchkeeper_gargolmar()
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_WATCHKEEPER_GARGOLMAR
Creature * me
bool HealthBelowPct(uint32 pct) const
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================