[9854] Fix negative amounts for spell base damage/healing and fix heal effects to correctly benefit from heal increasing/reducing auras

This commit is contained in:
Laise 2010-05-09 20:30:32 +03:00
parent 7915d60765
commit 4c3d2805bd
8 changed files with 45 additions and 34 deletions

View file

@ -699,8 +699,9 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
if (m_spellInfo->Id == 20187)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo));
if (holy < 0)
holy = 0;
damage += int32(ap * 0.2f) + int32(holy * 32 / 100);
}
// Judgement of Vengeance/Corruption ${1+0.22*$SPH+0.14*$AP} + 10% for each application of Holy Vengeance/Blood Corruption on the target
@ -715,8 +716,9 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
}
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo));
if (holy < 0)
holy = 0;
damage+=int32(ap * 0.14f) + int32(holy * 22 / 100);
// Get stack of Holy Vengeance on the target added by caster
uint32 stacks = 0;
@ -737,16 +739,18 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000))
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo));
if (holy < 0)
holy = 0;
damage += int32(ap * 0.07f) + int32(holy * 7 / 100);
}
// Hammer of Wrath ($m1+0.15*$SPH+0.15*$AP) - ranged type sdb future fix
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000008000000000))
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo));
if (holy < 0)
holy = 0;
damage += int32(ap * 0.15f) + int32(holy * 15 / 100);
}
// Hammer of the Righteous
@ -3054,8 +3058,9 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/)
if (m_spellInfo->Id == 20167)
{
float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseHealingBonusTaken(GetSpellSchoolMask(m_spellInfo));
int32 holy = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(m_spellInfo));
if (holy < 0)
holy = 0;
addhealth += int32(ap * 0.15) + int32(holy * 15 / 100);
}
// Vessel of the Naaru (Vial of the Sunwell trinket)
@ -3114,14 +3119,7 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/)
addhealth += tickheal * tickcount;
}
else
{
addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL);
addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL);
}
m_healing += addhealth;
// Chain Healing
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000100))
{
@ -3131,9 +3129,14 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/)
Aura* riptide = unitTarget->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0x00000010, caster->GetGUID());
if (!riptide)
return;
m_healing += m_healing/4;
addhealth += addhealth/4;
unitTarget->RemoveAura(riptide);
}
addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL);
addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL);
m_healing += addhealth;
}
}
@ -3147,8 +3150,9 @@ void Spell::EffectHealPct(SpellEffectIndex /*eff_idx*/)
return;
uint32 addhealth = unitTarget->GetMaxHealth() * damage / 100;
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL);
addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL);
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo);
unitTarget->getHostileRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
@ -3197,7 +3201,6 @@ void Spell::EffectHealthLeech(SpellEffectIndex eff_idx)
int32 heal = int32(damage*multiplier);
if (m_caster->isAlive())
{
heal = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, heal, HEAL);
heal = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, heal, HEAL);
m_caster->DealHeal(m_caster, heal, m_spellInfo);
@ -5021,8 +5024,9 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx)
if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x00020000000000))
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo));
if (holy < 0)
holy = 0;
spell_bonus += int32(ap * 0.08f) + int32(holy * 13 / 100);
}
break;