*Fix usage of EffectValueMultiplier in spell code.
*Remove some obsolete code from spell class. *Rename some spellmod and dbc column names to be more accurate. --HG-- branch : trunk
This commit is contained in:
@@ -1476,12 +1476,9 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
if (spell->m_spellInfo->Id == GetId())
|
||||
spell->cancel();
|
||||
|
||||
float multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()];
|
||||
float gainMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
|
||||
|
||||
if (Player *modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetSpellProto()->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
|
||||
|
||||
uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetBase()->GetStackAmount()));
|
||||
uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellProto(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount()));
|
||||
|
||||
int32 gain = caster->DealHeal(caster, heal, GetSpellProto());
|
||||
caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellProto());
|
||||
@@ -1503,12 +1500,9 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
caster->ModifyHealth(-(int32)damage);
|
||||
sLog.outDebug("PeriodicTick: donator %u target %u damage %u.", target->GetEntry(), target->GetEntry(), damage);
|
||||
|
||||
float multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()];
|
||||
float gainMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
|
||||
|
||||
if (Player *modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetSpellProto()->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
|
||||
|
||||
damage = int32(damage * multiplier);
|
||||
damage = int32(damage * gainMultiplier);
|
||||
|
||||
caster->DealHeal(target, damage, GetSpellProto());
|
||||
break;
|
||||
@@ -1667,12 +1661,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
float gain_multiplier = 0.0f;
|
||||
|
||||
if (caster->GetMaxPower(power) > 0)
|
||||
{
|
||||
gain_multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()];
|
||||
|
||||
if (Player *modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier);
|
||||
}
|
||||
gain_multiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
|
||||
|
||||
SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier, false);
|
||||
target->SendPeriodicAuraLog(&pInfo);
|
||||
@@ -1806,13 +1795,13 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
|
||||
uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
|
||||
|
||||
gain = uint32(gain * GetSpellProto()->EffectMultipleValue[GetEffIndex()]);
|
||||
float dmgMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
|
||||
|
||||
SpellEntry const* spellProto = GetSpellProto();
|
||||
//maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
|
||||
SpellNonMeleeDamage damageInfo(caster, target, spellProto->Id, spellProto->SchoolMask);
|
||||
//no SpellDamageBonus for burn mana
|
||||
caster->CalculateSpellDamageTaken(&damageInfo, gain, spellProto);
|
||||
caster->CalculateSpellDamageTaken(&damageInfo, gain * dmgMultiplier, spellProto);
|
||||
|
||||
caster->DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb);
|
||||
|
||||
|
||||
@@ -471,8 +471,6 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
|
||||
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType);
|
||||
}
|
||||
}
|
||||
// Set health leech amount to zero
|
||||
m_healthLeech = 0;
|
||||
|
||||
if (originalCasterGUID)
|
||||
m_originalCasterGUID = originalCasterGUID;
|
||||
@@ -2421,10 +2419,6 @@ 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;
|
||||
|
||||
@@ -3727,10 +3721,6 @@ void Spell::finish(bool ok)
|
||||
if (IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
m_caster->m_extraAttacks = 0;
|
||||
|
||||
// Heal caster for all health leech from all targets
|
||||
if (m_healthLeech)
|
||||
m_caster->DealHeal(m_caster, uint32(m_healthLeech), m_spellInfo);
|
||||
|
||||
if (IsMeleeAttackResetSpell())
|
||||
{
|
||||
bool found = false;
|
||||
@@ -6939,18 +6929,11 @@ bool Spell::IsValidSingleTargetSpell(Unit const* target) const
|
||||
|
||||
void Spell::CalculateDamageDoneForAllTargets()
|
||||
{
|
||||
float multiplier[3];
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
float multiplier[MAX_SPELL_EFFECTS];
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (m_applyMultiplierMask & (1 << i))
|
||||
{
|
||||
// Get multiplier
|
||||
multiplier[i] = m_spellInfo->DmgMultiplier[i];
|
||||
// Apply multiplier mods
|
||||
if (m_originalCaster)
|
||||
if (Player* modOwner = m_originalCaster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier[i], this);
|
||||
}
|
||||
// Get multiplier
|
||||
multiplier[i] = SpellMgr::CalculateSpellEffectDamageMultiplier(m_spellInfo, i, m_originalCaster, this);
|
||||
}
|
||||
|
||||
bool usesAmmo = true;
|
||||
@@ -7054,11 +7037,6 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_applyMultiplierMask & (1 << i))
|
||||
{
|
||||
m_damage = int32(m_damage * m_damageMultipliers[i]);
|
||||
m_damageMultipliers[i] *= multiplier[i];
|
||||
}
|
||||
|
||||
damageDone += m_damage;
|
||||
}
|
||||
|
||||
@@ -546,7 +546,6 @@ class Spell
|
||||
Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers()
|
||||
|
||||
Spell** m_selfContainer; // pointer to our spell container (if applicable)
|
||||
Spell** m_triggeringContainer; // pointer to container with spell that has triggered us
|
||||
|
||||
//Spell data
|
||||
SpellSchoolMask m_spellSchoolMask; // Spell school (can be overwrite for some spells (wand shoot for example)
|
||||
@@ -598,7 +597,6 @@ class Spell
|
||||
// Damage and healing in effects need just calculate
|
||||
int32 m_damage; // Damge in effects count here
|
||||
int32 m_healing; // Healing in effects count here
|
||||
int32 m_healthLeech; // Health leech in effects for all targets count here
|
||||
|
||||
//******************************************
|
||||
// Spell trigger system
|
||||
|
||||
@@ -600,7 +600,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
{
|
||||
// converts each extra point of energy into ($f1+$AP/410) additional damage
|
||||
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
|
||||
float multiple = ap / 410 + m_spellInfo->DmgMultiplier[effect_idx];
|
||||
float multiple = ap / 410 + m_spellInfo->EffectDamageMultiplier[effect_idx];
|
||||
int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
|
||||
damage += int32(energy * multiple);
|
||||
damage += int32(m_caster->ToPlayer()->GetComboPoints() * ap * 7 / 100);
|
||||
@@ -1511,7 +1511,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if (rage > 300)
|
||||
rage = 300;
|
||||
|
||||
bp = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
|
||||
bp = damage+int32(rage * m_spellInfo->EffectDamageMultiplier[i] +
|
||||
m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
|
||||
break;
|
||||
}
|
||||
@@ -1679,7 +1679,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE)
|
||||
{
|
||||
uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
|
||||
int32 bp = int32(count * m_caster->CountPctFromMaxHealth(m_spellInfo->DmgMultiplier[0]));
|
||||
int32 bp = int32(count * m_caster->CountPctFromMaxHealth(m_spellInfo->EffectDamageMultiplier[0]));
|
||||
// Improved Death Strike
|
||||
if (AuraEffect const * aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0))
|
||||
bp = int32(bp * (m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellProto(), 2) + 100.0f) / 100.0f);
|
||||
@@ -2337,48 +2337,29 @@ void Spell::EffectPowerDrain(uint32 i)
|
||||
if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
|
||||
return;
|
||||
|
||||
Powers drain_power = Powers(m_spellInfo->EffectMiscValue[i]);
|
||||
Powers powerType = Powers(m_spellInfo->EffectMiscValue[i]);
|
||||
|
||||
if (!unitTarget)
|
||||
return;
|
||||
if (!unitTarget->isAlive())
|
||||
return;
|
||||
if (unitTarget->getPowerType() != drain_power)
|
||||
return;
|
||||
if (damage < 0)
|
||||
if (!unitTarget || !unitTarget->isAlive() || unitTarget->getPowerType() != powerType || damage < 0)
|
||||
return;
|
||||
|
||||
uint32 curPower = unitTarget->GetPower(drain_power);
|
||||
|
||||
//add spell damage bonus
|
||||
damage=m_caster->SpellDamageBonus(unitTarget,m_spellInfo,uint32(damage),SPELL_DIRECT_DAMAGE);
|
||||
// add spell damage bonus
|
||||
damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
|
||||
|
||||
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
||||
uint32 power = damage;
|
||||
if (drain_power == POWER_MANA)
|
||||
if (powerType == POWER_MANA)
|
||||
power -= unitTarget->GetSpellCritDamageReduction(power);
|
||||
|
||||
int32 new_damage;
|
||||
if (curPower < power)
|
||||
new_damage = curPower;
|
||||
else
|
||||
new_damage = power;
|
||||
|
||||
unitTarget->ModifyPower(drain_power,-new_damage);
|
||||
int32 newDamage = unitTarget->ModifyPower(powerType, -int32(power));
|
||||
|
||||
// Don`t restore from self drain
|
||||
if (drain_power == POWER_MANA && m_caster != unitTarget)
|
||||
if (m_caster != unitTarget)
|
||||
{
|
||||
float manaMultiplier = m_spellInfo->EffectMultipleValue[i];
|
||||
if (manaMultiplier == 0)
|
||||
manaMultiplier = 1;
|
||||
float gainMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(m_spellInfo, i, m_originalCaster, this);
|
||||
|
||||
if (Player *modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
|
||||
int32 gain = int32(newDamage * gainMultiplier);
|
||||
|
||||
int32 gain = int32(new_damage * manaMultiplier);
|
||||
|
||||
m_caster->EnergizeBySpell(m_caster, m_spellInfo->Id, gain, POWER_MANA);
|
||||
m_caster->EnergizeBySpell(m_caster, m_spellInfo->Id, gain, powerType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2407,50 +2388,34 @@ void Spell::EffectPowerBurn(uint32 i)
|
||||
if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
|
||||
return;
|
||||
|
||||
Powers powertype = Powers(m_spellInfo->EffectMiscValue[i]);
|
||||
Powers powerType = Powers(m_spellInfo->EffectMiscValue[i]);
|
||||
|
||||
if (!unitTarget)
|
||||
if (!unitTarget || !unitTarget->isAlive() || unitTarget->getPowerType() != powerType || damage < 0)
|
||||
return;
|
||||
if (!unitTarget->isAlive())
|
||||
return;
|
||||
if (unitTarget->getPowerType() != powertype)
|
||||
return;
|
||||
if (damage < 0)
|
||||
return;
|
||||
|
||||
//Unit* caster = m_originalCaster ? m_originalCaster : m_caster;
|
||||
|
||||
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
|
||||
if (m_spellInfo->ManaCostPercentage)
|
||||
{
|
||||
int32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100;
|
||||
damage = unitTarget->GetMaxPower(powertype) * damage / 100;
|
||||
int32 maxdamage = m_caster->GetMaxPower(powerType) * damage * 2 / 100;
|
||||
damage = unitTarget->GetMaxPower(powerType) * damage / 100;
|
||||
if (damage > maxdamage) damage = maxdamage;
|
||||
}
|
||||
|
||||
int32 curPower = int32(unitTarget->GetPower(powertype));
|
||||
|
||||
int32 power = damage;
|
||||
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
||||
if (powertype == POWER_MANA)
|
||||
if (powerType == POWER_MANA)
|
||||
power -= unitTarget->GetSpellCritDamageReduction(power);
|
||||
|
||||
int32 new_damage = (curPower < power) ? curPower : power;
|
||||
int32 newDamage = unitTarget->ModifyPower(powerType, -power);
|
||||
|
||||
unitTarget->ModifyPower(powertype, -new_damage);
|
||||
float multiplier = m_spellInfo->EffectMultipleValue[i];
|
||||
// NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier
|
||||
float dmgMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(m_spellInfo, i, m_originalCaster, this);
|
||||
|
||||
if (Player *modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
|
||||
newDamage = int32(newDamage * dmgMultiplier);
|
||||
|
||||
new_damage = int32(new_damage*multiplier);
|
||||
//m_damage+=new_damage; should not apply spell bonus
|
||||
//TODO: no log
|
||||
//unitTarget->ModifyHealth(-new_damage);
|
||||
if (m_originalCaster)
|
||||
m_originalCaster->DealDamage(unitTarget, new_damage);
|
||||
|
||||
unitTarget->RemoveAurasByType(SPELL_AURA_MOD_FEAR);
|
||||
m_originalCaster->DealDamage(unitTarget, newDamage);
|
||||
}
|
||||
|
||||
void Spell::EffectHeal(uint32 /*i*/)
|
||||
@@ -2614,45 +2579,25 @@ void Spell::EffectHealMechanical(uint32 /*i*/)
|
||||
|
||||
void Spell::EffectHealthLeech(uint32 i)
|
||||
{
|
||||
if (!unitTarget)
|
||||
return;
|
||||
if (!unitTarget->isAlive())
|
||||
return;
|
||||
|
||||
if (damage < 0)
|
||||
if (!unitTarget || !unitTarget->isAlive() || damage < 0)
|
||||
return;
|
||||
|
||||
sLog.outDebug("HealthLeech :%i", damage);
|
||||
|
||||
float multiplier = m_spellInfo->EffectMultipleValue[i];
|
||||
float healMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(m_spellInfo, i, m_originalCaster, this);
|
||||
|
||||
if (Player *modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
|
||||
|
||||
// Do not apply multiplier to damage if it's Death Coil
|
||||
int32 new_damage;
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & 0x80000 ||
|
||||
m_spellInfo->Id == 72409 || m_spellInfo->Id == 72447 || // ...or Deathbringer Saurfang's Rune of Blood
|
||||
m_spellInfo->Id == 72448 || m_spellInfo->Id == 72449)
|
||||
new_damage = damage;
|
||||
else
|
||||
new_damage = int32(damage * multiplier);
|
||||
int32 newDamage = int32(damage * healMultiplier);
|
||||
|
||||
uint32 curHealth = unitTarget->GetHealth();
|
||||
new_damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, new_damage);
|
||||
if (int32(curHealth) < new_damage)
|
||||
new_damage = curHealth;
|
||||
newDamage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, newDamage);
|
||||
if (int32(curHealth) < newDamage)
|
||||
newDamage = curHealth;
|
||||
|
||||
if (m_caster->isAlive())
|
||||
{
|
||||
// Insead add it just to healing if it's Death Coil
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & 0x80000)
|
||||
new_damage = int32(new_damage*multiplier);
|
||||
new_damage = m_caster->SpellHealingBonus(m_caster, m_spellInfo, new_damage, HEAL);
|
||||
m_caster->DealHeal(m_caster, uint32(new_damage), m_spellInfo);
|
||||
newDamage = m_caster->SpellHealingBonus(m_caster, m_spellInfo, newDamage, HEAL);
|
||||
m_caster->DealHeal(m_caster, uint32(newDamage), m_spellInfo);
|
||||
}
|
||||
// m_healthLeech+=tmpvalue;
|
||||
// m_damage+=new_damage;
|
||||
}
|
||||
|
||||
void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
|
||||
|
||||
@@ -1896,6 +1896,26 @@ int32 SpellMgr::CalculateSpellEffectBaseAmount(int32 value, SpellEntry const * s
|
||||
return value - 1;
|
||||
}
|
||||
|
||||
float SpellMgr::CalculateSpellEffectValueMultiplier(SpellEntry const * spellEntry, uint8 effIndex, Unit * caster, Spell const * spell)
|
||||
{
|
||||
float multiplier = spellEntry->EffectValueMultiplier[effIndex];
|
||||
|
||||
if (caster)
|
||||
if (Player * modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_VALUE_MULTIPLIER, multiplier);
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
float SpellMgr::CalculateSpellEffectDamageMultiplier(SpellEntry const * spellEntry, uint8 effIndex, Unit * caster, Spell const * spell)
|
||||
{
|
||||
float multiplier = spellEntry->EffectDamageMultiplier[effIndex];
|
||||
|
||||
if (caster)
|
||||
if (Player * modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_DAMAGE_MULTIPLIER, multiplier);
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const
|
||||
{
|
||||
// ignore passive spells
|
||||
|
||||
@@ -1238,6 +1238,8 @@ class SpellMgr
|
||||
bool IsSkillTypeSpell(uint32 spellId, SkillType type) const;
|
||||
static int32 CalculateSpellEffectAmount(SpellEntry const * spellEntry, uint8 effIndex, Unit const * caster = NULL, int32 const * basePoints = NULL, Unit const * target = NULL);
|
||||
static int32 CalculateSpellEffectBaseAmount(int32 value, SpellEntry const * spellEntry, uint8 effIndex);
|
||||
static float CalculateSpellEffectValueMultiplier(SpellEntry const * spellEntry, uint8 effIndex, Unit * caster, Spell const * spell = NULL);
|
||||
static float CalculateSpellEffectDamageMultiplier(SpellEntry const * spellEntry, uint8 effIndex, Unit * caster, Spell const * spell = NULL);
|
||||
|
||||
// Spell correctess for client using
|
||||
static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true);
|
||||
|
||||
Reference in New Issue
Block a user