summaryrefslogtreecommitdiff
path: root/game.py
diff options
context:
space:
mode:
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