aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 44e27bbd76c..fddbd482b38 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -9318,21 +9318,29 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
// Check for table values
- float coeff;
+ float coeff = 0;
SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id);
if (bonus)
{
if (damagetype == DOT)
+ {
coeff = bonus->dot_damage;
+ if (bonus->ap_dot_bonus > 0)
+ DoneTotal+=bonus->ap_dot_bonus * stack * ApCoeffMod *
+ GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
+ }
else
+ {
coeff = bonus->direct_damage;
- if (bonus->ap_bonus)
- DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack * ApCoeffMod;
+ if (bonus->ap_bonus > 0)
+ DoneTotal+=bonus->ap_bonus * stack * ApCoeffMod *
+ GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
+ }
}
// Default calculation
if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
- if(!bonus)
+ if(!bonus || coeff < 0)
{
// Damage Done from spell damage bonus
int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
@@ -9785,16 +9793,24 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Check for table values
SpellBonusEntry const* bonus = !scripted ? spellmgr.GetSpellBonusData(spellProto->Id) : NULL;
- float coeff;
+ float coeff = 0;
float factorMod = 1.0f;
if (bonus)
{
if (damagetype == DOT)
+ {
coeff = bonus->dot_damage;
+ if (bonus->ap_dot_bonus > 0)
+ DoneTotal+=bonus->ap_dot_bonus * stack *
+ GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
+ }
else
+ {
coeff = bonus->direct_damage;
- if (bonus->ap_bonus)
- DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack;
+ if (bonus->ap_bonus > 0)
+ DoneTotal+=bonus->ap_bonus * stack *
+ GetTotalAttackPowerValue(IsRangedWeaponSpell(spellProto) ? RANGED_ATTACK: BASE_ATTACK);
+ }
}
else // scripted bonus
{
@@ -9828,7 +9844,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Default calculation
if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
- if(!bonus && !scripted)
+ if((!bonus && !scripted) || coeff < 0)
{
// Damage Done from spell damage bonus
int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);