32 lines
586 B
Python
32 lines
586 B
Python
import json
|
|
from random import randint
|
|
|
|
special = [
|
|
'Strength',
|
|
'Perception',
|
|
'Endurance',
|
|
'Intelligence',
|
|
'Charisma',
|
|
'Agility',
|
|
'Luck'
|
|
]
|
|
|
|
scores = [-2,-2,-2,-2,-2,
|
|
-1,-1,-1,
|
|
0,0,0,
|
|
1,1,
|
|
2,2,
|
|
3,3,
|
|
4,4,
|
|
5]
|
|
|
|
with open('data.json') as fd:
|
|
data = json.load(fd)
|
|
|
|
def get_stat(source=scores, size=10):
|
|
return source[randint(1,size)+randint(1,size)-1]
|
|
|
|
def get_stats(stats=special, source=scores, size=10):
|
|
return [{"stat":k, "value": get_stat(source, size)} for k in stats]
|
|
|