mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[8967] Fixed division by zero in Unit::CalcAbsorbResist.
This also fix spell 31662 work. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
f5895596c0
commit
25688fc8eb
2 changed files with 12 additions and 10 deletions
|
|
@ -1994,13 +1994,18 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
||||||
else
|
else
|
||||||
currentAbsorb = RemainingDamage;
|
currentAbsorb = RemainingDamage;
|
||||||
|
|
||||||
float manaMultiplier = (*i)->GetSpellProto()->EffectMultipleValue[(*i)->GetEffIndex()];
|
if (float manaMultiplier = (*i)->GetSpellProto()->EffectMultipleValue[(*i)->GetEffIndex()])
|
||||||
if(Player *modOwner = pVictim->GetSpellModOwner())
|
{
|
||||||
modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
|
if(Player *modOwner = pVictim->GetSpellModOwner())
|
||||||
|
modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
|
||||||
|
|
||||||
int32 maxAbsorb = int32(pVictim->GetPower(POWER_MANA) / manaMultiplier);
|
int32 maxAbsorb = int32(pVictim->GetPower(POWER_MANA) / manaMultiplier);
|
||||||
if (currentAbsorb > maxAbsorb)
|
if (currentAbsorb > maxAbsorb)
|
||||||
currentAbsorb = maxAbsorb;
|
currentAbsorb = maxAbsorb;
|
||||||
|
|
||||||
|
int32 manaReduction = int32(currentAbsorb * manaMultiplier);
|
||||||
|
pVictim->ApplyPowerMod(POWER_MANA, manaReduction, false);
|
||||||
|
}
|
||||||
|
|
||||||
(*i)->GetModifier()->m_amount -= currentAbsorb;
|
(*i)->GetModifier()->m_amount -= currentAbsorb;
|
||||||
if((*i)->GetModifier()->m_amount <= 0)
|
if((*i)->GetModifier()->m_amount <= 0)
|
||||||
|
|
@ -2009,9 +2014,6 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
||||||
next = vManaShield.begin();
|
next = vManaShield.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 manaReduction = int32(currentAbsorb * manaMultiplier);
|
|
||||||
pVictim->ApplyPowerMod(POWER_MANA, manaReduction, false);
|
|
||||||
|
|
||||||
RemainingDamage -= currentAbsorb;
|
RemainingDamage -= currentAbsorb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8966"
|
#define REVISION_NR "8967"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue