Split in blackjack

This commit is contained in:
NikolajDanger
2020-07-28 17:59:43 +02:00
parent 586cbc3d87
commit 4bd156b576
5 changed files with 258 additions and 63 deletions

View File

@ -26,9 +26,15 @@ def drawImage(channel):
for x in range(len(hands)):
key, value = list(hands.items())[x]
userHand = drawHand(value["hand"],False,value["busted"],value["blackjack"])
textWidth = fnt.getsize(key)[0]
table.paste(userHand,(32+(384*placement[x]),680),userHand)
if value["split"]:
table.paste(userHand,(32+(384*placement[x]),560),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32+(384*placement[x]),700),userOtherHand)
else:
table.paste(userHand,(32+(384*placement[x]),680),userHand)
textWidth = fnt.getsize(key)[0]
textImage.text((32+(384*placement[x])+117-int(textWidth/2)-3,1010-3),key,fill=(0,0,0), font=fnt)
textImage.text((32+(384*placement[x])+117-int(textWidth/2)+3,1010-3),key,fill=(0,0,0), font=fnt)
textImage.text((32+(384*placement[x])+117-int(textWidth/2)-3,1010+3),key,fill=(0,0,0), font=fnt)
@ -57,28 +63,29 @@ def drawHand(hand, dealer, busted, blackjack):
background.paste(img,(x*125,0),img)
w, h = background.size
textHeight = 290
if busted:
textWidth = fnt.getsize("BUSTED")[0]
textImage.text((int(w/2)-int(textWidth/2)-10,450-10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+10,450-10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-10,450+10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+10,450+10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-5,430-5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+5,430-5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-5,430+5),"BUSTED",fill=(255,255,225), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+5,430+5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2),430),"BUSTED",fill=(255,50,50), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-10,textHeight+20-10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+10,textHeight+20-10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-10,textHeight+20+10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+10,textHeight+20+10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-5,textHeight-5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+5,textHeight-5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-5,textHeight+5),"BUSTED",fill=(255,255,225), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+5,textHeight+5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2),textHeight),"BUSTED",fill=(255,50,50), font=fnt)
elif blackjack:
textWidth = fnt2.getsize("BLACKJACK")[0]
textImage.text((int(w/2)-int(textWidth/2)-6,450-6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+6,450-6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-6,450+6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+6,450+6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-3,430-3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+3,430-3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-3,430+3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+3,430+3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2),430),"BLACKJACK",fill=(255,223,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-6,textHeight+20-6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+6,textHeight+20-6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-6,textHeight+20+6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+6,textHeight+20+6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-3,textHeight-3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+3,textHeight-3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-3,textHeight+3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+3,textHeight+3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2),textHeight),"BLACKJACK",fill=(155,123,0), font=fnt2)
return background.resize((int(w/3.5),int(h/3.5)))