casino.qsrc 29 KB

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