Core/Spells: Bonuses from SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN should be multiplicative

This commit is contained in:
tobmaps
2011-07-23 22:17:16 +07:00
parent d06d174a4f
commit bb0634c7c2
2 changed files with 12 additions and 31 deletions

View File

@@ -10756,20 +10756,11 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
}
// ..taken
int32 maxPositiveMod = 0; // max of the positive amount aura (that increase the damage taken)
int32 sumNegativeMod = 0; // sum the negative amount aura (that reduce the damage taken)
AuraEffectList const& mModDamagePercentTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
for (AuraEffectList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
{
if ((*i)->GetAmount() > 0)
{
if ((*i)->GetAmount() > maxPositiveMod)
maxPositiveMod = (*i)->GetAmount();
}
else
sumNegativeMod += (*i)->GetAmount();
}
float TakenTotalMod = 1.0f;
// from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
// multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetSpellSchoolMask(spellProto));
// .. taken pct: dummy auras
AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
@@ -10784,18 +10775,13 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
if (victim->GetTypeId() != TYPEID_PLAYER)
continue;
float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
if (mod < (*i)->GetAmount())
mod = (float)(*i)->GetAmount();
sumNegativeMod += int32(mod);
AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
// Ebon Plague
case 1933:
if ((*i)->GetMiscValue() & (spellProto ? GetSpellSchoolMask(spellProto) : 0))
{
if ((*i)->GetAmount() > maxPositiveMod)
maxPositiveMod = (*i)->GetAmount();
}
AddPctN(TakenTotalMod, (*i)->GetAmount());
break;
}
}
@@ -10804,7 +10790,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
sumNegativeMod += (*i)->GetAmount();
AddPctN(TakenTotalMod, (*i)->GetAmount());
// Mod damage from spell mechanic
if (uint32 mechanicMask = GetAllSpellMechanicMask(spellProto))
@@ -10812,11 +10798,9 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
if (mechanicMask & uint32(1<<((*i)->GetMiscValue())))
sumNegativeMod += (*i)->GetAmount();
AddPctN(TakenTotalMod, (*i)->GetAmount());
}
float TakenTotalMod = (sumNegativeMod + maxPositiveMod + 100.0f) / 100.0f;
// Taken/Done fixed damage bonus auras
int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto));
int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), victim);
@@ -11937,10 +11921,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
}
// ..taken
AuraEffectList const& mModDamagePercentTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
for (AuraEffectList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask())
AddPctN(TakenTotalMod, (*i)->GetAmount());
TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask());
// From caster spells
AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);

View File

@@ -339,8 +339,8 @@ enum eWaygate
AT_SHOLAZAR = 5046,
AT_UNGORO = 5047,
QUEST_THE_MAKERS_OVERLOOK = 12613,
QUEST_THE_MAKERS_PERCH = 12559,
QUEST_THE_MAKERS_OVERLOOK = 12613,
QUEST_THE_MAKERS_PERCH = 12559,
};
class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript