[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

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0', `cache_id` int(10) default '0',
`required_9826_01_mangos_spell_script_target` bit(1) default NULL `required_9854_01_mangos_spell_bonus_data` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --

View file

@ -0,0 +1,2 @@
ALTER TABLE db_version CHANGE COLUMN required_9826_01_mangos_spell_script_target required_9854_01_mangos_spell_bonus_data bit;

View file

@ -57,6 +57,7 @@ pkgdata_DATA = \
9803_01_mangos_spell_bonus_data.sql \ 9803_01_mangos_spell_bonus_data.sql \
9826_01_mangos_spell_script_target.sql \ 9826_01_mangos_spell_script_target.sql \
9849_01_characters_saved_variables.sql \ 9849_01_characters_saved_variables.sql \
9854_01_mangos_spell_bonus_data.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -94,4 +95,5 @@ EXTRA_DIST = \
9803_01_mangos_spell_bonus_data.sql \ 9803_01_mangos_spell_bonus_data.sql \
9826_01_mangos_spell_script_target.sql \ 9826_01_mangos_spell_script_target.sql \
9849_01_characters_saved_variables.sql \ 9849_01_characters_saved_variables.sql \
9854_01_mangos_spell_bonus_data.sql \
README README

View file

@ -4791,8 +4791,9 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/)
if (m_spellProto->SpellIconID == 329 && m_spellProto->SpellVisual[0] == 7625) if (m_spellProto->SpellIconID == 329 && m_spellProto->SpellVisual[0] == 7625)
{ {
int32 ap = int32 (0.22f * caster->GetTotalAttackPowerValue(BASE_ATTACK)); int32 ap = int32 (0.22f * caster->GetTotalAttackPowerValue(BASE_ATTACK));
int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)) int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto));
+ m_target->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellProto)); if (holy < 0)
holy = 0;
holy = int32(holy * 377 / 1000); holy = int32(holy * 377 / 1000);
m_modifier.m_amount += ap > holy ? ap : holy; m_modifier.m_amount += ap > holy ? ap : holy;
} }
@ -4960,8 +4961,9 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
{ {
// AP * 0.025 + SPH * 0.013 bonus per tick // AP * 0.025 + SPH * 0.013 bonus per tick
float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)) + int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto));
GetTarget()->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellProto)); if (holy < 0)
holy = 0;
m_modifier.m_amount += int32(GetStackAmount()) * (int32(ap * 0.025f) + int32(holy * 13 / 1000)); m_modifier.m_amount += int32(GetStackAmount()) * (int32(ap * 0.025f) + int32(holy * 13 / 1000));
return; return;
} }

View file

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

View file

@ -6282,8 +6282,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{ {
triggered_spell_id = 25742; triggered_spell_id = 25742;
float ap = GetTotalAttackPowerValue(BASE_ATTACK); float ap = GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY) + int32 holy = SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY);
pVictim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY); if (holy < 0)
holy = 0;
basepoints[0] = GetAttackTime(BASE_ATTACK) * int32(ap*0.022f + 0.044f * holy) / 1000; basepoints[0] = GetAttackTime(BASE_ATTACK) * int32(ap*0.022f + 0.044f * holy) / 1000;
break; break;
} }
@ -9307,7 +9308,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 * int32(stack)) * TakenTotalMod; float tmpDamage = (int32(pdamage) + TakenTotal * int32(stack)) * TakenTotalMod;
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 "9853" #define REVISION_NR "9854"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables"
#define REVISION_DB_MANGOS "required_9826_01_mangos_spell_script_target" #define REVISION_DB_MANGOS "required_9854_01_mangos_spell_bonus_data"
#define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__