TrinityCore
Loading...
Searching...
No Matches
boss_slagmaw.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#include "Containers.h"
19#include "InstanceScript.h"
20#include "ScriptMgr.h"
21#include "ScriptedCreature.h"
22#include "ragefire_chasm.h"
23
25{
28 SPELL_MAGNAW_TELEPORT_NORTH = 119424, // Serverside
29 SPELL_MAGNAW_TELEPORT_EAST = 119425, // Serverside
30 SPELL_MAGNAW_TELEPORT_SOUTH = 119426, // Serverside
31 SPELL_MAGNAW_TELEPORT_WEST = 119428 // Serverside
32};
33
41
49
50// 61463 - Slagmaw
51struct boss_slagmaw : public BossAI
52{
54
55 void Reset() override
56 {
57 _Reset();
60 }
61
62 void JustDied(Unit* /*killer*/) override
63 {
64 _JustDied();
66 }
67
75
85
93
95 {
96 std::array<uint32, 3> teleportSpells = { };
97 std::ranges::remove_copy(SlagmawTeleportSpells, teleportSpells.begin(), _lastTeleportSpell);
99 return _lastTeleportSpell;
100 }
101
102 void UpdateAI(uint32 diff) override
103 {
104 if (!UpdateVictim())
105 return;
106
107 events.Update(diff);
108
110 return;
111
112 switch (events.ExecuteEvent())
113 {
114 case EVENT_LAVA_SPIT:
115 {
116 if (_lavaSpitCounter < 5)
117 {
119 {
120 DoCast(target, SPELL_LAVA_SPIT);
122 }
123 events.Repeat(1s);
124 break;
125 }
126 else if (_lavaSpitCounter == 5)
127 {
129 break;
130 }
131 break;
132 }
133 case EVENT_TELEPORT:
134 {
137 break;
138 }
139 case EVENT_EMERGE:
140 {
143 break;
144 }
146 {
147 if (me->GetVictim()->GetDistance(me) > 50.0f)
150 break;
151 }
152 default:
153 break;
154 }
155 }
156
157private:
160};
161
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
EvadeReason
@ UNIT_STATE_CASTING
Definition Unit.h:276
std::array< uint32, 4 > const SlagmawTeleportSpells
SlagmawSpells
@ SPELL_MAGNAW_TELEPORT_SOUTH
@ SPELL_LAVA_SPIT
@ SPELL_MAGNAW_TELEPORT_NORTH
@ SPELL_MAGNAW_TELEPORT_EAST
@ SPELL_MAGNAW_SUBMERGE
@ SPELL_MAGNAW_TELEPORT_WEST
SlagmawEvents
@ EVENT_BOUNDARY_CHECK
@ EVENT_EMERGE
@ EVENT_TELEPORT
@ EVENT_LAVA_SPIT
void AddSC_boss_slagmaw()
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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:635
Unit * GetVictim() const
Definition Unit.h:726
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:432
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
@ BOSS_SLAGMAW
#define RegisterRagefireChasmCreatureAI(ai_name)
void HandleSubmergePhase()
boss_slagmaw(Creature *creature)
void JustEngagedWith(Unit *who) override
void Reset() override
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
uint32 GetNextTeleportSpell()
uint32 _lastTeleportSpell
void JustDied(Unit *) override