[7263] Fixed AP calculation in some cases

Fixed use AP dynamic mods (bonuses from stats)
Apply ITEM_MOD_ATTACK_POWER for ranged AP
Implement feral AP from weapon dps for druids

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-02-10 21:21:25 +03:00
parent edfa757020
commit 14be347015
5 changed files with 47 additions and 9 deletions

View file

@ -6728,6 +6728,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
break;
case ITEM_MOD_ATTACK_POWER:
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(val), apply);
HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(val), apply);
break;
case ITEM_MOD_RANGED_ATTACK_POWER:
HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(val), apply);
@ -6805,6 +6806,18 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
SetBaseWeaponDamage(attType, MAXDAMAGE, damage);
}
if (proto->Class == ITEM_CLASS_WEAPON && proto->Delay)
{
// Druids get feral AP bonus from weapon dps
if(getClass() == CLASS_DRUID && (slot==EQUIPMENT_SLOT_MAINHAND || slot==EQUIPMENT_SLOT_OFFHAND))
{
float dps = (proto->Damage[0].DamageMin + proto->Damage[0].DamageMax)/(2*proto->Delay/1000.0f);
int32 feral_bonus = int32(dps*14.0f) - 767;
if (feral_bonus > 0)
ApplyFeralAPBonus(feral_bonus, apply);
}
}
if(!IsUseEquipedWeapon(slot==EQUIPMENT_SLOT_MAINHAND))
return;
@ -12033,6 +12046,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a
break;
case ITEM_MOD_ATTACK_POWER:
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply);
HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
sLog.outDebug("+ %u ATTACK_POWER", enchant_amount);
break;
case ITEM_MOD_RANGED_ATTACK_POWER: