✨ Blackjack doesn't wait
This commit is contained in:
@ -180,7 +180,7 @@ def blackjackContinue(channel):
|
||||
firstRoundMessage = ". You can also double down with \"!blackjack double\" or split with \"!blackjack split\""
|
||||
else:
|
||||
firstRoundMessage = ""
|
||||
return "You have 30 seconds to either hit or stand with \"!blackjack hit\" or \"!blackjack stand\""+firstRoundMessage+". It's assumed you're standing if you don't make a choice.", False, done
|
||||
return "You have 2 minutes to either hit or stand with \"!blackjack hit\" or \"!blackjack stand\""+firstRoundMessage+". It's assumed you're standing if you don't make a choice.", False, done
|
||||
|
||||
# When players try to hit
|
||||
def blackjackHit(channel,user,handNumber = 0):
|
||||
@ -225,7 +225,18 @@ def blackjackHit(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
return "accept"
|
||||
response = "accept"
|
||||
roundDone = True
|
||||
|
||||
for person in data["blackjack games"][channel]["user hands"].values():
|
||||
if person["hit"] == False and person["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
if person["split"]:
|
||||
if person["other hand"]["hit"] == False and person["other hand"]["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
return response + str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You can't hit when you're standing"
|
||||
@ -259,10 +270,10 @@ def blackjackDouble(channel,user,handNumber = 0):
|
||||
otherHand = True
|
||||
else:
|
||||
logThis(user+" tried to double without specifying which hand")
|
||||
return "You have to specify the hand you're doubling down."
|
||||
return "You have to specify the hand you're doubling down.",""
|
||||
else:
|
||||
logThis(user+" tried to double without specifying which hand")
|
||||
return "You have to specify the hand you're doubling down."
|
||||
return "You have to specify the hand you're doubling down.",""
|
||||
correctRound = 2
|
||||
|
||||
|
||||
@ -295,22 +306,33 @@ def blackjackDouble(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
return "Adding another "+str(bet)+" GwendoBucks to "+user+"'s bet and drawing another card."
|
||||
roundDone = True
|
||||
|
||||
for person in data["blackjack games"][channel]["user hands"].values():
|
||||
if person["hit"] == False and person["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
if person["split"]:
|
||||
if person["other hand"]["hit"] == False and person["other hand"]["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
|
||||
return "Adding another "+str(bet)+" GwendoBucks to "+user+"'s bet and drawing another card.",str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
|
||||
else:
|
||||
logThis(user+" doesn't have enough GwendoBucks")
|
||||
return "You don't have enough GwendoBucks"
|
||||
return "You don't have enough GwendoBucks",""
|
||||
else:
|
||||
logThis(user+" tried to double on round "+str(data["blackjack games"][channel]["round"]))
|
||||
return "You can only double down on the first round"
|
||||
return "You can only double down on the first round",""
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You can't double when you're standing"
|
||||
return "You can't double when you're standing",""
|
||||
else:
|
||||
logThis(user+" has already hit this round")
|
||||
return "You've already hit this round"
|
||||
return "You've already hit this round",""
|
||||
else:
|
||||
logThis(user+" tried to double on the 0th round")
|
||||
return "You can't double down before you see your cards"
|
||||
return "You can't double down before you see your cards",""
|
||||
|
||||
# When players try to stand
|
||||
def blackjackStand(channel,user,handNumber = 0):
|
||||
@ -326,7 +348,18 @@ def blackjackStand(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
return "accept"
|
||||
response = "accept"
|
||||
roundDone = True
|
||||
|
||||
for person in data["blackjack games"][channel]["user hands"].values():
|
||||
if person["hit"] == False and person["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
if person["split"]:
|
||||
if person["other hand"]["hit"] == False and person["other hand"]["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
return response + str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You're already standing"
|
||||
@ -385,25 +418,35 @@ def blackjackSplit(channel,user):
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
return "Splitting "+user+"'s hand into 2. Adding their original bet to the second hand. You can use \"!Blackjack hit/stand/double 1\" and \"!Blackjack hit/stand/double 2\" to play the different hands."
|
||||
roundDone = True
|
||||
|
||||
for person in data["blackjack games"][channel]["user hands"].values():
|
||||
if person["hit"] == False and person["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
if person["split"]:
|
||||
if person["other hand"]["hit"] == False and person["other hand"]["standing"] == False:
|
||||
roundDone = False
|
||||
|
||||
return "Splitting "+user+"'s hand into 2. Adding their original bet to the second hand. You can use \"!Blackjack hit/stand/double 1\" and \"!Blackjack hit/stand/double 2\" to play the different hands.",str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
|
||||
else:
|
||||
logThis(user+" doesn't have enough GwendoBucks")
|
||||
return "You don't have enough GwendoBucks"
|
||||
return "You don't have enough GwendoBucks",""
|
||||
else:
|
||||
logThis(user+" tried to split 2 different cards")
|
||||
return "Your cards need to have the same value to split"
|
||||
return "Your cards need to have the same value to split",""
|
||||
else:
|
||||
logThis(user+" tried to split on round "+data["blackjack games"][channel]["round"])
|
||||
return "You can only split on the first round"
|
||||
return "You can only split on the first round",""
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You can't split when you're standing"
|
||||
return "You can't split when you're standing",""
|
||||
else:
|
||||
logThis(user+" has already hit this round")
|
||||
return "You've already hit this round"
|
||||
return "You've already hit this round",""
|
||||
else:
|
||||
logThis(user+" tried to split on the 0th round")
|
||||
return "You can't split before you see your cards"
|
||||
return "You can't split before you see your cards",""
|
||||
|
||||
# Player enters the game and draws a hand
|
||||
def blackjackPlayerDrawHand(channel,user,bet):
|
||||
|
Reference in New Issue
Block a user