mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[8898] Fix typo: get SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT data from victim.
Signed-off-by: VladimirMangos <vladimir@getmangos.com> Also added function for 2 repeated loop code and fix another typo for second SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT case.
This commit is contained in:
parent
5186046c5e
commit
cd2ec48742
3 changed files with 23 additions and 20 deletions
|
|
@ -3466,6 +3466,23 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
|
|||
return modifier;
|
||||
}
|
||||
|
||||
float Unit::GetTotalAuraMultiplierByMiscValueForMask(AuraType auratype, uint32 mask) const
|
||||
{
|
||||
if(!mask)
|
||||
return 1.0f;
|
||||
|
||||
float multiplier = 1.0f;
|
||||
|
||||
AuraList const& mTotalAuraList = GetAurasByType(auratype);
|
||||
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
||||
{
|
||||
Modifier* mod = (*i)->GetModifier();
|
||||
if (mask & (1 << (mod->m_miscvalue -1)))
|
||||
multiplier *= (100.0f + mod->m_amount)/100.0f;
|
||||
}
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
bool Unit::AddAura(Aura *Aur)
|
||||
{
|
||||
SpellEntry const* aurSpellInfo = Aur->GetSpellProto();
|
||||
|
|
@ -8571,15 +8588,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
|||
}
|
||||
|
||||
// Mod damage from spell mechanic
|
||||
if (uint32 mechanicMask = GetAllSpellMechanicMask(spellProto))
|
||||
{
|
||||
AuraList const& mDamageDoneMechanic = pVictim->GetAurasByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
|
||||
for(AuraList::const_iterator i = mDamageDoneMechanic.begin();i != mDamageDoneMechanic.end(); ++i)
|
||||
{
|
||||
if (mechanicMask & uint32(1 << ((*i)->GetModifier()->m_miscvalue)))
|
||||
TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
|
||||
}
|
||||
}
|
||||
TakenTotalMod *= pVictim->GetTotalAuraMultiplierByMiscValueForMask(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT,GetAllSpellMechanicMask(spellProto));
|
||||
|
||||
// Mod damage taken from AoE spells
|
||||
if(IsAreaOfEffectSpell(spellProto))
|
||||
|
|
@ -9388,16 +9397,7 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
|
|||
TakenPercent *= pVictim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, schoolMask);
|
||||
|
||||
// ..taken pct (by mechanic mask)
|
||||
if (mechanicMask)
|
||||
{
|
||||
AuraList const& mTotalAuraList = GetAurasByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
|
||||
for(AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
|
||||
{
|
||||
Modifier* mod = (*i)->GetModifier();
|
||||
if ((1<<(mod->m_miscvalue-1)) & mechanicMask)
|
||||
TakenPercent *= (100.0f + mod->m_amount)/100.0f;
|
||||
}
|
||||
}
|
||||
TakenPercent *= pVictim->GetTotalAuraMultiplierByMiscValueForMask(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT,mechanicMask);
|
||||
|
||||
// ..taken pct (melee/ranged)
|
||||
if(attType == RANGED_ATTACK)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue