🎨 Drawing stuff
This commit is contained in:
@ -187,53 +187,57 @@ def blackjackHit(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if data["blackjack games"][channel]["user hands"][user]["split"] == False:
|
||||
hand = data["blackjack games"][channel]["user hands"][user]
|
||||
otherHand = False
|
||||
else:
|
||||
if handNumber != 0:
|
||||
if handNumber == 1:
|
||||
hand = data["blackjack games"][channel]["user hands"][user]
|
||||
otherHand = False
|
||||
elif handNumber == 2:
|
||||
hand = data["blackjack games"][channel]["user hands"][user]["other hand"]
|
||||
otherHand = True
|
||||
if user in data["blackjack games"][channel]["user hands"]:
|
||||
if data["blackjack games"][channel]["user hands"][user]["split"] == False:
|
||||
hand = data["blackjack games"][channel]["user hands"][user]
|
||||
otherHand = False
|
||||
else:
|
||||
if handNumber != 0:
|
||||
if handNumber == 1:
|
||||
hand = data["blackjack games"][channel]["user hands"][user]
|
||||
otherHand = False
|
||||
elif handNumber == 2:
|
||||
hand = data["blackjack games"][channel]["user hands"][user]["other hand"]
|
||||
otherHand = True
|
||||
else:
|
||||
logThis(user+" tried to hit without specifying which hand")
|
||||
return "You have to specify the hand you're hitting with."
|
||||
else:
|
||||
logThis(user+" tried to hit without specifying which hand")
|
||||
return "You have to specify the hand you're hitting with."
|
||||
else:
|
||||
logThis(user+" tried to hit without specifying which hand")
|
||||
return "You have to specify the hand you're hitting with."
|
||||
|
||||
if data["blackjack games"][channel]["round"] > 0:
|
||||
if hand["hit"] == False:
|
||||
if hand["standing"] == False:
|
||||
hand["hand"].append(drawCard())
|
||||
hand["hit"] = True
|
||||
|
||||
if data["blackjack games"][channel]["round"] > 0:
|
||||
if hand["hit"] == False:
|
||||
if hand["standing"] == False:
|
||||
hand["hand"].append(drawCard())
|
||||
hand["hit"] = True
|
||||
|
||||
handValue = calcHandValue(hand["hand"])
|
||||
|
||||
if handValue > 21:
|
||||
hand["busted"] = True
|
||||
|
||||
if otherHand:
|
||||
data["blackjack games"][channel]["user hands"][user]["other hand"] = hand
|
||||
handValue = calcHandValue(hand["hand"])
|
||||
|
||||
if handValue > 21:
|
||||
hand["busted"] = True
|
||||
|
||||
if otherHand:
|
||||
data["blackjack games"][channel]["user hands"][user]["other hand"] = hand
|
||||
else:
|
||||
data["blackjack games"][channel]["user hands"][user] = hand
|
||||
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
return "accept"
|
||||
else:
|
||||
data["blackjack games"][channel]["user hands"][user] = hand
|
||||
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
return "accept"
|
||||
logThis(user+" is already standing")
|
||||
return "You can't hit when you're standing"
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You can't hit when you're standing"
|
||||
logThis(user+" has already hit this round")
|
||||
return "You've already hit this round"
|
||||
else:
|
||||
logThis(user+" has already hit this round")
|
||||
return "You've already hit this round"
|
||||
logThis(user+" tried to hit on the 0th round")
|
||||
return "You can't hit before you see your cards"
|
||||
else:
|
||||
logThis(user+" tried to hit on the 0th round")
|
||||
return "You can't hit before you see your cards"
|
||||
logThis(user+" tried to hit without being in the game")
|
||||
return "You have to enter the game before you can hit"
|
||||
|
||||
|
||||
# When players try to double down
|
||||
@ -313,24 +317,28 @@ def blackjackStand(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
hand = data["blackjack games"][channel]["user hands"][user]
|
||||
if data["blackjack games"][channel]["round"] > 0:
|
||||
if hand["hit"] == False:
|
||||
if hand["standing"] == False:
|
||||
hand["standing"] = True
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
if user in data["blackjack games"][channel]["user hands"]:
|
||||
hand = data["blackjack games"][channel]["user hands"][user]
|
||||
if data["blackjack games"][channel]["round"] > 0:
|
||||
if hand["hit"] == False:
|
||||
if hand["standing"] == False:
|
||||
hand["standing"] = True
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
return "accept"
|
||||
return "accept"
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You're already standing"
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You're already standing"
|
||||
logThis(user+" has already hit this round")
|
||||
return "You've already hit this round"
|
||||
else:
|
||||
logThis(user+" has already hit this round")
|
||||
return "You've already hit this round"
|
||||
logThis(user+" tried to stand on the first round")
|
||||
return "You can't stand before you see your cards"
|
||||
else:
|
||||
logThis(user+" tried to stand on the first round")
|
||||
return "You can't stand before you see your cards"
|
||||
logThis(user+" tried to stand without being in the game")
|
||||
return "You have to enter the game before you can stand"
|
||||
|
||||
# When players try to split
|
||||
def blackjackSplit(channel,user):
|
||||
|
Reference in New Issue
Block a user