I actually made this a few months ago when I was trying to figure out what archery damage actually looked like, I updated it a bit since then but not much has really changed. As far as any game mechanics code goes, it's all done by cmp. The only thing I did was plug this into a python script, allow the user to input settings and allow you to see relevant information. This was also the first time I had ever even touched python so, don't be blame me too much for how bad it is.
Anyway, here's the code. Just copy and paste this into notepad and give it a name with ".py" at the end. This was made with python version 2.7.2 which you need to run this script, which you can get here:
http://www.python.org/download/#Tydeus' Complete Damage Calculator v0.1
#Made possible by several posts from cmp at:
#http://forums.taleworlds.com/index.php/topic,168722.msg4090940.html#msg4090940
#Special thanks to Xol, Espu and Urist
import os, time, math, sys
#==============================================================================================
armor_soak_factor_against_cut = 0.65
armor_soak_factor_against_pierce = 0.5
armor_soak_factor_against_blunt = 0.4
armor_reduction_factor_against_cut = 1.6
armor_reduction_factor_against_pierce = 1.1
armor_reduction_factor_against_blunt = 1.3
armor_soak_factor_for_damage_type = 0
armor_reduction_factor_for_damage_type = 0
armor_extra_penetration_soak_factor = 1.2
armor_extra_penetration_reduction_factor = 0.6
missile_damage_speed_power = 1.9
melee_damage_speed_power = 2
i = 0
while i == 0:
inputDict = {}
inputDict['armor'] = float(raw_input('Enter the opponents armor value: '))
inputDict['weapon_damage'] = float(raw_input('Enter your weapon damage: '))
inputDict['strength'] = float(raw_input('Enter your strength: '))
inputDict['power_strike'] = float(raw_input('Enter your power strike/draw/throw: '))
inputDict['proficiency'] = float(raw_input('Enter your effective weapon proficiency: '))
inputDict['speed_bonus'] = float(raw_input('Enter your speed bonus percentage in decimal format: '))
inputDict['hold_time'] = float(raw_input('Enter your hold time in seconds rounded to the nearest tenth: '))
inputDict['damage_type'] = float(raw_input('Enter your damage type "("Cut=1, Pierce=2, Blunt=3")": '))
inputDict['weapon_type'] = float(raw_input('Enter your type of weapon "("XBow=0, Bow=1, Throwing=2, 1H=3, 2H=4, 1/2H=5, Polearm=6")": '))
if inputDict['weapon_type'] == 1:
inputDict['difficulty'] = float(raw_input('Enter the bow difficulty: '))
inputDict['mounted'] = float(raw_input('Is there a mounted penalty? "("No=0, Yes=1")": '))
if inputDict['mounted']:
if inputDict['weapon_type'] == 1:
inputDict['horse_archery'] = float(raw_input('Enter your horse archery skill: '))
inputDict['raining'] = float(raw_input('Is there a raining penalty? "("No=0, Yes=1")": '))
inputDict['shield_penalty'] = float(raw_input('Is there a shield penalty? "("No=0, Yes=1")": '))
def dmg_calc(n,inDict,c):
armor = inDict['armor']
weapon_damage = inDict['weapon_damage']
strength = inDict['strength']
power_strike = inDict['power_strike']
proficiency = inDict['proficiency']
speed_bonus = inDict['speed_bonus']
hold_time = inDict['hold_time']
damage_type = inDict['damage_type']
weapon_type = inDict['weapon_type']
mounted = inDict['mounted']
if weapon_type == 1:
difficulty = inDict['difficulty']
if mounted == 1:
horse_archery = inDict['horse_archery']
raining = inDict['raining']
shield_penalty = inDict['shield_penalty']
if hold_time >= 1.1:
hold_bonus = 1.2
elif hold_time >= 0.6:
hold_bonus = (1.1 - hold_time) * 0.6 + 1.2
elif hold_time >= 0.5:
hold_bonus = 1.5
else:
hold_bonus = hold_time + 1.0
raw_damage = weapon_damage * (max(1.0, min(hold_bonus, 2.0)) * 0.5 + 0.5)
if weapon_type >= 3:
raw_damage *= math.pow(melee_damage_speed_power, speed_bonus)
elif weapon_type < 3:
raw_damage *= math.pow(missile_damage_speed_power, speed_bonus)
if weapon_type == 0 and raining:
raw_damage *= 0.75
else:
raw_damage *= proficiency * 0.01 * 0.15 + 0.85
if weapon_type == 1:
raw_damage *= min(power_strike, difficulty + 4) * 0.14 + 1
if mounted:
raw_damage *= horse_archery * 0.019 + 0.8
if raining:
raw_damage *= 0.9
elif weapon_type == 2:
raw_damage *= power_strike * 0.1 + 1.0
if mounted:
raw_damage *= horse_archery * 0.019 + 0.8
elif weapon_type >= 3:
raw_damage *= power_strike * 0.08 + 1.0
raw_damage += strength / 5.0
if (weapon_type >= 3) and (shield_penalty or mounted):
raw_damage *= 0.85
if weapon_type == 6:
raw_damage *= 0.85
#if weapon_flags & itp_two_handed:
# raw_damage *= 0.9
raw_damage = max(0, min(raw_damage, 500))
if c == 0:
print "Raw Damage: "
print raw_damage
if damage_type == 1:
armor_soak_factor_for_damage_type = armor_soak_factor_against_cut
armor_reduction_factor_for_damage_type = armor_reduction_factor_against_cut
elif damage_type == 2:
armor_soak_factor_for_damage_type = armor_soak_factor_against_pierce
armor_reduction_factor_for_damage_type = armor_reduction_factor_against_pierce
elif damage_type == 3:
armor_soak_factor_for_damage_type = armor_soak_factor_against_blunt
armor_reduction_factor_for_damage_type = armor_reduction_factor_against_blunt
#I don't think this applies to crpg.
#if hit_shield_on_back:
# armor += shield_resistance + 10
soak_factor = armor * armor_soak_factor_for_damage_type
reduction_factor = armor * armor_reduction_factor_for_damage_type
if weapon_type < 3:
soak_factor *= armor_extra_penetration_soak_factor
reduction_factor *= armor_extra_penetration_reduction_factor
randomized_soak = (n * 0.55 + 0.45) * soak_factor
randomized_damage = (n * 0.1 + 0.9) * raw_damage
soaked_damage = randomized_damage - randomized_soak
if (soaked_damage < 0.0):
soaked_damage = 0.0
randomized_reduction = math.exp((n * 0.55 + 0.45) * reduction_factor * 0.014)
reduced_damage = (1.0 - 1.0 / randomized_reduction) * soaked_damage
if (reduction_factor < 0.00001):
reduced_damage = 0.0
damage_difference = round(reduced_damage + randomized_soak)
effective_damage = randomized_damage - damage_difference
#I'll throw this in there eventually, current input is shit though.
#For headshots just multiply your min/max damage by 1.2 if melee otherwise, 1.75.
#Calf/thigh is always 90% damage regardless of weapon type; foot shots suffer no penalty.
#if hit_bone == head:
# if weapon_type != 0:
# effective_damage *= 1.75
# else
# effective_damage *= 1.2
#elif hit_bone == calf or hit_bone == thigh:
# effective_damage *= 0.9
effective_damage = max(0, min(effective_damage, 500))
return effective_damage
min_d = dmg_calc(1,inputDict,0)
print "Minimum Damage: "
print min_d
max_d = dmg_calc(0,inputDict,1)
print "Maximum Damage: "
print max_d
print "Average Damage: "
print ((min_d + max_d) / 2)
status_key = raw_input("Type quit to close or enter to try new numbers ")
if status_key == "quit":
i = 1
It's not as pretty as Vargas' Toolkit, which is a great tool for calculating builds and whatnot, but it's a bit more complete and customizable in that you can see realistic numbers.
How to use:Once you get python installed and you've copied over the code and saved it as a python script, double click the icon to launch the script. Inputs are all done numerically, don't try to input anything aside from numbers you'll just get errors that way.
Known issues:- It's fucking ugly
- There are no pretty graphs
- I'm not 100% sure on ranged damage numbers because of the screwy speed bonus. Therefore I suggest going with "0" for a speed bonus(Though cmp suggested just using "1").
- Currently it doesn't allow you to select a body location to test damage.
If anyone has any suggestions or questions feel free to post, thanks.