Skip to content

Commit

Permalink
Lint/style fixes with black
Browse files Browse the repository at this point in the history
  • Loading branch information
freiheit committed Mar 23, 2024
1 parent 206e7b5 commit 66cca03
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mvkroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def adv_disadv(advantage, disadvantage, dicecounts, dicerolls):

return answer, dicerolls[20]


def calc_action(fortunedicerolls, characterdicerolls):
"""Compute the action total, using up to one d20 and the highest character die roll."""
try:
Expand All @@ -151,6 +152,7 @@ def calc_action(fortunedicerolls, characterdicerolls):
) from exc
return answer


def calc_impact(fortunedicerolls, characterdicerolls):
"""Calculate the impact total"""
try:
Expand All @@ -168,6 +170,7 @@ def calc_impact(fortunedicerolls, characterdicerolls):
raise RollError("Coding error calculating Impact") from exc
return answer


def crit_fumble(fortunedicerolls, characterdicerolls):
"""Check if we had a critical fumble. If so, add output and discard lowest non-1 die"""
answer = ""
Expand All @@ -186,11 +189,12 @@ def crit_fumble(fortunedicerolls, characterdicerolls):
scratched = True
answer += f"*Scratched {i}*\n"
# no append because scratching this die

answer += "**Gain 1 inspiration point**\n"
answer += f"New character dice: {newdicerolls}\n"
return answer, newdicerolls


def mvkroll(dicestr: str):
"""Implementation of dice roller that applies MvK rules."""

Expand Down Expand Up @@ -245,8 +249,10 @@ def mvkroll(dicestr: str):
answer += adv_disadv_answer

answer += print_dice(dicerolls)

fumble_answer, characterdicerolls = crit_fumble(fortunedicerolls, characterdicerolls)

fumble_answer, characterdicerolls = crit_fumble(
fortunedicerolls, characterdicerolls
)
answer += fumble_answer

answer += calc_action(fortunedicerolls, characterdicerolls)
Expand Down

0 comments on commit 66cca03

Please sign in to comment.