dice in swroll

This commit is contained in:
NikolajDanger
2020-04-02 16:47:41 +02:00
parent 43d4fca76f
commit 87cebc6ab7
4 changed files with 149 additions and 36 deletions

View File

@ -4,12 +4,13 @@ from funcs import logThis
def destinyNew(num : int):
logThis("Creating a new destiny pool with "+str(num)+" players")
roll = swroll.roll(0,0,0,0,0,0,num)
roll, diceResults = swroll.roll(0,0,0,0,0,0,num)
roll = "".join(sorted(roll))
with open("resources/destinyPoints.txt","wt") as f:
f.write(roll)
return "Rolled for Destiny Points and got:\n"+swroll.resultToEmoji(roll)
return "Rolled for Destiny Points and got:\n"+swroll.diceResultToEmoji(diceResults)+"\n"+swroll.resultToEmoji(roll)
def destinyUse(user : str):
with open("resources/destinyPoints.txt","rt") as f:
@ -19,6 +20,7 @@ def destinyUse(user : str):
logThis("Trying to use a dark side destiny point")
if 'B' in points:
points = points.replace("B","L",1)
points = "".join(sorted(points))
with open("resources/destinyPoints.txt","wt") as f:
f.write(points)
logThis("Did it")
@ -30,6 +32,7 @@ def destinyUse(user : str):
logThis("Trying to use a light side destiny point")
if 'L' in points:
points = points.replace("L","B",1)
points = "".join(sorted(points))
with open("resources/destinyPoints.txt","wt") as f:
f.write(points)
logThis("Did it")