aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-12-20 17:20:33 +0100
committerOvahlord <dreadkiller@gmx.de>2024-12-20 17:20:33 +0100
commitab72a23a9fb14eb28b80a1945f17180d5440fc8d (patch)
tree5307a2942342799d7bd7a8f6b2301bebf4c95ddb
parentd353eb35a683e861d64f8ad72079406da3b7fef1 (diff)
Scripts/Spells: fixed Runic Empowerment
-rw-r--r--sql/updates/world/cata_classic/2024_12_20_00_world.sql7
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp63
2 files changed, 69 insertions, 1 deletions
diff --git a/sql/updates/world/cata_classic/2024_12_20_00_world.sql b/sql/updates/world/cata_classic/2024_12_20_00_world.sql
new file mode 100644
index 00000000000..48a099da5fb
--- /dev/null
+++ b/sql/updates/world/cata_classic/2024_12_20_00_world.sql
@@ -0,0 +1,7 @@
+DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_dk_runic_empowerment';
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(81229, 'spell_dk_runic_empowerment');
+
+DELETE FROM `spell_proc` WHERE `SpellId`= 81229;
+INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`) VALUES
+(81229, 15, 0x0, 0x4 | 0x20000000, 0x1, 0x1, 0x2, 0x0);
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 392dcc153c7..aba933d31a9 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -22,6 +22,8 @@
*/
#include "ScriptMgr.h"
+#include "Containers.h"
+#include "Player.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
@@ -31,7 +33,10 @@
enum DeathKnightSpells
{
SPELL_DK_DARK_SIMULACRUM_BUFF = 77616,
- SPELL_DK_DARK_SIMULACRUM_SPELLPOWER_BUFF = 94984
+ SPELL_DK_DARK_SIMULACRUM_SPELLPOWER_BUFF = 94984,
+ SPELL_DK_ENERGIZE_BLOOD_RUNE = 81166,
+ SPELL_DK_ENERGIZE_FROST_RUNE = 81168,
+ SPELL_DK_ENERGIZE_UNHOLY_RUNE = 81169
};
// 77606 - Dark Simulacrum
@@ -100,8 +105,64 @@ class spell_dk_dark_simulacrum_buff : public AuraScript
}
};
+// 81229 - Runic Empowerment
+class spell_dk_runic_empowerment : public AuraScript
+{
+ bool Load() override
+ {
+ if (!GetCaster()->IsPlayer() || GetCaster()->ToPlayer()->GetClass() != CLASS_DEATH_KNIGHT)
+ return false;
+
+ return true;
+ }
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_DK_ENERGIZE_BLOOD_RUNE, SPELL_DK_ENERGIZE_UNHOLY_RUNE, SPELL_DK_ENERGIZE_FROST_RUNE });
+ }
+
+ void HandleProc(AuraEffect const* aurEff, ProcEventInfo const& /*eventInfo*/) const
+ {
+ std::vector<uint32> energizeSpells;
+ Player* player = GetTarget()->ToPlayer();
+
+ for (RuneType runeType : { RuneType::Blood, RuneType::Unholy, RuneType::Frost })
+ {
+ if (player->IsRuneFullyDepleted(runeType))
+ {
+ switch (runeType)
+ {
+ case RuneType::Blood:
+ energizeSpells.push_back(SPELL_DK_ENERGIZE_BLOOD_RUNE);
+ break;
+ case RuneType::Frost:
+ energizeSpells.push_back(SPELL_DK_ENERGIZE_FROST_RUNE);
+ break;
+ case RuneType::Unholy:
+ energizeSpells.push_back(SPELL_DK_ENERGIZE_UNHOLY_RUNE);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (energizeSpells.empty())
+ return;
+
+ uint32 spellId = Trinity::Containers::SelectRandomContainerElement(energizeSpells);
+ player->CastSpell(nullptr, spellId, CastSpellExtraArgs(aurEff));
+ }
+
+ void Register() override
+ {
+ OnEffectProc += AuraEffectProcFn(spell_dk_runic_empowerment::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+};
+
void AddSC_deathknight_spell_scripts()
{
RegisterSpellScript(spell_dk_dark_simulacrum);
RegisterSpellScript(spell_dk_dark_simulacrum_buff);
+ RegisterSpellScript(spell_dk_runic_empowerment);
}