blackjackView.qsrc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # blackjackView
  2. *PL '<table width="100%"><tr><td>'
  3. *PL '<u>Dealer</u>'
  4. if ARGS[0] = 0:
  5. *P '<img <<$set_imgh>> src="<<$deckImg[dealerHand[0]]>>">'
  6. *PL '<img <<$set_imgh>> src="images/locations/city/industrial/casino/cards/back.jpg">'
  7. else
  8. numAces = 0
  9. dealerPoints = 0
  10. i = 0
  11. :loop1
  12. *P '<img <<$set_imgh>> src="<<$deckImg[dealerHand[i]]>>">'
  13. if deckFace[dealerHand[i]] = 1:
  14. dealerPoints += 11
  15. numAces += 1
  16. elseif deckFace[dealerHand[i]] > 9:
  17. dealerPoints += 10
  18. else
  19. dealerPoints += deckFace[dealerHand[i]]
  20. end
  21. i += 1
  22. if dealerHand[i] ! 0: jump 'loop1'
  23. :loop2
  24. if dealerPoints > 21 and numAces > 0:
  25. dealerPoints -= 10
  26. numAces -= 1
  27. jump 'loop2'
  28. end
  29. if dealerPoints > 21:
  30. *P '<br>BUST!'
  31. elseif dealerPoints = 21 and dealerHand[2] = 0:
  32. *P '<br>BLACKJACK!'
  33. else
  34. *P '<br><<dealerPoints>> points'
  35. end
  36. end
  37. *PL '<br><br><u>Player</u>'
  38. i = 0
  39. :loop3
  40. numAces = 0
  41. playerPoints[i] = 0
  42. if numHands > 1: *PL 'Hand #<<i + 1>>:'
  43. j = 0
  44. :loop4
  45. if playerHand[i * 16 + j] ! 0:
  46. *P '<img <<$set_imgh>> src="<<$deckImg[playerHand[i * 16 + j]]>>">'
  47. if deckFace[playerHand[i * 16 + j]] = 1:
  48. playerPoints[i] += 11
  49. numAces += 1
  50. elseif deckFace[playerHand[i * 16 + j]] > 9:
  51. playerPoints[i] += 10
  52. else
  53. playerPoints[i] += deckFace[playerHand[i * 16 + j]]
  54. end
  55. j += 1
  56. jump 'loop4'
  57. end
  58. :loop5
  59. if playerPoints[i] > 21 and numAces > 0:
  60. playerPoints[i] -= 10
  61. numAces -= 1
  62. jump 'loop5'
  63. end
  64. if playerPoints[i] > 21:
  65. *P '<br>BUST!'
  66. elseif playerPoints[i] = 21 and playerHand[2] = 0 and numHands = 1:
  67. *P '<br>BLACKJACK!'
  68. else
  69. *P '<br><<playerPoints[i]>> points |'
  70. end
  71. *P ' Bet = <<playerBets[i]>> <b>₽</b><br><br>'
  72. i += 1
  73. if i < numHands: jump 'loop3'
  74. *PL '</td><td valign="top"><div align="right"><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbd.jpg"></div></td></tr></table>'
  75. --- blackjackView ---------------------------------