Core/Spells: Fixed spell mana costs - percentage should be calculated using base mana, not total

This commit is contained in:
Shauren
2015-06-04 15:04:54 +02:00
parent 97a074def2
commit de486ebc2c

View File

@@ -2578,6 +2578,8 @@ std::vector<SpellInfo::CostData> 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::CostData> 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::CostData> 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()));