fix(Script/Spell): Vanish Purge behavior (#18127)

This commit is contained in:
Kitzunu
2024-01-07 16:03:53 +01:00
committed by GitHub
parent a1f924050f
commit 7a859da266
3 changed files with 67 additions and 29 deletions

View File

@@ -0,0 +1,6 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id` = 18461 AND `ScriptName` = 'spell_rog_vanish_purge';
DELETE FROM `spell_script_names` WHERE `spell_id` = -1856 AND `ScriptName` = 'spell_rog_vanish';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(18461, 'spell_rog_vanish_purge'),
(-1856, 'spell_rog_vanish');

View File

@@ -809,23 +809,6 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
break;
}
// Vanish (not exist)
case 18461:
{
unitTarget->RemoveMovementImpairingAuras(true);
unitTarget->RemoveAurasByType(SPELL_AURA_MOD_STALKED);
// See if we already are stealthed. If so, we're done.
if (unitTarget->HasAura(1784))
return;
// Reset cooldown on stealth if needed
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->ToPlayer()->HasSpellCooldown(1784))
unitTarget->ToPlayer()->RemoveSpellCooldown(1784);
unitTarget->CastSpell(unitTarget, 1784, true);
return;
}
// Demonic Empowerment -- succubus
case 54437:
{
@@ -4079,18 +4062,6 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
// Xinef: Set last sanctuary time
unitTarget->m_lastSanctuaryTime = GameTime::GetGameTimeMS().count();
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
if (m_caster->GetTypeId() == TYPEID_PLAYER
&& m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE
&& (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VANISH))
{
m_caster->ToPlayer()->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
//Clean Escape
if (m_caster->HasAura(23582))
m_caster->CastSpell(m_caster, 23583, true);
}
}
void Spell::EffectAddComboPoints(SpellEffIndex /*effIndex*/)

View File

@@ -693,6 +693,65 @@ class spell_rog_pickpocket : public SpellScript
}
};
enum vanish
{
SPELL_PARALYZE = 38132,
SPELL_CLEAN_ESCAPE_AURA = 23582,
SPELL_CLEAN_ESCAPE_HEAL = 23583
};
// 18461 - Vanish Purge (Server Side)
class spell_rog_vanish_purge : public SpellScript
{
PrepareSpellScript(spell_rog_vanish_purge);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PARALYZE });
}
void HandleRootRemove(SpellEffIndex /*effIndex*/)
{
if (GetCaster() && !GetCaster()->HasAura(SPELL_PARALYZE)) // Root from Tainted Core SSC, should not be removed by vanish.
GetCaster()->RemoveAurasWithMechanic(1 << MECHANIC_ROOT);
}
void HandleSnareRemove(SpellEffIndex /*effIndex*/)
{
if (GetCaster())
GetCaster()->RemoveAurasWithMechanic(1 << MECHANIC_SNARE);
}
void Register() override
{
// Blizzard handles EFFECT_0 as the unroot and EFFECT_1 as unsnare. Hence why they are not done in the same place.
OnEffectHitTarget += SpellEffectFn(spell_rog_vanish_purge::HandleRootRemove, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
OnEffectHitTarget += SpellEffectFn(spell_rog_vanish_purge::HandleSnareRemove, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
}
};
// -1856 - Vanish
class spell_rog_vanish : public SpellScript
{
PrepareSpellScript(spell_rog_vanish);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_CLEAN_ESCAPE_AURA, SPELL_CLEAN_ESCAPE_HEAL });
}
void HandleEffect(SpellEffIndex /*effIndex*/)
{
if (GetCaster() && GetCaster()->HasAura(SPELL_CLEAN_ESCAPE_AURA))
GetCaster()->CastSpell(GetCaster(), SPELL_CLEAN_ESCAPE_HEAL, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rog_vanish::HandleEffect, EFFECT_2, SPELL_EFFECT_SANCTUARY);
}
};
void AddSC_rogue_spell_scripts()
{
RegisterSpellScript(spell_rog_savage_combat);
@@ -709,5 +768,7 @@ void AddSC_rogue_spell_scripts()
RegisterSpellScript(spell_rog_tricks_of_the_trade);
RegisterSpellScript(spell_rog_tricks_of_the_trade_proc);
RegisterSpellScript(spell_rog_pickpocket);
RegisterSpellScript(spell_rog_vanish_purge);
RegisterSpellScript(spell_rog_vanish);
}