Scripts/Spells: Implement death knight talent Soul Reaper (#30236)

Co-authored-by: Shauren <[email protected]>
This commit is contained in:
Aqua Deus
2024-11-17 19:54:29 +01:00
committed by GitHub
co-authored by Shauren
parent f8de112619
commit 9b78546db2
2 changed files with 106 additions and 0 deletions
@@ -0,0 +1,11 @@
DELETE FROM `spell_proc` WHERE `SpellId` IN (469172);
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
(469172,0x00,15,0x00000000,0x00000000,0x00000000,0x00000000,0x0,0x0,0x0,0x1,0x0,0x8,0x0,0,0,0,0); -- Reaper of Souls
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dk_soul_reaper';
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dk_soul_reaper_reaper_of_souls';
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dk_reaper_of_souls';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(343294, 'spell_dk_soul_reaper'),
(469180, 'spell_dk_soul_reaper_reaper_of_souls'),
(343294, 'spell_dk_reaper_of_souls');
+95
View File
@@ -78,12 +78,16 @@ enum DeathKnightSpells
SPELL_DK_OBLITERATION_RUNE_ENERGIZE = 281327,
SPELL_DK_PILLAR_OF_FROST = 51271,
SPELL_DK_RAISE_DEAD_SUMMON = 52150,
SPELL_DK_REAPER_OF_SOULS_PROC = 469172,
SPELL_DK_RUNIC_CORRUPTION = 51460,
SPELL_DK_RECENTLY_USED_DEATH_STRIKE = 180612,
SPELL_DK_RUNIC_POWER_ENERGIZE = 49088,
SPELL_DK_RUNIC_RETURN = 61258,
SPELL_DK_SLUDGE_BELCHER = 207313,
SPELL_DK_SLUDGE_BELCHER_SUMMON = 212027,
SPELL_DK_SMOTHERING_OFFENSE = 435005,
SPELL_DK_SOUL_REAPER = 343294,
SPELL_DK_SOUL_REAPER_DAMAGE = 343295,
SPELL_DK_SUBDUING_GRASP_TALENT = 454822,
SPELL_DK_SUBDUING_GRASP_DEBUFF = 454824,
SPELL_DK_DEATH_STRIKE_ENABLER = 89832, // Server Side
@@ -1027,6 +1031,40 @@ class spell_dk_raise_dead : public SpellScript
}
};
// 440002 - Reaper of Souls (attached to 343294 - Soul Reaper)
class spell_dk_reaper_of_souls : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DK_REAPER_OF_SOULS_PROC });
}
bool IsAffectedByReaperOfSouls() const
{
if (Aura* reaperOfSouls = GetCaster()->GetAura(SPELL_DK_REAPER_OF_SOULS_PROC))
return GetSpell()->m_appliedMods.contains(reaperOfSouls);
return false;
}
void HandleDefault(WorldObject*& target) const
{
if (IsAffectedByReaperOfSouls())
target = nullptr;
}
void HandleReaperOfSouls(SpellEffIndex effIndex)
{
if (!IsAffectedByReaperOfSouls())
PreventHitDefaultEffect(effIndex);
}
void Register() override
{
OnObjectTargetSelect += SpellObjectTargetSelectFn(spell_dk_reaper_of_souls::HandleDefault, EFFECT_1, TARGET_UNIT_TARGET_ENEMY);
OnEffectLaunch += SpellEffectFn(spell_dk_reaper_of_souls::HandleReaperOfSouls, EFFECT_3, SPELL_EFFECT_TRIGGER_SPELL);
}
};
// 59057 - Rime
class spell_dk_rime : public AuraScript
{
@@ -1050,6 +1088,60 @@ class spell_dk_rime : public AuraScript
}
};
// 343294 - Soul Reaper
// 469180 - Soul Reaper
class spell_dk_soul_reaper : public AuraScript
{
public:
explicit spell_dk_soul_reaper(SpellEffIndex auraEffectIndex, Optional<SpellEffIndex> healthLimitEffectIndex)
: _auraEffectIndex(auraEffectIndex), _healthLimitEffectIndex(healthLimitEffectIndex) { }
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DK_SOUL_REAPER, SPELL_DK_SOUL_REAPER_DAMAGE, SPELL_DK_RUNIC_CORRUPTION });
}
void HandleOnTick(AuraEffect const* aurEff) const
{
Unit* target = GetTarget();
Unit* caster = GetCaster();
if (!caster)
return;
if (!_healthLimitEffectIndex || target->GetHealthPct() < float(GetEffectInfo(*_healthLimitEffectIndex).CalcValue(caster)))
caster->CastSpell(target, SPELL_DK_SOUL_REAPER_DAMAGE, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.TriggeringAura = aurEff
});
}
void RemoveEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
return;
Player* caster = Object::ToPlayer(GetCaster());
if (!caster)
return;
if (caster->isHonorOrXPTarget(GetTarget()))
caster->CastSpell(caster, SPELL_DK_RUNIC_CORRUPTION, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.TriggeringAura = aurEff
});
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_soul_reaper::HandleOnTick, _auraEffectIndex, SPELL_AURA_PERIODIC_DUMMY);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_soul_reaper::RemoveEffect, _auraEffectIndex, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
private:
SpellEffIndex _auraEffectIndex;
Optional<SpellEffIndex> _healthLimitEffectIndex;
};
// Called by 383312 Abomination Limb and 49576 - Death Grip
// 454822 - Subduing Grasp
class spell_dk_subduing_grasp : public SpellScript
@@ -1197,7 +1289,10 @@ void AddSC_deathknight_spell_scripts()
RegisterSpellScript(spell_dk_pet_skeleton_transform);
RegisterSpellScript(spell_dk_pvp_4p_bonus);
RegisterSpellScript(spell_dk_raise_dead);
RegisterSpellScript(spell_dk_reaper_of_souls);
RegisterSpellScript(spell_dk_rime);
RegisterSpellScriptWithArgs(spell_dk_soul_reaper, "spell_dk_soul_reaper", EFFECT_1, EFFECT_2);
RegisterSpellScriptWithArgs(spell_dk_soul_reaper, "spell_dk_soul_reaper_reaper_of_souls", EFFECT_0, Optional<SpellEffIndex>());
RegisterSpellScript(spell_dk_subduing_grasp);
RegisterSpellScript(spell_dk_t20_2p_rune_empowered);
RegisterSpellScript(spell_dk_vampiric_blood);