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 }
252
253private:
255};
256
257// 21913 - Water Globule
259{
261
262 void JustAppeared() override
263 {
265
267 .Schedule(0s, [this](TaskContext& task)
268 {
271 task.Repeat(7s, 10s);
272 })
273 .Schedule(0s, [this](TaskContext& task)
274 {
275 if (me->IsWithinDistInMap(me->GetVictim(), 5.0f))
277 task.Repeat(1200ms);
278 });
279 }
280
281 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
282 {
283 switch (spellInfo->Id)
284 {
286 if (Unit* unit = target->ToUnit())
287 AddThreat(unit, 3000000.0f);
288 break;
291 break;
292 default:
293 break;
294 }
295 }
296
297 void UpdateAI(uint32 diff) override
298 {
299 if (!UpdateVictim())
300 return;
301
302 _scheduler.Update(diff);
303 }
304
305private:
307};
308
309// 38028 - Watery Grave
311{
312public:
313 bool Validate(SpellInfo const* /*spellInfo*/) override
314 {
316 }
317
318 void FilterTargets(std::list<WorldObject*>& targets)
319 {
320 targets.remove(GetCaster()->GetVictim());
322 }
323
324 void HandleDummy(SpellEffIndex /*effIndex*/)
325 {
327 _targetCount++;
328 }
329
335
336private:
337 std::size_t _targetCount = 0;
338};
339
340// 37866 - Summon Water Globules
342{
343 bool Validate(SpellInfo const* /*spellInfo*/) override
344 {
346 }
347
348 void HandleDummy(SpellEffIndex /*effIndex*/)
349 {
350 Unit* caster = GetCaster();
352 caster->CastSpell(caster, spell, true);
353 }
354
359};
360
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELLVALUE_MAX_TARGETS
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore Spell and Category cooldowns.
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
@ 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()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void CancelEvent(EventId eventId)
Definition EventMap.cpp:156
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
Unit * ToUnit()
Definition Object.h:116
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Definition Unit.h:647
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:499
void FilterTargets(std::list< WorldObject * > &targets)
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:67
@ BOSS_MOROGRIM_TIDEWALKER
#define RegisterSerpentshrineCavernCreatureAI(ai_name)
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
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