Core/Spells: Fix spell damage/healing multipliers for spells that affect multiple targets (ie. Heart Strike, Chain Lightning, Chain Healing)
Author: dr.tenma Closes issue #4506 Closes issue #1874 --HG-- branch : trunk
This commit is contained in:
@@ -433,6 +433,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
|
||||
m_delayStart = 0;
|
||||
m_delayAtDamageCount = 0;
|
||||
|
||||
m_applyMultiplierMask = 0;
|
||||
m_effectMask = 0;
|
||||
m_auraScaleMask = 0;
|
||||
|
||||
@@ -2382,6 +2383,10 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
|
||||
if (maxTargets > 1)
|
||||
{
|
||||
//otherwise, this multiplier is used for something else
|
||||
m_damageMultipliers[i] = 1.0f;
|
||||
m_applyMultiplierMask |= 1 << i;
|
||||
|
||||
float range;
|
||||
std::list<Unit*> unitList;
|
||||
|
||||
@@ -6874,10 +6879,8 @@ void Spell::CalculateDamageDoneForAllTargets()
|
||||
{
|
||||
float multiplier[MAX_SPELL_EFFECTS];
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
// Get multiplier
|
||||
multiplier[i] = SpellMgr::CalculateSpellEffectDamageMultiplier(m_spellInfo, i, m_originalCaster, this);
|
||||
}
|
||||
if (m_applyMultiplierMask & (1 << i))
|
||||
multiplier[i] = SpellMgr::CalculateSpellEffectDamageMultiplier(m_spellInfo, i, m_originalCaster, this);
|
||||
|
||||
bool usesAmmo = true;
|
||||
Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
|
||||
@@ -6937,7 +6940,7 @@ void Spell::CalculateDamageDoneForAllTargets()
|
||||
}
|
||||
}
|
||||
|
||||
int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float * /*multiplier*/)
|
||||
int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float * multiplier)
|
||||
{
|
||||
int32 damageDone = 0;
|
||||
unitTarget = unit;
|
||||
@@ -6981,6 +6984,12 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float * /*
|
||||
}
|
||||
}
|
||||
|
||||
if (m_applyMultiplierMask & (1 << i))
|
||||
{
|
||||
m_damage = int32(m_damage * m_damageMultipliers[i]);
|
||||
m_damageMultipliers[i] *= multiplier[i];
|
||||
}
|
||||
|
||||
damageDone += m_damage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,6 +583,8 @@ class Spell
|
||||
bool m_referencedFromCurrentSpell; // mark as references to prevent deleted and access by dead pointers
|
||||
bool m_executedCurrently; // mark as executed to prevent deleted and access by dead pointers
|
||||
bool m_needComboPoints;
|
||||
uint8 m_applyMultiplierMask;
|
||||
float m_damageMultipliers[3];
|
||||
|
||||
// Current targets, to be used in SpellEffects (MUST BE USED ONLY IN SPELL EFFECTS)
|
||||
Unit* unitTarget;
|
||||
|
||||
@@ -3985,55 +3985,58 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
|
||||
case SPELLFAMILY_DEATHKNIGHT:
|
||||
{
|
||||
// Plague Strike
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001)
|
||||
if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x1)
|
||||
{
|
||||
// Glyph of Plague Strike
|
||||
if (AuraEffect * aurEff = m_caster->GetAuraEffect(58657,0))
|
||||
totalDamagePercentMod *= float((aurEff->GetAmount() + 100.0f) / 100.0f);
|
||||
if (AuraEffect const * aurEff = m_caster->GetAuraEffect(58657, EFFECT_0))
|
||||
totalDamagePercentMod *= (aurEff->GetAmount() + 100.0f) / 100.0f;
|
||||
break;
|
||||
}
|
||||
// Blood Strike
|
||||
else if (m_spellInfo->SpellFamilyFlags[0] & 0x400000)
|
||||
if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x400000)
|
||||
{
|
||||
totalDamagePercentMod *= (float(unitTarget->GetDiseasesByCaster(m_caster->GetGUID())) * 12.5f + 100.0f) / 100.0f;
|
||||
totalDamagePercentMod *= ((SpellMgr::CalculateSpellEffectAmount(m_spellInfo, EFFECT_2) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f) + 100.0f) / 100.0f;
|
||||
|
||||
// Glyph of Blood Strike
|
||||
if (m_caster->GetAuraEffect(59332,0))
|
||||
{
|
||||
if (m_caster->GetAuraEffect(59332, EFFECT_0))
|
||||
if (unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
|
||||
totalDamagePercentMod *= float((20 + 100.0f) / 100.0f);
|
||||
}
|
||||
totalDamagePercentMod *= (20 + 100.0f) / 100.0f;
|
||||
break;
|
||||
}
|
||||
// Death Strike
|
||||
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
|
||||
if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x10)
|
||||
{
|
||||
// Glyph of Death Strike
|
||||
if (m_caster->GetAuraEffect(59336,0))
|
||||
{
|
||||
if (uint32 runic = m_caster->GetPower(POWER_RUNIC_POWER))
|
||||
{
|
||||
if (runic > 25)
|
||||
runic = 25;
|
||||
|
||||
totalDamagePercentMod *= float((runic + 100.0f) / 100.0f);
|
||||
}
|
||||
}
|
||||
if (AuraEffect const * aurEff = m_caster->GetAuraEffect(59336, EFFECT_0))
|
||||
if (uint32 runic = std::min<uint32>(m_caster->GetPower(POWER_RUNIC_POWER), SpellMgr::CalculateSpellEffectAmount(aurEff->GetSpellProto(), EFFECT_1)))
|
||||
totalDamagePercentMod *= (runic + 100.0f) / 100.0f;
|
||||
break;
|
||||
}
|
||||
// Obliterate (12.5% more damage per disease)
|
||||
else if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
|
||||
if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x20000)
|
||||
{
|
||||
bool consumeDiseases = true;
|
||||
// Annihilation
|
||||
if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 2710, 0))
|
||||
{
|
||||
if (AuraEffect const * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 2710, EFFECT_0))
|
||||
// Do not consume diseases if roll sucesses
|
||||
if (roll_chance_i(aurEff->GetAmount()))
|
||||
consumeDiseases = false;
|
||||
}
|
||||
totalDamagePercentMod *= (float(CalculateDamage(2, unitTarget) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2) + 100.0f) / 100.0f;
|
||||
|
||||
totalDamagePercentMod *= ((SpellMgr::CalculateSpellEffectAmount(m_spellInfo, EFFECT_2) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f) + 100.0f) / 100.0f;
|
||||
break;
|
||||
}
|
||||
// Blood-Caked Strike - Blood-Caked Blade
|
||||
else if (m_spellInfo->SpellIconID == 1736)
|
||||
totalDamagePercentMod *= (float(unitTarget->GetDiseasesByCaster(m_caster->GetGUID())) * 12.5f + 100.0f) / 100.0f;
|
||||
if (m_spellInfo->SpellIconID == 1736)
|
||||
{
|
||||
totalDamagePercentMod *= ((unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f) + 100.0f) / 100.0f;
|
||||
break;
|
||||
}
|
||||
// Heart Strike
|
||||
if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x1000000)
|
||||
{
|
||||
totalDamagePercentMod *= ((SpellMgr::CalculateSpellEffectAmount(m_spellInfo, EFFECT_2) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID())) + 100.0f) / 100.0f;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user