replace dice sanity checks as asserts
This commit is contained in:
parent
c2aa3df13f
commit
b917f78ca5
@ -93,12 +93,8 @@ class DiceRoller(object):
|
|||||||
size = m[1]
|
size = m[1]
|
||||||
if keep > dice or keep == 0:
|
if keep > dice or keep == 0:
|
||||||
keep = dice
|
keep = dice
|
||||||
if size < 1:
|
assert size >= 1, f"Die must have at least one side."
|
||||||
output = "# of sides for die is incorrect: %d" % size
|
assert dice >= 1, f"At least one die must be rolled."
|
||||||
return output
|
|
||||||
if dice < 1:
|
|
||||||
output = "# of dice is incorrect: %d" % dice
|
|
||||||
return output
|
|
||||||
res = self.roll_dice(keep, dice, size)
|
res = self.roll_dice(keep, dice, size)
|
||||||
curr_str += "%d%s" % (res[0], res[1])
|
curr_str += "%d%s" % (res[0], res[1])
|
||||||
res = res[0]
|
res = res[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user