Changes to stuff
This commit is contained in:
53
funcs/swfuncs/swdestiny.py
Normal file
53
funcs/swfuncs/swdestiny.py
Normal file
@ -0,0 +1,53 @@
|
||||
from . import swroll
|
||||
|
||||
def destinyNew(num : int):
|
||||
roll = swroll.roll(0,0,0,0,0,0,num)
|
||||
|
||||
with open("resources/destinyPoints.txt","wt") as f:
|
||||
f.write(roll)
|
||||
|
||||
return "Rolled for Destiny Points and got:\n"+swroll.resultToEmoji(roll)
|
||||
|
||||
def destinyUse(user : str):
|
||||
with open("resources/destinyPoints.txt","rt") as f:
|
||||
points = f.read()
|
||||
|
||||
if user == "Nikolaj":
|
||||
if 'B' in points:
|
||||
points = points.replace("B","L",1)
|
||||
with open("resources/destinyPoints.txt","wt") as f:
|
||||
f.write(points)
|
||||
return "Used a dark side destiny point. Destiny pool is now:\n"+swroll.resultToEmoji(points)
|
||||
else:
|
||||
return "No dark side destiny points"
|
||||
else:
|
||||
if 'L' in points:
|
||||
points = points.replace("L","B",1)
|
||||
with open("resources/destinyPoints.txt","wt") as f:
|
||||
f.write(points)
|
||||
return "Used a light side destiny point. Destiny pool is now:\n"+swroll.resultToEmoji(points)
|
||||
else:
|
||||
return "No light side destiny points"
|
||||
|
||||
def parseDestiny(user : str, cmd : str):
|
||||
if cmd != "":
|
||||
while cmd[0] == ' ':
|
||||
cmd = cmd[1:]
|
||||
if cmd == "":
|
||||
break
|
||||
|
||||
|
||||
if cmd == "":
|
||||
with open("resources/destinyPoints.txt","rt") as f:
|
||||
return swroll.resultToEmoji(f.read())
|
||||
else:
|
||||
commands = cmd.upper().split(" ")
|
||||
if commands[0] == "N":
|
||||
if len(commands) > 1:
|
||||
return destinyNew(int(commands[1]))
|
||||
else:
|
||||
return "You need to give an amount of players"
|
||||
elif commands[0] == "U":
|
||||
return destinyUse(user)
|
||||
else:
|
||||
return "I didn't quite understand that"
|
Reference in New Issue
Block a user