From de82b464c8206defe8c4b483b4a8868954ddfe58 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 11 Sep 2021 14:10:53 +0200 Subject: [PATCH] Core/Spells: greatly simplify Runic Empowerment Sniffs have shown that there is no energize spell being involved in the activation. Probably because the activate spell effect does not care about fully depleted runes so we now can slim it all down by alot --- src/server/scripts/Spells/spell_dk.cpp | 64 ++++++++------------------ 1 file changed, 18 insertions(+), 46 deletions(-) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 988170a3518..4ed6e7e4f80 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -61,9 +61,6 @@ enum DeathKnightSpells SPELL_DK_DEATH_STRIKE_HEAL = 45470, SPELL_DK_DEATH_STRIKE_ENABLER = 89832, SPELL_DK_EBON_PLAGUE = 65142, - SPELL_DK_ENERGIZE_BLOOD_RUNE = 81166, - SPELL_DK_ENERGIZE_FROST_RUNE = 81168, - SPELL_DK_ENERGIZE_UNHOLY_RUNE = 81169, SPELL_DK_FLAMING_TORRENT = 99000, SPELL_DK_FROST_FEVER = 55095, SPELL_DK_FROST_PRESENCE = 48266, @@ -1142,13 +1139,7 @@ class spell_dk_runic_empowerment : public AuraScript { bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo( - { - SPELL_DK_ENERGIZE_BLOOD_RUNE, - SPELL_DK_ENERGIZE_FROST_RUNE, - SPELL_DK_ENERGIZE_UNHOLY_RUNE, - SPELL_DK_RUNIC_CORRUPTION_TRIGGERED - }); + return ValidateSpellInfo({ SPELL_DK_RUNIC_CORRUPTION_TRIGGERED }); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) @@ -1166,54 +1157,35 @@ class spell_dk_runic_empowerment : public AuraScript return; } - std::array depletedRunes = { }; - std::array availableBaseRunes = { }; - + std::vector fullyDepletedRuneIndexes; for (uint8 i = 0; i < MAX_RUNES; ++i) { - if (player->GetRuneCooldown(i)) - { - uint8 baseRune = player->GetBaseRune(i); - ++depletedRunes[baseRune]; - if (baseRune == player->GetCurrentRune(i)) - ++availableBaseRunes[baseRune]; - } - } - - // Selecting the runes that may proc. A fully depleted rune means that both runes of that type must be on cooldown. - std::vector availableEnergizeSpells; - for (uint8 runeType = 0; runeType < depletedRunes.size(); ++runeType) - { - if (depletedRunes[runeType] < 2 || availableBaseRunes[runeType] == 0) + // Only activate fully depleted runes, which are being on hold until + if (player->GetRuneCooldown(i) != RUNE_BASE_COOLDOWN) continue; - switch (RuneType(runeType)) - { - case RUNE_BLOOD: - availableEnergizeSpells.push_back(SPELL_DK_ENERGIZE_BLOOD_RUNE); - break; - case RUNE_UNHOLY: - availableEnergizeSpells.push_back(SPELL_DK_ENERGIZE_UNHOLY_RUNE); - break; - case RUNE_FROST: - availableEnergizeSpells.push_back(SPELL_DK_ENERGIZE_FROST_RUNE); - break; - default: - break; - } + fullyDepletedRuneIndexes.push_back(i); } - if (availableEnergizeSpells.empty()) - return; - - if (uint32 spellId = Trinity::Containers::SelectRandomContainerElement(availableEnergizeSpells)) - player->CastSpell(nullptr, spellId, aurEff); + if (!fullyDepletedRuneIndexes.empty()) + if (uint8 runeIndex = Trinity::Containers::SelectRandomContainerElement(fullyDepletedRuneIndexes)) + ActivateRune(player, runeIndex); } void Register() override { OnEffectProc.Register(&spell_dk_runic_empowerment::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } + +private: + // Sniffs do not show any spell cast to activate runes. We just copy the code part from Spell::EffectActivateRune in this case with some small tweaks + void ActivateRune(Player* player, uint8 runeIndex) + { + uint8 currentRuneState = player->GetRunesState(); + player->SetRuneCooldown(runeIndex, 0); + uint8 runesState = player->GetRunesState() & ~currentRuneState; + player->AddRunePower(runesState); + } }; // 49184 - Howling Blast