TrinityCore
boss_hydross_the_unstable.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/* ScriptData
19SDName: Boss_Hydross_The_Unstable
20SD%Complete: 90
21SDComment: Some details and adjustments left to do, probably nothing major. Spawns may be spawned in different way/location.
22SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "ObjectAccessor.h"
28#include "ScriptedCreature.h"
29#include "serpent_shrine.h"
30#include "TemporarySummon.h"
31
33{
41
43
45 MODEL_CLEAN = 20162,
46
61 SPELL_ENRAGE = 27680, //this spell need verification
62 SPELL_SUMMON_WATER_ELEMENT = 36459, //not in use yet(in use ever?)
65
68 ENTRY_BEAM_DUMMY = 21934
69};
70
71#define HYDROSS_X -239.439f
72#define HYDROSS_Y -363.481f
73
74#define SPAWN_X_DIFF1 6.934003f
75#define SPAWN_Y_DIFF1 -11.255012f
76#define SPAWN_X_DIFF2 -6.934003f
77#define SPAWN_Y_DIFF2 11.255012f
78#define SPAWN_X_DIFF3 -12.577011f
79#define SPAWN_Y_DIFF3 -4.72702f
80#define SPAWN_X_DIFF4 12.577011f
81#define SPAWN_Y_DIFF4 4.72702f
82
84{
86 {
87 Initialize();
88 }
89
91 {
92 beams[0].Clear();
93 beams[1].Clear();
94 PosCheck_Timer = 2500;
95 MarkOfHydross_Timer = 15000;
97 WaterTomb_Timer = 7000;
98 VileSludge_Timer = 7000;
101 EnrageTimer = 600000;
102
103 CorruptedForm = false;
104 beam = false;
105 }
106
117 bool beam;
118
119 void Reset() override
120 {
122 Initialize();
123
127
129
130 _Reset();
131 }
132
134 {
135 Creature* beamer = me->SummonCreature(ENTRY_BEAM_DUMMY, -258.333f, -356.34f, 22.0499f, 5.90835f, TEMPSUMMON_CORPSE_DESPAWN);
136 if (beamer)
137 {
138 beamer->CastSpell(me, SPELL_BLUE_BEAM, true);
139 beamer->SetDisplayId(11686); //invisible
140 beams[0] = beamer->GetGUID();
141 }
142 beamer = me->SummonCreature(ENTRY_BEAM_DUMMY, -219.918f, -371.308f, 22.0042f, 2.73072f, TEMPSUMMON_CORPSE_DESPAWN);
143 if (beamer)
144 {
145 beamer->CastSpell(me, SPELL_BLUE_BEAM, true);
146 beamer->SetDisplayId(11686); //invisible
147 beams[1] = beamer->GetGUID();
148 }
149 }
150
152 {
153 for (uint8 i = 0; i < 2; ++i)
154 {
156 mob->DespawnOrUnsummon();
157 }
158 }
159
160 void JustEngagedWith(Unit* who) override
161 {
163
164 _JustEngagedWith(who);
165 }
166
167 void KilledUnit(Unit* /*victim*/) override
168 {
170 }
171
172 void JustSummoned(Creature* summoned) override
173 {
174 if (summoned->GetEntry() == ENTRY_PURE_SPAWN)
175 summoned->CastSpell(summoned, SPELL_ELEMENTAL_SPAWNIN, true);
176
177 if (summoned->GetEntry() == ENTRY_TAINTED_SPAWN)
178 summoned->CastSpell(summoned, SPELL_ELEMENTAL_SPAWNIN, true);
179
180 BossAI::JustSummoned(summoned);
181 }
182
183 void JustDied(Unit* /*killer*/) override
184 {
186
187 _JustDied();
188 }
189
190 void UpdateAI(uint32 diff) override
191 {
192 if (!beam)
193 {
194 SummonBeams();
195 beam = true;
196 }
197 //Return since we have no target
198 if (!UpdateVictim())
199 return;
200
201 // corrupted form
202 if (CorruptedForm)
203 {
204 //MarkOfCorruption_Timer
205 if (MarkOfCorruption_Timer <= diff)
206 {
207 if (MarkOfCorruption_Count <= 5)
208 {
209 uint32 mark_spell = 0;
210
212 {
213 case 0:
214 mark_spell = SPELL_MARK_OF_CORRUPTION1;
215 break;
216
217 case 1:
218 mark_spell = SPELL_MARK_OF_CORRUPTION2;
219 break;
220
221 case 2:
222 mark_spell = SPELL_MARK_OF_CORRUPTION3;
223 break;
224
225 case 3:
226 mark_spell = SPELL_MARK_OF_CORRUPTION4;
227 break;
228
229 case 4:
230 mark_spell = SPELL_MARK_OF_CORRUPTION5;
231 break;
232
233 case 5:
234 mark_spell = SPELL_MARK_OF_CORRUPTION6;
235 break;
236 }
237
238 DoCastVictim(mark_spell);
239
242 }
243
245 } else MarkOfCorruption_Timer -= diff;
246
247 //VileSludge_Timer
248 if (VileSludge_Timer <= diff)
249 {
251 DoCast(target, SPELL_VILE_SLUDGE);
252
253 VileSludge_Timer = 15000;
254 } else VileSludge_Timer -= diff;
255
256 //PosCheck_Timer
257 if (PosCheck_Timer <= diff)
258 {
260 {
261 // switch to clean form
263 CorruptedForm = false;
265
268 SummonBeams();
269
270 // spawn 4 adds
275
279 }
280
281 PosCheck_Timer = 2500;
282 } else PosCheck_Timer -=diff;
283 }
284 // clean form
285 else
286 {
287 //MarkOfHydross_Timer
288 if (MarkOfHydross_Timer <= diff)
289 {
290 if (MarkOfHydross_Count <= 5)
291 {
292 uint32 mark_spell = 0;
293
294 switch (MarkOfHydross_Count)
295 {
296 case 0:
297 mark_spell = SPELL_MARK_OF_HYDROSS1;
298 break;
299
300 case 1:
301 mark_spell = SPELL_MARK_OF_HYDROSS2;
302 break;
303
304 case 2:
305 mark_spell = SPELL_MARK_OF_HYDROSS3;
306 break;
307
308 case 3:
309 mark_spell = SPELL_MARK_OF_HYDROSS4;
310 break;
311
312 case 4:
313 mark_spell = SPELL_MARK_OF_HYDROSS5;
314 break;
315
316 case 5:
317 mark_spell = SPELL_MARK_OF_HYDROSS6;
318 break;
319 }
320
321 DoCastVictim(mark_spell);
322
323 if (MarkOfHydross_Count < 5)
325 }
326
327 MarkOfHydross_Timer = 15000;
328 } else MarkOfHydross_Timer -= diff;
329
330 //WaterTomb_Timer
331 if (WaterTomb_Timer <= diff)
332 {
333 Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true);
334 if (target)
335 DoCast(target, SPELL_WATER_TOMB);
336
337 WaterTomb_Timer = 7000;
338 } else WaterTomb_Timer -= diff;
339
340 //PosCheck_Timer
341 if (PosCheck_Timer <= diff)
342 {
344 {
345 // switch to corrupted form
348 CorruptedForm = true;
349
353
354 // spawn 4 adds
359
363 }
364
365 PosCheck_Timer = 2500;
366 } else PosCheck_Timer -=diff;
367 }
368
369 //EnrageTimer
370 if (EnrageTimer <= diff)
371 {
373 EnrageTimer = 60000;
374 } else EnrageTimer -= diff;
375 }
376};
377
379{
381}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_CORPSE_DESPAWN
Definition: ObjectDefines.h:67
@ SPELL_SCHOOL_MASK_NATURE
@ SPELL_SCHOOL_MASK_FROST
@ IMMUNITY_SCHOOL
@ SPELL_SCHOOL_NATURE
@ SPELL_SCHOOL_FROST
#define SPAWN_Y_DIFF4
#define SPAWN_Y_DIFF3
#define SPAWN_X_DIFF2
#define SPAWN_Y_DIFF1
#define HYDROSS_Y
#define SPAWN_X_DIFF1
#define SPAWN_X_DIFF3
#define SPAWN_Y_DIFF2
#define SPAWN_X_DIFF4
@ SPELL_MARK_OF_CORRUPTION3
@ SPELL_MARK_OF_HYDROSS1
@ SPELL_MARK_OF_CORRUPTION5
@ SPELL_MARK_OF_CORRUPTION1
@ SPELL_MARK_OF_CORRUPTION2
@ SPELL_MARK_OF_HYDROSS4
@ SPELL_MARK_OF_HYDROSS2
@ SPELL_ELEMENTAL_SPAWNIN
@ SPELL_MARK_OF_CORRUPTION6
@ SPELL_SUMMON_WATER_ELEMENT
@ SPELL_MARK_OF_HYDROSS3
@ SPELL_MARK_OF_HYDROSS5
@ SPELL_MARK_OF_CORRUPTION4
@ SPELL_MARK_OF_HYDROSS6
void AddSC_boss_hydross_the_unstable()
#define HYDROSS_X
void _JustEngagedWith(Unit *who)
void JustSummoned(Creature *summon) override
void _JustDied()
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 SetDisplayId(uint32 displayId, bool setNative=false) override
Definition: Creature.cpp:3402
void SetMeleeDamageSchool(SpellSchools school)
Definition: Creature.h:217
void Clear()
Definition: ObjectGuid.h:286
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
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
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition: Unit.cpp:7845
bool IsWithinDist2d(float x, float y, float dist) const
Definition: Object.cpp:1132
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
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
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ BOSS_HYDROSS_THE_UNSTABLE
#define RegisterSerpentshrineCavernCreatureAI(ai_name)
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
void ResetThreatList(Unit *who=nullptr)
void JustEngagedWith(Unit *who) override
boss_hydross_the_unstable(Creature *creature)
void JustSummoned(Creature *summoned) override
void UpdateAI(uint32 diff) override