[9897] Avoid multiply AP bonus coeff. with spell power bonus.

Problem exist in original code before recent commits.
This commit is contained in:
VladimirMangos 2010-05-15 11:07:56 +04:00
parent b2b8ca1d70
commit 6e92d43237
2 changed files with 10 additions and 6 deletions

View file

@ -10131,6 +10131,8 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
// final calculation // final calculation
// ================= // =================
float DoneTotal = 0.0f;
// scaling of non weapon based spells // scaling of non weapon based spells
if (!isWeaponDamageBasedSpell) if (!isWeaponDamageBasedSpell)
{ {
@ -10148,19 +10150,19 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage;
if (bonus->ap_bonus) if (bonus->ap_bonus)
DoneFlat += bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + APbonus); DoneTotal += bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + APbonus);
} }
// Default calculation // Default calculation
else if (DoneFlat) else if (DoneFlat)
coeff = CalculateDefaultCoefficient(spellProto, damagetype); coeff = CalculateDefaultCoefficient(spellProto, damagetype);
DoneFlat *= coeff * LvlPenalty; DoneTotal += DoneFlat * coeff * LvlPenalty;
} }
// weapon damage based spells // weapon damage based spells
else if( APbonus || DoneFlat ) else if( APbonus || DoneFlat )
{ {
bool normalized = spellProto ? IsSpellHaveEffect(spellProto, SPELL_EFFECT_NORMALIZED_WEAPON_DMG) : false; bool normalized = spellProto ? IsSpellHaveEffect(spellProto, SPELL_EFFECT_NORMALIZED_WEAPON_DMG) : false;
DoneFlat += int32(APbonus / 14.0f * GetAPMultiplier(attType,normalized)); DoneTotal += int32(APbonus / 14.0f * GetAPMultiplier(attType,normalized));
// for weapon damage based spells we still have to apply damage done percent mods // for weapon damage based spells we still have to apply damage done percent mods
// (that are already included into pdamage) to not-yet included DoneFlat // (that are already included into pdamage) to not-yet included DoneFlat
@ -10174,10 +10176,12 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
case RANGED_ATTACK: unitMod = UNIT_MOD_DAMAGE_RANGED; break; case RANGED_ATTACK: unitMod = UNIT_MOD_DAMAGE_RANGED; break;
} }
DoneFlat *= GetModifierValue(unitMod, TOTAL_PCT); DoneTotal += DoneFlat;
DoneTotal *= GetModifierValue(unitMod, TOTAL_PCT);
} }
float tmpDamage = float(int32(pdamage) + DoneFlat * int32(stack)) * DonePercent; float tmpDamage = float(int32(pdamage) + DoneTotal * int32(stack)) * DonePercent;
// apply spellmod to Done damage // apply spellmod to Done damage
if(spellProto) if(spellProto)

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 "9896" #define REVISION_NR "9897"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__