Public feed #887781

Mine

public text v1 · immutable
Raw Edit
·published 2008-02-01 16:33 UTC
rendered paste body
Index: game/Unit.cpp
===================================================================
--- game/Unit.cpp	(revision 5121)
+++ game/Unit.cpp	(working copy)
@@ -2231,7 +2231,7 @@
     // apply melee damage bonus and absorb only if base damage not fully blocked to prevent negative damage or damage with full block
     if(*victimState != VICTIMSTATE_BLOCKS)
     {
-        MeleeDamageBonus(pVictim, damage,attType);
+        MeleeDamageBonus(pVictim, damage,attType,spellCasted);
         CalcAbsorbResist(pVictim, damageType, DIRECT_DAMAGE, *damage-*blocked_amount, absorbDamage, resistDamage);
     }
 
@@ -5880,7 +5880,7 @@
     return false;
 }
 
-void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attType)
+void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attType, SpellEntry const *spellCasted)
 {
     if(!pVictim) return;
 
@@ -5943,8 +5943,32 @@
     }
 
     if (APbonus!=0)  // Can be negative
-       DoneFlatBenefit += int32(APbonus/14.0f * GetAttackTime(attType)/1000);
+	{
+		uint32 wSpeed = GetAttackTime(attType);
 
+		if ( GetTypeId() == TYPEID_PLAYER  && spellCasted && 
+			(spellCasted->Effect[0] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG ||
+			spellCasted->Effect[1] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG ||
+			spellCasted->Effect[2] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG))
+		{
+			Item *weapon = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
+
+			if ( spellCasted->AttributesEx3 & 0x0000000001000000)
+				Item *weapon = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
+
+			if (spellCasted->rangeIndex != 1 && spellCasted->rangeIndex != 2 && spellCasted->rangeIndex != 7)
+				wSpeed = 2800;
+			else if ( weapon && weapon->GetProto()->InventoryType == INVTYPE_2HWEAPON)
+				wSpeed = 3300;
+			else if ( weapon && weapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
+				wSpeed = 1700;
+			else 
+				wSpeed = 2400;
+
+		}
+       DoneFlatBenefit += int32(APbonus/14.0f * wSpeed/1000);
+	}
+
     // ..taken
     AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
     for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
Index: game/Unit.h
===================================================================
--- game/Unit.h	(revision 5121)
+++ game/Unit.h	(working copy)
@@ -962,7 +962,7 @@
         uint32 SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype);
         uint32 SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, Unit *pVictim);
         bool SpellCriticalBonus(SpellEntry const *spellProto, uint32 *damage, Unit *pVictim);
-        void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType);
+        void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellCasted);
         void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
         virtual bool IsImmunedToSpell(SpellEntry const* spellInfo) const;
                                                             // redefined in Creature