Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
768 changes: 320 additions & 448 deletions BB1HanderBattery.py

Large diffs are not rendered by default.

767 changes: 319 additions & 448 deletions BB2HanderBattery.py

Large diffs are not rendered by default.

724 changes: 279 additions & 445 deletions BBAttackerVsEnemies.py

Large diffs are not rendered by default.

812 changes: 338 additions & 474 deletions BBCalc.py

Large diffs are not rendered by default.

776 changes: 323 additions & 453 deletions BBEnemiesVsDefender.py

Large diffs are not rendered by default.

778 changes: 323 additions & 455 deletions BBHitChance.py

Large diffs are not rendered by default.

711 changes: 276 additions & 435 deletions BBNimbleBattery.py

Large diffs are not rendered by default.

745 changes: 311 additions & 434 deletions BBRaisingHp.py

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions FastAd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#This is a script that you can use to calculate the expected return of Fast Adaptation from a given base hit chance.
#The only value you should edit is the value BASE_HIT_CHANCE. Everything else can be left alone.
#If you want to see the rolls appended to a file then you can remove the #comment in front of lines 15,20, and 33.

import random
import statistics
import collections

BASE_HIT_CHANCE = 40

data_list = []

current_hit_chance = BASE_HIT_CHANCE

#f = open("FastAd.txt","w")

for i in range(0,1000000):
roll = (random.randint(1,100))
data_list.append(current_hit_chance)
#f.write(str(current_hit_chance)+ "\n")
if roll > current_hit_chance:
current_hit_chance += 10
if current_hit_chance > 95:
current_hit_chance = 95
else:
current_hit_chance = BASE_HIT_CHANCE

Avg_Hit_Chance = statistics.mean(data_list)
Counter_for_Rolls = collections.Counter(data_list)
Percentage_of_Rolls_at_Each_Hit_Value = [(i,Counter_for_Rolls[i]/len(data_list)*100) for i in Counter_for_Rolls]
print("Average hit chance: " + str(Avg_Hit_Chance))
print("% of rolls at each hit%: " +str(Percentage_of_Rolls_at_Each_Hit_Value))
#f.close()

#Author: turtle225
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Battle-Brothers-Damage-Calculator
Updated for Of Flesh and Faith

Latest Update: 4/11/2022 - Fixed a bug where having Forge with low armor against Split Man was giving much better survivability than it should have been. Heavy armor Forge vs. Split Man tests were unlikely to be impacted by this bug, as they tend to die before armor was destroyed anyway.
Latest Update: 3/31/2025 - Improved the accuracy of rounding for damage calculation. (Thank you Calandro). Changed 3Head Flail data to return number of swings instead of tracking by each individual subhit, as subhits were skewing the data in its favor. (Thank you smr_rst). See bottom of calculator script for full details.

Latest Update: 3/20/2025 - Readjusted Split Man logic to account for recent change in game where it now interacts with damage modifiers on the second hit. Adjusted Fearsome formula to 15% to match recent change in game. Other minor changes - see bottom of calculator script for full details.

Note: Osgboy has made a web-app version of the calculator if you don't want to have to download and use the raw code. Check it out here: https://osgboy.pythonanywhere.com/
Big thanks to Osgboy for adapting the code and buliding the site to make it more user friendly.

Overview:

A script that simulates the damage formula used in Battle Brothers, returning expected hits until death, injury, heavy injury, and morale check given whatever scenario you provide. Also returns % chance of death by hit, and can also return % chance of first injuries or morale by hit.

Expand All @@ -17,23 +24,11 @@ At the bottom of each calculator is a version history, where you can see changel

IMPORTANT:

For instruction on setting up the calculator and how to use it once it is ready, please refer to the Installation and User Guide documents provided in the repository. I walk through step by step how to setup the calculator and use it with pictures and examples. Although I do not have a gui, the calculator is easy to use once you know how. The guide will help you get it running. The guide assists with setting up VSCode which is my preferred way to use the calculator, but if you want to use a different IDE then you can do so, or if you don't want to bother with any user setup then use Replit (see below).

An alternative method to use the calculator is to load it into Repl.it.

https://repl.it/

You don't have to sign up, choose "start coding" or "new repl" in the top right. Choose "Import from GitHub" and put my link url

https://github.com/turtle225/Battle-Brothers-Damage-Calculator

