File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ from random import choice
2+
3+
4+ class Character :
5+
6+ def __init__ (self ):
7+ self .strength = self .calculate_points ()
8+ self .dexterity = self .calculate_points ()
9+ self .constitution = self .calculate_points ()
10+ self .intelligence = self .calculate_points ()
11+ self .wisdom = self .calculate_points ()
12+ self .charisma = self .calculate_points ()
13+ self .hitpoints = 10 + modifier (self .constitution )
14+
15+ def ability (self ):
16+ score = choice ([item for item in vars (self ).values ()])
17+ return score
18+
19+ def dice_roll (self ):
20+ return choice (range (1 , 7 ))
21+
22+ def calculate_points (self ):
23+ rolls = sorted ([self .dice_roll () for number in range (4 )], reverse = True )
24+ return sum (rolls [:2 ])
25+
26+
27+ def modifier (constitution ):
28+ return (constitution - 10 ) // 2
You can’t perform that action at this time.
0 commit comments