aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authorQAston <none@none>2009-07-18 22:18:47 +0200
committerQAston <none@none>2009-07-18 22:18:47 +0200
commitbc4d862263b6823562c643c270f41de7e12001be (patch)
tree6f0faa29e419c844764c4642461237835f598a0d /src/game/Unit.cpp
parent91c309387a54aa34dfe982b8325f0b3b6e79f436 (diff)
*Add new column to spell_bonus_data table to store ap bonus for periodic auras.
*Use -1 to mark entries, for which default spell bonus calculation should be used. *Move periodic auras ap bonuses from core to db. *Add coefficient for Black Arrow. --HG-- branch : trunk
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);