dice.py: I've made a huge mistake - 'd' is a terrible letter for a modifier

This commit is contained in:
Anna Rose 2012-03-21 12:09:56 -04:00
parent fb1d1f01a6
commit 83826f9200

10
dice.py
View File

@ -30,14 +30,14 @@ class Dice():
reroll = 0
reroll_times = 0
for m in re.findall(r'[dD+-]\d+', desc):
for m in re.findall(r'[lh+-]\d+', desc):
if m[0] == '-':
mod += int(m)
elif m[0] == '+':
mod += int(m[1:])
elif m[0] == 'D':
elif m[0] == 'h':
drop_high = int(m[1:])
elif m[0] == 'd':
elif m[0] == 'l':
drop_low = int(m[1:])
m = re.search(r'r(\d+)(x\d+)?', desc)
@ -170,8 +170,8 @@ This will roll X Y-sided dice and apply the specified modifiers.
Modifiers can be any of the following (where N and M are integers):
(+|-)N Add or subtract N from the total
dN Drop the lowest-rolling N dice from the total
DN Drop the highest-rolling N dice from the total
lN Drop the lowest-rolling N dice from the total
hN Drop the highest-rolling N dice from the total
rN[xM] Any dice that roll <= N will be rerolled.
If the optional 'xM' option is specified, dice will be rerolled a maximum of M times.
Otherwise each die will be rerolled until the result is > N