Skip to content

Commit

Permalink
release 3.1.0 beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnDriscoll committed Sep 29, 2020
1 parent 52379c2 commit 76e5ab3
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 23 deletions.
30 changes: 21 additions & 9 deletions diceroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

number_of_dice = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']
simple_dice = ['D3', 'D4', 'D6', 'D8', 'D10', 'D12', 'D20', 'D30']
t5_dice = ['1D', '2D', '3D', '4D', '5D', '6D', '7D', '8D', '9D', '10D']
traveller5_dice = ['1D', '2D', '3D', '4D', '5D', '6D', '7D', '8D', '9D', '10D']

def _dierolls(dtype, dcount):
'''
Expand Down Expand Up @@ -258,12 +258,24 @@ def roll(dice):
diceroll_log.info('Sorted Bane roll: %d %d %d = %d' % (die[0], die[1], die[2], rolled))
return rolled

# check if T5 dice are being rolled
elif dice in t5_dice:
num_dice = int(dice[0:len(dice) - 1])
rolled = _dierolls(6, num_dice)
diceroll_log.info('%s = %d%s = %d' % (dice, num_dice, 'D6', rolled))
return rolled
else:
# check if T5 dice are being rolled
t5_dice = dice
dice_mod = 0
ichar2 = dice.find('+')
if ichar2 <> -1:
dice_mod = int(dice[ichar2:len(dice)])
t5_dice = dice[0:ichar2]
else:
ichar2 = dice.find('-')
if ichar2 <> -1:
dice_mod = int(dice[ichar2:len(dice)])
t5_dice = dice[0:ichar2]
if t5_dice in traveller5_dice:
num_dice = int(t5_dice[0:len(t5_dice) - 1])
rolled = _dierolls(6, num_dice) + dice_mod
diceroll_log.info('Traveller5 %s = %d%s+%d = %d' % (dice, num_dice, 'D6', dice_mod, rolled))
return rolled

# look for DD in the string (for destructive dice rolls)
ichar1 = dice.find('DD')
Expand Down Expand Up @@ -299,9 +311,9 @@ def roll(dice):

# what kind of dice are being rolled? D6? D66? etc.
if ichar2 <> -1:
dice_type = dice[ichar1: ichar2]
dice_type = dice[ichar1:ichar2]
else:
dice_type = dice[ichar1: len(dice)]
dice_type = dice[ichar1:len(dice)]

if dice_type in simple_dice:
rolled = _dierolls(int(dice_type[1:len(dice_type)]), num_dice) + dice_mod
Expand Down
Binary file modified docs/build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/.doctrees/tutorial.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="index" title="Global index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="top" title="diceroll 3.1 Operations Manual" href="index.html" />
<generator object at 0x036B5D00>
<generator object at 0x03603E90>

<script type="text/javascript">
DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX = true;
Expand Down
2 changes: 1 addition & 1 deletion docs/build/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="index" title="Global index" href="genindex.html" />
<link rel="search" title="Search" href="" />
<link rel="top" title="diceroll 3.1 Operations Manual" href="index.html" />
<generator object at 0x036D6B70>
<generator object at 0x036D21E8>
<script type="text/javascript" src="_static/searchtools.js"></script>

</head>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/searchindex.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/build/tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ <h2>Rolling the Dice<a class="headerlink" href="#rolling-the-dice" title="Permal
<p>D2 rolls now generate a range of 0 - 1.
The 4dF roll type for FATE has been added.</p>
<p><em>New in version 3.1</em></p>
<p>1D thru 10D rolls for Traveller5 have been added.</p>
<p>1D thru 10D rolls for Traveller5 have been added. Now with DM support.</p>
</div>
</div>

Expand Down
30 changes: 21 additions & 9 deletions docs/source/diceroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

number_of_dice = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']
simple_dice = ['D3', 'D4', 'D6', 'D8', 'D10', 'D12', 'D20', 'D30']
t5_dice = ['1D', '2D', '3D', '4D', '5D', '6D', '7D', '8D', '9D', '10D']
traveller5_dice = ['1D', '2D', '3D', '4D', '5D', '6D', '7D', '8D', '9D', '10D']

def _dierolls(dtype, dcount):
'''
Expand Down Expand Up @@ -258,12 +258,24 @@ def roll(dice):
diceroll_log.info('Sorted Bane roll: %d %d %d = %d' % (die[0], die[1], die[2], rolled))
return rolled

# check if T5 dice are being rolled
elif dice in t5_dice:
num_dice = int(dice[0:len(dice) - 1])
rolled = _dierolls(6, num_dice)
diceroll_log.info('%s = %d%s = %d' % (dice, num_dice, 'D6', rolled))
return rolled
else:
# check if T5 dice are being rolled
t5_dice = dice
dice_mod = 0
ichar2 = dice.find('+')
if ichar2 <> -1:
dice_mod = int(dice[ichar2:len(dice)])
t5_dice = dice[0:ichar2]
else:
ichar2 = dice.find('-')
if ichar2 <> -1:
dice_mod = int(dice[ichar2:len(dice)])
t5_dice = dice[0:ichar2]
if t5_dice in traveller5_dice:
num_dice = int(t5_dice[0:len(t5_dice) - 1])
rolled = _dierolls(6, num_dice) + dice_mod
diceroll_log.info('Traveller5 %s = %d%s+%d = %d' % (dice, num_dice, 'D6', dice_mod, rolled))
return rolled

# look for DD in the string (for destructive dice rolls)
ichar1 = dice.find('DD')
Expand Down Expand Up @@ -299,9 +311,9 @@ def roll(dice):

# what kind of dice are being rolled? D6? D66? etc.
if ichar2 <> -1:
dice_type = dice[ichar1: ichar2]
dice_type = dice[ichar1:ichar2]
else:
dice_type = dice[ichar1: len(dice)]
dice_type = dice[ichar1:len(dice)]

if dice_type in simple_dice:
rolled = _dierolls(int(dice_type[1:len(dice_type)]), num_dice) + dice_mod
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ The 4dF roll type for FATE has been added.

*New in version 3.1*

1D thru 10D rolls for Traveller5 have been added.
1D thru 10D rolls for Traveller5 have been added. Now with DM support.

0 comments on commit 76e5ab3

Please sign in to comment.