Scripts/Spells: Implement Bone Shield application by Marrowrend and Death's Caress (#30163)

This commit is contained in:
Naddley
2024-09-08 14:09:15 +02:00
committed by GitHub
parent a4e3274aeb
commit 7f6afa67f3
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dk_marrowrend_apply_bone_shield';
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dk_deaths_caress_apply_bone_shield';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(195182, 'spell_dk_marrowrend_apply_bone_shield'),
(195292, 'spell_dk_deaths_caress_apply_bone_shield');

View File

@@ -47,6 +47,7 @@ enum DeathKnightSpells
SPELL_DK_BLOOD_PLAGUE = 55078,
SPELL_DK_BLOOD_SHIELD_ABSORB = 77535,
SPELL_DK_BLOOD_SHIELD_MASTERY = 77513,
SPELL_DK_BONE_SHIELD = 195181,
SPELL_DK_BREATH_OF_SINDRAGOSA = 152279,
SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999,
SPELL_DK_DARK_SIMULACRUM_BUFF = 77616,
@@ -189,6 +190,38 @@ private:
uint32 absorbedAmount;
};
// 195182 - Marrowrend
// 195292 - Death's Caress
class spell_dk_apply_bone_shield : public SpellScript
{
public:
explicit spell_dk_apply_bone_shield(SpellEffIndex effIndex) : _effIndex(effIndex) { }
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_DK_BONE_SHIELD })
&& ValidateSpellEffect({ { spellInfo->Id, _effIndex } })
&& spellInfo->GetEffect(_effIndex).CalcBaseValue(nullptr, nullptr, 0, 0) <= int32(sSpellMgr->AssertSpellInfo(SPELL_DK_BONE_SHIELD, DIFFICULTY_NONE)->StackAmount);
}
void HandleHitTarget(SpellEffIndex /*effIndex*/) const
{
Unit* caster = GetCaster();
for (int32 i = 0; i < GetEffectValue(); ++i)
caster->CastSpell(caster, SPELL_DK_BONE_SHIELD, CastSpellExtraArgs()
.SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR)
.SetTriggeringSpell(GetSpell()));
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_dk_apply_bone_shield::HandleHitTarget, _effIndex, SPELL_EFFECT_DUMMY);
}
private:
SpellEffIndex _effIndex;
};
static uint32 const ArmyTransforms[]
{
SPELL_DK_ARMY_FLESH_BEAST_TRANSFORM,
@@ -1015,6 +1048,8 @@ void AddSC_deathknight_spell_scripts()
{
RegisterSpellScript(spell_dk_advantage_t10_4p);
RegisterSpellScript(spell_dk_anti_magic_shell);
RegisterSpellScriptWithArgs(spell_dk_apply_bone_shield, "spell_dk_marrowrend_apply_bone_shield", EFFECT_2);
RegisterSpellScriptWithArgs(spell_dk_apply_bone_shield, "spell_dk_deaths_caress_apply_bone_shield", EFFECT_2);
RegisterSpellScript(spell_dk_army_transform);
RegisterSpellScript(spell_dk_blinding_sleet);
RegisterSpellScript(spell_dk_blood_boil);