aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-02-21 23:19:18 +0100
committerShauren <shauren.trinity@gmail.com>2021-02-21 23:19:18 +0100
commit01a3be276f4076762290e985d10d5c4ab1176ce0 (patch)
tree9856bf32787b6cb26e5111795cb0bd31620fbe14 /src
parenta76c08843fc1695241b7246c4014322ee07a6453 (diff)
Core/Spells: Prevent spell power costs from changing their sign (positive cost cannot become negative)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 2c62209ce4d..fbe4388e62c 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -3775,6 +3775,7 @@ std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSc
// Base powerCost
int32 powerCost = power->ManaCost;
+ bool initiallyNegative = powerCost < 0;
// PCT cost from total amount
if (power->PowerCostPct)
{
@@ -3906,6 +3907,10 @@ std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSc
continue;
}
+ // power cost cannot become negative if initially positive
+ if (initiallyNegative != (powerCost < 0))
+ powerCost = 0;
+
bool found = false;
for (SpellPowerCost& cost : costs)
{