casino.qsrc 29 KB

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