Skip to content

Commit

Permalink
[c12700] Fix SpellDamage modifier of SPELL_AURA_MOD_DAMAGE_DONE_CREATURE
Browse files Browse the repository at this point in the history
This aura modifies a flat value, not a percent value.

Related cmangos/cmangos-classic#26

Signed-off-by: Schmoozerd <schmoozerd@cmangos.net>

(based on commit [12508] - 17a4097)
  • Loading branch information
cala authored and Dramacydal committed Aug 19, 2013
1 parent d2d071c commit 07b0d2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
21 changes: 9 additions & 12 deletions src/game/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6625,6 +6625,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
return owner->SpellDamageBonusDone(pVictim, spellProto, pdamage, damagetype);
}

uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
float DoneTotalMod = 1.0f;
int32 DoneTotal = 0;

Expand All @@ -6646,20 +6647,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
}
}

uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
// Add flat bonus from spell damage versus
DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask);
AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
if (creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
DoneTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;

AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
for (AuraList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i)
{
if (creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
DoneTotalMod += ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
}
// Add pct bonus from spell damage versus
DoneTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, creatureTypeMask);

// Add flat bonus from spell damage creature
DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, creatureTypeMask);

if (getPowerType() == POWER_MANA)
{
Expand All @@ -6677,7 +6672,9 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u

// done scripted mod (take it from owner)
Unit* owner = GetOwner();
if (!owner) owner = this;
if (!owner)
owner = this;

AuraList const& mOverrideClassScript = owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12699"
#define REVISION_NR "12700"
#endif // __REVISION_NR_H__

0 comments on commit 07b0d2f

Please sign in to comment.