[9831] Fix type conversion in spell/healing bonus calculations

This commit is contained in:
Laise 2010-05-04 07:19:15 +03:00
parent 3f5eccd8a9
commit 0cc946e91e
2 changed files with 7 additions and 7 deletions

View file

@ -9200,7 +9200,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
DoneTotal += int32(DoneAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty * SpellModSpellDamage); DoneTotal += int32(DoneAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty * SpellModSpellDamage);
} }
float tmpDamage = (pdamage + DoneTotal * stack) * DoneTotalMod; float tmpDamage = (int32(pdamage) + DoneTotal * int32(stack)) * DoneTotalMod;
// apply spellmod to Done damage (flat and pct) // apply spellmod to Done damage (flat and pct)
if(Player* modOwner = GetSpellModOwner()) if(Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage); modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
@ -9307,7 +9307,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto,
TakenTotal+= int32(TakenAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty); TakenTotal+= int32(TakenAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty);
} }
float tmpDamage = (pdamage + TakenTotal * stack) * TakenTotalMod; float tmpDamage = (pdamage + TakenTotal * int32(stack)) * TakenTotalMod;
return tmpDamage > 0 ? uint32(tmpDamage) : 0; return tmpDamage > 0 ? uint32(tmpDamage) : 0;
} }
@ -9757,7 +9757,7 @@ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto,
} }
// use float as more appropriate for negative values and percent applying // use float as more appropriate for negative values and percent applying
float heal = (healamount + DoneTotal * stack)*DoneTotalMod; float heal = (healamount + DoneTotal * int32(stack))*DoneTotalMod;
// apply spellmod to Done amount // apply spellmod to Done amount
if(Player* modOwner = GetSpellModOwner()) if(Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
@ -9845,7 +9845,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit *pCaster, SpellEntry const *spellProto,
TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
// use float as more appropriate for negative values and percent applying // use float as more appropriate for negative values and percent applying
float heal = (healamount + TakenTotal * stack) * TakenTotalMod; float heal = (healamount + TakenTotal * int32(stack)) * TakenTotalMod;
return heal < 0 ? 0 : uint32(heal); return heal < 0 ? 0 : uint32(heal);
} }
@ -10242,7 +10242,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
DoneFlat *= GetModifierValue(unitMod, TOTAL_PCT); DoneFlat *= GetModifierValue(unitMod, TOTAL_PCT);
} }
float tmpDamage = float(int32(pdamage) + DoneFlat * stack) * DonePercent; float tmpDamage = float(int32(pdamage) + DoneFlat * int32(stack)) * DonePercent;
// apply spellmod to Done damage // apply spellmod to Done damage
if(spellProto) if(spellProto)
@ -10376,7 +10376,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp
} }
} }
float tmpDamage = float(int32(pdamage) + TakenFlat * stack) * TakenPercent; float tmpDamage = float(int32(pdamage) + TakenFlat * int32(stack)) * TakenPercent;
// bonus result can be negative // bonus result can be negative
return tmpDamage > 0 ? uint32(tmpDamage) : 0; return tmpDamage > 0 ? uint32(tmpDamage) : 0;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9830" #define REVISION_NR "9831"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__