casino.qsrc 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  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. $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 'nord'
  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. $metka = $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. $metka = $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 stopps 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. $metka = $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. $metka = $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. $metka = $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. *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', 'bet'
  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] = 'bet':
  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. end
  707. betTotal = playerBets[0]
  708. gs 'deckShuffle'
  709. if (deckFace[playerHand[0]] = 1 and deckFace[playerHand[1]] > 9) or (deckFace[playerHand[0]] > 9 and deckFace[playerHand[1]] = 1):
  710. gt 'casino', 'blackjack'
  711. elseif deckFace[dealerHand[0]] > 9 and deckFace[dealerHand[1]] = 1:
  712. gt 'casino', 'blackjack'
  713. elseif deckFace[dealerCards[0]] = 1:
  714. gt 'casino', 'insurance1'
  715. else
  716. gt 'casino', 'player'
  717. end
  718. end
  719. if $ARGS[0] = 'blackjack':
  720. gs 'casino', 'blackjack_view', 1
  721. if playerPoints[0] = 21 and dealerPoints = 21:
  722. *pl 'DRAW GAME'
  723. *pl 'You retrieve your bet.'
  724. elseif playerPoints[0] = 21:
  725. *pl 'PLAYER WINS'
  726. *pl 'You receive <<playerBets[0] * 3 / 2>> <b>₽</b> in winnings.'
  727. money += playerBets[0] * 3 / 2
  728. else
  729. *pl 'DEALER WINS'
  730. *pl 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet.'
  731. money -= playerBets[0]
  732. end
  733. act 'Continue' : gt 'casino', 'blackjack_play'
  734. end
  735. if $ARGS[0] = 'insurance1':
  736. gs 'casino', 'blackjack_view'
  737. *pl 'The dealer has an ace showing. Would you like to place a bet for insurance?'
  738. insurance = 0
  739. act 'Bet insurance' :
  740. insurance = input('Place your bet.')
  741. if money < insurance:
  742. msg 'You don''t have enough money for that bet.'
  743. gt 'casino', 'insurance1'
  744. elseif insurance < 0:
  745. msg 'You cannot bet a negative amount of money.'
  746. gt 'casino', 'insurance1'
  747. elseif insurance > playerBets[0] / 2:
  748. msg 'Insurance cannot exceed half the original bet.'
  749. gt 'casino', 'insurance1'
  750. else
  751. gt 'casino', 'insurance2'
  752. end
  753. end
  754. act 'No insurance' : gt 'casino', 'insurance2'
  755. end
  756. if $ARGS[0] = 'insurance2':
  757. if deckFace[dealerCards[1]] > 9: gs 'casino', 'blackjack_view', 1
  758. if deckFace[dealerCards[1]] < 10: gs 'casino', 'blackjack_view'
  759. if dealerPoints = 21:
  760. *pl 'DEALER WINS'
  761. *p 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet'
  762. if insurance > 0: *p ' but also gives you <<insurance>> <b>₽</b> for your side bet'
  763. *p '.'
  764. money -= playerBets[0]
  765. money += insurance
  766. act 'Continue' : gt 'casino', 'blackjack_play'
  767. else
  768. *pl 'The dealer takes a peek at his hole card; no blackjack.'
  769. if insurance > 0: *p 'He relieves you of <<insurance>> <b>₽</b> for your side bet.'
  770. money -= insurance
  771. act 'Continue' :
  772. cla
  773. wait 500
  774. gt 'casino', 'player'
  775. end
  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' :
  790. cla
  791. wait 500
  792. gt 'casino', 'dealer'
  793. end
  794. else
  795. if numHands = 1:
  796. *pl 'You are considering actions for your hand.'
  797. $text = ''
  798. else
  799. *pl 'You are considering your actions for <b>hand #<<currentHand + 1>></b>.'
  800. $text = 'Hand #<<currentHand + 1>>: '
  801. end
  802. act '<<$text>>Hit' :
  803. i = currentHand * 16 + 2
  804. :loop1
  805. if playerHand[i] ! 0: i += 1 & jump 'loop1'
  806. playerHand[i] = cardsDealt
  807. cardsDealt += 1
  808. *clr & cla
  809. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  810. wait 750
  811. gt 'casino', 'player'
  812. end
  813. if money >= betTotal + playerBets[currentHand]:
  814. act '<<$text>>Double' :
  815. doubleBet = 1
  816. betTotal += playerBets[currentHand]
  817. playerBets[currentHand] += playerBets[currentHand]
  818. i = currentHand * 16 + 2
  819. :loop2
  820. if playerHand[i] ! 0: i += 1 & jump 'loop2'
  821. playerHand[i] = cardsDealt
  822. cardsDealt += 1
  823. *clr & cla
  824. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  825. wait 750
  826. gt 'casino', 'player'
  827. end
  828. 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]]):
  829. act '<<$text>>Split' :
  830. betTotal += playerBets[currentHand]
  831. playerBets[numHands] = playerBets[currentHand]
  832. numHands += 1
  833. i = (currentHand + 1) * 16
  834. :loop3
  835. if playerHand[i] ! 0: i += 16 & jump 'loop3'
  836. playerHand[i] = playerHand[currentHand * 16 + 1]
  837. playerHand[currentHand * 16 + 1] = cardsDealt
  838. cardsDealt += 1
  839. playerHand[i + 1] = cardsDealt
  840. cardsDealt += 1
  841. *clr & cla
  842. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  843. wait 750
  844. gt 'casino', 'player'
  845. end
  846. end
  847. end
  848. act '<<$text>>Stay' :
  849. currentHand += 1
  850. cla
  851. wait 500
  852. if currentHand < numHands: gt 'casino', 'player'
  853. if currentHand >= numHands: gt 'casino', 'dealer'
  854. end
  855. end
  856. end
  857. if $ARGS[0] = 'dealer':
  858. gs 'casino', 'blackjack_view', 1
  859. if dealerPoints < 17:
  860. act 'Continue' :
  861. i = 2
  862. :loop4
  863. if dealerHand[i] ! 0: i += 1 & jump 'loop4'
  864. dealerHand[i] = cardsDealt
  865. cardsDealt += 1
  866. *clr & cla
  867. *pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
  868. wait 750
  869. gt 'casino', 'dealer'
  870. end
  871. elseif dealerPoints > 21:
  872. betTotal = 0
  873. i = 0
  874. :loop5
  875. if playerPoints[i] <= 21: betTotal += playerBets[i]
  876. i += 1
  877. if i < numHands: jump 'loop5'
  878. *pl 'PLAYER WINS'
  879. *p 'You receive <<betTotal>> <b>₽</b> in winnings.'
  880. money += betTotal
  881. act 'Continue' : gt 'casino', 'blackjack_play'
  882. else
  883. betTotal = 0
  884. i = 0
  885. :loop6
  886. if playerPoints[i] > 21:
  887. betTotal -= playerBets[i]
  888. elseif playerPoints[i] < dealerPoints:
  889. betTotal -= playerBets[i]
  890. elseif playerpoints[i] > dealerPoints:
  891. betTotal += playerBets[i]
  892. end
  893. i += 1
  894. if i < numHands: jump 'loop6'
  895. if betTotal = 0:
  896. *pl 'DRAW GAME'
  897. if numHands = 1: *p 'You retrieve your bet.'
  898. if numHands > 1: *p 'You retrieve your bets.'
  899. elseif betTotal < 0:
  900. *pl 'DEALER WINS'
  901. if numHands > 1: *p 'After taking into account all the hands, you have lost. '
  902. *p 'The dealer relieves you of <<0 - betTotal>> <b>₽</b>.'
  903. else
  904. *pl 'PLAYER WINS'
  905. if numHands > 1: *p 'After taking into account all the hands, you have won. '
  906. *p 'You receive <<betTotal>> <b>₽</b> in winnings.'
  907. end
  908. money += betTotal
  909. act 'Continue' : gt 'casino', 'blackjack_play'
  910. end
  911. end
  912. if $ARGS[0] = 'blackjack_view':
  913. *pl '<table width="100%"><tr><td>'
  914. *pl '<u>Dealer</u>'
  915. if ARGS[1] = 0:
  916. *p '<img <<$set_imgh>> src="<<$deckImg[dealerHand[0]]>>">'
  917. *pl '<img <<$set_imgh>> src="images/locations/city/industrial/casino/cards/back.jpg">'
  918. else
  919. numAces = 0
  920. dealerPoints = 0
  921. i = 0
  922. :loop7
  923. *p '<img <<$set_imgh>> src="<<$deckImg[dealerHand[i]]>>">'
  924. if deckFace[dealerHand[i]] = 1:
  925. dealerPoints += 11
  926. numAces += 1
  927. elseif deckFace[dealerHand[i]] > 9:
  928. dealerPoints += 10
  929. else
  930. dealerPoints += deckFace[dealerHand[i]]
  931. end
  932. i += 1
  933. if dealerHand[i] ! 0: jump 'loop7'
  934. :loop2
  935. if dealerPoints > 21 and numAces > 0:
  936. dealerPoints -= 10
  937. numAces -= 1
  938. jump 'loop2'
  939. end
  940. if dealerPoints > 21:
  941. *p '<br>BUST!'
  942. elseif dealerPoints = 21 and dealerHand[2] = 0:
  943. *p '<br>BLACKJACK!'
  944. else
  945. *p '<br><<dealerPoints>> points'
  946. end
  947. end
  948. *pl '<br><br><u>Player</u>'
  949. i = 0
  950. :loop3
  951. numAces = 0
  952. playerPoints[i] = 0
  953. if numHands > 1: *pl 'Hand #<<i + 1>>:'
  954. j = 0
  955. :loop4
  956. if playerHand[i * 16 + j] ! 0:
  957. *p '<img <<$set_imgh>> src="<<$deckImg[playerHand[i * 16 + j]]>>">'
  958. if deckFace[playerHand[i * 16 + j]] = 1:
  959. playerPoints[i] += 11
  960. numAces += 1
  961. elseif deckFace[playerHand[i * 16 + j]] > 9:
  962. playerPoints[i] += 10
  963. else
  964. playerPoints[i] += deckFace[playerHand[i * 16 + j]]
  965. end
  966. j += 1
  967. jump 'loop4'
  968. end
  969. :loop8
  970. if playerPoints[i] > 21 and numAces > 0:
  971. playerPoints[i] -= 10
  972. numAces -= 1
  973. jump 'loop8'
  974. end
  975. if playerPoints[i] > 21:
  976. *p '<br>BUST!'
  977. elseif playerPoints[i] = 21 and playerHand[2] = 0 and numHands = 1:
  978. *p '<br>BLACKJACK!'
  979. else
  980. *p '<br><<playerPoints[i]>> points |'
  981. end
  982. *p ' Bet = <<playerBets[i]>> <b>₽</b><br><br>'
  983. i += 1
  984. if i < numHands: jump 'loop3'
  985. *pl '</td><td valign="top"><div align="right"><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbd.jpg"></div></td></tr></table>'
  986. end
  987. --- casino ---------------------------------