Merge pull request #2580 from hacknowledge/damagemodfix

Core/Spells: Fixed weapon dependent damage mods for players as well as au
This commit is contained in:
QAston
2011-08-16 03:41:23 -07:00
3 changed files with 23 additions and 29 deletions
+6 -6
View File
@@ -8033,13 +8033,9 @@ void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackTy
for (AuraEffectList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr)
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
float mod = 100.0f;
AuraEffectList const& auraDamagePctList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator itr = auraDamagePctList.begin(); itr != auraDamagePctList.end(); ++itr)
if ((apply && item->IsFitToSpellRequirements((*itr)->GetSpellInfo())) || HasItemFitToSpellRequirements((*itr)->GetSpellInfo(), item))
mod += (*itr)->GetAmount();
SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, mod/100.0f);
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
}
void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply)
@@ -8088,13 +8084,17 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
switch (aura->GetAuraType())
{
case SPELL_AURA_MOD_DAMAGE_DONE: unitModType = TOTAL_VALUE; break;
case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: unitModType = TOTAL_PCT; break;
default: return;
}
if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
{
HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
if (unitModType == TOTAL_VALUE)
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
else
ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, aura->GetAmount() / 100.0f, apply);
}
}
+6 -18
View File
@@ -11761,6 +11761,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
// ..done
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() & spellProto->GetSchoolMask())
@@ -11778,28 +11779,15 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
}
else if (player)
else
{
if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask() &&
(*i)->GetSpellInfo()->EquippedItemClass == -1)
{
EquipmentSlots slot;
switch (attType)
{
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
default: return;
}
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellInfo()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
else if (player->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
}
}
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)