Skip to content

Commit

Permalink
[9798] Implement basic splitting for caster/target part damage/heal b…
Browse files Browse the repository at this point in the history
…onus calculations, periodic damage/heal over time auras will now store m_amount with caster side bonuses applied and calculate target part on each tick. Currently critical chance/bonus calculations are not affected by this change
  • Loading branch information
Laise committed Apr 27, 2010
1 parent deb49de commit 8d982db
Show file tree
Hide file tree
Showing 6 changed files with 559 additions and 297 deletions.
209 changes: 133 additions & 76 deletions src/game/SpellAuras.cpp

Large diffs are not rendered by default.

47 changes: 29 additions & 18 deletions src/game/SpellEffects.cpp
Expand Up @@ -509,7 +509,8 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
if (aura)
{
// DoT not have applied spell bonuses in m_amount
int32 damagetick = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), aura->GetModifier()->m_amount, DOT);
int32 damagetick = m_caster->SpellDamageBonusDone(unitTarget, aura->GetSpellProto(), aura->GetModifier()->m_amount, DOT);
damagetick = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellProto(), damagetick, DOT);
damage += damagetick * 4;

// Glyph of Conflagrate
Expand Down Expand Up @@ -697,8 +698,8 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
if (m_spellInfo->Id == 20187)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
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
Expand All @@ -713,8 +714,8 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
}

float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
damage+=int32(ap * 0.14f) + int32(holy * 22 / 100);
// Get stack of Holy Vengeance on the target added by caster
uint32 stacks = 0;
Expand All @@ -735,16 +736,16 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000))
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
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->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
damage += int32(ap * 0.15f) + int32(holy * 15 / 100);
}
// Hammer of the Righteous
Expand Down Expand Up @@ -2930,7 +2931,8 @@ void Spell::EffectPowerDrain(SpellEffectIndex eff_idx)
uint32 curPower = unitTarget->GetPower(drain_power);

//add spell damage bonus
damage=m_caster->SpellDamageBonus(unitTarget,m_spellInfo,uint32(damage),SPELL_DIRECT_DAMAGE);
damage = m_caster->SpellDamageBonusDone(unitTarget,m_spellInfo,uint32(damage),SPELL_DIRECT_DAMAGE);
damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage),SPELL_DIRECT_DAMAGE);

// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
uint32 power = damage;
Expand Down Expand Up @@ -3029,8 +3031,8 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/)
if (m_spellInfo->Id == 20167)
{
float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellInfo)) +
caster->SpellBaseHealingBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
int32 holy = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseHealingBonusTaken(GetSpellSchoolMask(m_spellInfo));
addhealth += int32(ap * 0.15) + int32(holy * 15 / 100);
}
// Vessel of the Naaru (Vial of the Sunwell trinket)
Expand Down Expand Up @@ -3080,7 +3082,9 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/)
idx++;
}

int32 tickheal = caster->SpellHealingBonus(unitTarget, targetAura->GetSpellProto(), targetAura->GetModifier()->m_amount, DOT);
int32 tickheal = caster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellProto(), targetAura->GetModifier()->m_amount, DOT);
tickheal = unitTarget->SpellHealingBonusTaken(caster, targetAura->GetSpellProto(), tickheal, DOT);

int32 tickcount = GetSpellDuration(targetAura->GetSpellProto()) / targetAura->GetSpellProto()->EffectAmplitude[idx];

// Glyph of Swiftmend
Expand All @@ -3090,7 +3094,10 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/)
addhealth += tickheal * tickcount;
}
else
addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
{
addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL);
addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL);
}

m_healing += addhealth;

Expand Down Expand Up @@ -3137,7 +3144,9 @@ void Spell::EffectHealMechanical(SpellEffectIndex /*eff_idx*/)
if (!caster)
return;

uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, damage, HEAL);
uint32 addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, damage, HEAL);
addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL);

caster->DealHeal(unitTarget, addhealth, m_spellInfo);
}
}
Expand Down Expand Up @@ -3167,7 +3176,9 @@ void Spell::EffectHealthLeech(SpellEffectIndex eff_idx)
int32 heal = int32(damage*multiplier);
if (m_caster->isAlive())
{
heal = m_caster->SpellHealingBonus(m_caster, m_spellInfo, heal, HEAL);
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);
}
}
Expand Down Expand Up @@ -4989,8 +5000,8 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx)
if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x00020000000000))
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)) +
unitTarget->SpellBaseDamageBonusTaken(GetSpellSchoolMask(m_spellInfo));
spell_bonus += int32(ap * 0.08f) + int32(holy * 13 / 100);
}
break;
Expand Down
6 changes: 3 additions & 3 deletions src/game/StatSystem.cpp
Expand Up @@ -103,13 +103,13 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply)

