*Fix issues with negative dmg of periodic power burn and periodic power leech effects added recently.

*Minor cleanup.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-27 20:51:29 +02:00
parent 3aa117c9b0
commit 6c3015a7e6
2 changed files with 10 additions and 8 deletions
+7 -5
View File
@@ -2347,11 +2347,12 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
uint32 power = damage;
int32 power = damage;
if (powerType == POWER_MANA)
power -= unitTarget->GetSpellCritDamageReduction(power);
power = std::min(0, power);
int32 newDamage = unitTarget->ModifyPower(powerType, -int32(power));
int32 newDamage = -(unitTarget->ModifyPower(powerType, -int32(power)));
float gainMultiplier = 0.0f;
@@ -2400,17 +2401,18 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
if (m_spellInfo->ManaCostPercentage)
{
int32 maxdamage = m_caster->GetMaxPower(powerType) * damage * 2 / 100;
int32 maxDamage = m_caster->GetMaxPower(powerType) * damage * 2 / 100;
damage = unitTarget->GetMaxPower(powerType) * damage / 100;
if (damage > maxdamage) damage = maxdamage;
damage = std::min(damage, maxDamage);
}
int32 power = damage;
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
if (powerType == POWER_MANA)
power -= unitTarget->GetSpellCritDamageReduction(power);
power = std::min(0, power);
int32 newDamage = unitTarget->ModifyPower(powerType, -power);
int32 newDamage = -(unitTarget->ModifyPower(powerType, -power));
// NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier
float dmgMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(m_spellInfo, effIndex, m_originalCaster, this);
+2 -2
View File
@@ -1902,7 +1902,7 @@ float SpellMgr::CalculateSpellEffectValueMultiplier(SpellEntry const * spellEntr
if (caster)
if (Player * modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_VALUE_MULTIPLIER, multiplier);
modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_VALUE_MULTIPLIER, multiplier, spell);
return multiplier;
}
@@ -1912,7 +1912,7 @@ float SpellMgr::CalculateSpellEffectDamageMultiplier(SpellEntry const * spellEnt
if (caster)
if (Player * modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_DAMAGE_MULTIPLIER, multiplier);
modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_DAMAGE_MULTIPLIER, multiplier, spell);
return multiplier;
}