Author Topic: Tydeus' Complete Damage Calculator- Made Possible by cmp.  (Read 2316 times)

0 Members and 2 Guests are viewing this topic.

Offline Tydeus

  • King
  • **********
  • Renown: 1422
  • Infamy: 351
  • cRPG Player A Gentleman and a Scholar
  • Item re-unbalance guy
    • View Profile
  • Game nicks: Tydeus
  • IRC nick: Tydeus
Tydeus' Complete Damage Calculator- Made Possible by cmp.
« on: October 19, 2011, 08:35:47 am »
+5
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/

Code: [Select]
#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.
« Last Edit: October 19, 2011, 09:03:18 am by Tydeus »
chadz> i wouldnt mind seeing some penis on my character

Offline Digglez

  • Duke
  • *******
  • Renown: 573
  • Infamy: 596
  • cRPG Player
  • YOU INCOMPETENT TOH'PAH!
    • View Profile
  • Faction: Northmen
  • Game nicks: GotLander, Hamarr, Digglesan, Black_D34th
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #1 on: October 19, 2011, 09:02:58 am »
0
 do it in php, javascript or some other web based format

Offline Tydeus

  • King
  • **********
  • Renown: 1422
  • Infamy: 351
  • cRPG Player A Gentleman and a Scholar
  • Item re-unbalance guy
    • View Profile
  • Game nicks: Tydeus
  • IRC nick: Tydeus
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #2 on: October 19, 2011, 09:06:14 am »
0
do it in php, javascript or some other web based format
I should have just updated Vargas' Toolkit then. That would have ended up being more of a pain in the end. I made this simply because of how easy it was to do.
chadz> i wouldnt mind seeing some penis on my character

Offline Digglez

  • Duke
  • *******
  • Renown: 573
  • Infamy: 596
  • cRPG Player
  • YOU INCOMPETENT TOH'PAH!
    • View Profile
  • Faction: Northmen
  • Game nicks: GotLander, Hamarr, Digglesan, Black_D34th
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #3 on: October 19, 2011, 09:07:14 am »
0
I should have just updated Vargas' Toolkit then. That would have ended up being more of a pain in the end. I made this simply because of how easy it was to do.

and only a handful of people are going to go thru the trouble of using it, so its about useless.  excel spreadsheet is more friendly

Offline Tydeus

  • King
  • **********
  • Renown: 1422
  • Infamy: 351
  • cRPG Player A Gentleman and a Scholar
  • Item re-unbalance guy
    • View Profile
  • Game nicks: Tydeus
  • IRC nick: Tydeus
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #4 on: October 19, 2011, 09:44:35 am »
0
and only a handful of people are going to go thru the trouble of using it
Pretty much expected this from the beginning, yeah.

At a minimum, I think anyone interested in game mechanics should take a look at the code. Its got some stuff in there that's contrary to popular belief or would otherwise be rather counter intuitive.
« Last Edit: October 19, 2011, 09:46:27 am by Tydeus »
chadz> i wouldnt mind seeing some penis on my character

Offline Kafein

  • King
  • **********
  • Renown: 2203
  • Infamy: 808
  • cRPG Player Sir White Rook A Gentleman and a Scholar
    • View Profile
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #5 on: October 19, 2011, 10:27:40 am »
0
Hell man, this is python, not cobol, think OO :cry:

Cool though x)

Offline Balton

  • Knight
  • ***
  • Renown: 56
  • Infamy: 11
  • cRPG Player
  • Divine Being
    • View Profile
  • Faction: Death God
  • Game nicks: GoD_Balton_the_Buff
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #6 on: October 19, 2011, 10:31:37 am »
0
Very cool +1
Wherever I tread, only chaos & destruction follow.

Offline Paul

  • Developer
  • ******
  • Renown: 1879
  • Infamy: 442
  • cRPG Player A Gentleman and a Scholar
  • ball bounce boss
    • View Profile
  • IRC nick: Urist
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #7 on: October 19, 2011, 11:41:39 am »
-1
Average damage is not (min+max)/2.

