✨ Added doubling in blackjack
This commit is contained in:
@ -377,6 +377,11 @@ async def on_message(message):
|
||||
await message.add_reaction("👍")
|
||||
else:
|
||||
await message.channel.send(response)
|
||||
|
||||
if message.content.lower().startswith("!blackjack double"):
|
||||
response = funcs.blackjackDouble(str(message.channel),message.author.name)
|
||||
|
||||
await message.channel.send(response)
|
||||
|
||||
|
||||
# Is a bit sassy sometimes
|
||||
|
@ -6,6 +6,6 @@ from .lookup import spellFunc, monsterFunc
|
||||
|
||||
from .other import nameGen, tavernGen, movieFunc
|
||||
|
||||
from .games import triviaStart, triviaOtherThing, triviaCountPoints, checkBalance, addMoney, giveMoney, shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackStand, blackjackHit
|
||||
from .games import triviaStart, triviaOtherThing, triviaCountPoints, checkBalance, addMoney, giveMoney, shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackStand, blackjackHit,blackjackDouble
|
||||
|
||||
from .roll import roll_dice
|
@ -1,3 +1,3 @@
|
||||
from .money import checkBalance, giveMoney, addMoney
|
||||
from .trivia import triviaCountPoints, triviaStart, triviaOtherThing
|
||||
from .blackjack import shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackHit, blackjackStand
|
||||
from .blackjack import shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackHit, blackjackStand, blackjackDouble
|
@ -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