Permalink
Browse files

Core/Spells: Remove effIndex from Damage/Healing taken/done functions…

… [Need test damage/healing ingame]
1 parent 9f0a309 commit fec1afffe51e4731f83a50066830d573e45aade8 @Keital Keital committed Dec 6, 2016
@@ -11478,7 +11478,7 @@ void Unit::EnergizeBySpell(Unit* victim, uint32 spellId, int32 damage, Powers po
victim->getHostileRefManager().threatAssist(this, float(damage) * 0.5f, spellInfo);
}
-uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, uint32 stack) const
+uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) const
{
if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
return pdamage;
@@ -11510,7 +11510,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// For totems get damage bonus from owner
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
if (Unit* owner = GetOwner())
- return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, effIndex);
+ return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype);
// Done total percent damage auras
float DoneTotalMod = 1.0f;
@@ -11865,9 +11865,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
// Check for table values
- float coeff = spellProto->Effects[effIndex].SpellPowerCoeff;
-
- // Melee data is not present inside DBC! Use DB Value.
+ float coeff = 0;
SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
if (bonus)
{
@@ -11921,7 +11919,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
return uint32(std::max(tmpDamage, 0.0f));
}
-uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, uint32 stack) const
+uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) const
{
if (!spellProto || damagetype == DIRECT_DAMAGE)
return pdamage;
@@ -11983,7 +11981,10 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask());
// Check for table values
- float coeff = spellProto->Effects[effIndex].SpellPowerCoeff;
+ float coeff = 0;
+ SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
+ if (bonus)
+ coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
// Default calculation
if (TakenAdvertisedBenefit)
@@ -12427,7 +12428,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* /*spellProto*/, uint32 d
return damage;
}
-uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, uint32 stack) const
+uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) const
{
// For totems get healing bonus from owner (statue isn't totem in fact)
if (GetTypeId() == TYPEID_UNIT && IsTotem())
@@ -12595,7 +12596,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
return uint32(std::max(heal, 0.0f));
}
-uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, uint32 stack) const
+uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) const
{
float TakenTotalMod = 1.0f;
@@ -12665,7 +12666,11 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
}
// Check for table values
- float coeff = spellProto->Effects[effIndex].SpellPowerCoeff;
+ float coeff = 0;
+ SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
+ if (bonus)
+ coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
+
float factorMod = 1.0f;
if (coeff <= 0.0f)
{
@@ -2110,12 +2110,12 @@ class Unit : public WorldObject
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const;
int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const;
- uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, uint32 stack = 1) const;
- uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, uint32 stack = 1) const;
+ uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1) const;
+ uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1) const;
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const;
int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) const;
- uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, uint32 stack = 1) const;
- uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, uint32 stack = 1) const;
+ uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1) const;
+ uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1) const;
uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const* spellProto = NULL);
uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto = NULL);
@@ -2235,8 +2235,7 @@ void Guild::HandleUpdateRank(WorldSession* session, uint32 GuildID, bool RankId)
if (!RankInfo1 || !RankInfo2)
return;
- RankInfo tmp = NULL;
- tmp = *RankInfo2;
+ RankInfo tmp = *RankInfo2;
RankInfo2->SetName(RankInfo1->GetName());
RankInfo2->SetRights(RankInfo1->GetRights());
RankInfo1->SetName(tmp.GetName());
@@ -714,8 +714,8 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// Earth Shield
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x400)
{
- amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, NULL);
- amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, NULL);
+ amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE);
+ amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE);
}
break;
case SPELL_AURA_PERIODIC_DAMAGE:
@@ -7070,8 +7070,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(172);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
afflictionDamage = CalculatePct(afflictionDamage, GetSpellInfo()->Effects[2].BasePoints);
caster->CastCustomSpell(target, 131740, &afflictionDamage, NULL, NULL, true);
@@ -7081,8 +7081,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(30108);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
afflictionDamage = CalculatePct(afflictionDamage, GetSpellInfo()->Effects[2].BasePoints);
caster->CastCustomSpell(target, 131736, &afflictionDamage, NULL, NULL, true);
@@ -7092,8 +7092,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(27243);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
afflictionDamage = CalculatePct(afflictionDamage, GetSpellInfo()->Effects[2].BasePoints);
caster->CastCustomSpell(target, 132566, &afflictionDamage, NULL, NULL, true);
@@ -7103,8 +7103,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(980);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
afflictionDamage = CalculatePct(afflictionDamage, GetSpellInfo()->Effects[2].BasePoints);
agony->ModStackAmount(1);
@@ -7135,8 +7135,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(172);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
if (grimoireOfSacrifice)
AddPct(afflictionDamage, 50);
@@ -7148,8 +7148,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(30108);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
if (grimoireOfSacrifice)
AddPct(afflictionDamage, 50);
@@ -7161,8 +7161,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(27243);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
if (grimoireOfSacrifice)
AddPct(afflictionDamage, 50);
@@ -7174,8 +7174,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{
afflictionSpell = sSpellMgr->GetSpellInfo(980);
afflictionDamage = caster->CalculateSpellDamage(target, afflictionSpell, 0);
- afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT, NULL);
- afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT, NULL);
+ afflictionDamage = caster->SpellDamageBonusDone(target, afflictionSpell, afflictionDamage, DOT);
+ afflictionDamage = target->SpellDamageBonusTaken(caster, afflictionSpell, afflictionDamage, DOT);
if (grimoireOfSacrifice)
AddPct(afflictionDamage, 50);
@@ -7322,8 +7322,8 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
uint32 damage = std::max(GetAmount(), 0);
- damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, m_effIndex, GetBase()->GetStackAmount());
- damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, m_effIndex, GetBase()->GetStackAmount());
+ damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
bool crit = IsPeriodicTickCrit(target, caster);
if (crit)
@@ -7359,8 +7359,8 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
{
float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
- uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, m_effIndex, GetBase()->GetStackAmount()));
- heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, m_effIndex, GetBase()->GetStackAmount()));
+ uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount()));
+ heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount()));
int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal);
caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
@@ -7469,8 +7469,8 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
damage += addition;
}
- damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, m_effIndex, GetBase()->GetStackAmount());
- damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, m_effIndex, GetBase()->GetStackAmount());
+ damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
}
// Stay of Execution heal-per-tick calculation
@@ -1452,8 +1452,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Improved Devouring Plague
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 0))
{
- uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT, NULL);
- damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, NULL);
+ uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT);
+ damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
int32 heal = int32(CalculatePct(basepoints0, 15));
@@ -495,7 +495,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
break;
damage += int32(0.49f * m_caster->SpellBaseDamageBonusDone(SpellSchoolMask(m_spellInfo->SchoolMask)));
- damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE, 1, false);
+ damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
int32 holyPower = m_caster->GetPower(POWER_HOLY_POWER) + 1;
@@ -508,7 +508,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
damage *= holyPower;
- damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE, effIndex);
+ damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
// Remove holy power
if (!m_caster->HasAura(90174))
@@ -1230,7 +1230,7 @@ class spell_hun_improved_serpent_sting : public SpellScriptLoader
{
if (serpentSting->GetEffect(0))
{
- int32 bp = _player->SpellDamageBonusDone(target, GetSpellInfo(), serpentSting->GetEffect(0)->GetAmount(), DOT, NULL);
+ int32 bp = _player->SpellDamageBonusDone(target, GetSpellInfo(), serpentSting->GetEffect(0)->GetAmount(), DOT);
bp *= serpentSting->GetMaxDuration() / serpentSting->GetEffect(0)->GetAmplitude();
bp = CalculatePct(bp, 30);
Oops, something went wrong.

3 comments on commit fec1aff

@cybrann
Collaborator
cybrann commented on fec1aff Dec 7, 2016

Nice to see someone still working here, soon I should be able to do some stuff here again

@sunshitwowsucks

BTW this commit actually makes spell_bonus_data table useless and makes spells do way less damage and ele sham do 9k dps in full bis

@Keital
Member
Keital commented on fec1aff Jan 19, 2017
  • float coeff = 0;
  • SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
  • if (bonus)
  •    coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
    

that should do the trick

Please sign in to comment.