void Player::UpdateSpellDamageAndHealingBonus()
{
// Magic damage modifiers implemented in Unit::SpellDamageBonus
// Magic damage modifiers implemented in Unit::SpellDamageBonusDone
// This information for client side use only
// Get healing bonus for all schools
SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonus(SPELL_SCHOOL_MASK_ALL));
SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL));
// Get damage bonus for all schools
for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonus(SpellSchoolMask(1 << i)));
SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i)));
}

bool Player::UpdateAllStats()
Expand Down

30 comments on commit 8d982db

@pyrophorous
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Laise, this is a huge update. You are awesome. Thanks!

@laly-zz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@goldberg002
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWESOME!

@shockwave
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi , smal bug compilation :
../../../src/game/SpellEffects.cpp: In member function «void Spell::EffectSchoolDMG(SpellEffectIndex)»:
../../../src/game/SpellEffects.cpp:775: erreur: «class Unit» has no member named «SpellBaseDamageBonus»
../../../src/game/SpellEffects.cpp:776: erreur: «class Unit» has no member named «SpellBaseDamageBonusForVictim»
Forget to declare in unit.h ?

@shockwave
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...Sorry its on my side . :D

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db Apr 27, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for easier code for the future it also fixes damage/heal over time auras so now they will store caster damage on apply - meaning if caster for example dies, his dots will still do same amount of damage as before (dependent from target side ofc)

@3raZar3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get it.. so you are saying that killing the caster wont immediately stop his DoT's from running thier course... right? sounds good to me!

also, wanted to welcome laise... your work is amazing bud!

@morphau
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my god laise you're a BEAST :p

@morphau
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my god laise you're a BEAST :p

@peycho
Copy link

@peycho peycho commented on 8d982db Apr 28, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job.

Thank you.

@Tasssadar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also fix shatter combo, does it? :)

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db Apr 29, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, shatter combo should be fixed in [9784] =)

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db Apr 29, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if anyone have too high Conflagrate damage, in SpellEffects.cpp line 512-513 try removing calls to SpellDamageBonusDone, maybe also Taken

@insider42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have, but already reverted this revision xD

@insider42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a bug when you have a mage with talent 12606 + spell 43015 and receive damage from for example DK blood Plague, you receive millions of damage

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db May 3, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ is it on clean core or on yours? Because its not happening for me

@insider42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just bugreport from my core users, i didn't test it already, maybe there is a specific condition for bug... will try to get more info from that user. And i think my patches can't cause this bug because they affect on some single spells, it started after switch to this rev.

@kero99
Copy link

@kero99 kero99 commented on 8d982db May 3, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db May 3, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% on clean core? and what spell it was for paladin?

@kero99
Copy link

@kero99 kero99 commented on 8d982db May 3, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sorry, insider42 based. dont this problem exist in clean core?, maybe Pala and DK spells related

Best regards

@Wowka321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HowTo on clean core :
cast on self:
.cast 43015
.cast 55078
->i'll die xD

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db May 3, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange - did that, damage remained normal - also tried on naked/full geared with/out talents - no difference
btw whats in your spell_bonus_data for 55078?

@Wowka321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, just did it again. Full rebuild project. On any character
.cast 43015 then .cast 55078
or even mob:
.aura 43015 then .aura 55078
Log on tick: http://paste2.org/p/808734
damage negative -256 o_O
I think it's OS-dependent. Tested on Win 32bit.
this is from my DB http://paste2.org/p/808753

Seems trouble in calculations Unit::MeleeDamageBonusTaken here
float tmpDamage (should be int32???)

@Andrewzz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to note, the bug just happen with rank 7 of Dampen Magic, with Rank 6 you dont have the bug, using Win Server 2008 x64

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db May 4, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Wowka321 - in mangos.sql : (55078, 0, 0, 0.055, 'Death Knight - Blood Plague Dummy Proc'),
I'll check with your values
@Andrewzz, I used 7 =\

@Andrewzz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same DB values that Wowka321 has, I didnt manually edited that, it just came from 1 DB provider (YTDB) or 2 core update.

@Laise
Copy link
Contributor Author

@Laise Laise commented on 8d982db May 4, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think i got it, will fix soon, thx 2all
*
should be fixed in [9831]

@Wowka321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, Laise ^^

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same DB values that Wowka321 has, I didnt manually edited that, it just came from 1 DB provider (YTDB) or 2 core update.

Then YTDB not mangos core compatible. They don't must touch tables filled by mangos team ;)

@Andrewzz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wrong, the values came from an Insider addition, sorry ^_^

Please sign in to comment.