aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-11 11:51:17 -0600
committermegamage <none@none>2009-02-11 11:51:17 -0600
commit848af429189fe20fef67cbb09295c3ecd5b9fae6 (patch)
treeb69e91f3471eafefae863733df6dd6854f3be8c1 /src/game/Unit.cpp
parent8012f78d00ef29025397d2fe8a18dc1eb8876292 (diff)
[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> --HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index be764eaee3e..b74eec24ae7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10393,23 +10393,16 @@ Powers Unit::GetPowerTypeByAuraGroup(UnitMods unitMod) const
float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const
{
-//get value from unit field instead of calculating from mods-because mods from stat are not added to unit_mods
- int32 index, index_mod, index_mult;
if (attType == RANGED_ATTACK)
{
- index=UNIT_FIELD_RANGED_ATTACK_POWER;
- index_mod=UNIT_FIELD_RANGED_ATTACK_POWER_MODS;
- index_mult=UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER;
+ uint32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS);
+ return ap * (1.0f + GetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER));
}
- else //meele
+ else
{
- index=UNIT_FIELD_ATTACK_POWER;
- index_mod=UNIT_FIELD_ATTACK_POWER_MODS;
- index_mult=UNIT_FIELD_ATTACK_POWER_MULTIPLIER;
+ uint32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS);
+ return ap * (1.0f + GetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER));
}
-
- float val = float(GetUInt32Value(index) + GetUInt32Value(index_mod)) * float(GetFloatValue(index_mult)+1);
- return (val < 0.0f)? 0.0f : val;
}
float Unit::GetWeaponDamageRange(WeaponAttackType attType ,WeaponDamageRange type) const