This commit is contained in:
luis
2026-09-27 13:41:50 -03:00
parent 0cf63552e0
commit 098c6241c1
+101
View File
@@ -76,9 +76,11 @@ enum DeathKnightSpells
SPELL_DK_DEATH_GRIP_DUMMY = 243912,
SPELL_DK_DEATH_GRIP_JUMP = 49575,
SPELL_DK_DEATH_GRIP_TAUNT = 51399,
SPELL_DK_DEATH_STRIKE = 49998,
SPELL_DK_DEATH_STRIKE_ENABLER = 89832, // Server Side
SPELL_DK_DEATH_STRIKE_HEAL = 45470,
SPELL_DK_DEATH_STRIKE_OFFHAND = 66188,
SPELL_DK_FESTERING_STRIKE = 85948,
SPELL_DK_FROST = 137006,
SPELL_DK_FROST_FEVER = 55095,
SPELL_DK_FROST_SCYTHE = 207230,
@@ -1924,6 +1926,103 @@ class spell_dk_putrefy : public SpellScript
}
};
// 85948 - Festering Strike
// The spell carries no aura of its own, only the two dummy effects that hold how many Scourge
// Strikes are left to summon a Lesser Ghoul, so the blight is tracked on the caster here and
// consumed by spell_dk_festering_strike_scourge_strike below.
struct FesteringStrikeBlight
{
static void Apply(Unit* caster, uint32 charges)
{
if (charges)
Charges()[caster->GetGUID()] = charges;
else
Charges().erase(caster->GetGUID());
}
// Returns true when a Scourge Strike was actually owed a ghoul
static bool Consume(Unit* caster)
{
auto& charges = Charges();
auto itr = charges.find(caster->GetGUID());
if (itr == charges.end())
return false;
if (--itr->second == 0)
charges.erase(itr);
return true;
}
private:
static std::unordered_map<ObjectGuid, uint32>& Charges()
{
static std::unordered_map<ObjectGuid, uint32> charges;
return charges;
}
};
class spell_dk_festering_strike : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DK_LESSER_GHOUL_SUMMON });
}
void HandleApplyBlight(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
// Effect 2 and effect 3 hold the lowest and the highest amount of Scourge Strikes that
// summon a ghoul, so the blight lasts a random amount in between
SpellInfo const* spellInfo = GetSpell()->GetSpellInfo();
int32 const minCharges = int32(spellInfo->GetEffect(EFFECT_2).CalcBaseValue(caster, GetHitUnit(), 0, 0));
int32 const maxCharges = int32(spellInfo->GetEffect(EFFECT_3).CalcBaseValue(caster, GetHitUnit(), 0, 0));
if (minCharges < 0 || maxCharges < minCharges)
return;
FesteringStrikeBlight::Apply(caster, urand(uint32(minCharges), uint32(maxCharges)));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dk_festering_strike::HandleApplyBlight, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
// The Scourge Strikes (Death Strike, Icy Touch, Obliterate) spend the blight Festering Strike
// leaves behind, each one summoning a Lesser Ghoul. They are attached by ScriptName rather than
// looked up by id, so the exact spell ids only matter for the SQL rows.
class spell_dk_festering_strike_scourge_strike : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
// Only the ghoul is used at runtime. The Scourge Strikes are attached by ScriptName, so
// validating them here would discard the whole script if any one of them is absent.
return ValidateSpellInfo({ SPELL_DK_LESSER_GHOUL_SUMMON });
}
void SummonLesserGhoul()
{
Unit* caster = GetCaster();
if (!caster || !FesteringStrikeBlight::Consume(caster))
return;
caster->CastSpell(nullptr, SPELL_DK_LESSER_GHOUL_SUMMON, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.TriggeringSpell = GetSpell()
});
}
void Register() override
{
AfterCast += SpellCastFn(spell_dk_festering_strike_scourge_strike::SummonLesserGhoul);
}
};
// 1256576 - Forbidden Sacrifice (triggered by Putrefy when 1256565 - Forbidden Knowledge is known)
class spell_dk_forbidden_sacrifice : public AuraScript
{
@@ -2145,6 +2244,8 @@ void AddSC_deathknight_spell_scripts()
RegisterSpellScript(spell_dk_voracious);
RegisterSpellScript(spell_dk_vestigial_shell);
RegisterSpellScript(spell_dk_putrefy);
RegisterSpellScript(spell_dk_festering_strike);
RegisterSpellScript(spell_dk_festering_strike_scourge_strike);
RegisterSpellScript(spell_dk_forbidden_sacrifice);
RegisterSpellScript(spell_dk_frozen_dominion);
RegisterSpellScript(spell_dk_pillar_of_frost);