TrinityCore
hyjal_trash.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 "hyjal.h"
20#include "hyjal_trash.h"
21#include "InstanceScript.h"
22#include "MotionMaster.h"
23#include "ObjectAccessor.h"
24#include "TemporarySummon.h"
25
27{
28 SPELL_METEOR = 33814, //infernal visual
31 MODEL_INVIS = 11686, //invisible model
34 SPELL_FRENZY = 31540,
42 SPELL_WEB = 28991,
47};
48
50{
53};
54
55float HordeWPs[8][3]=//basic waypoints from spawn to leader
56{
57 {5492.91f, -2404.61f, 1462.63f},
58 {5531.76f, -2460.87f, 1469.55f},
59 {5554.58f, -2514.66f, 1476.12f},
60 {5554.16f, -2567.23f, 1479.90f},
61 {5540.67f, -2625.99f, 1480.89f},
62 {5508.16f, -2659.20f, 1480.15f}, //random rush starts from here
63 {5489.62f, -2704.05f, 1482.18f},
64 {5457.04f, -2726.26f, 1485.10f}
65};
66float AllianceWPs[8][3]=//basic waypoints from spawn to leader
67{
68 {4896.08f, -1576.35f, 1333.65f},
69 {4898.68f, -1615.02f, 1329.48f},
70 {4907.12f, -1667.08f, 1321.00f},
71 {4963.18f, -1699.35f, 1340.51f},
72 {4989.16f, -1716.67f, 1335.74f}, //first WP in the base, after the gate
73 {5026.27f, -1736.89f, 1323.02f},
74 {5037.77f, -1770.56f, 1324.36f},
75 {5067.23f, -1789.95f, 1321.17f}
76};
77
78float FrostWyrmWPs[3][3]=//waypoints for the frost wyrms in horde base
79{
80 {5580.82f, -2628.83f, 1528.28f},
81 {5550.90f, -2667.16f, 1505.45f},
82 {5459.64f, -2725.91f, 1484.83f}
83};
84
85float GargoyleWPs[3][3]=//waypoints for the gargoyles in horde base
86{
87 {5533.66f, -2634.32f, 1495.33f},
88 {5517.88f, -2712.05f, 1490.54f},
89 {5459.64f, -2725.91f, 1484.83f}
90};
91
92float FlyPathWPs[3][3]=//waypoints for the gargoyls and frost wyrms in horde base in wave 1/3
93{
94 {5531.96f, -2772.83f, 1516.68f},
95 {5498.32f, -2734.84f, 1497.01f},
96 {5456.67f, -2725.48f, 1493.08f}
97};
98
99float AllianceOverrunWP[55][3]=//waypoints in the alliance base used in the end in the cleaning wave
100{
101 {4976.37f, -1708.02f, 1339.43f}, //0spawn
102 {4994.83f, -1725.52f, 1333.25f}, //1 start
103 {4982.92f, -1753.7f, 1330.69f}, //2 end
104 {4996.75f, -1721.47f, 1332.95f}, //3 start
105 {5015.74f, -1755.05f, 1322.49f}, //4
106 {4998.68f, -1773.44f, 1329.59f}, //5
107 {4994.83f, -1725.52f, 1333.25f}, //6 start
108 {5022.8f, -1735.46f, 1323.53f}, //7
109 {5052.15f, -1729.02f, 1320.88f}, //8
110 {5082.43f, -1726.29f, 1327.87f}, //9
111 {4994.83f, -1725.52f, 1333.25f}, //10 start
112 {5018.92f, -1751.14f, 1322.19f}, //11
113 {5040.09f, -1792.09f, 1322.1f}, //12
114 {4994.83f, -1725.52f, 1333.25f}, //13 start
115 {5023.47f, -1748.1f, 1322.51f}, //14
116 {5013.43f, -1842.39f, 1322.07f}, //15
117 {4994.83f, -1725.52f, 1333.25f}, //16 start
118 {5020.8f, -1756.86f, 1322.2f}, //17
119 {5019.53f, -1824.6f, 1321.96f}, //18
120 {5043.42f, -1853.75f, 1324.52f}, //19
121 {5053.02f, -1864.13f, 1330.36f}, //20
122 {5062.49f, -1852.47f, 1330.49f}, //21
123 {5015.27f, -1738.77f, 1324.83f}, //35//start 22
124 {5027.97f, -1775.25f, 1321.87f}, //34 23
125 {5015.94f, -1821.24f, 1321.86f}, //33 24
126 {4983.25f, -1857.4f, 1320.48f}, //32 25
127 {4981.51f, -1883.7f, 1322.34f}, //31 26
128 {5002.33f, -1893.98f, 1325.88f}, //30 27
129 {5049.32f, -1886.54f, 1331.69f}, //29 28
130 {5089.68f, -1846.88f, 1328.99f}, //28 29
131 {5127.90f, -1825.14f, 1335.58f}, //27 30
132 {5163.27f, -1789.08f, 1337.04f}, //26 31
133 {5138.97f, -1755.88f, 1334.57f}, //25 32
134 {5096.63f, -1742.22f, 1329.61f}, //24 33
135 {5065.81f, -1729.43f, 1325.66f}, //23 34
136 {5049.32f, -1726.31f, 1320.64f}, //22 start
137 {5081.07f, -1902.10f, 1346.36f}, //36 abo start
138 {5107.65f, -1912.03f, 1356.49f}, //37
139 {5132.83f, -1927.07f, 1362.42f}, //38
140 {5147.78f, -1954.41f, 1365.98f}, //39
141 {5164.96f, -1966.48f, 1367.04f}, //40
142 {5189.04f, -1961.06f, 1367.90f}, //41
143 {5212.27f, -1975.30f, 1365.58f}, //42
144 {5221.82f, -1994.18f, 1364.97f}, //43 end1
145 {5202.23f, -1994.94f, 1367.59f}, //44 end2
146 {5279.94f, -2049.68f, 1311.38f}, //45 garg1
147 {5289.15f, -2219.06f, 1291.12f}, //46 garg2
148 {5202.07f, -2136.10f, 1305.07f}, //47 garg3
149 {5071.52f, -2425.63f, 1454.48f}, //48 garg4
150 {5120.65f, -2467.92f, 1463.93f}, //49 garg5
151 {5283.04f, -2043.26f, 1300.11f}, //50 garg target1
152 {5313.22f, -2207.60f, 1290.06f}, //51 garg target2
153 {5180.41f, -2121.87f, 1292.62f}, //52 garg target3
154 {5088.68f, -2432.04f, 1441.73f}, //53 garg target4
155 {5111.26f, -2454.73f, 1449.63f}//54 garg target5
156
157};
158
159float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the cleaning wave
160{
161 {5490.72f, -2702.94f, 1482.14f}, //0 start
162 {5469.77f, -2741.34f, 1486.95f},
163 {5439.47f, -2771.02f, 1494.59f},
164 {5408.85f, -2811.92f, 1505.68f},
165 {5423.87f, -2857.80f, 1515.55f},
166 {5428.19f, -2898.15f, 1524.61f},
167 {5394.59f, -2930.05f, 1528.23f},
168 {5351.11f, -2935.80f, 1532.24f},
169 {5312.37f, -2959.06f, 1536.21f},
170 {5264.93f, -2989.80f, 1545.70f},
171 {5256.63f, -3056.16f, 1559.24f},
172 {5267.32f, -3119.55f, 1575.36f},
173 {5305.61f, -3139.88f, 1586.38f},
174 {5330.56f, -3135.37f, 1588.58f},
175 {5365.87f, -3139.78f, 1583.96f},
176 {5389.39f, -3163.57f, 1582.57f}, //15 end
177 {5500.86f, -2669.89f, 1481.04f}, //16 start
178 {5472.08f, -2715.14f, 1483.55f},
179 {5450.11f, -2721.47f, 1485.61f},
180 {5433.25f, -2712.93f, 1493.02f}, //19 end 1
181 {5429.91f, -2718.44f, 1493.42f}//20 end 2
182};
183
185{
186 instance = creature->GetInstanceScript();
187 IsEvent = false;
188 Delay = 0;
189 LastOverronPos = 0;
190 IsOverrun = false;
191 OverrunType = 0;
192 SetupOverrun = false;
193 faction = 0;
194 useFlyPath = false;
195 damageTaken = 0;
196 memset(DummyTarget, 0, sizeof(DummyTarget));
197}
198
199void hyjal_trashAI::DamageTaken(Unit* done_by, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/)
200{
201 if (!done_by || done_by->GetTypeId() == TYPEID_PLAYER || done_by->IsPet())
202 {
203 damageTaken += damage;
204 instance->SetData(DATA_RAIDDAMAGE, damage);//store raid's damage
205 }
206}
207
209{
210 if (IsOverrun && !SetupOverrun)
211 {
212 SetupOverrun = true;
213 if (faction == 0)
214 {
215 if (me->GetEntry() == GARGOYLE)
216 {
217 DummyTarget[0] = AllianceOverrunWP[50+OverrunType][0]; //+OverrunType 0 - 4
220 }
221 if (me->GetEntry() == ABOMINATION)
222 {
223 for (uint8 i = 0; i < 4; ++i)
224 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2]);
225 switch (OverrunType)
226 {
227 case 0:
228 AddWaypoint(4, AllianceOverrunWP[22][0]+irand(-3, 3), AllianceOverrunWP[22][1]+irand(-3, 3), AllianceOverrunWP[22][2], true);
229 AddWaypoint(5, AllianceOverrunWP[23][0]+irand(-3, 3), AllianceOverrunWP[23][1]+irand(-3, 3), AllianceOverrunWP[23][2], true);
230 AddWaypoint(6, AllianceOverrunWP[24][0]+irand(-3, 3), AllianceOverrunWP[24][1]+irand(-3, 3), AllianceOverrunWP[24][2], true);
231 AddWaypoint(7, AllianceOverrunWP[25][0]+irand(-3, 3), AllianceOverrunWP[25][1]+irand(-3, 3), AllianceOverrunWP[25][2], true);
232 AddWaypoint(8, AllianceOverrunWP[26][0]+irand(-3, 3), AllianceOverrunWP[26][1]+irand(-3, 3), AllianceOverrunWP[26][2], true);
233 AddWaypoint(9, AllianceOverrunWP[27][0]+irand(-3, 3), AllianceOverrunWP[27][1]+irand(-3, 3), AllianceOverrunWP[27][2], true);
234 AddWaypoint(10, AllianceOverrunWP[28][0]+irand(-3, 3), AllianceOverrunWP[28][1]+irand(-3, 3), AllianceOverrunWP[28][2], true);
235
236 AddWaypoint(11, AllianceOverrunWP[36][0]+irand(-3, 3), AllianceOverrunWP[36][1]+irand(-3, 3), AllianceOverrunWP[36][2], true);
237 AddWaypoint(12, AllianceOverrunWP[37][0]+irand(-3, 3), AllianceOverrunWP[37][1]+irand(-3, 3), AllianceOverrunWP[37][2], true);
238 AddWaypoint(13, AllianceOverrunWP[38][0]+irand(-3, 3), AllianceOverrunWP[38][1]+irand(-3, 3), AllianceOverrunWP[38][2], true);
239 AddWaypoint(14, AllianceOverrunWP[39][0]+irand(-3, 3), AllianceOverrunWP[39][1]+irand(-3, 3), AllianceOverrunWP[39][2], true);
240 AddWaypoint(15, AllianceOverrunWP[40][0]+irand(-3, 3), AllianceOverrunWP[40][1]+irand(-3, 3), AllianceOverrunWP[40][2], true);
241 AddWaypoint(16, AllianceOverrunWP[41][0]+irand(-3, 3), AllianceOverrunWP[41][1]+irand(-3, 3), AllianceOverrunWP[41][2], true);
242 AddWaypoint(17, AllianceOverrunWP[42][0]+irand(-3, 3), AllianceOverrunWP[42][1]+irand(-3, 3), AllianceOverrunWP[42][2], true);
243 AddWaypoint(18, AllianceOverrunWP[43][0]+irand(-3, 3), AllianceOverrunWP[43][1]+irand(-3, 3), AllianceOverrunWP[43][2], true);
244 me->SetHomePosition(AllianceOverrunWP[43][0]+irand(-3, 3), AllianceOverrunWP[43][1]+irand(-3, 3), AllianceOverrunWP[43][2], 0);
245 SetDespawnAtEnd(false);
246 LastOverronPos = 18;
247 Start(true);
248 break;
249 case 1:
250 AddWaypoint(4, AllianceOverrunWP[22][0]+irand(-3, 3), AllianceOverrunWP[22][1]+irand(-3, 3), AllianceOverrunWP[22][2], true);
251 AddWaypoint(5, AllianceOverrunWP[23][0]+irand(-3, 3), AllianceOverrunWP[23][1]+irand(-3, 3), AllianceOverrunWP[23][2], true);
252 AddWaypoint(6, AllianceOverrunWP[24][0]+irand(-3, 3), AllianceOverrunWP[24][1]+irand(-3, 3), AllianceOverrunWP[24][2], true);
253 AddWaypoint(7, AllianceOverrunWP[25][0]+irand(-3, 3), AllianceOverrunWP[25][1]+irand(-3, 3), AllianceOverrunWP[25][2], true);
254 AddWaypoint(8, AllianceOverrunWP[26][0]+irand(-3, 3), AllianceOverrunWP[26][1]+irand(-3, 3), AllianceOverrunWP[26][2], true);
255 AddWaypoint(9, AllianceOverrunWP[27][0]+irand(-3, 3), AllianceOverrunWP[27][1]+irand(-3, 3), AllianceOverrunWP[27][2], true);
256 AddWaypoint(10, AllianceOverrunWP[28][0]+irand(-3, 3), AllianceOverrunWP[28][1]+irand(-3, 3), AllianceOverrunWP[28][2], true);
257
258 AddWaypoint(11, AllianceOverrunWP[36][0]+irand(-3, 3), AllianceOverrunWP[36][1]+irand(-3, 3), AllianceOverrunWP[36][2], true);
259 AddWaypoint(12, AllianceOverrunWP[37][0]+irand(-3, 3), AllianceOverrunWP[37][1]+irand(-3, 3), AllianceOverrunWP[37][2], true);
260 AddWaypoint(13, AllianceOverrunWP[38][0]+irand(-3, 3), AllianceOverrunWP[38][1]+irand(-3, 3), AllianceOverrunWP[38][2], true);
261 AddWaypoint(14, AllianceOverrunWP[39][0]+irand(-3, 3), AllianceOverrunWP[39][1]+irand(-3, 3), AllianceOverrunWP[39][2], true);
262 AddWaypoint(15, AllianceOverrunWP[40][0]+irand(-3, 3), AllianceOverrunWP[40][1]+irand(-3, 3), AllianceOverrunWP[40][2], true);
263 AddWaypoint(16, AllianceOverrunWP[41][0]+irand(-3, 3), AllianceOverrunWP[41][1]+irand(-3, 3), AllianceOverrunWP[41][2], true);
264 AddWaypoint(17, AllianceOverrunWP[42][0]+irand(-3, 3), AllianceOverrunWP[42][1]+irand(-3, 3), AllianceOverrunWP[42][2], true);
265 AddWaypoint(18, AllianceOverrunWP[44][0]+irand(-3, 3), AllianceOverrunWP[44][1]+irand(-3, 3), AllianceOverrunWP[44][2], true);
266 me->SetHomePosition(AllianceOverrunWP[44][0]+irand(-3, 3), AllianceOverrunWP[44][1]+irand(-3, 3), AllianceOverrunWP[44][2], 0);
267 SetDespawnAtEnd(false);
268 LastOverronPos = 18;
269 Start(true);
270 break;
271 default:
272 for (uint8 i = 22; i < 36; ++i)
273 AddWaypoint(i-18, AllianceOverrunWP[i][0]+irand(-3, 3), AllianceOverrunWP[i][1]+irand(-3, 3), AllianceOverrunWP[i][2], true);
274
275 SetDespawnAtEnd(true);
276 LastOverronPos = 17;
277 Start(true);
278 break;
279 }
280 }
281 if (me->GetEntry() == GHOUL)
282 {
283 for (uint8 i = 0; i < 4; ++i)
284 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2]);
285 switch (OverrunType)
286 {
287 case 0:
288 AddWaypoint(4, AllianceOverrunWP[1][0]+irand(-3, 3), AllianceOverrunWP[1][1]+irand(-3, 3), AllianceOverrunWP[1][2], true);
289 AddWaypoint(5, AllianceOverrunWP[2][0]+irand(-3, 3), AllianceOverrunWP[2][1]+irand(-3, 3), AllianceOverrunWP[2][2], true);
291 SetDespawnAtEnd(false);
292 LastOverronPos = 5;
293 Start(true);
294 break;
295 case 1:
296 AddWaypoint(4, AllianceOverrunWP[3][0]+irand(-3, 3), AllianceOverrunWP[3][1]+irand(-3, 3), AllianceOverrunWP[3][2], true);
297 AddWaypoint(5, AllianceOverrunWP[4][0]+irand(-3, 3), AllianceOverrunWP[4][1]+irand(-3, 3), AllianceOverrunWP[4][2], true);
298 AddWaypoint(6, AllianceOverrunWP[5][0]+irand(-3, 3), AllianceOverrunWP[5][1]+irand(-3, 3), AllianceOverrunWP[5][2], true);
300 SetDespawnAtEnd(false);
301 LastOverronPos = 6;
302 Start(true);
303 break;
304 case 2:
305 AddWaypoint(4, AllianceOverrunWP[6][0]+irand(-3, 3), AllianceOverrunWP[6][1]+irand(-3, 3), AllianceOverrunWP[6][2], true);
306 AddWaypoint(5, AllianceOverrunWP[7][0]+irand(-3, 3), AllianceOverrunWP[7][1]+irand(-3, 3), AllianceOverrunWP[7][2], true);
307 AddWaypoint(6, AllianceOverrunWP[8][0]+irand(-3, 3), AllianceOverrunWP[8][1]+irand(-3, 3), AllianceOverrunWP[8][2], true);
308 AddWaypoint(7, AllianceOverrunWP[9][0]+irand(-3, 3), AllianceOverrunWP[9][1]+irand(-3, 3), AllianceOverrunWP[9][2], true);
310 SetDespawnAtEnd(false);
311 LastOverronPos = 7;
312 Start(true);
313 break;
314 case 3:
315 AddWaypoint(4, AllianceOverrunWP[10][0]+irand(-3, 3), AllianceOverrunWP[10][1]+irand(-3, 3), AllianceOverrunWP[10][2], true);
316 AddWaypoint(5, AllianceOverrunWP[11][0]+irand(-3, 3), AllianceOverrunWP[11][1]+irand(-3, 3), AllianceOverrunWP[11][2], true);
317 AddWaypoint(6, AllianceOverrunWP[12][0]+irand(-3, 3), AllianceOverrunWP[12][1]+irand(-3, 3), AllianceOverrunWP[12][2], true);
318 me->SetHomePosition(AllianceOverrunWP[12][0]+irand(-3, 3), AllianceOverrunWP[12][1]+irand(-3, 3), AllianceOverrunWP[12][2], 0);
319 SetDespawnAtEnd(false);
320 LastOverronPos = 6;
321 Start(true);
322 break;
323 case 4:
324 AddWaypoint(4, AllianceOverrunWP[13][0]+irand(-3, 3), AllianceOverrunWP[13][1]+irand(-3, 3), AllianceOverrunWP[13][2], true);
325 AddWaypoint(5, AllianceOverrunWP[14][0]+irand(-3, 3), AllianceOverrunWP[14][1]+irand(-3, 3), AllianceOverrunWP[14][2], true);
326 AddWaypoint(6, AllianceOverrunWP[15][0]+irand(-3, 3), AllianceOverrunWP[15][1]+irand(-3, 3), AllianceOverrunWP[15][2], true);
327 me->SetHomePosition(AllianceOverrunWP[15][0]+irand(-3, 3), AllianceOverrunWP[15][1]+irand(-3, 3), AllianceOverrunWP[15][2], 0);
328 SetDespawnAtEnd(false);
329 LastOverronPos = 6;
330 Start(true);
331 break;
332 case 5:
333 AddWaypoint(4, AllianceOverrunWP[16][0]+irand(-3, 3), AllianceOverrunWP[16][1]+irand(-3, 3), AllianceOverrunWP[16][2], true);
334 AddWaypoint(5, AllianceOverrunWP[17][0]+irand(-3, 3), AllianceOverrunWP[17][1]+irand(-3, 3), AllianceOverrunWP[17][2], true);
335 AddWaypoint(6, AllianceOverrunWP[18][0]+irand(-3, 3), AllianceOverrunWP[18][1]+irand(-3, 3), AllianceOverrunWP[18][2], true);
336 AddWaypoint(7, AllianceOverrunWP[19][0]+irand(-3, 3), AllianceOverrunWP[19][1]+irand(-3, 3), AllianceOverrunWP[19][2], true);
337 AddWaypoint(8, AllianceOverrunWP[20][0]+irand(-3, 3), AllianceOverrunWP[20][1]+irand(-3, 3), AllianceOverrunWP[20][2], true);
338 AddWaypoint(9, AllianceOverrunWP[21][0]+irand(-3, 3), AllianceOverrunWP[21][1]+irand(-3, 3), AllianceOverrunWP[21][2], true);
339 me->SetHomePosition(AllianceOverrunWP[21][0]+irand(-3, 3), AllianceOverrunWP[21][1]+irand(-3, 3), AllianceOverrunWP[21][2], 0);
340 SetDespawnAtEnd(false);
341 LastOverronPos = 9;
342 Start(true);
343 break;
344 default:
345 for (uint8 i = 22; i < 36; ++i)
346 AddWaypoint(i-18, AllianceOverrunWP[i][0]+irand(-3, 3), AllianceOverrunWP[i][1]+irand(-3, 3), AllianceOverrunWP[i][2], true);
347 SetDespawnAtEnd(true);
348 LastOverronPos = 17;
349 Start(true);
350 break;
351 }
352 }
353 }
354 if (faction == 1)
355 {
356 if (me->GetEntry() == GHOUL)
357 {
358 for (uint8 i = 0; i < 6; ++i)
359 AddWaypoint(i, HordeWPs[i][0]+irand(-3, 3), HordeWPs[i][1]+irand(-3, 3), HordeWPs[i][2]);
360 switch (OverrunType)
361 {
362 case 0:
363 AddWaypoint(5, HordeOverrunWP[16][0]+irand(-10, 10), HordeOverrunWP[16][1]+irand(-10, 10), HordeOverrunWP[16][2], true);
364 AddWaypoint(6, HordeOverrunWP[17][0]+irand(-10, 10), HordeOverrunWP[17][1]+irand(-10, 10), HordeOverrunWP[17][2], true);
365 AddWaypoint(7, HordeOverrunWP[18][0], HordeOverrunWP[18][1], HordeOverrunWP[18][2], true);
366 AddWaypoint(8, HordeOverrunWP[19][0], HordeOverrunWP[19][1], HordeOverrunWP[19][2], true);
368 SetDespawnAtEnd(false);
369 LastOverronPos = 8;
370 Start(true);
371 break;
372 case 1:
373 AddWaypoint(5, HordeOverrunWP[16][0]+irand(-10, 10), HordeOverrunWP[16][1]+irand(-10, 10), HordeOverrunWP[16][2], true);
374 AddWaypoint(6, HordeOverrunWP[17][0]+irand(-10, 10), HordeOverrunWP[17][1]+irand(-10, 10), HordeOverrunWP[17][2], true);
375 AddWaypoint(7, HordeOverrunWP[18][0], HordeOverrunWP[18][1], HordeOverrunWP[18][2], true);
376 AddWaypoint(8, HordeOverrunWP[20][0], HordeOverrunWP[20][1], HordeOverrunWP[20][2], true);
378 SetDespawnAtEnd(false);
379 LastOverronPos = 8;
380 Start(true);
381 break;
382 default:
383 for (uint8 i = 0; i < 16; ++i)
384 AddWaypoint(i+6, HordeOverrunWP[i][0]+irand(-10, 10), HordeOverrunWP[i][1]+irand(-10, 10), HordeOverrunWP[i][2], true);
385 SetDespawnAtEnd(true);
386 LastOverronPos = 21;
387 Start(true);
388 break;
389 }
390 }
391 if (me->GetEntry() == ABOMINATION)
392 {
393 for (uint8 i = 0; i < 6; ++i)
394 AddWaypoint(i, HordeWPs[i][0]+irand(-10, 10), HordeWPs[i][1]+irand(-10, 10), HordeWPs[i][2], true);
395 for (uint8 i = 0; i < 16; ++i)
396 AddWaypoint(i+6, HordeOverrunWP[i][0]+irand(-10, 10), HordeOverrunWP[i][1]+irand(-10, 10), HordeOverrunWP[i][2], true);
397 SetDespawnAtEnd(true);
398 LastOverronPos = 21;
399 Start(true);
400 }
401 }
402 }
403}
404
406{
407 if (IsEvent && !me->isWorldBoss())
408 instance->SetData(DATA_TRASH, 0);//signal trash is dead
409
410 if ((instance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE && !me->isWorldBoss()) || (damageTaken < me->GetMaxHealth()/4 && me->isWorldBoss()))
412}
413
415{
416public:
417 npc_giant_infernal() : CreatureScript("npc_giant_infernal") { }
418
420 {
422 {
423 instance = creature->GetInstanceScript();
424 meteor = false;//call once!
425 CanMove = false;
426 Delay = rand32() % 30000;
428 me->SetUninteractible(true);
430 go = false;
431 Initialize();
432 }
433
435 {
436 spawnTimer = 2000;
437 FlameBuffetTimer = 2000;
438 imol = false;
439 }
440
441 bool meteor;
443 bool go;
446 bool imol;
447
448 void Reset() override
449 {
450 Initialize();
451 }
452
453 void JustEngagedWith(Unit* /*who*/) override { }
454
455 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
456 {
457 if (waypointId == 0 && !IsOverrun)
458 {
459 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
460 {
462 if (target && target->IsAlive())
463 AddThreat(target, 0.0f);
464 }
465 }
466 }
467
468 void UpdateAI(uint32 diff) override
469 {
470 if (Delay <= diff)
471 {
472 Delay=0;
473 }
474 else
475 {
476 Delay -= diff;
477 return;
478 }
479 if (!meteor)
480 {
481 if (Creature* trigger = me->SummonCreature(NPC_WORLD_TRIGGER_TINY, me->GetPositionWithOffset({ 8.0f, 8.0f, frand(25.0f, 35.0f), 0.0f }), TEMPSUMMON_TIMED_DESPAWN, 1s))
482 {
483 trigger->SetDisableGravity(true);
484 trigger->CastSpell(me, SPELL_METEOR, true);
485 }
487 meteor = true;
488 } else if (!CanMove){
489 if (spawnTimer <= diff)
490 {
492 me->SetUninteractible(false);
494 CanMove = true;
496 {
498 if (target && target->IsAlive())
499 AddThreat(target, 0.0f);
501 //do overrun
502 }
503 } else spawnTimer -= diff;
504 }
505 if (!CanMove)return;
507 if (IsEvent || IsOverrun)
508 EscortAI::UpdateAI(diff);
509 if (IsEvent)
510 {
511 if (!go)
512 {
513 go = true;
514 AddWaypoint(0, HordeWPs[7][0]+irand(-3, 3), HordeWPs[7][1]+irand(-3, 3), HordeWPs[7][2], true);//HordeWPs[7] infront of thrall
515 Start(true);
516 SetDespawnAtEnd(false);
517 }
518 }
519
520 if (!UpdateVictim())
521 return;
522 if (!imol)
523 {
525 imol = true;
526 }
527 if (FlameBuffetTimer <= diff)
528 {
530 FlameBuffetTimer = 7000;
531 } else FlameBuffetTimer -= diff;
532 }
533 };
534
535 CreatureAI* GetAI(Creature* creature) const override
536 {
537 return GetHyjalAI<npc_giant_infernalAI>(creature);
538 }
539};
540
542{
543public:
544 npc_abomination() : CreatureScript("npc_abomination") { }
545
546 CreatureAI* GetAI(Creature* creature) const override
547 {
548 return GetHyjalAI<npc_abominationAI>(creature);
549 }
550
552 {
554 {
555 instance = creature->GetInstanceScript();
556 go = false;
557 Initialize();
558 }
559
561 {
562 KnockDownTimer = 10000;
563 }
564
565 bool go;
567 void Reset() override
568 {
569 Initialize();
570 }
571
572 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
573 {
574 if (waypointId == 7 && !IsOverrun)
575 {
576 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
577 {
579 if (target && target->IsAlive())
580 AddThreat(target, 0.0f);
581 }
582 else
583 {
585 if (target && target->IsAlive())
586 AddThreat(target, 0.0f);
587 }
588 }
589 if (waypointId == LastOverronPos && IsOverrun)
590 {
591 if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
592 {
594 }
595 }
596 }
597
598 void JustEngagedWith(Unit* /*who*/) override { }
599
600 void UpdateAI(uint32 diff) override
601 {
603 if (IsEvent || IsOverrun)
604 EscortAI::UpdateAI(diff);
605 if (IsEvent)
606 {
607 if (!go)
608 {
609 go = true;
610 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
611 {
612 for (uint8 i = 0; i < 8; ++i)
613 AddWaypoint(i, HordeWPs[i][0]+irand(-3, 3), HordeWPs[i][1]+irand(-3, 3), HordeWPs[i][2], true);
614 Start(false);
615 SetDespawnAtEnd(false);
616 }else//use alliance WPs
617 {
618 for (uint8 i = 0; i < 8; ++i)
619 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2], true);
620 Start(false);
621 SetDespawnAtEnd(false);
622 }
623 }
624 }
627 if (!UpdateVictim())
628 return;
629 if (KnockDownTimer <= diff)
630 {
632 KnockDownTimer = 15000 + rand32() % 10000;
633 } else KnockDownTimer -= diff;
634 }
635 };
636
637};
638
640{
641public:
642 npc_ghoul() : CreatureScript("npc_ghoul") { }
643
644 CreatureAI* GetAI(Creature* creature) const override
645 {
646 return GetHyjalAI<npc_ghoulAI>(creature);
647 }
648
650 {
651 npc_ghoulAI(Creature* creature) : hyjal_trashAI(creature)
652 {
653 instance = creature->GetInstanceScript();
654 go = false;
655 Initialize();
656 }
657
659 {
660 FrenzyTimer = 5000 + rand32() % 5000;
661 MoveTimer = 2000;
662 RandomMove = false;
663 }
664
665 bool go;
669 void Reset() override
670 {
671 Initialize();
672 }
673
674 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
675 {
676 if (waypointId == 7 && !IsOverrun)
677 {
678 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
679 {
681 if (target && target->IsAlive())
682 AddThreat(target, 0.0f);
683 }
684 else
685 {
687 if (target && target->IsAlive())
688 AddThreat(target, 0.0f);
689 }
690 }
691 if (waypointId == LastOverronPos && IsOverrun)
692 {
694 if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
695 {
697 }
698 }
699 }
700
701 void JustEngagedWith(Unit* /*who*/) override { }
702
703 void UpdateAI(uint32 diff) override
704 {
706 if (IsEvent || IsOverrun)
707 EscortAI::UpdateAI(diff);
708 if (IsEvent)
709 {
710 if (!go)
711 {
712 go = true;
713 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
714 {
715 for (uint8 i = 0; i < 8; ++i)
716 AddWaypoint(i, HordeWPs[i][0]+irand(-3, 3), HordeWPs[i][1]+irand(-3, 3), HordeWPs[i][2], true);
717 Start(false);
718 SetDespawnAtEnd(false);
719 }else//use alliance WPs
720 {
721 for (uint8 i = 0; i < 8; ++i)
722 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2], true);
723 Start(false);
724 SetDespawnAtEnd(false);
725 }
726 }
727 }
728 if (FrenzyTimer <= diff)
729 {
731 FrenzyTimer = 15000 + rand32() % 15000;
732 } else FrenzyTimer -= diff;
733 if (!UpdateVictim())
734 return;
735 }
736 };
737
738};
739
741{
742public:
743 npc_necromancer() : CreatureScript("npc_necromancer") { }
744
745 CreatureAI* GetAI(Creature* creature) const override
746 {
747 return GetHyjalAI<npc_necromancerAI>(creature);
748 }
749
751 {
753 {
754 instance = creature->GetInstanceScript();
755 go = false;
756 Initialize();
757 }
758
760 {
761 ShadowBoltTimer = 1000 + rand32() % 5000;
762 }
763
765 bool go;
767
768 void Reset() override
769 {
770 Initialize();
772 }
773
774 void JustSummoned(Creature* summon) override
775 {
776 Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30, true);
777 if (target)
778 summon->Attack(target, false);
779 summons.Summon(summon);
780 }
781
782 void SummonedCreatureDespawn(Creature* summon) override
783 {
784 summons.Despawn(summon);
785 }
786
787 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
788 {
789 if (waypointId == 7 && !IsOverrun)
790 {
791 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
792 {
794 if (target && target->IsAlive())
795 AddThreat(target, 0.0f);
796 }
797 else
798 {
800 if (target && target->IsAlive())
801 AddThreat(target, 0.0f);
802 }
803 }
804 }
805
806 void KilledUnit(Unit* /*victim*/) override
807 {
809 switch (urand(0, 2))
810 {
811 case 0:
812 DoSpawnCreature(17902, 3, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60s);
813 DoSpawnCreature(17902, -3, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60s);
814 break;
815 case 1:
816 DoSpawnCreature(17903, 3, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60s);
817 DoSpawnCreature(17903, -3, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60s);
818 break;
819 case 2:
820 DoSpawnCreature(RAND(17902, 17903), 3, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60s);
821 break;
822 }
823 }
824
825 void JustEngagedWith(Unit* /*who*/) override { }
826
827 void JustDied(Unit* killer) override
828 {
831 }
832
833 void UpdateAI(uint32 diff) override
834 {
836
837 if (IsEvent || IsOverrun)
838 EscortAI::UpdateAI(diff);
839
840 if (IsEvent)
841 {
842 if (!go)
843 {
844 go = true;
845 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
846 {
847 for (uint8 i = 0; i < 8; ++i)
848 AddWaypoint(i, HordeWPs[i][0]+irand(-3, 3), HordeWPs[i][1]+irand(-3, 3), HordeWPs[i][2], true);
849 Start(true);
850 SetDespawnAtEnd(false);
851 }else//use alliance WPs
852 {
853 for (uint8 i = 0; i < 8; ++i)
854 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2], true);
855 Start(true);
856 SetDespawnAtEnd(false);
857 }
858 }
859 }
860
861 if (!UpdateVictim())
862 return;
863
864 if (ShadowBoltTimer <= diff)
865 {
867 ShadowBoltTimer = 20000 + rand32() % 10000;
868 } else ShadowBoltTimer -= diff;
869 }
870 };
871
872};
873
875{
876public:
877 npc_banshee() : CreatureScript("npc_banshee") { }
878
879 CreatureAI* GetAI(Creature* creature) const override
880 {
881 return GetHyjalAI<npc_bansheeAI>(creature);
882 }
883
885 {
886 npc_bansheeAI(Creature* creature) : hyjal_trashAI(creature)
887 {
888 instance = creature->GetInstanceScript();
889 go = false;
890 Initialize();
891 }
892
894 {
895 CourseTimer = 20000 + rand32() % 5000;
896 WailTimer = 15000 + rand32() % 5000;
897 ShellTimer = 50000 + rand32() % 10000;
898 }
899
900 bool go;
904
905 void Reset() override
906 {
907 Initialize();
908 }
909
910 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
911 {
912 if (waypointId == 7 && !IsOverrun)
913 {
914 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
915 {
917 if (target && target->IsAlive())
918 AddThreat(target, 0.0f);
919 }
920 else
921 {
923 if (target && target->IsAlive())
924 AddThreat(target, 0.0f);
925 }
926 }
927 }
928
929 void KilledUnit(Unit* /*victim*/) override
930 {
932 }
933
934 void JustDied(Unit* killer) override
935 {
938 }
939
940 void JustEngagedWith(Unit* /*who*/) override { }
941
942 void UpdateAI(uint32 diff) override
943 {
945 if (IsEvent || IsOverrun)
946 EscortAI::UpdateAI(diff);
947 if (IsEvent)
948 {
949 if (!go)
950 {
951 go = true;
952 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
953 {
954 for (uint8 i = 0; i < 8; ++i)
955 AddWaypoint(i, HordeWPs[i][0]+irand(-3, 3), HordeWPs[i][1]+irand(-3, 3), HordeWPs[i][2], true);
956 Start(false);
957 SetDespawnAtEnd(false);
958 }else//use alliance WPs
959 {
960 for (uint8 i = 0; i < 8; ++i)
961 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2], true);
962 Start(false);
963 SetDespawnAtEnd(false);
964 }
965 }
966 }
967 if (!UpdateVictim())
968 return;
969 if (CourseTimer <= diff)
970 {
972 CourseTimer = 20000 + rand32() % 5000;
973 } else CourseTimer -= diff;
974 if (WailTimer <= diff)
975 {
977 WailTimer = 15000 + rand32() % 5000;
978 } else WailTimer -= diff;
979 if (ShellTimer <= diff)
980 {
982 ShellTimer = 50000 + rand32() % 10000;
983 } else ShellTimer -= diff;
984 }
985 };
986
987};
988
990{
991public:
992 npc_crypt_fiend() : CreatureScript("npc_crypt_fiend") { }
993
994 CreatureAI* GetAI(Creature* creature) const override
995 {
996 return GetHyjalAI<npc_crypt_fiendAI>(creature);
997 }
998
1000 {
1002 {
1003 instance = creature->GetInstanceScript();
1004 go = false;
1005 Initialize();
1006 }
1007
1009 {
1010 WebTimer = 20000 + rand32() % 5000;
1011 }
1012
1013 bool go;
1015
1016 void Reset() override
1017 {
1018 Initialize();
1019 }
1020
1021 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
1022 {
1023 if (waypointId == 7 && !IsOverrun)
1024 {
1025 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
1026 {
1028 if (target && target->IsAlive())
1029 AddThreat(target, 0.0f);
1030 }
1031 else
1032 {
1034 if (target && target->IsAlive())
1035 AddThreat(target, 0.0f);
1036 }
1037 }
1038 }
1039
1040 void JustEngagedWith(Unit* /*who*/) override { }
1041
1042 void UpdateAI(uint32 diff) override
1043 {
1045 if (IsEvent || IsOverrun)
1046 EscortAI::UpdateAI(diff);
1047 if (IsEvent)
1048 {
1049 if (!go)
1050 {
1051 go = true;
1052 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
1053 {
1054 for (uint8 i = 0; i < 8; ++i)
1055 AddWaypoint(i, HordeWPs[i][0]+irand(-3, 3), HordeWPs[i][1]+irand(-3, 3), HordeWPs[i][2], true);
1056 Start(false);
1057 SetDespawnAtEnd(false);
1058 }else//use alliance WPs
1059 {
1060 for (uint8 i = 0; i < 8; ++i)
1061 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2], true);
1062 Start(false);
1063 SetDespawnAtEnd(false);
1064 }
1065 }
1066 }
1067 if (!UpdateVictim())
1068 return;
1069 if (WebTimer <= diff)
1070 {
1072 WebTimer = 20000 + rand32() % 5000;
1073 } else WebTimer -= diff;
1074 }
1075 };
1076
1077};
1078
1080{
1081public:
1082 npc_fel_stalker() : CreatureScript("npc_fel_stalker") { }
1083
1084 CreatureAI* GetAI(Creature* creature) const override
1085 {
1086 return GetHyjalAI<npc_fel_stalkerAI>(creature);
1087 }
1088
1090 {
1092 {
1093 instance = creature->GetInstanceScript();
1094 go = false;
1095 Initialize();
1096 }
1097
1099 {
1100 ManaBurnTimer = 9000 + rand32() % 5000;
1101 }
1102
1103 bool go;
1105
1106 void Reset() override
1107 {
1108 Initialize();
1109 }
1110
1111 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
1112 {
1113 if (waypointId == 7 && !IsOverrun)
1114 {
1115 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
1116 {
1118 if (target && target->IsAlive())
1119 AddThreat(target, 0.0f);
1120 }
1121 else
1122 {
1124 if (target && target->IsAlive())
1125 AddThreat(target, 0.0f);
1126 }
1127 }
1128 }
1129
1130 void JustEngagedWith(Unit* /*who*/) override { }
1131
1132 void UpdateAI(uint32 diff) override
1133 {
1135 if (IsEvent || IsOverrun)
1136 EscortAI::UpdateAI(diff);
1137 if (IsEvent)
1138 {
1139 if (!go)
1140 {
1141 go = true;
1142 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
1143 {
1144 for (uint8 i = 0; i < 8; ++i)
1145 AddWaypoint(i, HordeWPs[i][0]+irand(-3, 3), HordeWPs[i][1]+irand(-3, 3), HordeWPs[i][2], true);
1146 Start(false);
1147 SetDespawnAtEnd(false);
1148 }else//use alliance WPs
1149 {
1150 for (uint8 i = 0; i < 8; ++i)
1151 AddWaypoint(i, AllianceWPs[i][0]+irand(-3, 3), AllianceWPs[i][1]+irand(-3, 3), AllianceWPs[i][2], true);
1152 Start(false);
1153 SetDespawnAtEnd(false);
1154 }
1155 }
1156 }
1157 if (!UpdateVictim())
1158 return;
1159 if (ManaBurnTimer <= diff)
1160 {
1162 ManaBurnTimer = 9000 + rand32() % 5000;
1163 } else ManaBurnTimer -= diff;
1164 }
1165 };
1166
1167};
1168
1170{
1171public:
1172 npc_frost_wyrm() : CreatureScript("npc_frost_wyrm") { }
1173
1174 CreatureAI* GetAI(Creature* creature) const override
1175 {
1176 return GetHyjalAI<npc_frost_wyrmAI>(creature);
1177 }
1178
1180 {
1182 {
1183 Initialize();
1184 instance = creature->GetInstanceScript();
1185 go = false;
1186 }
1187
1189 {
1190 FrostBreathTimer = 5000;
1191 MoveTimer = 0;
1192 }
1193
1194 bool go;
1197
1198 void Reset() override
1199 {
1200 Initialize();
1201 }
1202
1203 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
1204 {
1205 if (waypointId == 2 && !IsOverrun)
1206 {
1208 if (target && target->IsAlive())
1209 {
1210 AddThreat(target, 0.0f);
1211 DoCast(target, SPELL_FROST_BREATH, true);
1212 }
1213 }
1214 }
1215
1216 void JustDied(Unit* /*killer*/) override
1217 {
1218 if (IsEvent)
1219 instance->SetData(DATA_TRASH, 0);//signal trash is dead
1220
1221 float x, y, z;
1222 me->GetPosition(x, y, z);
1223 me->UpdateGroundPositionZ(x, y, z);
1224 me->GetMotionMaster()->MovePoint(0, x, y, z);
1225 me->UpdatePosition(x, y, z, 0);
1226 }
1227
1228 void JustEngagedWith(Unit* /*who*/) override { }
1229
1230 void UpdateAI(uint32 diff) override
1231 {
1233
1234 if (IsEvent || IsOverrun)
1235 {
1236 ENSURE_AI(hyjal_trashAI, me->AI())->SetActiveAttacker(false);
1237 EscortAI::UpdateAI(diff);
1238 }
1239
1240 if (IsEvent)
1241 {
1242 if (!go)
1243 {
1244
1245 if (!useFlyPath)
1246 {
1247 for (uint8 i = 0; i < 3; ++i)
1248 AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2], true);
1249 }
1250 else
1251 {//fly path FlyPathWPs
1252 for (uint8 i = 0; i < 3; ++i)
1253 AddWaypoint(i, FlyPathWPs[i][0]+irand(-10, 10), FlyPathWPs[i][1]+irand(-10, 10), FlyPathWPs[i][2], true);
1254 }
1255 go = true;
1256 Start(false);
1257 SetDespawnAtEnd(false);
1258 }
1259 }
1260
1261 if (!UpdateVictim())
1262 return;
1263
1264 if (!me->IsWithinDist(me->GetVictim(), 25))
1265 {
1266 if (MoveTimer <= diff)
1267 {
1269 MoveTimer = 2000;
1270 }
1271 else
1272 MoveTimer -= diff;
1273 }
1274
1275 if (FrostBreathTimer <= diff)
1276 {
1277 if (!me->IsWithinDist(me->GetVictim(), 25))
1278 {
1280 me->StopMoving();
1281 me->GetMotionMaster()->Clear();
1282 FrostBreathTimer = 4000;
1283 }
1284 }
1285 else
1286 FrostBreathTimer -= diff;
1287 }
1288 };
1289};
1290
1292{
1293public:
1294 npc_gargoyle() : CreatureScript("npc_gargoyle") { }
1295
1296 CreatureAI* GetAI(Creature* creature) const override
1297 {
1298 return GetHyjalAI<npc_gargoyleAI>(creature);
1299 }
1300
1302 {
1304 {
1305 instance = creature->GetInstanceScript();
1306 go = false;
1307 for (uint8 i = 0; i < 3; ++i)
1308 DummyTarget[i] = 0;
1309 Initialize();
1310 }
1311
1313 {
1314 forcemove = true;
1315 Zpos = 10.0f;
1316 StrikeTimer = 2000 + rand32() % 5000;
1317 MoveTimer = 0;
1318 }
1319
1320 bool go;
1323 float Zpos;
1325
1326 void Reset() override
1327 {
1328 Initialize();
1329 }
1330
1331 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
1332 {
1333 if (waypointId == 2 && !IsOverrun)
1334 {
1336 if (target && target->IsAlive())
1337 {
1338 AddThreat(target, 0.0f);
1339 DoCast(target, SPELL_GARGOYLE_STRIKE, true);
1340 }
1341 }
1342 }
1343
1344 void JustDied(Unit* killer) override
1345 {
1346 float x, y, z;
1347 me->GetPosition(x, y, z);
1348 me->UpdateGroundPositionZ(x, y, z);
1349 me->GetMotionMaster()->MovePoint(0, x, y, z);
1350 me->UpdatePosition(x, y, z, 0);
1352 }
1353
1354 void UpdateAI(uint32 diff) override
1355 {
1357
1358 if (IsEvent || IsOverrun)
1359 {
1360 ENSURE_AI(hyjal_trashAI, me->AI())->SetActiveAttacker(false);
1361 EscortAI::UpdateAI(diff);
1362 }
1363
1364 if (IsEvent)
1365 {
1366 if (!go)
1367 {
1368 if (!useFlyPath)
1369 {
1370 for (uint8 i = 0; i < 3; ++i)
1371 AddWaypoint(i, GargoyleWPs[i][0]+irand(-10, 10), GargoyleWPs[i][1]+irand(-10, 10), GargoyleWPs[i][2], true);
1372 }else{//fly path FlyPathWPs
1373 for (uint8 i = 0; i < 3; ++i)
1374 AddWaypoint(i, FlyPathWPs[i][0]+irand(-10, 10), FlyPathWPs[i][1]+irand(-10, 10), FlyPathWPs[i][2], true);
1375 }
1376 go = true;
1377 Start(false);
1378 SetDespawnAtEnd(false);
1379 }
1380 }
1381
1382 if (IsOverrun && !UpdateVictim())
1383 {
1384 if (faction == 0)//alliance
1385 {
1386 if (StrikeTimer <= diff)
1387 {
1389 StrikeTimer = 2000 + rand32() % 1000;
1390 } else StrikeTimer -= diff;
1391 }
1392 }
1393
1394 if (!UpdateVictim())
1395 return;
1396
1397 if (!me->IsWithinDist(me->GetVictim(), 20) || forcemove)
1398 {
1399 if (forcemove)
1400 {
1401 forcemove = false;
1403 me->Attack(target, false);
1404 }
1405 if (MoveTimer <= diff)
1406 {
1407 float x, y, z;
1408 me->EnsureVictim()->GetPosition(x, y, z);
1409 me->GetMotionMaster()->MovePoint(0, x, y, z + Zpos);
1410 Zpos -= 1.0f;
1411 if (Zpos <= 0)
1412 Zpos = 0;
1413 MoveTimer = 2000;
1414 }
1415 else
1416 MoveTimer -= diff;
1417 }
1418
1419 if (StrikeTimer <= diff)
1420 {
1421 if (me->IsWithinDist(me->GetVictim(), 20))
1422 {
1424 me->StopMoving();
1425 me->GetMotionMaster()->Clear();
1426 StrikeTimer = 2000 + rand32() % 1000;
1427 }
1428 else
1429 StrikeTimer = 0;
1430 }
1431 else
1432 StrikeTimer -= diff;
1433 }
1434 };
1435};
1436
1438{
1439public:
1440 alliance_rifleman() : CreatureScript("alliance_rifleman") { }
1441
1442 CreatureAI* GetAI(Creature* creature) const override
1443 {
1444 return GetHyjalAI<alliance_riflemanAI>(creature);
1445 }
1446
1448 {
1450 {
1451 Initialize();
1452 SetCombatMovement(false);
1453 }
1454
1456 {
1457 ExplodeTimer = 5000 + rand32() % 5000;
1458 }
1459
1461
1462 void JustDied(Unit* /*killer*/) override
1463 {
1464 }
1465
1466 void Reset() override
1467 {
1468 Initialize();
1469 }
1470
1471 void MoveInLineOfSight(Unit* who) override
1472
1473 {
1474 if (!who || me->GetVictim())
1475 return;
1476
1477 if (me->IsValidAttackTarget(who))
1478 {
1479 //float attackRadius = me->GetAttackDistance(who);
1480 if (me->IsWithinDistInMap(who, 30))
1481 AttackStart(who);
1482 }
1483 }
1484
1485 void JustEngagedWith(Unit* /*who*/) override
1486 {
1487 }
1488
1489 void UpdateAI(uint32 diff) override
1490 {
1491 //Check if we have a target
1492 if (!UpdateVictim())
1493 return;
1494 if (ExplodeTimer <= diff)
1495 {
1496 if (!me->IsWithinDistInMap(me->GetVictim(), 30))
1497 {
1499 return;
1500 }
1501 CastSpellExtraArgs args;
1502 args.AddSpellMod(SPELLVALUE_BASE_POINT0, 500 + rand32() % 700);
1504 ExplodeTimer = 5000 + rand32() % 5000;
1505 } else ExplodeTimer -= diff;
1506 }
1507 };
1508
1509};
1510
1512{
1513 new npc_giant_infernal();
1514 new npc_abomination();
1515 new npc_ghoul();
1516 new npc_necromancer();
1517 new npc_banshee();
1518 new npc_crypt_fiend();
1519 new npc_fel_stalker();
1520 new npc_frost_wyrm();
1521 new npc_gargoyle();
1522 new alliance_rifleman();
1523}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:65
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
int32 irand(int32 min, int32 max)
Definition: Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
uint32 rand32()
Definition: Random.cpp:70
@ EMOTE_ONESHOT_ATTACK_UNARMED
@ UNIT_DYNFLAG_LOOTABLE
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:196
#define ENSURE_AI(a, b)
Definition: UnitAI.h:29
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:145
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
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
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:371
bool isWorldBoss() const
Definition: Creature.cpp:2484
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
void SetDisplayId(uint32 displayId, bool setNative=false) override
Definition: Creature.cpp:3402
CreatureAI * AI() const
Definition: Creature.h:214
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:170
void Despawn(Creature const *summon)
void Summon(Creature const *summon)
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
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool IsPet() const
Definition: Unit.h:740
bool IsAlive() const
Definition: Unit.h:1164
void StopMoving()
Definition: Unit.cpp:10049
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
Unit * EnsureVictim() const
Definition: Unit.h:717
void SetEmoteState(Emote emote)
Definition: Unit.h:852
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:12392
uint32 GetNativeDisplayId() const
Definition: Unit.h:1570
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:5670
Unit * GetVictim() const
Definition: Unit.h:715
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition: Object.cpp:2991
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
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition: Object.cpp:1360
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1142
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ GARGOYLE
Definition: hyjal.h:64
@ ABOMINATION
Definition: hyjal.h:60
@ GHOUL
Definition: hyjal.h:61
@ NPC_WORLD_TRIGGER_TINY
Definition: hyjal.h:79
@ DATA_TRASH
Definition: hyjal.h:39
@ DATA_RAIDDAMAGE
Definition: hyjal.h:43
@ DATA_THRALL
Definition: hyjal.h:37
@ DATA_JAINAPROUDMOORE
Definition: hyjal.h:36
@ DATA_ALLIANCE_RETREAT
Definition: hyjal.h:41
@ DATA_HORDE_RETREAT
Definition: hyjal.h:42
#define MINRAIDDAMAGE
Definition: hyjal.h:92
float FlyPathWPs[3][3]
Definition: hyjal_trash.cpp:92
void AddSC_hyjal_trash()
float FrostWyrmWPs[3][3]
Definition: hyjal_trash.cpp:78
@ SPELL_WEB
Definition: hyjal_trash.cpp:42
@ SPELL_RAISE_DEAD_3
Definition: hyjal_trash.cpp:37
@ SPELL_IMMOLATION
Definition: hyjal_trash.cpp:29
@ SPELL_FROST_BREATH
Definition: hyjal_trash.cpp:44
@ MODEL_INVIS
Definition: hyjal_trash.cpp:31
@ SPELL_BANSHEE_WAIL
Definition: hyjal_trash.cpp:40
@ SPELL_BANSHEE_CURSE
Definition: hyjal_trash.cpp:39
@ SPELL_RAISE_DEAD_2
Definition: hyjal_trash.cpp:36
@ SPELL_GARGOYLE_STRIKE
Definition: hyjal_trash.cpp:45
@ SPELL_RAISE_DEAD_1
Definition: hyjal_trash.cpp:35
@ SPELL_SHADOW_BOLT
Definition: hyjal_trash.cpp:38
@ SPELL_METEOR
Definition: hyjal_trash.cpp:28
@ SPELL_DISEASE_CLOUD
Definition: hyjal_trash.cpp:32
@ SPELL_FRENZY
Definition: hyjal_trash.cpp:34
@ SPELL_ANTI_MAGIC_SHELL
Definition: hyjal_trash.cpp:41
@ SPELL_KNOCKDOWN
Definition: hyjal_trash.cpp:33
@ SPELL_FLAME_BUFFET
Definition: hyjal_trash.cpp:30
@ SPELL_EXPLODING_SHOT
Definition: hyjal_trash.cpp:46
@ SPELL_MANA_BURN
Definition: hyjal_trash.cpp:43
float AllianceOverrunWP[55][3]
Definition: hyjal_trash.cpp:99
float AllianceWPs[8][3]
Definition: hyjal_trash.cpp:66
float GargoyleWPs[3][3]
Definition: hyjal_trash.cpp:85
float HordeWPs[8][3]
Definition: hyjal_trash.cpp:55
float HordeOverrunWP[21][3]
HyjalCreatureText
Definition: hyjal_trash.cpp:50
@ TRASH_SAY_DEATH
Definition: hyjal_trash.cpp:52
@ TRASH_SAY_SLAY
Definition: hyjal_trash.cpp:51
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void AddWaypoint(uint32 id, float x, float y, float z, bool run)
void SetDespawnAtEnd(bool despawn)
void UpdateAI(uint32 diff) override
Position GetPositionWithOffset(Position const &offset) const
Definition: Position.cpp:58
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void SetCombatMovement(bool allowMovement)
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void MoveInLineOfSight(Unit *who) override
void UpdateAI(uint32 diff) override
bool SetupOverrun
Definition: hyjal_trash.h:39
void DamageTaken(Unit *done_by, uint32 &damage, DamageEffectType, SpellInfo const *) override
uint32 Delay
Definition: hyjal_trash.h:36
uint32 LastOverronPos
Definition: hyjal_trash.h:37
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
float DummyTarget[3]
Definition: hyjal_trash.h:44
uint32 damageTaken
Definition: hyjal_trash.h:43
InstanceScript * instance
Definition: hyjal_trash.h:34
uint32 OverrunType
Definition: hyjal_trash.h:40
hyjal_trashAI(Creature *creature)
void WaypointReached(uint32 waypointId, uint32) override
npc_abominationAI(Creature *creature)
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void JustDied(Unit *killer) override
void WaypointReached(uint32 waypointId, uint32) override
void KilledUnit(Unit *) override
void UpdateAI(uint32 diff) override
npc_bansheeAI(Creature *creature)
void WaypointReached(uint32 waypointId, uint32) override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
npc_crypt_fiendAI(Creature *creature)
void WaypointReached(uint32 waypointId, uint32) override
void JustEngagedWith(Unit *) override
npc_fel_stalkerAI(Creature *creature)
void UpdateAI(uint32 diff) override
void WaypointReached(uint32 waypointId, uint32) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
npc_frost_wyrmAI(Creature *creature)
void JustEngagedWith(Unit *) override
npc_gargoyleAI(Creature *creature)
void JustDied(Unit *killer) override
void WaypointReached(uint32 waypointId, uint32) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
void Reset() override
void JustEngagedWith(Unit *) override
void WaypointReached(uint32 waypointId, uint32) override
npc_ghoulAI(Creature *creature)
void UpdateAI(uint32 diff) override
void WaypointReached(uint32 waypointId, uint32) override
void JustSummoned(Creature *summon) override
npc_necromancerAI(Creature *creature)
void KilledUnit(Unit *) override
void WaypointReached(uint32 waypointId, uint32) override
void JustDied(Unit *killer) override
void JustEngagedWith(Unit *) override
void SummonedCreatureDespawn(Creature *summon) override
void UpdateAI(uint32 diff) override