Core/Spells: Prevent spell power costs from changing their sign (positive cost cannot become negative)
Port From (https://github.com/TrinityCore/TrinityCore/commit/01a3be276f4076762290e985d10d5c4ab1176ce0)
This commit is contained in:
@@ -2714,6 +2714,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
// Base powerCost
|
// Base powerCost
|
||||||
int powerCost = power.ManaCost;
|
int powerCost = power.ManaCost;
|
||||||
|
bool initiallyNegative = powerCost < 0;
|
||||||
// PCT cost from total amount
|
// PCT cost from total amount
|
||||||
if (power.PowerCostPct != 0)
|
if (power.PowerCostPct != 0)
|
||||||
{
|
{
|
||||||
@@ -2847,6 +2848,10 @@ namespace Game.Spells
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// power cost cannot become negative if initially positive
|
||||||
|
if (initiallyNegative != (powerCost < 0))
|
||||||
|
powerCost = 0;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (var i = 0; i < costs.Count; ++i)
|
for (var i = 0; i < costs.Count; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user