fix(Scripts/SerpentshrineCavern): Use proper spells to handle the Lur… (#18002)

* fix(Scripts/SerpentshrineCavern): Use proper spells to handle the Lurker spout rotation

* Update boss_lurker_below.cpp
This commit is contained in:
Andrew
2023-12-12 04:45:43 -03:00
committed by GitHub
parent 9f1abf1214
commit a84a56536d
2 changed files with 16 additions and 38 deletions
@@ -0,0 +1,4 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id` = 37429 AND `ScriptName` = 'spell_lurker_below_spout';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(37429, 'spell_lurker_below_spout');
@@ -23,12 +23,13 @@
enum Spells enum Spells
{ {
SPELL_WATER_BOLT = 37138, SPELL_WATER_BOLT = 37138,
SPELL_WHIRL = 37660, SPELL_WHIRL = 37660,
SPELL_GEYSER = 37478, SPELL_GEYSER = 37478,
SPELL_SPOUT_VISUAL = 37431, SPELL_SPOUT_VISUAL = 37431,
SPELL_SPOUT_PERIODIC = 37430, SPELL_SPOUT_PERIODIC_1 = 37429,
SPELL_LURKER_SPAWN_TRIGGER = 54587, // Needed for achievement SPELL_SPOUT_PERIODIC_2 = 37430,
SPELL_LURKER_SPAWN_TRIGGER = 54587, // Needed for achievement
SPELL_CLEAR_ALL_DEBUFFS = 34098, SPELL_CLEAR_ALL_DEBUFFS = 34098,
SPELL_SUBMERGE_VISUAL = 28819, SPELL_SUBMERGE_VISUAL = 28819,
@@ -38,8 +39,6 @@ enum Misc
{ {
EMOTE_TAKE_BREATH = 0, EMOTE_TAKE_BREATH = 0,
ACTION_START_EVENT = 1, ACTION_START_EVENT = 1,
ACTION_ROTATE = 2,
ACTION_SHUFFLE_ROTATION = 3,
MAX_SUMMONS = 9, MAX_SUMMONS = 9,
NPC_COILFANG_GUARDIAN = 21873, NPC_COILFANG_GUARDIAN = 21873,
@@ -67,7 +66,7 @@ const Position positions[MAX_SUMMONS] =
struct boss_the_lurker_below : public BossAI struct boss_the_lurker_below : public BossAI
{ {
boss_the_lurker_below(Creature* creature) : BossAI(creature, DATA_THE_LURKER_BELOW), _clockWise(false) { } boss_the_lurker_below(Creature* creature) : BossAI(creature, DATA_THE_LURKER_BELOW) { }
void Reset() override void Reset() override
{ {
@@ -75,7 +74,6 @@ struct boss_the_lurker_below : public BossAI
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->SetStandState(UNIT_STAND_STATE_SUBMERGED); me->SetStandState(UNIT_STAND_STATE_SUBMERGED);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
_clockWise = RAND(false, true);
} }
void EnterEvadeMode(EvadeReason why) override void EnterEvadeMode(EvadeReason why) override
@@ -94,15 +92,6 @@ struct boss_the_lurker_below : public BossAI
me->SetStandState(UNIT_STAND_STATE_STAND); me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetInCombatWithZone(); me->SetInCombatWithZone();
} }
else if (action == ACTION_ROTATE)
{
float orientation = _clockWise ? Position::NormalizeOrientation(me->GetOrientation() + 0.1f) : Position::NormalizeOrientation(me->GetOrientation() - 0.1f);
me->SetFacingTo(orientation);
}
else if (action == ACTION_SHUFFLE_ROTATION)
{
_clockWise = RAND(false, true);
}
} }
void AttackStart(Unit* who) override void AttackStart(Unit* who) override
@@ -150,7 +139,7 @@ struct boss_the_lurker_below : public BossAI
scheduler.Schedule(3s, [this](TaskContext) scheduler.Schedule(3s, [this](TaskContext)
{ {
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
DoCastSelf(SPELL_SPOUT_PERIODIC, true); DoCastSelf(RAND(SPELL_SPOUT_PERIODIC_1, SPELL_SPOUT_PERIODIC_2), true);
}); });
context.Repeat(60s); context.Repeat(60s);
}).Schedule(p2Timer, [this](TaskContext) }).Schedule(p2Timer, [this](TaskContext)
@@ -223,9 +212,6 @@ struct boss_the_lurker_below : public BossAI
} }
me->resetAttackTimer(); me->resetAttackTimer();
} }
private:
bool _clockWise;
}; };
class go_strange_pool : public GameObjectScript class go_strange_pool : public GameObjectScript
@@ -252,11 +238,6 @@ class spell_lurker_below_spout : public AuraScript
{ {
PrepareAuraScript(spell_lurker_below_spout); PrepareAuraScript(spell_lurker_below_spout);
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& /*isPeriodic*/, int32& amplitude)
{
amplitude = 200;
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
SetDuration(16000); SetDuration(16000);
@@ -270,27 +251,20 @@ class spell_lurker_below_spout : public AuraScript
creature->SetReactState(REACT_AGGRESSIVE); creature->SetReactState(REACT_AGGRESSIVE);
if (Unit* target = creature->GetVictim()) if (Unit* target = creature->GetVictim())
creature->SetTarget(target->GetGUID()); creature->SetTarget(target->GetGUID());
if (GetUnitOwner()->GetAI())
{
GetUnitOwner()->GetAI()->DoAction(ACTION_SHUFFLE_ROTATION);
}
} }
} }
void OnPeriodic(AuraEffect const* aurEff) void OnPeriodic(AuraEffect const* aurEff)
{ {
PreventDefaultAction(); PreventDefaultAction();
if (GetUnitOwner()->GetAI()) Unit* caster = GetUnitOwner();
{ float orientation = GetSpellInfo()->Id == SPELL_SPOUT_PERIODIC_1 ? Position::NormalizeOrientation(caster->GetOrientation() + 0.1f) : Position::NormalizeOrientation(caster->GetOrientation() - 0.1f);
GetUnitOwner()->GetAI()->DoAction(ACTION_ROTATE); caster->SetFacingTo(orientation);
}
GetUnitOwner()->CastSpell(GetUnitOwner(), aurEff->GetAmount(), true); GetUnitOwner()->CastSpell(GetUnitOwner(), aurEff->GetAmount(), true);
} }
void Register() override void Register() override
{ {
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_lurker_below_spout::CalcPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectApply += AuraEffectApplyFn(spell_lurker_below_spout::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); OnEffectApply += AuraEffectApplyFn(spell_lurker_below_spout::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_lurker_below_spout::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); OnEffectRemove += AuraEffectRemoveFn(spell_lurker_below_spout::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_lurker_below_spout::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); OnEffectPeriodic += AuraEffectPeriodicFn(spell_lurker_below_spout::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);