TrinityCore
Loading...
Searching...
No Matches
boss_king_dred.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 "drak_tharon_keep.h"
20#include "Containers.h"
21#include "InstanceScript.h"
22#include "ObjectAccessor.h"
23#include "ScriptedCreature.h"
24#include "SpellInfo.h"
25
27{
28 EMOTE_SLASH = 0
29};
30
32{
33 // Dred
41
42 // Raptors
44 SPELL_REND = 13738
45};
46
57
63
64// 27483 - King Dred
65struct boss_king_dred : public BossAI
66{
68
69 void Reset() override
70 {
71 _Reset();
73 }
74
85
86 void OnSpellCast(SpellInfo const* spell) override
87 {
88 if (spell->Id == SPELL_MULTI_SLASH)
90 }
91
92 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
93 {
94 if (spellInfo->Id == SPELL_MULTI_SLASH)
95 {
98 }
99
100 if (spellInfo->Id == SPELL_RAPTOR_CALL)
101 {
103 float x, y, z;
104
105 me->GetClosePoint(x, y, z, me->GetCombatReach() / 3, 10.0f);
107 }
108 }
109
110 void DoAction(int32 action) override
111 {
112 if (action == ACTION_RAPTOR_KILLED)
114 }
115
116 uint32 GetData(uint32 type) const override
117 {
118 if (type == DATA_RAPTORS_KILLED)
119 return _raptorsKilled;
120
121 return 0;
122 }
123
124 void UpdateAI(uint32 diff) override
125 {
126 if (!UpdateVictim())
127 return;
128
129 events.Update(diff);
130
132 return;
133
134 while (uint32 eventId = events.ExecuteEvent())
135 {
136 switch (eventId)
137 {
140 events.Repeat(15s, 20s);
141 break;
144 events.Repeat(20s);
145 break;
148 events.Repeat(10s, 20s);
149 break;
152 events.Repeat(30s);
153 break;
156 events.Repeat(18s, 22s);
157 break;
160 break;
163 break;
164 default:
165 break;
166 }
167
169 return;
170 }
171
173 }
174
175private:
177};
178
179// 26641 - Drakkari Gutripper
181{
182 npc_drakkari_gutripper(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
183
184 void Reset() override
185 {
187 }
188
189 void JustEngagedWith(Unit* /*who*/) override
190 {
191 _scheduler.Schedule(10s, 15s, [this](TaskContext task)
192 {
194 task.Repeat(10s, 15s);
195 });
196 }
197
198 void JustDied(Unit* /*killer*/) override
199 {
201 dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
202 }
203
204 void UpdateAI(uint32 diff) override
205 {
206 if (!UpdateVictim())
207 return;
208
209 _scheduler.Update(diff);
210
212 }
213
214private:
217};
218
219// 26628 - Drakkari Scytheclaw
221{
222 npc_drakkari_scytheclaw(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
223
224 void Reset() override
225 {
227 }
228
229 void JustEngagedWith(Unit* /*who*/) override
230 {
231 _scheduler.Schedule(10s, 15s, [this](TaskContext task)
232 {
234 task.Repeat(10s, 15s);
235 });
236 }
237
238 void JustDied(Unit* /*killer*/) override
239 {
241 dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
242 }
243
244 void UpdateAI(uint32 diff) override
245 {
246 if (!UpdateVictim())
247 return;
248
249 _scheduler.Update(diff);
250
252 }
253
254private:
257};
258
260{
261 public:
263 {
264 }
265
266 bool OnCheck(Player* /*player*/, Unit* target) override
267 {
268 if (!target)
269 return false;
270
271 if (Creature* Dred = target->ToCreature())
272 if (Dred->AI()->GetData(DATA_RAPTORS_KILLED) >= 6)
273 return true;
274
275 return false;
276 }
277};
278
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_DEAD_DESPAWN
@ UNIT_STATE_CASTING
Definition Unit.h:235
void AddSC_boss_king_dred()
DredTexts
@ EMOTE_SLASH
@ ACTION_RAPTOR_KILLED
@ DATA_RAPTORS_KILLED
DredEvents
@ EVENT_MANGLING_SLASH
@ EVENT_PIERCING_SLASH
@ EVENT_BELLOWING_ROAR
@ EVENT_GRIEVOUS_BITE
@ EVENT_FEARSOME_ROAR
@ EVENT_RAPTOR_CALL
@ EVENT_MULTI_SLASH
DredSpells
@ SPELL_BELLOWING_ROAR
@ SPELL_MANGLING_SLASH
@ SPELL_GRIEVOUS_BITE
@ SPELL_FEARSOME_ROAR
@ SPELL_PIERCING_SLASH
@ SPELL_MULTI_SLASH
@ SPELL_REND
@ SPELL_GUT_RIP
@ SPELL_RAPTOR_CALL
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
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
virtual ObjectGuid GetGuidData(uint32 type) const override
static Creature * ToCreature(Object *o)
Definition Object.h:186
uint32 Id
Definition SpellInfo.h:289
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
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
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
Definition Unit.h:769
float GetCombatReach() const override
Definition Unit.h:839
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
Definition Object.cpp:3244
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1992
bool OnCheck(Player *, Unit *target) override
#define RegisterDrakTharonKeepCreatureAI(ai_name)
@ NPC_DRAKKARI_GUTRIPPER
@ NPC_DRAKKARI_SCYTHECLAW
@ DATA_KING_DRED
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
boss_king_dred(Creature *creature)
uint32 GetData(uint32 type) const override
void OnSpellCast(SpellInfo const *spell) override
void DoAction(int32 action) override
void JustEngagedWith(Unit *who) override
void Reset() override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
InstanceScript * _instance
npc_drakkari_gutripper(Creature *creature)
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *) override
npc_drakkari_scytheclaw(Creature *creature)
void UpdateAI(uint32 diff) override