diff options
| author | hacknowledge <hacknowledge101@googlemail.com> | 2011-08-07 16:13:20 +0200 |
|---|---|---|
| committer | hacknowledge <hacknowledge101@googlemail.com> | 2011-08-13 23:26:16 +0200 |
| commit | 0c500486f343ae02508379576c503fe300e17041 (patch) | |
| tree | bdd14753f135500267bcbdd4c0d7693304825973 /src | |
| parent | 0cb68815ec207e519a442283fa6e901ad3704833 (diff) | |
Core/Spells: Fixed weapon dependent damage mods for players as well as autohit damage mods for NPCs and pets. This fixes also meta sockel effects. Also fixed displaying the correct values in the char info. I also took care of applying and unapplying the weapon based damage mods when the player is being disarmed and equips/unequips his weapon.
Fixes #178, #418, #1276, #259 and possible a few other issues.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 12 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 24 | ||||
| -rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 16 |
3 files changed, 23 insertions, 29 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index cff76936aa8..c200eddb257 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -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); } } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8745acce08d..379af2e508a 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b3e955de11f..899034db369 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2553,12 +2553,10 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, return; } + // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods if (!apply) target->RemoveFlag(field, flag); - if (apply) - target->SetFlag(field, flag); - // Handle damage modification, shapeshifted druids are not affected if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm()) { @@ -2567,10 +2565,17 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, uint8 attacktype = Player::GetAttackBySlot(slot); if (attacktype < MAX_ATTACK) + { target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), NULL, !apply); + target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply); + } } } + // if disarm effects should be applied, wait to set flag until damage mods are unapplied + if (apply) + target->SetFlag(field, flag); + if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId()) target->UpdateDamagePhysical(attType); } @@ -4499,8 +4504,9 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 if (!target) return; - if (target->HasItemFitToSpellRequirements(GetSpellInfo())) - target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, GetAmount() / 100.0f, apply); + for(int i = 0; i < MAX_ATTACK; ++i) + if(Item* item = target->GetWeaponForAttack(WeaponAttackType(i),false)) + target->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply); } void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const |
