aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2008-11-22 13:55:11 -0600
committermegamage <none@none>2008-11-22 13:55:11 -0600
commitd6066ce58590f746156075e4077596790f0039c8 (patch)
treebe39752459280a919d925229141511c7c7d8e2f2 /src
parent57f39315565b6916affcf6c70a4a4d7255a33b02 (diff)
*Update creature damage calculation. Make -ap spells have effect on them.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Creature.cpp7
-rw-r--r--src/game/StatSystem.cpp18
2 files changed, 17 insertions, 8 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index b2b6639148e..c547065b206 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1279,8 +1279,11 @@ void Creature::SelectLevel(const CreatureInfo *cinfo)
SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, cinfo->minrangedmg * damagemod);
SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, cinfo->maxrangedmg * damagemod);
- SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cinfo->attackpower * damagemod);
- SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, cinfo->rangedattackpower * damagemod);
+ // this value is not accurate, but should be close to the real value
+ SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, level * 5);
+ SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, level * 5);
+ //SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cinfo->attackpower * damagemod);
+ //SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, cinfo->rangedattackpower * damagemod);
}
float Creature::_GetHealthMod(int32 Rank)
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp
index 3533c5c8a02..84e49485e5e 100644
--- a/src/game/StatSystem.cpp
+++ b/src/game/StatSystem.cpp
@@ -737,16 +737,22 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
break;
}
- float att_speed = float(GetAttackTime(attType))/1000.0f;
-
- float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType)/ 14.0f * att_speed;
- float base_pct = GetModifierValue(unitMod, BASE_PCT);
- float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
- float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
+ //float att_speed = float(GetAttackTime(attType))/1000.0f;
float weapon_mindamage = GetWeaponDamageRange(attType, MINDAMAGE);
float weapon_maxdamage = GetWeaponDamageRange(attType, MAXDAMAGE);
+ //This formula is not correct
+ //The correct one is (Damage_from_AttackPower + Base_Weapon_Damage) * Multiplier
+ //We do not know the multiplier, so we assume attack power is about 25% damage
+ //float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType)/ 14.0f * att_speed;
+ float base_value = GetModifierValue(unitMod, BASE_VALUE)
+ + (weapon_mindamage + weapon_maxdamage) / 6
+ / GetTotalAttackPowerValue(attType) * getLevel() * 5;
+ float base_pct = GetModifierValue(unitMod, BASE_PCT);
+ float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
+ float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
+
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct ;
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct ;