From de486ebc2cf8af7f3878d128b0643feeca82942a Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 4 Jun 2015 15:04:54 +0200 Subject: Core/Spells: Fixed spell mana costs - percentage should be calculated using base mana, not total --- src/server/game/Spells/SpellInfo.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/server') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index f97714d36eb..6560309527c 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2578,6 +2578,8 @@ std::vector SpellInfo::CalcPowerCost(Unit const* caster, Sp powerCost += int32(CalculatePct(caster->GetMaxHealth(), power->ManaCostPercentage)); break; case POWER_MANA: + powerCost += int32(CalculatePct(caster->GetCreateMana(), power->ManaCostPercentage)); + break; case POWER_RAGE: case POWER_FOCUS: case POWER_ENERGY: @@ -2636,7 +2638,7 @@ std::vector SpellInfo::CalcPowerCost(Unit const* caster, Sp modOwner->ApplySpellMod(Id, SPELLMOD_SPELL_COST2, powerCost); } - if (!caster->IsControlledByPlayer()) + if (!caster->IsControlledByPlayer() && G3D::fuzzyEq(power->ManaCostPercentage, 0.0f)) { if (Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION) { @@ -2694,7 +2696,7 @@ std::vector SpellInfo::CalcPowerCost(Unit const* caster, Sp } }; - if (_hasPowerDifficultyData) // optimization - use static data for 99.5% cases (4753 of 4772 in build 6.1.0.19702) + if (!_hasPowerDifficultyData) // optimization - use static data for 99.5% cases (4753 of 4772 in build 6.1.0.19702) collector(PowerCosts); else collector(sDB2Manager.GetSpellPowers(Id, caster->GetMap()->GetDifficultyID())); -- cgit v1.2.3