From d1c0aa114a80a76a4a0d5ff7b7be5c3ec80a29d6 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 22 Feb 2021 16:07:10 -0500 Subject: [PATCH] Core/Spells: Prevent spell power costs from changing their sign (positive cost cannot become negative) Port From (https://github.com/TrinityCore/TrinityCore/commit/01a3be276f4076762290e985d10d5c4ab1176ce0) --- Source/Game/Spells/SpellInfo.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 60418a986..bbc072aba 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -2714,6 +2714,7 @@ namespace Game.Spells // Base powerCost int powerCost = power.ManaCost; + bool initiallyNegative = powerCost < 0; // PCT cost from total amount if (power.PowerCostPct != 0) { @@ -2847,6 +2848,10 @@ namespace Game.Spells continue; } + // power cost cannot become negative if initially positive + if (initiallyNegative != (powerCost < 0)) + powerCost = 0; + bool found = false; for (var i = 0; i < costs.Count; ++i) {