TrinityCore
Loading...
Searching...
No Matches
boss_morogrim_tidewalker.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 * Combat timers requires to be revisited
20 * Everything requires sniff verification, especially Water Globule
21 */
22
23#include "ScriptMgr.h"
24#include "Containers.h"
25#include "ScriptedCreature.h"
26#include "serpent_shrine.h"
27#include "SpellInfo.h"
28#include "SpellScript.h"
29
41
90
98
108
118
126
134
135// 21213 - Morogrim Tidewalker
137{
139
140 void Reset() override
141 {
142 _Reset();
143
144 _isSecondPhaseStarted = false;
145
147 }
148
149 void JustEngagedWith(Unit* who) override
150 {
152
154
158 }
159
160 void OnSpellCast(SpellInfo const* spellInfo) override
161 {
162 switch (spellInfo->Id)
163 {
164 case SPELL_EARTHQUAKE:
167
168 for (uint32 spell : SummonMurlocsNorthSpells)
169 DoCastSelf(spell, true);
170
171 for (uint32 spell : SummonMurlocsSouthSpells)
172 DoCastSelf(spell, true);
173
174 break;
177 break;
181 break;
182 default:
183 break;
184 }
185 }
186
187 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
188 {
190 {
194 }
195 }
196
197 void JustReachedHome() override
198 {
201 }
202
203 void KilledUnit(Unit* /*victim*/) override
204 {
205 Talk(SAY_SLAY);
206 }
207
208 void JustDied(Unit* /*killer*/) override
209 {
210 _JustDied();
212 }
213
214 void UpdateAI(uint32 diff) override
215 {
216 if (!UpdateVictim())
217 return;
218
219 events.Update(diff);
220
222 return;
223
224 while (uint32 eventId = events.ExecuteEvent())
225 {
226 switch (eventId)
227 {
228 case EVENT_TIDAL_WAVE:
230 events.Repeat(20s, 25s);
231 break;
232 case EVENT_EARTHQUAKE:
234 events.Repeat(50s, 60s);
235 break;
238 events.Repeat(30s, 35s);
239 break;
242 events.Repeat(40s, 50s);
243 break;
244 default:
245 break;
246 }
247
249 return;
250 }
251
253 }
254
255private:
257};
258
259// 21913 - Water Globule
261{
263
264 void JustAppeared() override
265 {
267
269 .Schedule(0s, [this](TaskContext task)
270 {
273 task.Repeat(7s, 10s);
274 })
275 .Schedule(0s, [this](TaskContext task)
276 {
277 if (me->IsWithinDistInMap(me->GetVictim(), 5.0f))
279 task.Repeat(1200ms);
280 });
281 }
282
283 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
284 {
285 switch (spellInfo->Id)
286 {
288 if (Unit* unit = target->ToUnit())
289 AddThreat(unit, 3000000.0f);
290 break;
293 break;
294 default:
295 break;
296 }
297 }
298
299 void UpdateAI(uint32 diff) override
300 {
301 if (!UpdateVictim())
302 return;
303
304 _scheduler.Update(diff);
305 }
306
307private:
309};
310
311// 38028 - Watery Grave
343
344// 37866 - Summon Water Globules
366
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ TARGET_UNIT_SRC_AREA_ENEMY
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore GCD.
@ SPELLVALUE_MAX_TARGETS
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
@ EVENT_SUMMON_WATER_GLOBULES
@ SPELL_SUMMON_WATER_GLOBULE_3
@ SPELL_SUMMON_MURLOC_A10
@ SPELL_SUMMON_WATER_GLOBULE_2
@ SPELL_WATERY_GRAVE_TELEPORT_2
@ SPELL_WATERY_GRAVE_TELEPORT_3
@ SPELL_SUMMON_MURLOC_B10
@ SPELL_WATER_GLOBULE_EXPLODE
@ SPELL_WATER_GLOBULE_NEW_TARGET
@ SPELL_SUMMON_WATER_GLOBULE_4
@ SPELL_SUMMON_WATER_GLOBULE_1
@ SPELL_WATERY_GRAVE_TELEPORT_4
@ SPELL_SUMMON_WATER_GLOBULES
@ SPELL_WATERY_GRAVE_TELEPORT_1
static constexpr std::array< uint32, 6 > SummonMurlocsNorthSpells
static constexpr std::array< uint32, 4 > SummonWaterGlobulesSpells
static constexpr std::array< uint32, 6 > SummonMurlocsSouthSpells
static constexpr std::array< uint32, 4 > WateryGraveTeleportSpells
void AddSC_boss_morogrim_tidewalker()
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
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
static Unit * ToUnit(Object *o)
Definition Object.h:192
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
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
Definition Unit.h:769
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_morogrim_tidewalker_summon_water_globules)
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_morogrim_tidewalker_watery_grave)
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:66
@ BOSS_MOROGRIM_TIDEWALKER
#define RegisterSerpentshrineCavernCreatureAI(ai_name)
ScriptedAI(Creature *creature)
void ResetThreatList(Unit *who=nullptr)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
boss_morogrim_tidewalker(Creature *creature)
void OnSpellCast(SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void SpellHitTarget(WorldObject *target, SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override