Scripts/Spells: Implemented Dark Simulacrum and its related attribute SPELL_ATTR9_ALLOW_DARK_SIMULACRUM

This commit is contained in:
Shauren
2024-06-27 12:58:44 +02:00
parent cb335c3274
commit a33864ce2d
4 changed files with 82 additions and 4 deletions

View File

@@ -49,6 +49,8 @@ enum DeathKnightSpells
SPELL_DK_BLOOD_SHIELD_MASTERY = 77513,
SPELL_DK_BREATH_OF_SINDRAGOSA = 152279,
SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999,
SPELL_DK_DARK_SIMULACRUM_BUFF = 77616,
SPELL_DK_DARK_SIMULACRUM_SPELLPOWER_BUFF = 94984,
SPELL_DK_DEATH_AND_DECAY_DAMAGE = 52212,
SPELL_DK_DEATH_COIL_DAMAGE = 47632,
SPELL_DK_DEATH_GRIP_DUMMY = 243912,
@@ -324,6 +326,72 @@ class spell_dk_dancing_rune_weapon : public AuraScript
}
};
// 77606 - Dark Simulacrum
class spell_dk_dark_simulacrum : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DK_DARK_SIMULACRUM_BUFF, SPELL_DK_DARK_SIMULACRUM_SPELLPOWER_BUFF });
}
bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo const& eventInfo) const
{
Spell const* procSpell = eventInfo.GetProcSpell();
if (!procSpell)
return false;
if (!GetTarget()->IsPlayer())
return procSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR9_ALLOW_DARK_SIMULACRUM);
if (!procSpell->HasPowerTypeCost(POWER_MANA))
return false;
// filter out spells not castable by mind controlled players (teleports, summons, item creations (healthstones))
if (procSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR1_NO_AUTOCAST_AI))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo const& eventInfo) const
{
Unit* caster = GetCaster();
if (!caster)
return;
caster->CastSpell(caster, SPELL_DK_DARK_SIMULACRUM_BUFF, CastSpellExtraArgs()
.SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR)
.SetTriggeringSpell(eventInfo.GetProcSpell())
.AddSpellMod(SPELLVALUE_BASE_POINT0, eventInfo.GetSpellInfo()->Id));
caster->CastSpell(caster, SPELL_DK_DARK_SIMULACRUM_SPELLPOWER_BUFF, CastSpellExtraArgs()
.SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR)
.SetTriggeringSpell(eventInfo.GetProcSpell())
.AddSpellMod(SPELLVALUE_BASE_POINT0, GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_MAGIC))
.AddSpellMod(SPELLVALUE_BASE_POINT1, GetTarget()->SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_MAGIC)));
}
void Register() override
{
DoCheckEffectProc += AuraCheckEffectProcFn(spell_dk_dark_simulacrum::CheckProc, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectProc += AuraEffectProcFn(spell_dk_dark_simulacrum::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
// 77616 - Dark Simulacrum
class spell_dk_dark_simulacrum_buff : public AuraScript
{
bool CheckProc(AuraEffect const* aurEff, ProcEventInfo const& eventInfo) const
{
return uint32(aurEff->GetAmount()) == eventInfo.GetSpellInfo()->Id;
}
void Register() override
{
DoCheckEffectProc += AuraCheckEffectProcFn(spell_dk_dark_simulacrum_buff::CheckProc, EFFECT_0, SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_TRIGGERED);
}
};
// 43265 - Death and Decay (Aura)
class spell_dk_death_and_decay : public AuraScript
{
@@ -951,6 +1019,8 @@ void AddSC_deathknight_spell_scripts()
RegisterSpellScript(spell_dk_blinding_sleet);
RegisterSpellScript(spell_dk_blood_boil);
RegisterSpellScript(spell_dk_dancing_rune_weapon);
RegisterSpellScript(spell_dk_dark_simulacrum);
RegisterSpellScript(spell_dk_dark_simulacrum_buff);
RegisterSpellScript(spell_dk_death_and_decay);
RegisterSpellScript(spell_dk_death_coil);
RegisterSpellScript(spell_dk_death_gate);