mod-paragon: combined Arcane Torrent that refunds mana, energy, and runic power

Building on the previous fix that hid the rogue and DK Arcane Torrent variants
for Paragon Blood Elves: instead of just dropping the duplicates, turn the
remaining mana variant (28730) into a single combined racial that refunds
whichever resource pool the character is using at the moment.

Add SpellScript spell_paragon_arcane_torrent in modules/mod-paragon/src/
Paragon_SC.cpp. Hooks AfterCast on 28730: when the caster is class 12 the
script EnergizeBySpell's 15 energy and 150 internal runic power (= 15 displayed,
matching stock 25046 / 50613 amounts) on top of the spell's stock mana effect.
ModifyPower no-ops on pools the player has no max for, so it is safe even
before the Paragon picks up energy- or RP-using abilities. Non-Paragon Blood
Elves are untouched and keep learning their stock racial.

Update migration 2026_05_10_03.sql to also register the script binding via
spell_script_names (28730 -> 'spell_paragon_arcane_torrent'). Idempotent
DELETE + INSERT.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Docker Build
2026-05-09 15:44:42 -04:00
parent d96123e661
commit 16717acdd3
2 changed files with 66 additions and 3 deletions
+49
View File
@@ -13,6 +13,8 @@
#include "Player.h"
#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "UnitDefines.h"
#include "WorldPacket.h"
#include "WorldSession.h"
@@ -268,7 +270,54 @@ private:
std::unordered_map<ObjectGuid, Paragon_PlayerScript::ParagonRuneSyncState> Paragon_PlayerScript::runeSyncByGuid;
// Arcane Torrent (28730) for Paragon: Blood Elf racial skill line 756 has
// three Arcane Torrent variants in stock WotLK (28730 mana, 25046 rogue
// energy, 50613 DK runic power). For Paragon Blood Elves we keep only 28730
// (see migration 2026_05_10_03.sql) and turn it into a "combined" version:
// the stock spell already silences nearby enemies and energizes mana via its
// own effects; this script adds energy and runic power energize on top when
// the caster is class 12, so a single button refunds whichever resource pool
// the player is actually using. Non-Paragon casters are untouched and keep
// learning their stock racial variant.
class spell_paragon_arcane_torrent : public SpellScript
{
PrepareSpellScript(spell_paragon_arcane_torrent);
void HandleAfterCast()
{
Unit* caster = GetCaster();
if (!caster || !caster->IsPlayer())
return;
Player* player = caster->ToPlayer();
if (player->getClass() != CLASS_PARAGON)
return;
// Stock energize amounts from spell_dbc:
// 25046 Arcane Torrent (Energy) -> 15 energy
// 50613 Arcane Torrent (Runic Power) -> 15 displayed RP (= 150
// internal; AC stores RP scaled 10x, see Player::SetMaxPower
// POWER_RUNIC_POWER, 1000).
// ModifyPower no-ops on pools the player has no max for, so this is
// safe even before the Paragon picks up energy/RP-using abilities.
constexpr int32 kEnergyGain = 15;
constexpr int32 kRunicPowerGain = 150;
SpellInfo const* spellInfo = GetSpellInfo();
uint32 const spellId = spellInfo ? spellInfo->Id : 28730u;
caster->EnergizeBySpell(player, spellId, kEnergyGain, POWER_ENERGY);
caster->EnergizeBySpell(player, spellId, kRunicPowerGain, POWER_RUNIC_POWER);
}
void Register() override
{
AfterCast += SpellCastFn(spell_paragon_arcane_torrent::HandleAfterCast);
}
};
void AddSC_paragon()
{
new Paragon_PlayerScript();
RegisterSpellScript(spell_paragon_arcane_torrent);
}