Skip to content

Instantly share code, notes, and snippets.

@sayotte
Created August 15, 2022 18:42
Show Gist options
  • Save sayotte/2480818bf5763d0eb1fafea7ec1eba3d to your computer and use it in GitHub Desktop.
Save sayotte/2480818bf5763d0eb1fafea7ec1eba3d to your computer and use it in GitHub Desktop.
UORenaissance weapon damage calculations
#!/bin/bash
IFS=$'\n'
# Written in bash because I was in a hurry.
# Note that "dc" is a reverse-polish notation calculator.
#
# For the following, consider this example line:
# Magic Wand| 0 2d3 (2-6) 35 31-70 Mace *
for line in $(cat uo-dmg-table.txt); do
# weap="Magic Wand"
weap=$(printf '%s' "$line" | awk -F\| '{print $1}')
# dmgrange="2-6"
dmgrange=$(printf '%s' "$line" | awk -F\| '{print $2}' | cut -d\( -f2 | cut -d\) -f1)
# mindmg="2"
mindmg=$(printf '%s' "$dmgrange" | cut -d- -f1)
# maxdmg="6"
maxdmg=$(printf '%s' "$dmgrange" | cut -d- -f2)
# avg="(mindmg/maxdmg)/2" = 4
avg=$(printf '5 k %d %d + 2 / p q' $mindmg $maxdmg | dc)
# Compute delay between weapon swings, according to this
# FORMULA: Attack Speed= 15,000 ÷ ( [Stamina +100] x Weapon Speed )
# We assume 100 stamina here.
# speed="35"
speed=$(printf '%s' "$line" | awk -F\| '{print $2}' | cut -d\) -f2 | awk '{print $1}')
# delay="15000 / (200 * speed)" = 2.14(s)
delay=$(printf '5 k 15000 200 %d * / p q' $speed | dc)
# dps="avg / delay" = 1.86666
dps=$(printf '5 k %s %s / p q' $avg $delay | dc)
printf '%f %s\n' $dps "$weap"
done
1.866670 Magic Wand
2.933330 Skinning Knife
3.000000 Shepherd's Crook (2-H)
3.733340 Pickaxe
4.000000 Cleaver
4.266660 Butcher Knife
4.466660 Crossbow, Heavy (2-H)
4.800000 Smith's Hammer
5.066660 Hatchet (2-H)
6.000020 Pitchfork (2-H)
6.120000 Crossbow (2-H)
6.600030 Dagger
6.666660 Bow (2-H)
7.800000 Hammer Pick
8.000000 Mace
8.000000 Maul
8.000000 Viking Sword
8.320010 Bardiche (2-H)
8.533330 Club
8.533330 War Mace
8.800000 Battle Axe (2-H)
8.800000 Large Battle Axe (2-H)
8.800000 Two-handed Axe (2-H)
8.800020 Gnarled Staff (2-H)
8.866690 Long Sword (thin)
8.866690 Longsword
9.000000 Halberd(2-H)
9.093350 War Hammer (2-H)
9.566690 Black Staff (2-H)
9.600000 War Axe
9.620030 Axe (2-H)
9.620030 Executioner's Axe (2-H)
9.746700 Scimitar
9.866700 Double Axe (2-H)
10.200040 Broad Sword
10.200040 Cutlass
10.800040 War Fork
10.953360 Kryss
11.520000 Quarterstaff (2-H)
11.653360 Spear (2-H)
11.986690 Katana
12.000000 Short Spear (2-H)
Axe (2-H)| 35 3d10+3 (6-33) 37 31-100 Swords
Battle Axe (2-H)| 40 2d17+4 (6-38) 30 31-80 Swords
Double Axe (2-H)| 45 1d31+4 (5-35) 37 31-110 Swords
Executioner's Axe (2-H)| 35 3d10+3 (6-33) 37 31-90 Swords
Hatchet (2-H)| 15 1d16+1 (2-17) 40 31-80 Swords
Large Battle Axe (2-H)| 40 2d17+4 (6-38) 30 31-110 Swords
Pickaxe| 25 1d15 (1-15) 35 31-60 Swords
Two-handed Axe (2-H)| 35 2d18+3 (5-39) 30 31-70 Swords
War Axe| 35 6d4+3 (9-27) 40 31-80 Mace *
Bow (2-H)| 20 4d9+5 (9-41) 20 31-60 Archery
Crossbow (2-H)| 30 5d8+3 (8-43) 18 31-80 Archery
Crossbow, Heavy (2-H)| 40 5d10+6 (11-56) 10 31-100 Archery
Butcher Knife| 5 2d7 (2-14) 40 31-40 Swords
Cleaver| 10 1d12+1 (2-13) 40 31-50 Swords
Dagger| 1 3d5 (3-15) 55 31-50 Fencing
Dagger+7| 1 3d5+7 (10-22) 55 31-50 Fencing
Skinning Knife| 5 1d10 (1-10) 40 31-40 Swords
Club| 10 4d5+4 (8-24) 40 31-40 Mace *
Hammer Pick| 35 3d10+3 (6-33) 30 31-70 Mace *
Mace| * 20 6d5+2 (8-32) 30 31-70 Mace *
Magic Wand| 0 2d3 (2-6) 35 31-70 Mace *
Maul| 20 5d5+5 (10-30) 30 31-70 Mace *
Smith's Hammer| 30 6d3 (6-18) 30 31-60 Mace *
War Hammer (2-H)| 40 7d5+1 (8-36) 31 31-110 Mace *
War Mace| * 30 5d5+5 (10-30) 32 31-110 Mace *
Bardiche (2-H)| 40 2d20+3 (5-43) 26 31-100 Swords
Halberd(2-H)| 45 2d23+3 (5-49) 25 31-80 Swords
Pitchfork (2-H)| 15 4d4 (4-16) 45 31-60 Fencing
Short Spear (2-H)| 15 2d15+2 (4-32) 50 31-70 Fencing
Short Spear +7 (2-H)| 15 2d15+9 (11-39) 50 31-70 Fencing
Spear (2-H)| 30 2d18 (2-36) 46 31-80 Fencing
War Fork| 35 1d29+3 (4-32) 45 31-110 Fencing
Black Staff (2-H)| 35 5d6+3 (8-33) 35 31-70 Mace *
Gnarled Staff (2-H)| 20 5d5+5 (10-30) 33 31-50 Mace *
Quarterstaff (2-H)| 30 5d5+3 (8-28) 48 31-60 Mace *
Shepherd's Crook (2-H)| 10 3d4 (3-12) 30 31-50 Mace *
Broad Sword| 25 2d13+3 (5-29) 45 31-100 Swords
Cutlass| 10 2d12+4 (6-28) 45 31-70 Swords
Katana| 10 3d8+2 (5-26) 58 31-90 Swords
Kryss| 10 1d26+2 (3-28) 53 31-90 Fencing
Longsword| 25 2d15+3 (5-33) 35 31-90 Swords
Long Sword (thin)| 25 2d15+3 (5-33) 35 31-90 Swords
Scimitar| 10 2d14+2 (4-30) 43 31-90 Swords
Viking Sword| 40 4d8+2 (6-34) 30 31-90 Swords
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment