-
Notifications
You must be signed in to change notification settings - Fork 0
/
dice_roll
24 lines (20 loc) · 840 Bytes
/
dice_roll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import random as rd
class Dice :
def roll_dice(Disadvantage = False, Advantage = False, dice_type = 20):
if Disadvantage == True : # lower dice gets returned
roll1 = rd.randrange(1,dice_type)
roll2 = rd.randrange(1,dice_type)
if roll1 < roll2 :
return roll1
else :
return roll2
elif Advantage == True : #higher roll gets returned
roll1 = rd.randrange(1,dice_type)
roll2 = rd.randrange(1,dice_type)
if roll1 > roll2 :
return roll1
else :
return roll2
else : #regular 1 dice roll
roll = rd.randrange(1,dice_type)
return roll