diff options
author | Ovahlord <dreadkiller@gmx.de> | 2024-06-28 18:51:38 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-06-28 18:51:38 +0200 |
commit | 686f10cb0f4684aa55b3ad8682123007384ea0a6 (patch) | |
tree | 686ba1b73e33cf873360dd8135fbc122edeea86f | |
parent | 9b2c78694dce80c2aa4528dccaa6f6a441cf2459 (diff) |
Core/Spells: ported the Dark Simulacrum implementation from a33864ce2d9038e491fe99eba8acc532ebd6327f
-rw-r--r-- | sql/updates/world/cata_classic/2024_06_28_00_world.sql | 8 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 79 |
2 files changed, 87 insertions, 0 deletions
diff --git a/sql/updates/world/cata_classic/2024_06_28_00_world.sql b/sql/updates/world/cata_classic/2024_06_28_00_world.sql new file mode 100644 index 00000000000..3a20188dfe4 --- /dev/null +++ b/sql/updates/world/cata_classic/2024_06_28_00_world.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc` WHERE `SpellId` IN (77616); +INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES +(77616,0x00,0,0x00000000,0x00000000,0x00000000,0x00000000,0x0,0x0,0x7,0x1,0x0,0x0,0x0,0,0,0,0); -- Dark Simulacrum + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dk_dark_simulacrum','spell_dk_dark_simulacrum_buff'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(77606,'spell_dk_dark_simulacrum'), +(77616,'spell_dk_dark_simulacrum_buff'); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 778a7f54772..392dcc153c7 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -22,7 +22,86 @@ */ #include "ScriptMgr.h" +#include "Spell.h" +#include "SpellAuraEffects.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "Unit.h" + +enum DeathKnightSpells +{ + SPELL_DK_DARK_SIMULACRUM_BUFF = 77616, + SPELL_DK_DARK_SIMULACRUM_SPELLPOWER_BUFF = 94984 +}; + +// 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); + } +}; void AddSC_deathknight_spell_scripts() { + RegisterSpellScript(spell_dk_dark_simulacrum); + RegisterSpellScript(spell_dk_dark_simulacrum_buff); } |