TrinityCore
Loading...
Searching...
No Matches
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/*
19 * Everything should be rechecked with sniffs
20 * The way beams are handled out of combat requires additional research. It seems like it's timed
21 and is enabled and disabled from time to time, not used all the time
22 */
23
24#include "ScriptMgr.h"
25#include "InstanceScript.h"
26#include "ScriptedCreature.h"
27#include "serpent_shrine.h"
28
39
76
91
97
98#define HYDROSS_X -239.439f
99#define HYDROSS_Y -363.481f
100
101// 21216 - Hydross the Unstable
103{
106
107 void JustAppeared() override
108 {
110 }
111
127
128 void HandleBeamHelpers(bool reset)
129 {
130 std::list<Creature*> helpersList;
132 if (!helpersList.empty())
133 {
134 for (Creature* helper : helpersList)
135 if (reset)
136 helper->InterruptNonMeleeSpells(false);
137 else
138 helper->CastSpell(helper, SPELL_BLUE_BEAM);
139 }
140 }
141
154
155 void JustReachedHome() override
156 {
159 }
160
161 void KilledUnit(Unit* /*victim*/) override
162 {
164 }
165
166 void JustDied(Unit* /*killer*/) override
167 {
169
170 _JustDied();
171 }
172
174 {
175 events.Update(diff);
176
177 while (uint32 eventId = events.ExecuteEvent())
178 {
179 switch (eventId)
180 {
181 case EVENT_BLUE_BEAMS:
182 HandleBeamHelpers(false);
183 break;
184 default:
185 break;
186 }
187 }
188 }
189
190 void UpdateAI(uint32 diff) override
191 {
192 if (!UpdateVictim())
193 {
195 return;
196 }
197
198 events.Update(diff);
199
201 return;
202
203 while (uint32 eventId = events.ExecuteEvent())
204 {
205 switch (eventId)
206 {
207 // Purified form
209 if (_markOfHydrossCount <= 5)
210 {
211 uint32 markSpell = 0;
212
213 switch (_markOfHydrossCount)
214 {
215 case 0: markSpell = SPELL_MARK_OF_HYDROSS_1; break;
216 case 1: markSpell = SPELL_MARK_OF_HYDROSS_2; break;
217 case 2: markSpell = SPELL_MARK_OF_HYDROSS_3; break;
218 case 3: markSpell = SPELL_MARK_OF_HYDROSS_4; break;
219 case 4: markSpell = SPELL_MARK_OF_HYDROSS_5; break;
220 case 5: markSpell = SPELL_MARK_OF_HYDROSS_6; break;
221 }
222
223 DoCastVictim(markSpell);
224
225 if (_markOfHydrossCount < 5)
227 }
228 events.Repeat(15s);
229 break;
230 case EVENT_WATER_TOMB:
231 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
232 DoCast(target, SPELL_WATER_TOMB);
233 events.Repeat(7s);
234 break;
237 {
240 _corruptedForm = true;
241
244 HandleBeamHelpers(true);
245
250
254
258
262 }
263 else
264 events.Repeat(2500ms);
265 break;
266
267 // Corrupted form
269 if (_markOfCorruptionCount <= 5)
270 {
271 uint32 markSpell = 0;
272
274 {
275 case 0: markSpell = SPELL_MARK_OF_CORRUPTION_1; break;
276 case 1: markSpell = SPELL_MARK_OF_CORRUPTION_2; break;
277 case 2: markSpell = SPELL_MARK_OF_CORRUPTION_3; break;
278 case 3: markSpell = SPELL_MARK_OF_CORRUPTION_4; break;
279 case 4: markSpell = SPELL_MARK_OF_CORRUPTION_5; break;
280 case 5: markSpell = SPELL_MARK_OF_CORRUPTION_6; break;
281 }
282
283 DoCastVictim(markSpell);
284
287 }
288 events.Repeat(15s);
289 break;
291 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
292 DoCast(target, SPELL_VILE_SLUDGE);
293 events.Repeat(15s);
294 break;
297 {
299 _corruptedForm = false;
301
304 HandleBeamHelpers(false);
305
310
314
318
322 }
323 else
324 events.Repeat(2500ms);
325 break;
326
327 // All forms
328 case EVENT_BERSERK:
330 break;
331 default:
332 break;
333 }
334
336 return;
337 }
338
340 }
341
342private:
346};
347
uint32_t uint32
Definition Define.h:133
@ SPELL_SCHOOL_NATURE
@ SPELL_SCHOOL_FROST
@ SPELL_SCHOOL_MASK_NATURE
@ SPELL_SCHOOL_MASK_FROST
@ IMMUNITY_SCHOOL
@ UNIT_STATE_CASTING
Definition Unit.h:235
#define HYDROSS_Y
@ EVENT_SWITCH_TO_CORRUPTED
@ SPELL_MARK_OF_CORRUPTION_6
@ SPELL_SUMMON_PURIFIED_SPAWN_4
@ SPELL_MARK_OF_CORRUPTION_2
@ SPELL_SUMMON_CORRUPTED_SPAWN_4
@ SPELL_SUMMON_CORRUPTED_SPAWN_2
@ SPELL_SUMMON_PURIFIED_SPAWN_1
@ SPELL_SUMMON_PURIFIED_SPAWN_2
@ SPELL_MARK_OF_CORRUPTION_4
@ SPELL_MARK_OF_CORRUPTION_1
@ SPELL_SUMMON_CORRUPTED_SPAWN_3
@ SPELL_MARK_OF_CORRUPTION_5
@ SPELL_SUMMON_PURIFIED_SPAWN_3
@ SPELL_SUMMON_CORRUPTED_SPAWN_1
@ SPELL_SUMMON_WATER_ELEMENTAL
@ SPELL_MARK_OF_CORRUPTION_3
void AddSC_boss_hydross_the_unstable()
#define HYDROSS_X
void _JustReachedHome()
void _JustEngagedWith(Unit *who)
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetMeleeDamageSchool(SpellSchools school)
Definition Creature.h:159
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
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
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8142
bool IsWithinDist2d(float x, float y, float dist) const
Definition Object.cpp:1177
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:3153
@ BOSS_HYDROSS_THE_UNSTABLE
#define RegisterSerpentshrineCavernCreatureAI(ai_name)
void ResetThreatList(Unit *who=nullptr)
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override