Skip to content

Commit f96aa9a

Browse files
authored
Scripts/RagefireChasm: Implement Slagmaw encounter (TrinityCore#29989)
1 parent 3e5850d commit f96aa9a

File tree

4 files changed

+193
-7
lines changed

4 files changed

+193
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-- Creature
2+
UPDATE `creature_template` SET `ScriptName`='boss_slagmaw' WHERE `entry`=61463;
3+
4+
-- Serverside spells
5+
DELETE FROM `serverside_spell` WHERE `Id` IN (119424, 119425, 119426, 119428) AND `DifficultyID`=0;
6+
INSERT INTO `serverside_spell` (`Id`, `DifficultyID`, `CategoryId`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `AttributesEx6`, `AttributesEx7`, `AttributesEx8`, `AttributesEx9`, `AttributesEx10`, `AttributesEx11`, `AttributesEx12`, `AttributesEx13`, `AttributesEx14`, `Stances`, `StancesNot`, `Targets`, `TargetCreatureType`, `RequiresSpellFocus`, `FacingCasterFlags`, `CasterAuraState`, `TargetAuraState`, `ExcludeCasterAuraState`, `ExcludeTargetAuraState`, `CasterAuraSpell`, `TargetAuraSpell`, `ExcludeCasterAuraSpell`, `ExcludeTargetAuraSpell`, `CasterAuraType`, `TargetAuraType`, `ExcludeCasterAuraType`, `ExcludeTargetAuraType`, `CastingTimeIndex`, `RecoveryTime`, `CategoryRecoveryTime`, `StartRecoveryCategory`, `StartRecoveryTime`, `InterruptFlags`, `AuraInterruptFlags1`, `AuraInterruptFlags2`, `ChannelInterruptFlags1`, `ChannelInterruptFlags2`, `ProcFlags`, `ProcFlags2`, `ProcChance`, `ProcCharges`, `ProcCooldown`, `ProcBasePPM`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `RangeIndex`, `Speed`, `LaunchDelay`, `StackAmount`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `ContentTuningId`, `SpellName`, `ConeAngle`, `ConeWidth`, `MaxTargetLevel`, `MaxAffectedTargets`, `SpellFamilyName`, `SpellFamilyFlags1`, `SpellFamilyFlags2`, `SpellFamilyFlags3`, `SpellFamilyFlags4`, `DmgClass`, `PreventionType`, `AreaGroupId`, `SchoolMask`, `ChargeCategoryId`) VALUES
7+
(119424, 0, 0, 0, 0, 0x100, 0x40000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 'Magnaw Teleport North', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0),
8+
(119425, 0, 0, 0, 0, 0x100, 0x40000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 'Magnaw Teleport East', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0),
9+
(119426, 0, 0, 0, 0, 0x100, 0x40000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 'Magnaw Teleport South', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0),
10+
(119428, 0, 0, 0, 0, 0x100, 0x40000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 'Magnaw Teleport West', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0);
11+
12+
DELETE FROM `serverside_spell_effect` WHERE `SpellID` IN (119424, 119425, 119426, 119428) AND `EffectIndex`=0 AND `DifficultyID`=0;
13+
INSERT INTO `serverside_spell_effect` (`SpellID`, `EffectIndex`, `DifficultyID`, `Effect`, `EffectAura`, `EffectAmplitude`, `EffectAttributes`, `EffectAuraPeriod`, `EffectBonusCoefficient`, `EffectChainAmplitude`, `EffectChainTargets`, `EffectItemType`, `EffectMechanic`, `EffectPointsPerResource`, `EffectPosFacing`, `EffectRealPointsPerLevel`, `EffectTriggerSpell`, `BonusCoefficientFromAP`, `PvpMultiplier`, `Coefficient`, `Variance`, `ResourceCoefficient`, `GroupSizeBasePointsCoefficient`, `EffectBasePoints`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectSpellClassMask1`, `EffectSpellClassMask2`, `EffectSpellClassMask3`, `EffectSpellClassMask4`, `ImplicitTarget1`, `ImplicitTarget2`) VALUES
14+
(119424, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17),
15+
(119425, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17),
16+
(119426, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17),
17+
(119428, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17);
18+
19+
DELETE FROM `spell_target_position` WHERE `ID` IN (119424, 119425, 119426, 119428) AND `EffectIndex`=0;
20+
INSERT INTO `spell_target_position` (`ID`, `EffectIndex`, `MapID`, `PositionX`, `PositionY`, `PositionZ`, `Orientation`, `VerifiedBuild`) VALUES
21+
(119424, 0, 389, -222.94, 165.703, -19.721, 3.797819, 54630),
22+
(119425, 0, 389, -226.477, 135.704, -19.721, 2.330294, 54630),
23+
(119426, 0, 389, -263.212, 136.244, -19.721, 0.7556769, 54630),
24+
(119428, 0, 389, -256.389, 172.884, -19.721, 5.577933, 54630);
25+
26+
UPDATE `creature_template_difficulty` SET `StaticFlags4`=`StaticFlags4`|0x00000200 WHERE `Entry`=61463;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
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+
24+
enum SlagmawSpells
25+
{
26+
SPELL_LAVA_SPIT = 119434,
27+
SPELL_MAGNAW_SUBMERGE = 120384,
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+
34+
enum SlagmawEvents
35+
{
36+
EVENT_LAVA_SPIT = 1,
37+
EVENT_TELEPORT,
38+
EVENT_EMERGE,
39+
EVENT_BOUNDARY_CHECK,
40+
};
41+
42+
std::array<uint32, 4> const SlagmawTeleportSpells =
43+
{
44+
SPELL_MAGNAW_TELEPORT_NORTH,
45+
SPELL_MAGNAW_TELEPORT_EAST,
46+
SPELL_MAGNAW_TELEPORT_SOUTH,
47+
SPELL_MAGNAW_TELEPORT_WEST
48+
};
49+
50+
// 61463 - Slagmaw
51+
struct boss_slagmaw : public BossAI
52+
{
53+
boss_slagmaw(Creature* creature) : BossAI(creature, BOSS_SLAGMAW), _lavaSpitCounter(0), _lastTeleportSpell(SPELL_MAGNAW_TELEPORT_WEST) { }
54+
55+
void Reset() override
56+
{
57+
_Reset();
58+
_lavaSpitCounter = 0;
59+
_lastTeleportSpell = SPELL_MAGNAW_TELEPORT_WEST;
60+
}
61+
62+
void JustDied(Unit* /*killer*/) override
63+
{
64+
_JustDied();
65+
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
66+
}
67+
68+
void EnterEvadeMode(EvadeReason /*why*/) override
69+
{
70+
_EnterEvadeMode();
71+
_DespawnAtEvade();
72+
73+
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
74+
}
75+
76+
void JustEngagedWith(Unit* who) override
77+
{
78+
BossAI::JustEngagedWith(who);
79+
80+
instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1);
81+
82+
events.ScheduleEvent(EVENT_LAVA_SPIT, 1s);
83+
events.ScheduleEvent(EVENT_BOUNDARY_CHECK, 2500ms);
84+
}
85+
86+
void HandleSubmergePhase()
87+
{
88+
DoCastSelf(SPELL_MAGNAW_SUBMERGE);
89+
_lavaSpitCounter = 0;
90+
91+
events.ScheduleEvent(EVENT_TELEPORT, 3s);
92+
}
93+
94+
uint32 GetNextTeleportSpell()
95+
{
96+
std::array<uint32, 3> teleportSpells = { };
97+
std::ranges::remove_copy(SlagmawTeleportSpells, teleportSpells.begin(), _lastTeleportSpell);
98+
_lastTeleportSpell = Trinity::Containers::SelectRandomContainerElement(teleportSpells);
99+
return _lastTeleportSpell;
100+
}
101+
102+
void UpdateAI(uint32 diff) override
103+
{
104+
if (!UpdateVictim())
105+
return;
106+
107+
events.Update(diff);
108+
109+
if (me->HasUnitState(UNIT_STATE_CASTING))
110+
return;
111+
112+
switch (events.ExecuteEvent())
113+
{
114+
case EVENT_LAVA_SPIT:
115+
{
116+
if (_lavaSpitCounter < 5)
117+
{
118+
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
119+
{
120+
DoCast(target, SPELL_LAVA_SPIT);
121+
_lavaSpitCounter++;
122+
}
123+
events.Repeat(1s);
124+
break;
125+
}
126+
else if (_lavaSpitCounter == 5)
127+
{
128+
HandleSubmergePhase();
129+
break;
130+
}
131+
break;
132+
}
133+
case EVENT_TELEPORT:
134+
{
135+
DoCastSelf(GetNextTeleportSpell());
136+
events.ScheduleEvent(EVENT_EMERGE, 1s);
137+
break;
138+
}
139+
case EVENT_EMERGE:
140+
{
141+
me->RemoveAurasDueToSpell(SPELL_MAGNAW_SUBMERGE);
142+
events.ScheduleEvent(EVENT_LAVA_SPIT, 1s);
143+
break;
144+
}
145+
case EVENT_BOUNDARY_CHECK:
146+
{
147+
if (me->GetVictim()->GetDistance(me) > 50.0f)
148+
EnterEvadeMode(EvadeReason::Other);
149+
events.ScheduleEvent(EVENT_BOUNDARY_CHECK, 2500ms);
150+
break;
151+
}
152+
default:
153+
break;
154+
}
155+
}
156+
157+
private:
158+
uint8 _lavaSpitCounter;
159+
uint32 _lastTeleportSpell;
160+
};
161+
162+
void AddSC_boss_slagmaw()
163+
{
164+
RegisterRagefireChasmCreatureAI(boss_slagmaw);
165+
}

src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,10 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
#include "AreaBoundary.h"
1918
#include "ScriptMgr.h"
2019
#include "InstanceScript.h"
2120
#include "ragefire_chasm.h"
2221

23-
BossBoundaryData const boundaries =
24-
{
25-
{ BOSS_SLAGMAW, new RectangleBoundary(-298.2f, -257.1f, 94.4f, 172.4f) }
26-
};
27-
2822
ObjectData const creatureData[] =
2923
{
3024
{ NPC_ADAROGG, BOSS_ADAROGG },
@@ -54,7 +48,6 @@ class instance_ragefire_chasm : public InstanceMapScript
5448
SetHeaders(DataHeader);
5549
SetBossNumber(EncounterCount);
5650
LoadObjectData(creatureData, nullptr);
57-
LoadBossBoundaries(boundaries);
5851
LoadDungeonEncounterData(encounters);
5952
}
6053
};

src/server/scripts/Kalimdor/kalimdor_script_loader.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void AddSC_instance_dragon_soul();
6565
// Ragefire Chasm
6666
void AddSC_boss_adarogg();
6767
void AddSC_boss_dark_shaman_koranthal();
68+
void AddSC_boss_slagmaw();
6869
void AddSC_boss_lava_guard_gordoth();
6970
void AddSC_instance_ragefire_chasm();
7071
// Maraudon
@@ -209,6 +210,7 @@ void AddKalimdorScripts()
209210
// Ragefire Chasm
210211
AddSC_boss_adarogg();
211212
AddSC_boss_dark_shaman_koranthal();
213+
AddSC_boss_slagmaw();
212214
AddSC_boss_lava_guard_gordoth();
213215
AddSC_instance_ragefire_chasm();
214216
//Maraudon

0 commit comments

Comments
 (0)