Offline Espu

  • The good
  • Count
  • *****
  • Renown: 261
  • Infamy: 33
  • cRPG Player
    • View Profile
  • IRC nick: Espu
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #8 on: October 20, 2011, 01:24:40 pm »
+2
I'll copy this to my calculator and won't add credits.

Offline Jacko

  • OKAM Developer
  • ***
  • Renown: 839
  • Infamy: 99
  • cRPG Player Sir White Knight
  • Mappers Guild
    • View Profile
  • Faction: Fffnanguard!
  • Game nicks: Jacko
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #9 on: October 20, 2011, 01:29:46 pm »
0
It' needs to be pretty.
Monkeys!

Offline Vibe

  • Vibrator
  • King
  • **********
  • Renown: 2528
  • Infamy: 615
  • cRPG Player Madam White Queen A Gentleman and a Scholar
    • View Profile
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #10 on: October 20, 2011, 01:33:33 pm »
0
I'll copy this to my calculator and won't add credits.

Do it, schneller!

Offline Tears of Destiny

  • Naive
  • King
  • **********
  • Renown: 1847
  • Infamy: 870
  • cRPG Player A Gentleman and a Scholar
  • Quiet drifting through shallow waters. 死のび
    • View Profile
    • NADS
  • Faction: Black Company
  • IRC nick: Tears
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #11 on: October 20, 2011, 10:08:46 pm »
0
Average damage is not (min+max)/2.

Pfft, as if you know anything about this game, Mr. Claiming that AGI does not effect swing speed  :mrgreen: (just ignore your findings in 0.808)
I'm not normal and I don't pretend so, my approach is pretty much a bomb crescendo.
Death is a fun way to pass the time though, several little bullets moving in staccato.
The terror of my reign will live on in infamy, singing when they die like a dead man's symphony.

Offline marco1391

  • Noble
  • **
  • Renown: 18
  • Infamy: 11
  • cRPG Player
    • View Profile
  • Game nicks: Legio_Marco1691
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #12 on: October 20, 2011, 10:24:07 pm »
0
it says with a 6 difficulty bow with 35 pierce(longbow+1 and bodkin+3), 1% speed bonus,7 pd, no rain penality, 150 wpf and 60 enemy's armor I should do from a minimum of 70 to a maximum of 100 effective damage, seems something is wrong

Offline MrShine

  • Ragdoll Basher
  • King
  • **********
  • Renown: 1156
  • Infamy: 193
  • cRPG Player A Gentleman and a Scholar
  • Fear the stache
    • View Profile
  • Game nicks: MrShine
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #13 on: October 20, 2011, 10:43:38 pm »
0
cool I'll have to give this a shot when I get a chance.

Thanks for posting!

it says with a 6 difficulty bow with 35 pierce(longbow+1 and bodkin+3), 1% speed bonus,7 pd, no rain penality, 150 wpf and 60 enemy's armor I should do from a minimum of 70 to a maximum of 100 effective damage, seems something is wrong
Working as intended!  :twisted:
Holy crap I have a youtube gaming channel! https://www.youtube.com/user/MrShine12345

Offline Tydeus

  • King
  • **********
  • Renown: 1422
  • Infamy: 351
  • cRPG Player A Gentleman and a Scholar
  • Item re-unbalance guy
    • View Profile
  • Game nicks: Tydeus
  • IRC nick: Tydeus
Re: Tydeus' Complete Damage Calculator- Made Possible by cmp.
« Reply #14 on: October 21, 2011, 12:45:58 pm »
0
it says with a 6 difficulty bow with 35 pierce(longbow+1 and bodkin+3), 1% speed bonus,7 pd, no rain penality, 150 wpf and 60 enemy's armor I should do from a minimum of 70 to a maximum of 100 effective damage, seems something is wrong
Yeah, that's cause you used "1" as your speed bonus. Like I said, for ranged the speed bonus part isn't very intuitive. Arrows start out at max damage and only decrease over time.
chadz> i wouldnt mind seeing some penis on my character