Once it loads in, on the top right you can configure the "run" button if you wish to use it (it isn't necessary). To do so select Python from the drop down and in the box type "python BBCalc.py" without the quotes. This will make it so that the green run button runs the main calculator, but this won't work for the other calculators.
For instruction on setting up the calculator and how to use it once it is ready, please refer to the Installation and User Guide documents provided in the repository. I walk through step by step how to setup the calculator and use it with pictures and examples. Although I do not have a gui, the calculator is easy to use once you know how. The guide will help you get it running. The guide assists with setting up VSCode which is my preferred way to use the calculator, but if you want to use a different IDE then you can do so.

Alternatively, don't worry about the run button, you can run any of the calculator versions by typing "python calcname.py" without the quotes into the command line on the right, where calcname is the name of the calculator you wish to use. Remember to press your Tab button to autocomplete the command for convenience.
If you don't want to bother with manually installing and interacting with the code, then please use the web-app gui that osgboy has created here: https://osgboy.pythonanywhere.com/

Using Replit skips the first half of the installation and user guide. Refer to part 2 to understand how to edit and use the calculator (note that it is unlikely that the user guide will load in Replit, open it elsewhere on your computer). Make sure any edits you make are done saving before you run the calculator. You can see a greyed out "saved" status next to the open file tab.

The advantage to using Replit is that it is faster and easier to setup than getting your own VSCode going. Once you have the calculator loaded in Replit, you can also save that url link as a bookmark/favorite to quickly load the calculator again later without having to upload it into Replit again. The downside is that it makes the code scrunched and hideous to look at, which makes it hard to read the helpful comments I tried to put in. It may also take longer to compute (lower trials variable if it is taking too long).
Another alternative to manually setting up your own coding environment is to import the code into https://replit.com/. This will still involve manually interacting with the code, but it makes it so that you don't have to download your own IDE. This is not my preferred way of using the calculator but I still wanted to mention it as an option.

Limitations:

Expand All @@ -50,12 +45,24 @@ Special Thanks:
-- Abel (aka) Villain Joueur: For grabbing the damage formula out of the game code, writing the damage page on the wiki, and for
helping me with many questions along the way.

-- Osgboy: For making a web-app gui version of the calculator making it much more user friendly and accessible to people. Located here: https://osgboy.pythonanywhere.com/

-- Wall (aka) Wlira: For helping me with some questions along the way and having an existing calculator for me to test against. Also for pointing out Replit as an option for using the calculator.

-- You: If you are using the calculator, thank you! If you find any bugs or have feedback/questions/suggestions, you can usually find me on the Steam forums or send me an email.

-- Overhype: For making an amazing game for us to play.

Upcoming update (note written 8/4/2024): There is currently a bug in the game with Split Man where it does not interact with generic damage modifiers on the second hit (ie things like Frenzy, Huge, Dazed, etc.). This is reportedly fixed in the next update of the game, but that has not been released yet. I will update the calculator once that update goes live. The calculator currently accounts for the bug existing.

Prior Update: 10/1/2024 - Added logic for Ijirok armor testing. Added a condition for the code to terminate if the defender survives abnormally long.

Prior Update: 8/22/2024 - Fixed some attacker/defender presets that were incorrect. Fixed Boneplates working against Puncture.

Prior Update: 6/27/2023 - Added the ability to track the first instance of a bleed proc for cleaver tests and return this data in the output. Now you can test various armor lines, perks, or attachments, and see how that helps prolong the first instance of suffering bleed.

Prior update: 4/11/2022 - Fixed a bug where having Forge with low armor against Split Man was giving much better survivability than it should have been. Heavy armor Forge vs. Split Man tests were unlikely to be impacted by this bug, as they tend to die before armor was destroyed anyway.

Prior Update: 3/13/2022 - Adjusted Orc Berserker preset for Berserk Chain damage buff.

Prior update: 3/10/2022 - Added the changes that occurred from the Of Flash and Faith dlc balance pass. Notably, 2H Flails got reworked and that logic has been configured. HeadHunter change only effects the hit chance version of the calculator. Nine Lives, Handgonne, Throwing, and Fearsome changes are all in. Also added +5% armor ignore to Aimed Shot which I never realized it had before.
Expand Down
12 changes: 6 additions & 6 deletions data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Overseer: 70hp, 120 helmet, 180 armor. Xbow Mastery.

Barbarians:
Thrall: 70hp, 0 or 30-50 helmet, 0 or 30-45 armor. Resilient.
Reaver: 80hp, 0 or 30-145 helmet, 65-95 armor. Resilient, Cleaver Mastery, Hammer Master, Throwing Mastery.
Reaver: 120hp, 0 or 30-145 helmet, 65-95 armor. Resilient, Cleaver Mastery, Hammer Master, Throwing Mastery.
Chosen: 130hp, 145-190 helmet, 140-230 armor. Resilient, Forge, Crippling, Executioner, Cleaver Mastery.
King: 150hp, 250 helmet, 270 armor. Resilient, Forge, Crippling, Executioner, Cleaver Mastery, (Frenzy).
Madman: 160hp, 300 helmet, 300 armor. Resilient, Forge, Crippling, Executioner, Cleaver Mastery.
Expand All @@ -42,8 +42,8 @@ Footman: 70hp, 80-215 helmet, 65-150 armor. Forge, Hammer Mastery.
Billman: 70hp, 0 or 80-215 helmet, 50-130 armor. Forge.
Arbalester: 60hp, 20-80 helmet, 50-65 armor. Xbow Mastery.
Bannerman: 80hp, 0 or 115-215 helmet, 115-150 armor. SteelBrow.
Knight: 125hp, 300 helmet, 210-320 armor. Forge, Crippling, Executioner.
Sergeant: 100hp, 0 helmet, 150-210 armor. Nimble, SteelBrow, Duelist, Cleaver Mastery, Hammer Mastery.
Knight: 135hp, 300 helmet, 210-320 armor. Forge, Crippling, Executioner.
Sergeant: 100hp, 0 helmet, 150-210 armor. Nimble, SteelBrow, Resilient, Duelist, Cleaver Mastery, Hammer Mastery.
Zweihander: 90hp, 70 or 160 helmet, 150-240 armor. Forge, SteelBrow.
Wardog: 50hp, 0 helmet, 55 armor. SteelBrow.

Expand All @@ -52,7 +52,7 @@ Thug: 55hp, 0-45 helmet, 5-70 armor.
Poacher: 55hp, 0-20 helmet, 20 armor.
Raider: 75hp, 0-140 helmet, 55-115 armor. Executioner, All Wpn Mastery.
Marksman: 60hp, 0-45 helmet, 20-70 armor. Xbow Mastery.
Leader: 100hp, 90-250 helmet, 110-230 armor. NineLives, Executioner, All Wpn Mastery.
Leader: 100hp, 90-250 helmet, 110-210 armor. NineLives, Executioner, All Wpn Mastery.

Sellswords:
Mercenary: 90hp, 0-230 helmet, 80-260 armor. Forge, All Wpn Mastery.
Expand Down Expand Up @@ -155,7 +155,7 @@ Reinforced Wood Flail: 20-45, 30% Ignore, 80% Armor, 35% Head.
Flail: 25-55, 30% Ignore, 100% Armor, 35% Head.
3Head Flail: 30-75, 30% Ignore, 100% Armor, 35% Head.

2H Wood Flail: 25-60, 30% Ignore, 80% Armor, 40% Head.
2H Wood Flail: 30-60, 30% Ignore, 80% Armor, 40% Head.
2H Flail: 45-90, 30% Ignore, 115% Armor, 40% Head.
Berserk Chain: 50-100, 30% Ignore, 125% Armor, 40% Head.

Expand Down Expand Up @@ -194,7 +194,7 @@ Banner: 50-70, 30% Ignore, 100% Armor.
Jagged Pike: 50-70, 25% Ignore, 90% Armor, 30% Head.
Broken Bladed Pike: 35-55, 30% Ignore, 80% Armor, 30% Head.
Ancient Bladed Pike: 55-80, 30% Ignore, 125% Armor, 30% Head.
Warscythe: 55-80, 35% Ignore, 104% Armor. (Note: actual Ignore is 30% on single target and 25% on AoE).
Warscythe: 55-80, 35% Ignore, 105% Armor. (Note: actual Ignore is 30% on single target and 25% on AoE).
Swordlance: 60-80, 30% Ignore, 90% Armor. (Note: actual Ignore is 25% on AoE).

Throwing:
Expand Down