mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[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:
parent
edfa757020
commit
14be347015
5 changed files with 47 additions and 9 deletions
|
|
@ -108,6 +108,7 @@ enum ITEM_FLAGS
|
||||||
ITEM_FLAGS_WRAPPER = 0x00000200, // used or not used wrapper
|
ITEM_FLAGS_WRAPPER = 0x00000200, // used or not used wrapper
|
||||||
ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not
|
ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not
|
||||||
ITEM_FLAGS_CHARTER = 0x00002000, // arena/guild charter
|
ITEM_FLAGS_CHARTER = 0x00002000, // arena/guild charter
|
||||||
|
ITEM_FLAGS_PROSPECTABLE = 0x00040000,
|
||||||
ITEM_FLAGS_UNIQUE_EQUIPPED = 0x00080000,
|
ITEM_FLAGS_UNIQUE_EQUIPPED = 0x00080000,
|
||||||
ITEM_FLAGS_USEABLE_IN_ARENA = 0x00200000,
|
ITEM_FLAGS_USEABLE_IN_ARENA = 0x00200000,
|
||||||
ITEM_FLAGS_THROWABLE = 0x00400000, // not used in game for check trow possibility, only for item in game tooltip
|
ITEM_FLAGS_THROWABLE = 0x00400000, // not used in game for check trow possibility, only for item in game tooltip
|
||||||
|
|
|
||||||
|
|
@ -6728,6 +6728,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
|
||||||
break;
|
break;
|
||||||
case ITEM_MOD_ATTACK_POWER:
|
case ITEM_MOD_ATTACK_POWER:
|
||||||
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(val), apply);
|
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(val), apply);
|
||||||
|
HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(val), apply);
|
||||||
break;
|
break;
|
||||||
case ITEM_MOD_RANGED_ATTACK_POWER:
|
case ITEM_MOD_RANGED_ATTACK_POWER:
|
||||||
HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(val), apply);
|
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);
|
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))
|
if(!IsUseEquipedWeapon(slot==EQUIPMENT_SLOT_MAINHAND))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -12033,6 +12046,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a
|
||||||
break;
|
break;
|
||||||
case ITEM_MOD_ATTACK_POWER:
|
case ITEM_MOD_ATTACK_POWER:
|
||||||
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply);
|
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);
|
sLog.outDebug("+ %u ATTACK_POWER", enchant_amount);
|
||||||
break;
|
break;
|
||||||
case ITEM_MOD_RANGED_ATTACK_POWER:
|
case ITEM_MOD_RANGED_ATTACK_POWER:
|
||||||
|
|
|
||||||
|
|
@ -772,9 +772,29 @@ void Creature::UpdateMaxPower(Powers power)
|
||||||
|
|
||||||
void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
||||||
{
|
{
|
||||||
|
UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER;
|
||||||
|
|
||||||
|
uint16 index = UNIT_FIELD_ATTACK_POWER;
|
||||||
|
uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS;
|
||||||
|
uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER;
|
||||||
|
|
||||||
|
if(ranged)
|
||||||
|
{
|
||||||
|
index = UNIT_FIELD_RANGED_ATTACK_POWER;
|
||||||
|
index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS;
|
||||||
|
index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
|
||||||
|
float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
|
||||||
|
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
|
||||||
|
|
||||||
|
SetUInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
|
||||||
|
SetUInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
|
||||||
|
SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
|
||||||
|
|
||||||
if(ranged)
|
if(ranged)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//automatically update weapon damage after attack power modification
|
//automatically update weapon damage after attack power modification
|
||||||
UpdateDamagePhysical(BASE_ATTACK);
|
UpdateDamagePhysical(BASE_ATTACK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9788,13 +9788,16 @@ Powers Unit::GetPowerTypeByAuraGroup(UnitMods unitMod) const
|
||||||
|
|
||||||
float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const
|
float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const
|
||||||
{
|
{
|
||||||
UnitMods unitMod = (attType == RANGED_ATTACK) ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER;
|
if (attType == RANGED_ATTACK)
|
||||||
|
{
|
||||||
float val = GetTotalAuraModValue(unitMod);
|
uint32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS);
|
||||||
if(val < 0.0f)
|
return ap * (1.0f + GetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER));
|
||||||
val = 0.0f;
|
}
|
||||||
|
else
|
||||||
return val;
|
{
|
||||||
|
uint32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS);
|
||||||
|
return ap * (1.0f + GetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Unit::GetWeaponDamageRange(WeaponAttackType attType ,WeaponDamageRange type) const
|
float Unit::GetWeaponDamageRange(WeaponAttackType attType ,WeaponDamageRange type) const
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7262"
|
#define REVISION_NR "7263"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue