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 }
172
173private:
175};
176
177// 26641 - Drakkari Gutripper
179{
180 npc_drakkari_gutripper(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
181
182 void Reset() override
183 {
185 }
186
187 void JustEngagedWith(Unit* /*who*/) override
188 {
189 _scheduler.Schedule(10s, 15s, [this](TaskContext& task)
190 {
192 task.Repeat(10s, 15s);
193 });
194 }
195
196 void JustDied(Unit* /*killer*/) override
197 {
199 dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
200 }
201
202 void UpdateAI(uint32 diff) override
203 {
204 if (!UpdateVictim())
205 return;
206
207 _scheduler.Update(diff);
208 }
209
210private:
213};
214
215// 26628 - Drakkari Scytheclaw
217{
218 npc_drakkari_scytheclaw(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
219
220 void Reset() override
221 {
223 }
224
225 void JustEngagedWith(Unit* /*who*/) override
226 {
227 _scheduler.Schedule(10s, 15s, [this](TaskContext& task)
228 {
230 task.Repeat(10s, 15s);
231 });
232 }
233
234 void JustDied(Unit* /*killer*/) override
235 {
237 dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
238 }
239
240 void UpdateAI(uint32 diff) override
241 {
242 if (!UpdateVictim())
243 return;
244
245 _scheduler.Update(diff);
246 }
247
248private:
251};
252
254{
255 public:
257 {
258 }
259
260 bool OnCheck(Player* /*player*/, Unit* target) override
261 {
262 if (!target)
263 return false;
264
265 if (Creature* Dred = target->ToCreature())
266 if (Dred->AI()->GetData(DATA_RAPTORS_KILLED) >= 6)
267 return true;
268
269 return false;
270 }
271};
272
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_DEAD_DESPAWN
@ UNIT_STATE_CASTING
Definition Unit.h:290
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:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
virtual ObjectGuid GetGuidData(uint32 type) const override
Creature * ToCreature()
Definition Object.h:121
uint32 const Id
Definition SpellInfo.h:328
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
Definition Unit.h:647
float GetCombatReach() const override
Definition Unit.h:717
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
Definition Object.cpp:2754
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:1403
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