✨ Added doubling in blackjack
This commit is contained in:
@ -176,6 +176,42 @@ def blackjackHit(channel,user):
|
||||
logThis(user+" tried to hit on the first round")
|
||||
return "You can't hit before you see your cards"
|
||||
|
||||
def blackjackDouble(channel,user):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if data["blackjack games"][channel]["user hands"][user]["hit"] == False:
|
||||
if data["blackjack games"][channel]["user hands"][user]["standing"] == False:
|
||||
bet = data["blackjack games"][channel]["user hands"][user]["bet"]
|
||||
if money.checkBalance(user) >= bet:
|
||||
money.addMoney(user,-1 * bet)
|
||||
|
||||
data["blackjack games"][channel]["user hands"][user]["hand"].append(drawCard())
|
||||
data["blackjack games"][channel]["user hands"][user]["hit"] = True
|
||||
data["blackjack games"][channel]["user hands"][user]["standing"] = True
|
||||
data["blackjack games"][channel]["user hands"][user]["bet"] += bet
|
||||
|
||||
handValue = calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"])
|
||||
|
||||
|
||||
if handValue > 21:
|
||||
data["blackjack games"][channel]["user hands"][user]["busted"] = True
|
||||
|
||||
|
||||
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"
|
||||
else:
|
||||
logThis(user+" doesn't have enough GwendoBucks")
|
||||
return "You don't have enough GwendoBucks"
|
||||
else:
|
||||
logThis(user+" is already standing")
|
||||
return "You can't hit when you're standing"
|
||||
else:
|
||||
logThis(user+" has already hit this round")
|
||||
return "You've already hit this round"
|
||||
|
||||
def blackjackStand(channel,user):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
Reference in New Issue
Block a user