TrinityCore
Loading...
Searching...
No Matches
boss_fathomlord_karathress.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 * Greater Poison Cleansing Totem has no passive spell (nothing found in sniffs). What spell should it use?
20 * Seer Olum's event is NYI (should be handled in DB)
21 * Damage of fathom pets is too low, core issue (if creature is summoned by spell, damage is quite low)
22 * Bestial Wrath cannot be applied on Fathom Lurker and only applies on Fathom Sporebat. The reason is Creature Type Mask = 0x00000001 (BEAST).
23 It is unclear if this is an issue or not
24 * Sharkkis should be able to summon multiple pets, at this moment he can have only one summoned pet per time
25 * Transform spells (handled in SAI for each totem) for totems cannot be casted by totems because of Totem::IsImmunedToSpellEffect (SPELL_AURA_TRANSFORM)
26 * Timers requires to be revisited
27 */
28
29#include "ScriptMgr.h"
30#include "InstanceScript.h"
31#include "Map.h"
32#include "ScriptedCreature.h"
33#include "SpellInfo.h"
34#include "SpellScript.h"
35#include "serpent_shrine.h"
36
45
90
116
124
125static constexpr std::array<uint32, 3> FathomGuardSpawnGroupsData =
126{
130};
131
132// 21214 - Fathom-Lord Karathress
134{
137
138 void JustAppeared() override
139 {
141 me->GetMap()->SpawnGroupSpawn(group, true);
142 }
143
144 void JustEngagedWith(Unit* who) override
145 {
147
149
153 }
154
155 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
156 {
157 switch (spellInfo->Id)
158 {
163 break;
165 if (!_performedEmote)
166 {
168 _performedEmote = true;
169 }
170 break;
171 default:
172 break;
173 }
174 }
175
176 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
177 {
178 if (!_blessingOfTides && me->HealthBelowPctDamaged(75, damage))
179 {
180 _blessingOfTides = true;
181
183 if (Creature* guard = instance->GetCreature(data))
184 if (guard->IsAlive())
185 guard->AI()->DoAction(ACTION_GIVE_BLESSING);
186 }
187 }
188
189 void JustSummoned(Creature* summon) override
190 {
191 summons.Summon(summon);
192 }
193
194 void EnterEvadeMode(EvadeReason /*why*/) override
195 {
197 me->GetMap()->SpawnGroupDespawn(group);
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 {
230 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 80.0f, true))
232 events.Repeat(6s, 12s);
233 break;
234 case EVENT_SEAR_NOVA:
236 events.Repeat(30s, 40s);
237 break;
238 case EVENT_BERSERK:
240 break;
241 default:
242 break;
243 }
244
246 return;
247 }
248 }
249
250private:
253};
254
256{
257 FathomGuardBaseAI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()) { }
258
259 void Reset() override
260 {
261 Events.Reset();
262 }
263
264 void DoAction(int32 action) override
265 {
266 if (action == ACTION_GIVE_BLESSING)
268 }
269
270 void JustSummoned(Creature* summon) override
271 {
273 karathress->AI()->JustSummoned(summon);
274 }
275
276 virtual void ExecuteEvent(uint32 const eventId) = 0;
277
278 void UpdateAI(uint32 diff) override
279 {
280 if (!UpdateVictim())
281 return;
282
283 Events.Update(diff);
284
286 return;
287
288 while (uint32 eventId = Events.ExecuteEvent())
289 {
290 ExecuteEvent(eventId);
291
293 return;
294 }
295 }
296
297protected:
300};
301
302// 21966 - Fathom-Guard Sharkkis
304{
306
307 void JustEngagedWith(Unit* /*who*/) override
308 {
309 Events.ScheduleEvent(EVENT_LEECHING_THROW, 5s, 10s);
310 Events.ScheduleEvent(EVENT_THE_BEAST_WITHIN, 30s, 40s);
311 Events.ScheduleEvent(EVENT_MULTI_TOSS, 20s, 30s);
312 Events.ScheduleEvent(EVENT_SUMMON_FATHOM_PET, 10s);
313 }
314
315 void JustDied(Unit* /*killer*/) override
316 {
318 }
319
320 void ExecuteEvent(uint32 eventId) override
321 {
322 switch (eventId)
323 {
327 Events.Repeat(5s, 10s);
328 break;
331 Events.Repeat(30s, 40s);
332 break;
333 case EVENT_MULTI_TOSS:
335 DoCast(target, SPELL_MULTI_TOSS);
336 Events.Repeat(20s, 30s);
337 break;
340 Events.Repeat(30s);
341 break;
342 default:
343 break;
344 }
345 }
346};
347
348// 21965 - Fathom-Guard Tidalvess
350{
352
353 void JustAppeared() override
354 {
356 }
357
358 void JustEngagedWith(Unit* /*who*/) override
359 {
360 Events.ScheduleEvent(EVENT_FROST_SHOCK, 10s, 15s);
361 Events.ScheduleEvent(EVENT_SPITFIRE_TOTEM, 10s, 15s);
362 Events.ScheduleEvent(EVENT_EARTHBIND_TOTEM, 15s, 25s);
363 Events.ScheduleEvent(EVENT_POISON_CLEANSING_TOTEM, 20s, 30s);
364 }
365
366 void JustDied(Unit* /*killer*/) override
367 {
369 }
370
371 void ExecuteEvent(uint32 eventId) override
372 {
373 switch (eventId)
374 {
377 Events.Repeat(10s, 15s);
378 break;
381 Events.Repeat(40s, 60s);
382 break;
385 Events.Repeat(40s, 60s);
386 break;
389 Events.Repeat(30s, 50s);
390 break;
391 default:
392 break;
393 }
394 }
395};
396
397// 21964 - Fathom-Guard Caribdis
399{
401
402 void JustEngagedWith(Unit* /*who*/) override
403 {
404 Events.ScheduleEvent(EVENT_WATER_BOLT_VOLLEY, 15s, 25s);
405 Events.ScheduleEvent(EVENT_TIDAL_SURGE, 15s, 20s);
406 Events.ScheduleEvent(EVENT_SUMMON_CYCLONE, 10s, 25s);
407 Events.ScheduleEvent(EVENT_HEALING_WAVE, 15s, 25s);
408 }
409
410 void JustDied(Unit* /*killer*/) override
411 {
413 }
414
415 void ExecuteEvent(uint32 eventId) override
416 {
417 switch (eventId)
418 {
421 Events.Repeat(10s, 30s);
422 break;
425 Events.Repeat(15s, 25s);
426 break;
430 Events.Repeat(40s, 50s);
431 break;
433 if (Unit* target = DoSelectLowestHpFriendly(250.0f))
434 DoCast(target, SPELL_HEALING_WAVE);
435 Events.Repeat(15s, 20s);
436 break;
437 default:
438 break;
439 }
440 }
441};
442
443// 22104 - Cyclone (Karathress)
445{
447
448 void Reset() override
449 {
451 }
452
453 void JustAppeared() override
454 {
463
464 _scheduler.Schedule(10s, [this](TaskContext& task)
465 {
467
468 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
469 {
471 AddThreat(target, 1000000.0f);
472 AttackStart(target);
473 }
474 task.Repeat(10s);
475 });
476 }
477
478 void UpdateAI(uint32 diff) override
479 {
480 UpdateVictim();
481
482 _scheduler.Update(diff);
483 }
484
485private:
487};
488
489// 38358 - Tidal Surge
507
508// 38373 - The Beast Within
510{
511 bool Validate(SpellInfo const* /*spellInfo*/) override
512 {
514 }
515
517 {
518 GetCaster()->CastSpell(nullptr, SPELL_BESTIAL_WRATH, true);
519 }
520
525};
526
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
#define SpellCastFn(F)
EvadeReason
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
@ SPELL_SUMMON_FATHOM_SPOREBAT
@ SPELL_BLESSING_OF_THE_TIDES
@ SPELL_POISON_CLEANSING_TOTEM
@ SPELL_CYCLONE_WATER_VISUAL_2
static constexpr std::array< uint32, 3 > FathomGuardSpawnGroupsData
void AddSC_boss_fathomlord_karathress()
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
Creature * GetCreature(uint32 type)
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:2360
bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
Definition Map.cpp:2449
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< CastHandler > OnCast
void Summon(Creature const *summon)
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
uint32 GetThreatListPlayerCount(bool includeOffline=false) const
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
ThreatManager & GetThreatManager()
Definition Unit.h:1093
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
@ DATA_CARIBDIS
@ DATA_TIDALVESS
@ DATA_SHARKKIS
@ BOSS_FATHOM_LORD_KARATHRESS
#define RegisterSerpentshrineCavernCreatureAI(ai_name)
void UpdateAI(uint32 diff) override
virtual void ExecuteEvent(uint32 const eventId)=0
void JustSummoned(Creature *summon) override
FathomGuardBaseAI(Creature *creature)
void DoAction(int32 action) override
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
void ResetThreatList(Unit *who=nullptr)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void ExecuteEvent(uint32 eventId) override
void ExecuteEvent(uint32 eventId) override
void ExecuteEvent(uint32 eventId) override
void JustSummoned(Creature *summon) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void EnterEvadeMode(EvadeReason) override