diff options
Diffstat (limited to 'game.py')
| -rw-r--r-- | game.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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 |
