Skip to content

Commit 13a7d54

Browse files
authored
Scripts/Steamvault: Update scripts (TrinityCore#31885)
Instance: * Improve Main Chambers Access Panel script by handling everything in one place * Replace direct change of gameobject flags with gameobject actions * Now door to Kalithresh closes when encounter is in progress Thespia: * Update spell timers and targets * Minor cosmetic changes Steamrigger: * Re-handle Summon Gnomes script using more appropriate OnEffectPeriodic hook * Add corpse delay for Steamrigger Mechanic * Update spell timers and targets Kalithresh: * Update spell timers * Remove unconfirmed spell
1 parent 3439fe4 commit 13a7d54

6 files changed

Lines changed: 156 additions & 141 deletions

File tree

src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
/* Timers requires update */
18+
/*
19+
* Timers requires to be revisited
20+
*/
1921

2022
#include "ScriptMgr.h"
2123
#include "ScriptedCreature.h"
@@ -53,51 +55,51 @@ struct boss_hydromancer_thespia : public BossAI
5355

5456
void JustEngagedWith(Unit* who) override
5557
{
56-
Talk(SAY_AGGRO);
5758
BossAI::JustEngagedWith(who);
5859

59-
events.ScheduleEvent(EVENT_LIGHTNING_CLOUD, 10s, 15s);
60-
events.ScheduleEvent(EVENT_LUNG_BURST, 7s, 12s);
61-
events.ScheduleEvent(EVENT_ENVELOPING_WINDS, 10s, 15s);
60+
Talk(SAY_AGGRO);
61+
62+
events.ScheduleEvent(EVENT_LIGHTNING_CLOUD, 5s, 15s);
63+
events.ScheduleEvent(EVENT_LUNG_BURST, 10s, 20s);
64+
events.ScheduleEvent(EVENT_ENVELOPING_WINDS, 10s, 20s);
6265
}
6366

64-
void OnSpellCast(SpellInfo const* spell) override
67+
void OnSpellCast(SpellInfo const* spellInfo) override
6568
{
66-
if (spell->Id == SPELL_LIGHTNING_CLOUD)
69+
if (spellInfo->Id == SPELL_LIGHTNING_CLOUD)
6770
if (roll_chance_i(50))
6871
Talk(SAY_CLOUD);
6972
}
7073

71-
void KilledUnit(Unit* who) override
74+
void KilledUnit(Unit* /*who*/) override
7275
{
73-
if (who->GetTypeId() == TYPEID_PLAYER)
74-
Talk(SAY_SLAY);
76+
Talk(SAY_SLAY);
7577
}
7678

7779
void JustDied(Unit* /*killer*/) override
7880
{
79-
Talk(SAY_DEATH);
8081
_JustDied();
82+
Talk(SAY_DEATH);
8183
}
8284

8385
void ExecuteEvent(uint32 eventId) override
8486
{
8587
switch (eventId)
8688
{
8789
case EVENT_LIGHTNING_CLOUD:
88-
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
90+
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f))
8991
DoCast(target, SPELL_LIGHTNING_CLOUD);
90-
events.Repeat(15s, 25s);
92+
events.Repeat(20s, 35s);
9193
break;
9294
case EVENT_LUNG_BURST:
93-
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
95+
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f))
9496
DoCast(target, SPELL_LUNG_BURST);
95-
events.Repeat(7s, 12s);
97+
events.Repeat(20s, 30s);
9698
break;
9799
case EVENT_ENVELOPING_WINDS:
98-
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 35.0f, true))
100+
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 35.0f))
99101
DoCast(target, SPELL_ENVELOPING_WINDS);
100-
events.Repeat(10s, 15s);
102+
events.Repeat(25s, 40s);
101103
break;
102104
default:
103105
break;
@@ -108,7 +110,7 @@ struct boss_hydromancer_thespia : public BossAI
108110
// 17917 - Coilfang Water Elemental
109111
struct npc_coilfang_waterelemental : public ScriptedAI
110112
{
111-
npc_coilfang_waterelemental(Creature* creature) : ScriptedAI(creature) { }
113+
using ScriptedAI::ScriptedAI;
112114

113115
void Reset() override
114116
{

src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp

Lines changed: 65 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
/* Timers requires update */
18+
/*
19+
* Timers requires to be revisited
20+
*/
1921

2022
#include "ScriptMgr.h"
21-
#include "ScriptedCreature.h"
22-
#include "SpellScript.h"
2323
#include "InstanceScript.h"
2424
#include "MotionMaster.h"
25+
#include "ScriptedCreature.h"
26+
#include "SpellScript.h"
27+
#include "SpellInfo.h"
2528
#include "steam_vault.h"
29+
#include "TemporarySummon.h"
2630

2731
enum SteamriggerTexts
2832
{
@@ -49,7 +53,7 @@ enum SteamriggerSpells
4953

5054
enum SteamriggerEvents
5155
{
52-
EVENT_SHRINK = 1,
56+
EVENT_SUPER_SHRINK_RAY = 1,
5357
EVENT_SAW_BLADE,
5458
EVENT_ELECTRIFIED_NET,
5559
EVENT_SUMMON,
@@ -82,11 +86,13 @@ struct boss_mekgineer_steamrigger : public BossAI
8286

8387
void JustEngagedWith(Unit* who) override
8488
{
85-
Talk(SAY_AGGRO);
8689
BossAI::JustEngagedWith(who);
87-
events.ScheduleEvent(EVENT_SHRINK, 20s);
90+
91+
Talk(SAY_AGGRO);
92+
93+
events.ScheduleEvent(EVENT_SUPER_SHRINK_RAY, 20s, 30s);
8894
events.ScheduleEvent(EVENT_SAW_BLADE, 5s, 20s);
89-
events.ScheduleEvent(EVENT_ELECTRIFIED_NET, 20s, 30s);
95+
events.ScheduleEvent(EVENT_ELECTRIFIED_NET, 10s, 20s);
9096
if (IsHeroic())
9197
events.ScheduleEvent(EVENT_SUMMON_H, 15s, 20s);
9298
}
@@ -113,15 +119,21 @@ struct boss_mekgineer_steamrigger : public BossAI
113119
}
114120
}
115121

122+
void OnSpellCast(SpellInfo const* spellInfo) override
123+
{
124+
if (spellInfo->Id == SPELL_SUMMON_GNOMES)
125+
Talk(SAY_MECHANICS);
126+
}
127+
116128
void KilledUnit(Unit* /*victim*/) override
117129
{
118130
Talk(SAY_SLAY);
119131
}
120132

121133
void JustDied(Unit* /*killer*/) override
122134
{
123-
Talk(SAY_DEATH);
124135
_JustDied();
136+
Talk(SAY_DEATH);
125137
}
126138

127139
void UpdateAI(uint32 diff) override
@@ -138,22 +150,21 @@ struct boss_mekgineer_steamrigger : public BossAI
138150
{
139151
switch (eventId)
140152
{
141-
case EVENT_SHRINK:
153+
case EVENT_SUPER_SHRINK_RAY:
142154
DoCastSelf(SPELL_SUPER_SHRINK_RAY);
143-
events.Repeat(15s, 25s);
155+
events.Repeat(35s, 50s);
144156
break;
145157
case EVENT_SAW_BLADE:
146-
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
158+
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
147159
DoCast(target, SPELL_SAW_BLADE);
148-
events.Repeat(10s, 20s);
160+
events.Repeat(8s, 15s);
149161
break;
150162
case EVENT_ELECTRIFIED_NET:
151163
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
152164
DoCast(target, SPELL_ELECTRIFIED_NET);
153-
events.Repeat(15s, 25s);
165+
events.Repeat(20s, 30s);
154166
break;
155167
case EVENT_SUMMON:
156-
Talk(SAY_MECHANICS);
157168
DoCastSelf(SPELL_SUMMON_GNOMES);
158169
break;
159170
case EVENT_SUMMON_H:
@@ -178,24 +189,36 @@ struct boss_mekgineer_steamrigger : public BossAI
178189
// 17951 - Steamrigger Mechanic
179190
struct npc_steamrigger_mechanic : public ScriptedAI
180191
{
181-
npc_steamrigger_mechanic(Creature* creature) : ScriptedAI(creature) { }
192+
using ScriptedAI::ScriptedAI;
193+
194+
void InitializeAI() override
195+
{
196+
if (me->IsSummon())
197+
{
198+
me->SetCorpseDelay(5, true);
199+
me->SetReactState(REACT_DEFENSIVE);
200+
}
201+
202+
ScriptedAI::InitializeAI();
203+
}
182204

183205
void Reset() override
184206
{
185207
_scheduler.CancelAll();
186208
}
187209

188-
void IsSummonedBy(WorldObject* ownerWO) override
210+
void JustAppeared() override
189211
{
190-
me->SetReactState(REACT_DEFENSIVE);
191-
192-
Creature* owner = ownerWO->ToCreature();
193-
if (!owner)
194-
return;
195-
196-
float x, y, z;
197-
owner->GetContactPoint(me, x, y, z);
198-
me->GetMotionMaster()->MovePoint(POINT_REPAIR, x, y, z);
212+
if (TempSummon* summon = me->ToTempSummon())
213+
{
214+
Unit* summoner = summon->GetSummonerUnit();
215+
if (summoner && summoner->IsCreature())
216+
{
217+
float x, y, z;
218+
summoner->GetContactPoint(me, x, y, z);
219+
me->GetMotionMaster()->MovePoint(POINT_REPAIR, x, y, z);
220+
}
221+
}
199222
}
200223

201224
void MovementInform(uint32 type, uint32 pointId) override
@@ -209,17 +232,17 @@ struct npc_steamrigger_mechanic : public ScriptedAI
209232

210233
void JustEngagedWith(Unit* /*who*/) override
211234
{
212-
_scheduler.Schedule(5s, 10s, [this](TaskContext task)
213-
{
214-
DoCastSelf(SPELL_DISPEL_MAGIC);
215-
task.Repeat(5s, 10s);
216-
});
217-
218-
_scheduler.Schedule(5s, [this](TaskContext task)
219-
{
220-
DoCastSelf(SPELL_REPAIR);
221-
task.Repeat(5s);
222-
});
235+
_scheduler
236+
.Schedule(5s, 10s, [this](TaskContext task)
237+
{
238+
DoCastSelf(SPELL_DISPEL_MAGIC);
239+
task.Repeat(5s, 10s);
240+
})
241+
.Schedule(5s, 15s, [this](TaskContext task)
242+
{
243+
DoCastSelf(SPELL_REPAIR);
244+
task.Repeat(5s, 10s);
245+
});
223246
}
224247

225248
void UpdateAI(uint32 diff) override
@@ -241,22 +264,22 @@ class spell_mekgineer_steamrigger_summon_gnomes : public AuraScript
241264
{
242265
PrepareAuraScript(spell_mekgineer_steamrigger_summon_gnomes);
243266

244-
bool Validate(SpellInfo const* /*spell*/) override
267+
bool Validate(SpellInfo const* /*spellInfo*/) override
245268
{
246269
return ValidateSpellInfo({ SPELL_SUMMON_GNOME_1, SPELL_SUMMON_GNOME_2, SPELL_SUMMON_GNOME_3 });
247270
}
248271

249-
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
272+
void OnPeriodic(AuraEffect const* /*aurEff*/)
250273
{
251274
Unit* target = GetTarget();
252-
target->CastSpell(target, SPELL_SUMMON_GNOME_1, true);
253-
target->CastSpell(target, SPELL_SUMMON_GNOME_2, true);
254-
target->CastSpell(target, SPELL_SUMMON_GNOME_3, true);
275+
target->CastSpell(nullptr, SPELL_SUMMON_GNOME_1, true);
276+
target->CastSpell(nullptr, SPELL_SUMMON_GNOME_2, true);
277+
target->CastSpell(nullptr, SPELL_SUMMON_GNOME_3, true);
255278
}
256279

257280
void Register() override
258281
{
259-
AfterEffectRemove += AuraEffectRemoveFn(spell_mekgineer_steamrigger_summon_gnomes::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
282+
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mekgineer_steamrigger_summon_gnomes::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
260283
}
261284
};
262285

0 commit comments

Comments
 (0)