summaryrefslogtreecommitdiff
path: root/game.py
diff options
context:
space:
mode:
authorSupremist <sergkarv@gmail.com>2025-10-30 01:16:56 +0200
committerSupremist <sergkarv@gmail.com>2025-10-30 01:16:56 +0200
commit9cc423f1e3b0a1d9e498c522cb550709e348eed7 (patch)
tree9cf54a7b7d77cc6f905f091c7bff972430dfdc40 /game.py
parent9fa4cfbe2f948f4067ca1572bbc5dbfab678e7da (diff)
downloadpf2e_calc-9cc423f1e3b0a1d9e498c522cb550709e348eed7.tar.xz
pf2e_calc-9cc423f1e3b0a1d9e498c522cb550709e348eed7.zip
Add weapon damage comparison graph
Diffstat (limited to 'game.py')
-rw-r--r--game.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/game.py b/game.py
index 7adcc8a..0115a4a 100644
--- a/game.py
+++ b/game.py
@@ -48,6 +48,26 @@ class Roll:
def clamp(value):
return max(Roll.Fumble, min(Roll.Crit, value))
+ @staticmethod
+ def icon(check_res):
+ if check_res == Roll.Crit:
+ return "🎯"
+ if check_res == Roll.Success:
+ return "✅"
+ if check_res == Roll.Fail:
+ return "💢"
+ if check_res == Roll.Fumble:
+ return "💀"
+ return "?"
+
+ @staticmethod
+ def short_str(dist: Distribution):
+ res = list()
+ for roll in range(2, -2, -1):
+ number = int(round(dist.probabilities[roll] * 20))
+ res.append(Roll.icon(roll) + str(number))
+ return " ".join(res)
+
class Difficulty(Enum):
Terrible = -2