tobmaps / TrinityCore

http://www.TrinityCore.org
GNU General Public License v2.0
38 stars 7 forks source link

logic issue at upplying SPELL_AURA_MOD_DAMAGE_PERCENT_DONE #211

Closed Erfa1l closed 13 years ago

Erfa1l commented 13 years ago

1) create warrior && learn Two-handed Weapon Specialization 2) equip 2h weapon and use Heroic strike. We'll see that damage multiplair is correct. 3) equip 1h weapon and again use Heroic strike. We'll see that damage multiplair is incorrect (in calculation included Two-handed Weapon Specialization which is incorrect)

Source of problem: 1) Two-handed Weapon Specialization hasn't SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK 2) In Unit.cpp we'll see incorrect check. Some spells have mask for both 1h & 2h weapons and they usable with 1h & 2h weapons

    @@ 12022 @@ void Unit::MeleeDamageBonus(Unit\* victim, uint32 _pdamage, WeaponAttackType attT
    AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
    for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
        if (spellProto)
        {
            if ((_i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
            {
                if ((_i)->GetSpellProto()->EquippedItemClass == -1)
                    AddPctN(DoneTotalMod, (_i)->GetAmount());
                else if (!((_i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
                {
                    if ((_i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass)
                        if (((_i)->GetSpellProto()->EquippedItemSubClassMask == 0) ||
                            ((_i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask)) // Incorrect
                            AddPctN(DoneTotalMod, (_i)->GetAmount());
                }
                else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((_i)->GetSpellProto()))
                    AddPctN(DoneTotalMod, (*i)->GetAmount());
            }
        }
    

Solution: https://github.com/artkeep/trinity/commit/b738da29ac473c5dde28ef333e544491682e2a11

Erfa1l commented 13 years ago

closed due to inactivity of repo owner.