From 9cc423f1e3b0a1d9e498c522cb550709e348eed7 Mon Sep 17 00:00:00 2001 From: Supremist Date: Thu, 30 Oct 2025 01:16:56 +0200 Subject: Add weapon damage comparison graph --- game.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'game.py') 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 -- cgit v1.2.3