TrinityCore
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/*
19 * Comment: MAYBE need more improve the "Raptor Call".
20 */
21
22#include "ScriptMgr.h"
23#include "drak_tharon_keep.h"
24#include "InstanceScript.h"
25#include "ObjectAccessor.h"
26#include "ScriptedCreature.h"
27
29{
30 SPELL_BELLOWING_ROAR = 22686, // fears the group, can be resisted/dispelled
32 SPELL_MANGLING_SLASH = 48873, // cast on the current tank, adds debuf
34 SPELL_PIERCING_SLASH = 48878, // debuff --> Armor reduced by 75%
35 SPELL_RAPTOR_CALL = 59416, // dummy
37 SPELL_REND = 13738
38};
39
40enum Misc
41{
44};
45
47{
54};
55
56struct boss_king_dred : public BossAI
57{
59 {
60 Initialize();
61 }
62
64 {
65 raptorsKilled = 0;
66 }
67
68 void Reset() override
69 {
70 Initialize();
71 _Reset();
72 }
73
74 void JustEngagedWith(Unit* who) override
75 {
77
84 }
85
86 void DoAction(int32 action) override
87 {
88 if (action == ACTION_RAPTOR_KILLED)
90 }
91
92 uint32 GetData(uint32 type) const override
93 {
94 if (type == DATA_RAPTORS_KILLED)
95 return raptorsKilled;
96
97 return 0;
98 }
99
100 void JustDied(Unit* /*killer*/) override
101 {
102 _JustDied();
103 }
104
105 void UpdateAI(uint32 diff) override
106 {
107 if (!UpdateVictim())
108 return;
109
110 events.Update(diff);
111
113 return;
114
115 while (uint32 eventId = events.ExecuteEvent())
116 {
117 switch (eventId)
118 {
122 break;
126 break;
130 break;
134 break;
138 break;
141
142 float x, y, z;
143
144 me->GetClosePoint(x, y, z, me->GetCombatReach() / 3, 10.0f);
147 break;
148 default:
149 break;
150 }
151
153 return;
154 }
155 }
156
157private:
159};
160
162{
164 {
165 Initialize();
167 }
168
170 {
171 GutRipTimer = urand(10000, 15000);
172 }
173
175
177
178 void Reset() override
179 {
180 Initialize();
181 }
182
183 void UpdateAI(uint32 diff) override
184 {
185 if (!UpdateVictim())
186 return;
187
188 if (GutRipTimer <= diff)
189 {
191 GutRipTimer = urand(10000, 15000);
192 }
193 else
194 GutRipTimer -= diff;
195 }
196
197 void JustDied(Unit* /*killer*/) override
198 {
200 Dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
201 }
202};
203
205{
207 {
208 Initialize();
210 }
211
213 {
214 uiRendTimer = urand(10000, 15000);
215 }
216
218
220
221 void Reset() override
222 {
223 Initialize();
224 }
225
226 void UpdateAI(uint32 diff) override
227 {
228 if (!UpdateVictim())
229 return;
230
231 if (uiRendTimer <= diff)
232 {
233 DoCastVictim(SPELL_REND, false);
234 uiRendTimer = urand(10000, 15000);
235 }
236 else
237 uiRendTimer -= diff;
238 }
239
240 void JustDied(Unit* /*killer*/) override
241 {
243 Dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
244 }
245};
246
248{
249 public:
251 {
252 }
253
254 bool OnCheck(Player* /*player*/, Unit* target) override
255 {
256 if (!target)
257 return false;
258
259 if (Creature* Dred = target->ToCreature())
260 if (Dred->AI()->GetData(DATA_RAPTORS_KILLED) >= 6)
261 return true;
262
263 return false;
264 }
265};
266
268{
273}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_DEAD_DESPAWN
Definition: ObjectDefines.h:69
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_king_dred()
@ ACTION_RAPTOR_KILLED
@ DATA_RAPTORS_KILLED
@ SPELL_BELLOWING_ROAR
@ SPELL_MANGLING_SLASH
@ SPELL_GRIEVOUS_BITE
@ SPELL_FEARSOME_ROAR
@ SPELL_PIERCING_SLASH
@ SPELL_REND
@ SPELL_GUT_RIP
@ SPELL_RAPTOR_CALL
@ EVENT_MANGLING_SLASH
@ EVENT_PIERCING_SLASH
@ EVENT_BELLOWING_ROAR
@ EVENT_GRIEVOUS_BITE
@ EVENT_FEARSOME_ROAR
@ EVENT_RAPTOR_CALL
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
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
virtual ObjectGuid GetGuidData(uint32 type) const override
static Creature * ToCreature(Object *o)
Definition: Object.h:219
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
Definition: Unit.h:627
float GetCombatReach() const override
Definition: Unit.h:694
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
Definition: Object.cpp:3403
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:2025
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 DoAction(int32 action) override
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
void Reset() override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
InstanceScript * instance
npc_drakkari_gutripper(Creature *creature)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
npc_drakkari_scytheclaw(Creature *creature)
void UpdateAI(uint32 diff) override
InstanceScript * instance