casino.qsrc 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. # casino
  2. $loc = 'casino'
  3. $menu_loc = 'casino'
  4. if $ARGS[0] = 'outside':
  5. $loc_arg = 'outside'
  6. $menu_arg = 'outside'
  7. menu_off = 0
  8. $location_type = 'public_outdoors'
  9. *clr & cla
  10. gs 'stat'
  11. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/zdcasino.jpg"></right>'
  12. 'You stand in front of the door of the huge building casinos.'
  13. act 'Return to the city industrial area': minut += 10 & gt 'city_industrial'
  14. act 'Enter the casino': gt 'casino', 'foyer'
  15. end
  16. if $ARGS[0] = 'foyer':
  17. CLOSE ALL
  18. $loc_arg = $ARGS[0]
  19. $menu_arg = $ARGS[0]
  20. menu_off = 0
  21. $location_type = 'public_indoors'
  22. *clr & cla
  23. minut += 1
  24. gs 'stat'
  25. picrand = rand(1, 3)
  26. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/hcasino<<picrand>>.jpg"></right>'
  27. 'You enter the foyer of the casino, there are lots of games .'
  28. *nl
  29. 'In the hall are various <a href="exec:gt ''casino'', ''slots''">slot machines</a>.'
  30. 'In the games room there is <a href="exec:gt ''casino'', ''roulette''">Roulette</a> and <a href="exec:gt ''casino'', ''cards''">card games</a>.'
  31. act 'Go outside': gt 'casino', 'outside'
  32. act 'Go to the slot machines': gt 'casino', 'slots'
  33. act 'Go to the roulette table': gt 'casino', 'roulette'
  34. act 'Go to the card tables': gt 'casino', 'cards'
  35. end
  36. !!----------
  37. !! Roulette
  38. !!----------
  39. if $ARGS[0] = 'roulette':
  40. $loc_arg = $ARGS[0]
  41. $menu_arg = $ARGS[0]
  42. menu_off = 0
  43. *clr & cla
  44. minut += 1
  45. gs 'stat'
  46. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/ruletka.jpg"></right>'
  47. 'You came to the table with American roulette.'
  48. act 'Go back to the foyer': gt 'casino', 'foyer'
  49. act 'Play roulette': gt 'casino', 'roulette_bet1'
  50. act 'Approach the croupier':
  51. *clr & cla
  52. menu_off = 1
  53. minut += 1
  54. gs 'stat'
  55. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/crup.jpg"></right>'
  56. '"Can I help you?" He asks.'
  57. act 'Shake your head and move away': gt 'casino', 'roulette'
  58. act 'Ask rules':
  59. msg 'The rules are very simple.
  60. First you choose the amount you want to bet.
  61. But in our casino maximum amount is 1000 <b>₽</b>.
  62. Then you choose where to put your chips. There are six different types of bets:
  63. 1. Red/Black (Payout: 1 to 1)
  64. 2. Even/Odd (Payout: 1 to 1)
  65. 3. Small/Large (Payout: 1 to 1)
  66. 4. Dozen (Payout: 1 to 3)
  67. 5. Series (Payout: 1 to 3)
  68. 6. Number (Payout: 1 to 36)
  69. And the rest depends on your luck.'
  70. gt 'casino', 'roulette'
  71. end
  72. end
  73. end
  74. if $ARGS[0] = 'roulette_bet1':
  75. *clr & cla
  76. menu_off = 1
  77. minut += 1
  78. kh = 0
  79. chnch = 0
  80. mb = 0
  81. du = 0
  82. series = 0
  83. chi = 100
  84. x_rul = 100
  85. gs 'stat'
  86. '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/amrul.jpg"></center>'
  87. 'The maximum amount you can bet is 1000 <b>₽</b>.'
  88. 'You lean over the table.'
  89. act 'Move away from the table':gt 'casino', 'roulette'
  90. act 'Make a bet':
  91. st_1 = input 'Enter the amount'
  92. if money < st_1:
  93. msg '<br>You don''t have enough money.'
  94. gt 'casino', 'roulette_bet1'
  95. elseif st_1 <= 0:
  96. msg '<br>You can''t bet zero or a negative amount.'
  97. gt 'casino', 'roulette_bet1'
  98. elseif st_1 > 1000:
  99. msg '<br>The maximum amount you can bet is 1000 <b>₽</b>'
  100. gt 'casino', 'roulette_bet1'
  101. else
  102. money -= st_1
  103. gt 'casino', 'roulette_bet2'
  104. end
  105. end
  106. end
  107. if $ARGS[0] = 'roulette_bet2':
  108. *clr & cla
  109. minut += 1
  110. kh = 0
  111. chnch = 0
  112. mb = 0
  113. du = 0
  114. series = 0
  115. chi = 100
  116. gs 'stat'
  117. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/stavkaru.jpg"></right>'
  118. 'Where do you put your chips?'
  119. act 'Don''t bet':
  120. money += st_1
  121. gt 'casino', 'roulette_bet1'
  122. end
  123. act 'Red / Black':
  124. cla
  125. act 'Reconsider': gt 'casino', 'roulette_bet2'
  126. act 'Red': kh = 1 & gt 'casino', 'roulette_result'
  127. act 'Black': kh = 2 & gt 'casino', 'roulette_result'
  128. end
  129. act 'Even / Odd':
  130. cla
  131. act 'Reconsider': gt 'casino', 'roulette_bet2'
  132. act 'Even': chnch = 1 & gt 'casino', 'roulette_result'
  133. act 'Odd': chnch = 2 & gt 'casino', 'roulette_result'
  134. end
  135. act 'Small / Large':
  136. cla
  137. act 'Reconsider': gt 'casino', 'roulette_bet2'
  138. act 'Small: 1-18': mb = 1 & gt 'casino', 'roulette_result'
  139. act 'Large: 19-36': mb = 2 & gt 'casino', 'roulette_result'
  140. end
  141. act 'Dozen':
  142. cla
  143. act 'Reconsider': gt 'casino', 'roulette_bet2'
  144. act 'First dozen: 1-12': du = 1 & gt 'casino', 'roulette_result'
  145. act 'Second dozen: 13-24': du = 2 & gt 'casino', 'roulette_result'
  146. act 'Third dozen:25-36': du = 3 & gt 'casino', 'roulette_result'
  147. end
  148. act 'Series':
  149. cla
  150. act 'Reconsider': gt 'casino', 'roulette_bet2'
  151. act 'First row: 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34': series = 1 & gt 'casino', 'roulette_result'
  152. act 'Second row: 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35': series = 2 & gt 'casino', 'roulette_result'
  153. act 'Third row: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36': series = 3 & gt 'casino', 'roulette_result'
  154. end
  155. act 'Number':
  156. cla
  157. act 'Reconsider': gt 'casino', 'roulette_bet2'
  158. act 'Choose a number':
  159. chi = input 'Enter a number from 0-36'
  160. if chi < 0 and chi > 36:
  161. msg 'You need to choose a number between 0 and 36.'
  162. gt 'casino', 'roulette_bet2'
  163. else
  164. gt 'casino', 'roulette_result'
  165. end
  166. end
  167. end
  168. end
  169. if $ARGS[0] = 'roulette_result':
  170. cla
  171. minut += 5
  172. gs 'stat'
  173. x_rul = 100
  174. x_rul = rand(0, 36)
  175. if x_rul = 0:
  176. $color = ' '
  177. else
  178. if x_rul = 1 or x_rul = 3 or x_rul = 5 or x_rul = 7 or x_rul = 9 or x_rul = 12 or x_rul = 14 or x_rul = 16 or x_rul = 18 or x_rul = 19 or x_rul = 21 or x_rul = 23 or x_rul = 25 or x_rul = 27 or x_rul = 30 or x_rul = 32 or x_rul = 34 or x_rul = 36:
  179. $color = 'red'
  180. else
  181. $color = 'black'
  182. end
  183. end
  184. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/resul.jpg"></right>'
  185. *nl
  186. 'The ball stops at <<x_rul>> <<$color>>'
  187. if kh ! 0:
  188. if kh = 1:
  189. if x_rul = 1 or x_rul = 3 or x_rul = 5 or x_rul = 7 or x_rul = 9 or x_rul = 12 or x_rul = 14 or x_rul = 16 or x_rul = 18 or x_rul = 19 or x_rul = 21 or x_rul = 23 or x_rul = 25 or x_rul = 27 or x_rul = 30 or x_rul = 32 or x_rul = 34 or x_rul = 36:
  190. act 'You have won <<2 * st_1>>':
  191. money += 2 * st_1
  192. gt 'casino', 'roulette_bet1'
  193. end
  194. else
  195. act 'You have lost':gt 'casino', 'roulette_bet1'
  196. end
  197. elseif kh = 2:
  198. if x_rul = 2 or x_rul = 4 or x_rul = 6 or x_rul = 8 or x_rul = 10 or x_rul = 11 or x_rul = 13 or x_rul = 15 or x_rul = 17 or x_rul = 20 or x_rul = 22 or x_rul = 24 or x_rul = 26 or x_rul = 28 or x_rul = 29 or x_rul = 31 or x_rul = 33 or x_rul = 35:
  199. act 'You have won <<2 * st_1>>':
  200. money += 2 * st_1
  201. gt 'casino', 'roulette_bet1'
  202. end
  203. else
  204. act 'You have lost':gt 'casino', 'roulette_bet1'
  205. end
  206. end
  207. elseif chnch ! 0:
  208. if chnch = 1:
  209. chnch = 0
  210. if x_rul mod 2 = 0:
  211. act 'You have won <<2 * st_1>>':
  212. money += 2 * st_1
  213. gt 'casino', 'roulette_bet1'
  214. end
  215. else
  216. act 'You have lost':gt 'casino', 'roulette_bet1'
  217. end
  218. elseif chnch = 2:
  219. chnch = 0
  220. if x_rul mod 2 = 1:
  221. act 'You have won <<2 * st_1>>':
  222. money += 2 * st_1
  223. gt 'casino', 'roulette_bet1'
  224. end
  225. else
  226. act 'You have lost':gt 'casino', 'roulette_bet1'
  227. end
  228. end
  229. elseif mb ! 0:
  230. if mb = 1:
  231. mb = 0
  232. if x_rul > 0 and x_rul < 19:
  233. act 'You have won <<2 * st_1>>':
  234. money += 2 * st_1
  235. gt 'casino', 'roulette_bet1'
  236. end
  237. else
  238. act 'You have lost':gt 'casino', 'roulette_bet1'
  239. end
  240. elseif mb = 2:
  241. mb = 0
  242. if x_rul > 18 and x_rul < 37:
  243. act 'You have won <<2 * st_1>>':
  244. money += 2 * st_1
  245. gt 'casino', 'roulette_bet1'
  246. end
  247. else
  248. act 'You have lost':gt 'casino', 'roulette_bet1'
  249. end
  250. end
  251. elseif du ! 0:
  252. if du = 1:
  253. du = 0
  254. if x_rul > 0 and x_rul < 13:
  255. act 'You have won <<3 * st_1>>':
  256. money += 3 * st_1
  257. gt 'casino', 'roulette_bet1'
  258. end
  259. else
  260. act 'You have lost':gt 'casino', 'roulette_bet1'
  261. end
  262. elseif du = 2:
  263. du = 0
  264. if x_rul > 12 and x_rul < 25:
  265. act 'You have won <<3 * st_1>>':
  266. money += 3 * st_1
  267. gt 'casino', 'roulette_bet1'
  268. end
  269. else
  270. act 'You have lost':gt 'casino', 'roulette_bet1'
  271. end
  272. elseif du = 3:
  273. du = 0
  274. if x_rul > 24 and x_rul < 37:
  275. act 'You have won <<3 * st_1>>':
  276. money += 3 * st_1
  277. gt 'casino', 'roulette_bet1'
  278. end
  279. else
  280. act 'You have lost':gt 'casino', 'roulette_bet1'
  281. end
  282. end
  283. elseif series ! 0:
  284. if series = 1:
  285. series = 0
  286. if x_rul = 1 or x_rul = 4 or x_rul = 7 or x_rul = 10 or x_rul = 13 or x_rul = 16 or x_rul = 19 or x_rul = 22 or x_rul = 25 or x_rul = 28 or x_rul = 31 or x_rul = 34:
  287. act 'You have won <<3*st_1>>':
  288. money += 3 * st_1
  289. gt 'casino', 'roulette_bet1'
  290. end
  291. else
  292. act 'You have lost':gt 'casino', 'roulette_bet1'
  293. end
  294. elseif series = 2:
  295. series = 0
  296. if x_rul = 2 or x_rul = 3 or x_rul = 8 or x_rul = 11 or x_rul = 14 or x_rul = 17 or x_rul = 20 or x_rul = 23 or x_rul = 26 or x_rul = 29 or x_rul = 32 or x_rul = 35:
  297. act 'You have won <<3*st_1>>':
  298. money += 3 * st_1
  299. gt 'casino', 'roulette_bet1'
  300. end
  301. else
  302. act 'You have lost':gt 'casino', 'roulette_bet1'
  303. end
  304. elseif series = 3:
  305. series = 0
  306. if x_rul = 3 or x_rul = 4 or x_rul = 9 or x_rul = 12 or x_rul = 15 or x_rul = 18 or x_rul = 21 or x_rul = 24 or x_rul = 27 or x_rul = 30 or x_rul = 33 or x_rul = 36:
  307. act 'You have won <<3*st_1>>':
  308. money += 3 * st_1
  309. gt 'casino', 'roulette_bet1'
  310. end
  311. else
  312. act 'You have lost':gt 'casino', 'roulette_bet1'
  313. end
  314. end
  315. elseif chi ! 100:
  316. if chi = x_rul:
  317. act 'You have won <<37 * st_1>>':
  318. money += 37 * st_1
  319. gt 'casino', 'roulette_bet1'
  320. end
  321. else
  322. act 'You have lost':gt 'casino', 'roulette_bet1'
  323. end
  324. end
  325. end
  326. !!-------
  327. !! Slots
  328. !!-------
  329. if $ARGS[0] = 'slots':
  330. $loc_arg = $ARGS[0]
  331. $menu_arg = $ARGS[0]
  332. menu_off = 0
  333. *clr & cla
  334. minut += 1
  335. gs 'stat'
  336. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/zaligravt.jpg"></right>'
  337. 'You enter the hall and are momentarily dazzled by the multitude of ringing sounds and blinking lights coming from endless rows of slot machines. In front of them you see people of various ages, sexes and backgrounds, trying their luck or perhaps just killing time.'
  338. 'Every once in a while you hear the satisfying sound of coins streaming into the tray of the next lucky winner.'
  339. 'According to the huge animated digital display on the back wall, there is a hefty jackpot up for grabs.'
  340. act 'Go to the foyer': gt 'casino', 'foyer'
  341. act 'Use one of the slot machines':
  342. *clr & cla
  343. menu_off = 1
  344. minut += 1
  345. gs 'stat'
  346. betAmount = 10
  347. slotsJackpot = betAmount * 20000
  348. '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/avt.jpg"></center>'
  349. 'Rules of the game are very simple: feed a <<betAmount>> <b>₽</b> coin into the machine and pull the lever. There are multiple winning combinations, but everyone here has their eyes on the <<slotsJackpot>> <b>₽</b> jackpot.'
  350. act 'Go back to the foyer': gt 'casino', 'foyer'
  351. act 'Pull the lever':
  352. if money >= betAmount:
  353. money -= betAmount
  354. slotsRand = rand(1, 100000)
  355. if slotsRand > 99990:
  356. winnings = slotsJackpot
  357. msg 'Jackpot! What are the odds!?'
  358. elseif slotsRand >= 99900:
  359. winnings = betAmount * 1500
  360. elseif slotsRand >= 99000:
  361. winnings = betAmount * 100
  362. elseif slotsRand >= 90000:
  363. winnings = betAmount * 5
  364. elseif slotsRand >= 66667:
  365. winnings = betAmount * 2
  366. else
  367. winnings = 0
  368. end
  369. if winnings > 0:
  370. money += winnings
  371. msg 'You have won <<winnings>> <b>₽</b>.'
  372. else
  373. msg 'You have lost. Try again?'
  374. end
  375. minut += 1
  376. gs 'stat'
  377. gt 'casino', 'slots'
  378. else
  379. msg 'You don''t have enough money to play. Turns out there''s no such thing as a free lunch, and you need money for a chance to win more money. Life is so unfair.'
  380. gt 'casino', 'slots'
  381. end
  382. killvar 'slotsRand'
  383. killvar 'winnings'
  384. end
  385. end
  386. end
  387. !!-------
  388. !! Cards
  389. !!-------
  390. if $ARGS[0] = 'cards':
  391. $loc_arg = $ARGS[0]
  392. $menu_arg = $ARGS[0]
  393. menu_off = 0
  394. *clr & cla
  395. minut += 1
  396. gs 'stat'
  397. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/zalcart.jpg"></right>'
  398. 'In the hall a lot of free games tables in Blackjack and Casino Wars.'
  399. act 'Go back to the foyer': gt 'casino', 'foyer'
  400. act 'Play Blackjack': gt 'casino', 'blackjack_play'
  401. act 'Play Casino War': gt 'casino', 'cards_cw'
  402. !!SYMBOLS
  403. !! ♥
  404. !! ♠
  405. !! ♦
  406. !! ♣
  407. !!deck of cards
  408. $suit[1] = 'Spades'
  409. $symbol[1] = '♠'
  410. $suit[2] = 'Clubs'
  411. $symbol[2] = '♣'
  412. $suit[3] = 'Hearts'
  413. $symbol[3] = '♥'
  414. $suit[4] = 'Diamonds'
  415. $symbol[4] = '♦'
  416. $number[1] = 'Ace '
  417. points[1] = 11
  418. $number[2] = 'Deuce '
  419. points[2] = 2
  420. $number[3] = 'Three '
  421. points[3] = 3
  422. $number[4] = 'Four '
  423. points[4] = 4
  424. $number[5] = 'Five '
  425. points[5] = 5
  426. $number[6] = 'Six '
  427. points[6] = 6
  428. $number[7] = 'Seven '
  429. points[7] = 7
  430. $number[8] = 'Eight '
  431. points[8] = 8
  432. $number[9] = 'Nine '
  433. points[9] = 9
  434. $number[10] = 'Ten '
  435. points[10] = 10
  436. $number[11] = 'Jack '
  437. points[11] = 10
  438. $number[12] = 'Queen '
  439. points[12] = 10
  440. $number[13] = 'King '
  441. points[13] = 10
  442. $number[14] = 'Ace '
  443. points[14] = 11
  444. end
  445. !!--------------------
  446. !! Cards: Casino Wars
  447. !!--------------------
  448. if $ARGS[0] = 'cards_cw':
  449. $loc_arg = $ARGS[0]
  450. $menu_arg = $ARGS[0]
  451. menu_off = 0
  452. *clr & cla
  453. minut += 1
  454. gs 'stat'
  455. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/stolcw.jpg"></right>'
  456. 'You approach the gambling table at the casino.'
  457. act 'Move away from the table': gt 'casino', 'cards'
  458. act 'Sit down at the table': gt 'casino', 'cards_cwplay'
  459. act 'Approach the croupier':
  460. *clr & cla
  461. menu_off = 1
  462. minut += 1
  463. gs 'stat'
  464. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/crupcw.jpg"></right>'
  465. '"How can I help you?"'
  466. act 'Move away from the dealer': gt 'casino', 'cards_cw'
  467. act 'Ask for the rules':
  468. msg 'The rules are very simple.
  469. First you choose how much you want to wager.
  470. But note that in our casino maximum rate is 1000 <b>₽</b>.
  471. After that, you can either continue with your bet, or bet on a draw (which costs your bet a second time), for a larger payout.
  472. Regular:
  473. Everyone is dealt a card. Face cards have different values.
  474. Highest card wins. Payout is 1 to 1.
  475. If both have the same card, choose between continuing (doubles bet), or end the round and return your bet.
  476. If you win the second round you get a payout of 2 to 1. If it is another draw you get a payout of 1.5 to 1.
  477. Bet on draw:
  478. When betting on a draw and winning, you get your bet back.
  479. However, if it is a draw, the payout will be 10 to 1.
  480. That''s it. Enjoy the game.'
  481. gt 'casino', 'cards_cw'
  482. end
  483. end
  484. end
  485. if $ARGS[0] = 'cards_cwplay':
  486. *clr & cla
  487. menu_off = 1
  488. minut += 1
  489. gs 'stat'
  490. if turn1 = 0:
  491. cla
  492. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/stavkacw.jpg"></right>'
  493. 'Place your bets, ladies and gentlemen.'
  494. act 'Leave the table': gt 'casino', 'cards_cw'
  495. act 'Place your bet':
  496. if money < 1:
  497. 'You don''t have any money!'
  498. act 'Leave the table': gt 'casino', 'cards_cw'
  499. end
  500. bet_amount = input 'Enter the amount to bet'
  501. if money < bet_amount:
  502. msg 'You don''t have enough money to bet that much'
  503. elseif bet_amount < 1:
  504. msg 'You must place a minimum bet of 1 <b>₽</b>.'
  505. elseif bet_amount > 1000:
  506. msg 'The maximum bet allowed is 1000 <b>₽</b>.'
  507. else
  508. money -= bet_amount
  509. turn1 = 1
  510. end
  511. gt 'casino', 'cards_cwplay'
  512. end
  513. end
  514. if turn1 = 1:
  515. cla
  516. bet_draw = 0
  517. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/stavkacw.jpg"></right>'
  518. 'Continue with regular bet (payout 2 to 1), or bet on a draw (payout 11 to 1)?'
  519. if money < bet_amount:
  520. turn1 = 2
  521. gt 'casino', 'cards_cwplay'
  522. else
  523. act 'Continue with regular bet':
  524. turn1 = 2
  525. gt 'casino', 'cards_cwplay'
  526. end
  527. act 'Bet on draw (doubles bet)':
  528. turn1 = 2
  529. bet_draw = 1
  530. money -= bet_amount
  531. gt 'casino', 'cards_cwplay'
  532. end
  533. end
  534. end
  535. if turn1 = 2:
  536. cla
  537. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartcw.jpg"></right>'
  538. ' The dealer deals the cards:'
  539. '...'
  540. suit = rand(1, 4)
  541. number = rand(1, 13)
  542. $d_card[1] = $number[number] + 'of ' + $suit[suit]
  543. d_points = number
  544. suit = rand(1, 4)
  545. !! Player draws from cards 2-14 so that they win if both they and the dealer draw an ace
  546. number = rand(2, 14)
  547. $p_card[1] = $number[number] + 'of ' + $suit[suit]
  548. p_points = number
  549. wait 1000
  550. 'Dealer''s Card:'
  551. '  <<$d_card[1]>>'
  552. '__________________________'
  553. 'Your Card:'
  554. '  <<$p_card[1]>>'
  555. if d_points > p_points:
  556. ' '
  557. 'Casino won'
  558. act 'You lost':
  559. turn1 = 0
  560. gt 'casino', 'cards_cwplay'
  561. end
  562. elseif d_points < p_points:
  563. ' '
  564. 'You won'
  565. act 'Take money (<<2 * bet_amount>> <b>₽</b>)':
  566. money += 2 * bet_amount
  567. turn1 = 0
  568. gt 'casino', 'cards_cwplay'
  569. end
  570. else
  571. if bet_draw = 1:
  572. ' '
  573. 'You won'
  574. act 'Take money (<<11 * bet_amount>> <b>₽</b>)':
  575. money += 11 * bet_amount
  576. turn1 = 0
  577. gt 'casino', 'cards_cwplay'
  578. end
  579. else
  580. turn1 = 3
  581. gt 'casino', 'cards_cwplay'
  582. end
  583. end
  584. end
  585. if turn1 = 3:
  586. '<right><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartcw.jpg"></right>'
  587. ' '
  588. 'Draw'
  589. if money >= bet_amount:
  590. act 'Continue (bet another <<bet_amount>> <b>₽</b>)':
  591. cla
  592. money -= bet_amount
  593. ' The dealer deals the cards:'
  594. '...'
  595. suit = rand(1, 4)
  596. number = rand(1, 13)
  597. $d_card[2] = $number[number] + 'of ' + $suit[suit]
  598. d_points = number
  599. suit = rand(1, 4)
  600. number = rand(2, 14)
  601. $p_card[2] = $number[number] + 'of ' + $suit[suit]
  602. p_points = number
  603. 'Dealer''s Cards:'
  604. '  <<$d_card[1]>>'
  605. '  <<$d_card[2]>>'
  606. '__________________________'
  607. 'Your Cards:'
  608. '  <<$p_card[1]>>'
  609. '  <<$p_card[2]>>'
  610. if d_points > p_points:
  611. ' '
  612. 'Casino won'
  613. act 'You lost':
  614. turn1 = 0
  615. gt 'casino', 'cards_cwplay'
  616. end
  617. elseif d_points < p_points:
  618. ' '
  619. 'You won'
  620. act 'Take money (<<4 * bet_amount>> <b>₽</b>)':
  621. money += 4 * bet_amount
  622. turn1 = 0
  623. gt 'casino', 'cards_cwplay'
  624. end
  625. elseif d_points = p_points:
  626. ' '
  627. 'Draw'
  628. act 'Take money (<<3 * bet_amount>> <b>₽</b>)':
  629. money += 3 * bet_amount
  630. turn1 = 0
  631. gt 'casino', 'cards_cwplay'
  632. end
  633. end
  634. end
  635. else
  636. ' '
  637. 'You don''t have enough money to continue'
  638. end
  639. act 'Take original bet (<<bet_amount>> <b>₽</b>)':
  640. money += bet_amount
  641. turn1 = 0
  642. gt 'casino', 'cards_cwplay'
  643. end
  644. end
  645. end
  646. !!--------------------
  647. !! Cards: Blackjack
  648. !!--------------------
  649. if $ARGS[0] = 'blackjack_play':
  650. menu_off = 1
  651. minut += 1
  652. gs 'stat'
  653. killvar 'dealerHand'
  654. killvar 'playerHand'
  655. killvar 'playerBets'
  656. killvar 'playerPoints'
  657. dealerHand[] = 0
  658. dealerHand[] = 1
  659. playerHand[] = 2
  660. playerHand[] = 3
  661. cardsDealt = 4
  662. numHands = 1
  663. currentHand = 0
  664. handLosses = 0
  665. numAces = 0
  666. dealerPoints = 0
  667. insurance = 0
  668. betTotal = 0
  669. doubleBet = 0
  670. minBet = 10
  671. maxBet = 500
  672. gs 'deckShuffle', 'sort'
  673. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/stolbd.jpg"></center>'
  674. *pl 'You are sitting at the blackjack table.'
  675. act 'Move away from the table' : gt 'casino', 'cards'
  676. act 'Play blackjack' : gt 'casino', 'bet1'
  677. act 'Ask for the rules' : gt 'casino', 'rules'
  678. end
  679. if $ARGS[0] = 'rules':
  680. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/crupbd.jpg"></center>'
  681. *pl '<h2><u>Blackjack Rules:</u></h2>'
  682. *p '<ol><li>The player and dealer are each dealt 2 cards after initial bets (<<minBet>> <b>₽</b> - <<maxBet>> <b>₽</b>). The dealer will have 1 face-up card and 1 face-down card.</li>'
  683. *p '<li>Face cards are worth 10 points, aces can double as either 11 or 1, and all other cards are worth their numeric value.</li>'
  684. *p '<li>After the player finishes drawing, the dealer must continue to draw until he has 17 points or more.</li>'
  685. *p '<li>To win, the player must score more points than the dealer, have the dealer bust, or get a blackjack.</li>'
  686. *p '<li>Getting over 21 points is known as a bust, and an automatic loss.</li>'
  687. *p '<li>Getting an ace and a 10 point card in the first 2 cards is known as a blackjack, and is an automatic win which pays 3 : 2.</li>'
  688. *p '<li>If the dealer''s face-up card is an ace, the player can make a side-bet called "insurance" that pays 2 : 1 if the dealer has a blackjack.</li>'
  689. *p '<li>At any time, the player can choose to double his/her bet, which gives the player 1 more card but prevents further draws on that hand.</li>'
  690. *p '<li>If the player''s hand only consists of two cards of equal value, he/she can split them into 2 hands. Each hand must be covered by an amount equal to the original bet.</li>'
  691. *p '<li>The player cannot score a blackjack using a split hand.</li>'
  692. act 'Return' : gt 'casino', 'blackjack_play'
  693. end
  694. if $ARGS[0] = 'bet1':
  695. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/stavkabd.jpg"></center>'
  696. playerBets[0] = input('Place your bet.')
  697. if money < playerBets[0]:
  698. msg 'You don''t have enough money for that bet.'
  699. gt 'casino', 'blackjack_play'
  700. elseif playerBets[0] < minBet:
  701. msg 'There is a minimum bet of <<minBet>> <b>₽</b>.'
  702. gt 'casino', 'blackjack_play'
  703. elseif playerBets[0] > maxBet:
  704. msg 'There is a maximum bet of <<maxBet>> <b>₽</b>.'
  705. gt 'casino', 'blackjack_play'
  706. else
  707. gt 'casino', 'bet2'
  708. end
  709. end
  710. if $ARGS[0] = 'bet2':
  711. betTotal = playerBets[0]
  712. gs 'deckShuffle', 'shuffle'
  713. if (deckFace[playerHand[0]] = 1 and deckFace[playerHand[1]] > 9) or (deckFace[playerHand[0]] > 9 and deckFace[playerHand[1]] = 1):
  714. gt 'casino', 'blackjack'
  715. elseif deckFace[dealerHand[0]] > 9 and deckFace[dealerHand[1]] = 1:
  716. gt 'casino', 'blackjack'
  717. elseif deckFace[dealerCards[0]] = 1:
  718. gt 'casino', 'insurance1'
  719. else
  720. gt 'casino', 'player'
  721. end
  722. end
  723. if $ARGS[0] = 'blackjack':
  724. gs 'casino', 'blackjack_view', 1
  725. if playerPoints[0] = 21 and dealerPoints = 21:
  726. *pl 'DRAW GAME'
  727. *pl 'You retrieve your bet.'
  728. elseif playerPoints[0] = 21:
  729. *pl 'PLAYER WINS'
  730. *pl 'You receive <<playerBets[0] * 3 / 2>> <b>₽</b> in winnings.'
  731. money += playerBets[0] * 3 / 2
  732. else
  733. *pl 'DEALER WINS'
  734. *pl 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet.'
  735. money -= playerBets[0]
  736. end
  737. act 'Continue' : gt 'casino', 'blackjack_play'
  738. end
  739. if $ARGS[0] = 'insurance1':
  740. gs 'casino', 'blackjack_view'
  741. *pl 'The dealer has an ace showing. Would you like to place a bet for insurance?'
  742. insurance = 0
  743. act 'Bet insurance' :
  744. insurance = input('Place your bet.')
  745. if money < insurance:
  746. msg 'You don''t have enough money for that bet.'
  747. gt 'casino', 'insurance1'
  748. elseif insurance < 0:
  749. msg 'You cannot bet a negative amount of money.'
  750. gt 'casino', 'insurance1'
  751. elseif insurance > playerBets[0] / 2:
  752. msg 'Insurance cannot exceed half the original bet.'
  753. gt 'casino', 'insurance1'
  754. else
  755. gt 'casino', 'insurance2'
  756. end
  757. end
  758. act 'No insurance' : gt 'casino', 'insurance2'
  759. end
  760. if $ARGS[0] = 'insurance2':
  761. if dealerPoints = 21 or deckFace[dealerHand[1]] > 9:
  762. gs 'casino', 'blackjack_view', 1
  763. *pl 'DEALER WINS'
  764. *p 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet'
  765. if insurance > 0: *p ' but also gives you <<insurance>> <b>₽</b> for your side bet'
  766. *p '.'
  767. money -= playerBets[0]
  768. money += insurance
  769. act 'Continue' : gt 'casino', 'blackjack_play'
  770. else
  771. gs 'casino', 'blackjack_view'
  772. *pl 'The dealer takes a peek at his hole card; no blackjack.'
  773. if insurance > 0: *p 'He relieves you of <<insurance>> <b>₽</b> for your side bet.'
  774. money -= insurance
  775. act 'Continue' : gt 'casino', 'player'
  776. end
  777. end
  778. if $ARGS[0] = 'player':
  779. gs 'casino', 'blackjack_view'
  780. if playerPoints[currentHand] > 21: currentHand += 1 & handLosses += 1 & doubleBet = 0
  781. if playerPoints[currentHand] = 21 or doubleBet = 1: currentHand += 1 & doubleBet = 0
  782. if handLosses = numHands:
  783. *pl 'DEALER WINS'
  784. *p 'The dealer relieves you of <<betTotal>> <b>₽</b>.'
  785. money -= betTotal
  786. act 'Continue' : gt 'casino', 'blackjack_play'
  787. elseif currentHand >= numHands:
  788. *pl 'You can take no further actions.'
  789. act 'Continue' : gt 'casino', 'dealer'
  790. else
  791. if numHands = 1:
  792. *pl 'You are considering actions for your hand.'
  793. $text = ''
  794. else
  795. *pl 'You are considering your actions for <b>hand #<<currentHand + 1>></b>.'
  796. $text = 'Hand #<<currentHand + 1>>: '
  797. end
  798. act '<<$text>>Hit' :
  799. i = currentHand * 16 + 2
  800. :loop1
  801. if playerHand[i] ! 0: i += 1 & jump 'loop1'
  802. playerHand[i] = cardsDealt
  803. cardsDealt += 1
  804. *clr & cla
  805. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  806. gt 'casino', 'player'
  807. end
  808. if money >= betTotal + playerBets[currentHand]:
  809. act '<<$text>>Double' :
  810. doubleBet = 1
  811. betTotal += playerBets[currentHand]
  812. playerBets[currentHand] += playerBets[currentHand]
  813. i = currentHand * 16 + 2
  814. :loop2
  815. if playerHand[i] ! 0: i += 1 & jump 'loop2'
  816. playerHand[i] = cardsDealt
  817. cardsDealt += 1
  818. *clr & cla
  819. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  820. gt 'casino', 'player'
  821. end
  822. if playerHand[currentHand * 16 + 2] = 0 and ((deckFace[playerHand[currentHand * 16]] > 9 and deckFace[playerHand[currentHand * 16 + 1]] > 9) or deckFace[playerHand[currentHand * 16]] = deckFace[playerHand[currentHand * 16 + 1]]):
  823. act '<<$text>>Split' :
  824. betTotal += playerBets[currentHand]
  825. playerBets[numHands] = playerBets[currentHand]
  826. numHands += 1
  827. i = (currentHand + 1) * 16
  828. :loop3
  829. if playerHand[i] ! 0: i += 16 & jump 'loop3'
  830. playerHand[i] = playerHand[currentHand * 16 + 1]
  831. playerHand[currentHand * 16 + 1] = cardsDealt
  832. cardsDealt += 1
  833. playerHand[i + 1] = cardsDealt
  834. cardsDealt += 1
  835. *clr & cla
  836. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  837. gt 'casino', 'player'
  838. end
  839. end
  840. end
  841. act '<<$text>>Stay' :
  842. currentHand += 1
  843. cla
  844. if currentHand < numHands: gt 'casino', 'player'
  845. if currentHand >= numHands: gt 'casino', 'dealer'
  846. end
  847. end
  848. end
  849. if $ARGS[0] = 'dealer':
  850. gs 'casino', 'blackjack_view', 1
  851. if dealerPoints < 17:
  852. act 'Continue' :
  853. i = 2
  854. :loop4
  855. if dealerHand[i] ! 0: i += 1 & jump 'loop4'
  856. dealerHand[i] = cardsDealt
  857. cardsDealt += 1
  858. *clr & cla
  859. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  860. gt 'casino', 'dealer'
  861. end
  862. elseif dealerPoints > 21:
  863. betTotal = 0
  864. i = 0
  865. :loop5
  866. if playerPoints[i] <= 21: betTotal += playerBets[i]
  867. i += 1
  868. if i < numHands: jump 'loop5'
  869. *pl 'PLAYER WINS'
  870. *p 'You receive <<betTotal>> <b>₽</b> in winnings.'
  871. money += betTotal
  872. act 'Continue' : gt 'casino', 'blackjack_play'
  873. else
  874. betTotal = 0
  875. i = 0
  876. :loop6
  877. if playerPoints[i] > 21:
  878. betTotal -= playerBets[i]
  879. elseif playerPoints[i] < dealerPoints:
  880. betTotal -= playerBets[i]
  881. elseif playerpoints[i] > dealerPoints:
  882. betTotal += playerBets[i]
  883. end
  884. i += 1
  885. if i < numHands: jump 'loop6'
  886. if betTotal = 0:
  887. *pl 'DRAW GAME'
  888. if numHands = 1: *p 'You retrieve your bet.'
  889. if numHands > 1: *p 'You retrieve your bets.'
  890. elseif betTotal < 0:
  891. *pl 'DEALER WINS'
  892. if numHands > 1: *p 'After taking into account all the hands, you have lost. '
  893. *p 'The dealer relieves you of <<0 - betTotal>> <b>₽</b>.'
  894. else
  895. *pl 'PLAYER WINS'
  896. if numHands > 1: *p 'After taking into account all the hands, you have won. '
  897. *p 'You receive <<betTotal>> <b>₽</b> in winnings.'
  898. end
  899. money += betTotal
  900. act 'Continue' : gt 'casino', 'blackjack_play'
  901. end
  902. end
  903. if $ARGS[0] = 'blackjack_view':
  904. *pl '<table width="100%"><tr><td>'
  905. *pl '<u>Dealer</u>'
  906. if ARGS[1] = 0:
  907. *p '<img <<$set_imgh>> src="<<$deckImg[dealerHand[0]]>>">'
  908. *pl '<img <<$set_imgh>> src="images/locations/city/industrial/casino/cards/back.jpg">'
  909. else
  910. numAces = 0
  911. dealerPoints = 0
  912. i = 0
  913. :loop7
  914. *p '<img <<$set_imgh>> src="<<$deckImg[dealerHand[i]]>>">'
  915. if deckFace[dealerHand[i]] = 1:
  916. dealerPoints += 11
  917. numAces += 1
  918. elseif deckFace[dealerHand[i]] > 9:
  919. dealerPoints += 10
  920. else
  921. dealerPoints += deckFace[dealerHand[i]]
  922. end
  923. i += 1
  924. if dealerHand[i] ! 0: jump 'loop7'
  925. :loop8
  926. if dealerPoints > 21 and numAces > 0:
  927. dealerPoints -= 10
  928. numAces -= 1
  929. jump 'loop8'
  930. end
  931. if dealerPoints > 21:
  932. *p '<br>BUST!'
  933. elseif dealerPoints = 21 and dealerHand[2] = 0:
  934. *p '<br>BLACKJACK!'
  935. else
  936. *p '<br><<dealerPoints>> points'
  937. end
  938. end
  939. *pl '<br><br><u>Player</u>'
  940. i = 0
  941. :loop9
  942. numAces = 0
  943. playerPoints[i] = 0
  944. if numHands > 1: *pl 'Hand #<<i + 1>>:'
  945. j = 0
  946. :loop10
  947. if playerHand[i * 16 + j] ! 0:
  948. *p '<img <<$set_imgh>> src="<<$deckImg[playerHand[i * 16 + j]]>>">'
  949. if deckFace[playerHand[i * 16 + j]] = 1:
  950. playerPoints[i] += 11
  951. numAces += 1
  952. elseif deckFace[playerHand[i * 16 + j]] > 9:
  953. playerPoints[i] += 10
  954. else
  955. playerPoints[i] += deckFace[playerHand[i * 16 + j]]
  956. end
  957. j += 1
  958. jump 'loop10'
  959. end
  960. :loop11
  961. if playerPoints[i] > 21 and numAces > 0:
  962. playerPoints[i] -= 10
  963. numAces -= 1
  964. jump 'loop11'
  965. end
  966. if playerPoints[i] > 21:
  967. *p '<br>BUST!'
  968. elseif playerPoints[i] = 21 and playerHand[2] = 0 and numHands = 1:
  969. *p '<br>BLACKJACK!'
  970. else
  971. *p '<br><<playerPoints[i]>> points |'
  972. end
  973. *p ' Bet = <<playerBets[i]>> <b>₽</b><br><br>'
  974. i += 1
  975. if i < numHands: jump 'loop9'
  976. *pl '</td><td valign="top"><div align="right"><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbd.jpg"></div></td></tr></table>'
  977. end
  978. --- casino ---------------------------------