Core/Auras: Fixed SPELL_AURA_MOD_DAMAGE_PERCENT_DONE for creatures (and crashfix)

This commit is contained in:
Shauren
2016-11-20 11:52:04 +01:00
parent b9f7b500a3
commit ee21cd31a1
2 changed files with 16 additions and 8 deletions
+16 -6
View File
@@ -7950,9 +7950,14 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
float maxModDamagePercentSchool = 0.0f;
for (uint32 i = 0; i < MAX_SPELL_SCHOOL; ++i)
if (spellProto->GetSchoolMask() & (1 << i))
maxModDamagePercentSchool = std::max(maxModDamagePercentSchool, GetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i));
if (GetTypeId() == TYPEID_PLAYER)
{
for (uint32 i = 0; i < MAX_SPELL_SCHOOL; ++i)
if (spellProto->GetSchoolMask() & (1 << i))
maxModDamagePercentSchool = std::max(maxModDamagePercentSchool, GetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i));
}
else
maxModDamagePercentSchool = GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, spellProto->GetSchoolMask());
DoneTotalMod *= maxModDamagePercentSchool;
@@ -8900,9 +8905,14 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if (!spellProto->HasAttribute(SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL))
{
float maxModDamagePercentSchool = 0.0f;
for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
if (spellProto->GetSchoolMask() & (1 << i))
maxModDamagePercentSchool = std::max(maxModDamagePercentSchool, GetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i));
if (GetTypeId() == TYPEID_PLAYER)
{
for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
if (spellProto->GetSchoolMask() & (1 << i))
maxModDamagePercentSchool = std::max(maxModDamagePercentSchool, GetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i));
}
else
maxModDamagePercentSchool = GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, spellProto->GetSchoolMask());
DoneTotalMod *= maxModDamagePercentSchool;
}