chessplay.qsrc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. # chessplay
  2. menu_off = 1
  3. if $ARGS[0] = '':
  4. if $chess_name='':$chess_name='Boy'
  5. gs'stat'
  6. chess_GG = 20
  7. chess_com = 20
  8. ! chess_ind is used to show the integer difference between Sveta and her opponent
  9. ! if it is 0 then Sveta is equally skilled as her opponent
  10. ! the opponent will play more neutrally if the skill gap is within 5 points
  11. ! if it is > 0 then Sveta is less skilled then her opponent
  12. ! the opponent will play more aggressively if Sveta is less skilled by at least 5 points
  13. ! if it is < 0 then Sveta is more skilled then her opponent
  14. ! the opponent will play more conservatively if Sveta is more skilled by at least 5 points
  15. chess_ind = chessV - pcs_chess
  16. ! chess_diff is used to show how that difference affects the swing in momentum with each move
  17. if chess_ind < 0:
  18. chess_diff = (chess_ind/2)*-1
  19. else
  20. chess_diff = (chess_ind/2)
  21. end
  22. ! move_limit and time_limit keeps games from going forever
  23. chess_move_limit = 60
  24. chess_time_limit = 120
  25. ! chess_move and total_chess_time keep track of total moves and time until it hits the limits
  26. chess_move = 0
  27. total_chess_time = 0
  28. gt 'chessplay', 'game'
  29. end
  30. if $ARGS[0] = 'game':
  31. chess_exp += rand(0,1)
  32. intel_exp += rand(0,1)
  33. chess_move += 1
  34. chess_time = rand(1,3)
  35. minut += chess_time
  36. total_chess_time += chess_time
  37. gs 'stat'
  38. if chess_move = 1:
  39. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/board' + rand(1,1) + '.jpg"></center>'
  40. *nl
  41. if chess_ind > 5:
  42. 'You are less skilled at chess than '+$chess_name+'. They will play more aggressively to try and defeat you.'
  43. 'You might want to play more conservatively and wear down their attacks.'
  44. elseif chess_ind < -5:
  45. 'You are more skilled at chess than '+$chess_name+'. They will play more conservatively to try and defeat you.'
  46. 'You might want to play more aggressively and wear down their defenses.'
  47. else
  48. 'You are about equally skilled at chess as '+$chess_name+'. They will use a wide range of moves to try and defeat you.'
  49. 'You might want to try different types of moves to keep your opponent off balance.'
  50. end
  51. end
  52. if chess_GG <= 0 and chess_com <= 0:
  53. *clr & cla
  54. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/stalemate' + rand(1,1) + '.jpg"></center>'
  55. *nl
  56. 'Stalemate! You have drawn the match against '+$chess_name+'!'
  57. 'You and '+$chess_name+' could not find a way to win the match.'
  58. act 'Return': gt 'kruchess'
  59. elseif chess_GG <= 0:
  60. *clr & cla
  61. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/lose' + rand(1,1) + '.jpg"></center>'
  62. *nl
  63. 'Checkmate! You have lost the match against '+$chess_name+'!'
  64. act 'Return': gt 'kruchess'
  65. elseif chess_com <= 0:
  66. *clr & cla
  67. chess_win += 1
  68. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/win' + rand(1,1) + '.jpg"></center>'
  69. *nl
  70. 'Checkmate! You have won the match against '+$chess_name+'!'
  71. act 'Return': gt 'kruchess'
  72. elseif chess_moves >= chess_move_limit:
  73. *clr & cla
  74. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/stalemate' + rand(1,1) + '.jpg"></center>'
  75. *nl
  76. 'Draw! You agree to end the match with '+$chess_name+'.'
  77. 'You and '+$chess_name+' have both used too many moves and neither could find a way to win the match.'
  78. act 'Return': gt 'kruchess'
  79. elseif total_chess_time >= chess_time_limit:
  80. *clr & cla
  81. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/stalemate' + rand(1,1) + '.jpg"></center>'
  82. *nl
  83. 'Draw! You agree to end the match with '+$chess_name+'.'
  84. 'You and '+$chess_name+' have both used too much time and neither could find a way to win the match.'
  85. act 'Return': gt 'kruchess'
  86. else
  87. gs 'chessplay', 'moves'
  88. end
  89. end
  90. if $ARGS[0] = 'moves':
  91. if chess_ind > 5:
  92. chessM = rand(4,11)
  93. elseif chess_ind < -5:
  94. chessM = rand(0,7)
  95. else
  96. chessM = rand(2,9)
  97. end
  98. act 'Play conservatively':
  99. ! this works as the opposite of aggressive play
  100. ! conservative wins against offense and trap
  101. ! conservative loses to defense and tactical
  102. ! conservative ties with conservative and aggressive
  103. *clr & cla
  104. if chessM <= 1:
  105. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/conservative' + rand(1,1) + '.jpg"></center>'
  106. *nl
  107. $chess_name+' also plays conservatively.'
  108. 'Neither of you gain an advantage from this move.'
  109. elseif chessM <= 3:
  110. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/defensive' + rand(1,1) + '.jpg"></center>'
  111. *nl
  112. $chess_name+' plays defensively and is now in a better position than you.'
  113. gs 'chessplay', 'advantage', 'conservative', 'bad'
  114. elseif chessM <= 5:
  115. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/tactical' + rand(1,1) + '.jpg"></center>'
  116. *nl
  117. $chess_name+' plays tactically and is able to deftly pick apart your conservative defenses.'
  118. gs 'chessplay', 'advantage', 'conservative', 'bad'
  119. elseif chessM <= 7:
  120. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/trap' + rand(1,1) + '.jpg"></center>'
  121. *nl
  122. $chess_name+' tries to trap you, but you encircle it with your defenses.'
  123. gs 'chessplay', 'advantage', 'conservative', 'good'
  124. elseif chessM <= 9:
  125. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/offensive' + rand(1,1) + '.jpg"></center>'
  126. *nl
  127. $chess_name+' plays offensively, but your defense repulses his attacks.'
  128. gs 'chessplay', 'advantage', 'conservative', 'good'
  129. elseif chessM <= 11:
  130. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/aggressive' + rand(1,1) + '.jpg"></center>'
  131. *nl
  132. $chess_name+' plays aggressively, but your defense manages to hold them off.'
  133. 'Neither of you gain an advantage from this move.'
  134. end
  135. *nl
  136. 'You are on move '+str(chess_move)+' out of '+str(chess_move_limit)
  137. 'You are on minute '+str(total_chess_time)+' out of '+str(chess_time_limit)
  138. chess_GG -= 1
  139. chess_com -= 1
  140. gs 'chessplay', 'game'
  141. end
  142. act 'Play defensively':
  143. ! this works as the opposite of offensive play
  144. ! defense wins against trap and conservative
  145. ! defense loses to aggressive and tactical
  146. ! defense ties with offense and defense
  147. *clr & cla
  148. if chessM <= 1:
  149. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/conservative' + rand(1,1) + '.jpg"></center>'
  150. *nl
  151. $chess_name+' plays very conservatively and does not threaten your defenses at all.'
  152. gs 'chessplay', 'advantage', 'defense', 'good'
  153. elseif chessM <= 3:
  154. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/defensive' + rand(1,1) + '.jpg"></center>'
  155. *nl
  156. $chess_name+' also plays defensively.'
  157. 'Neither of you gain an advantage from this move.'
  158. elseif chessM <= 5:
  159. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/tactical' + rand(1,1) + '.jpg"></center>'
  160. *nl
  161. $chess_name+' plays tactically and is able to deftly pick apart your defenses.'
  162. gs 'chessplay', 'advantage', 'defense', 'bad'
  163. elseif chessM <= 7:
  164. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/trap' + rand(1,1) + '.jpg"></center>'
  165. *nl
  166. $chess_name+' tries to trap you, but you avoid it with your defenses.'
  167. gs 'chessplay', 'advantage', 'defense', 'good'
  168. elseif chessM <= 9:
  169. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/offensive' + rand(1,1) + '.jpg"></center>'
  170. *nl
  171. $chess_name+' plays offensively, but your defense absorbs his attacks.'
  172. 'Neither of you gain an advantage from this move.'
  173. elseif chessM <= 11:
  174. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/aggressive' + rand(1,1) + '.jpg"></center>'
  175. *nl
  176. $chess_name+' plays aggressively and overwhelms your defenses.'
  177. gs 'chessplay', 'advantage', 'defense', 'bad'
  178. end
  179. *nl
  180. 'You are on move '+str(chess_move)+' out of '+str(chess_move_limit)
  181. 'You are on minute '+str(total_chess_time)+' out of '+str(chess_time_limit)
  182. chess_GG -= 1
  183. chess_com -= 1
  184. gs 'chessplay', 'game'
  185. end
  186. act 'Play tactically':
  187. ! this works as the opposite of trap play
  188. ! tactical wins against defense and conservative
  189. ! tactical loses to aggressive and offense
  190. ! tactical ties with tactical and trap
  191. *clr & cla
  192. if chessM <= 1:
  193. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/conservative' + rand(1,1) + '.jpg"></center>'
  194. *nl
  195. $chess_name+' plays very conservatively and your tactical moves leave you in a better position.'
  196. gs 'chessplay', 'advantage', 'tactical', 'good'
  197. elseif chessM <= 3:
  198. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/defensive' + rand(1,1) + '.jpg"></center>'
  199. *nl
  200. $chess_name+' plays defensively allowing you to pick apart their defenses.'
  201. gs 'chessplay', 'advantage', 'tactical', 'good'
  202. elseif chessM <= 5:
  203. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/tactical' + rand(1,1) + '.jpg"></center>'
  204. *nl
  205. $chess_name+' also plays tactically.'
  206. 'Neither of you gain an advantage from this move.'
  207. elseif chessM <= 7:
  208. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/trap' + rand(1,1) + '.jpg"></center>'
  209. *nl
  210. $chess_name+' tries to trap you, but you avoid it with your tactical movements.'
  211. 'Neither of you gain an advantage from this move.'
  212. elseif chessM <= 9:
  213. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/offensive' + rand(1,1) + '.jpg"></center>'
  214. *nl
  215. $chess_name+' plays offensively, and some of your pieces are caught out of position.'
  216. gs 'chessplay', 'advantage', 'tactical', 'bad'
  217. elseif chessM <= 11:
  218. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/aggressive' + rand(1,1) + '.jpg"></center>'
  219. *nl
  220. $chess_name+' plays aggressively and rushes past your unprepared defenses.'
  221. gs 'chessplay', 'advantage', 'tactical', 'bad'
  222. end
  223. *nl
  224. 'You are on move '+str(chess_move)+' out of '+str(chess_move_limit)
  225. 'You are on minute '+str(total_chess_time)+' out of '+str(chess_time_limit)
  226. chess_GG -= 1
  227. chess_com -= 1
  228. gs 'chessplay', 'game'
  229. end
  230. act 'Bait a trap for your opponent':
  231. ! this works as the opposite of tactical play
  232. ! trap wins against offense and aggressive
  233. ! trap loses to conservative and defense
  234. ! trap ties with tactical and trap
  235. *clr & cla
  236. if chessM <= 1:
  237. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/conservative' + rand(1,1) + '.jpg"></center>'
  238. *nl
  239. $chess_name+' plays very conservatively and their defenses are now very well prepared.'
  240. gs 'chessplay', 'advantage', 'trap', 'bad'
  241. elseif chessM <= 3:
  242. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/defensive' + rand(1,1) + '.jpg"></center>'
  243. *nl
  244. $chess_name+' plays defensively and your bait is now out of position.'
  245. gs 'chessplay', 'advantage', 'trap', 'bad'
  246. elseif chessM <= 5:
  247. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/tactical' + rand(1,1) + '.jpg"></center>'
  248. *nl
  249. $chess_name+' plays tactically and avoids your trap.'
  250. 'Neither of you gain an advantage from this move.'
  251. elseif chessM <= 7:
  252. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/trap' + rand(1,1) + '.jpg"></center>'
  253. *nl
  254. $chess_name+' also tries to trap you.'
  255. 'Neither of you gain an advantage from this move.'
  256. elseif chessM <= 9:
  257. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/offensive' + rand(1,1) + '.jpg"></center>'
  258. *nl
  259. $chess_name+' plays offensively, and a couple of their pieces are caught out of position.'
  260. gs 'chessplay', 'advantage', 'trap', 'good'
  261. elseif chessM <= 11:
  262. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/aggressive' + rand(1,1) + '.jpg"></center>'
  263. *nl
  264. $chess_name+' plays aggressively and many of their pieces fall into your trap.'
  265. gs 'chessplay', 'advantage', 'trap', 'good'
  266. end
  267. *nl
  268. 'You are on move '+str(chess_move)+' out of '+str(chess_move_limit)
  269. 'You are on minute '+str(total_chess_time)+' out of '+str(chess_time_limit)
  270. chess_GG -= 1
  271. chess_com -= 1
  272. gs 'chessplay', 'game'
  273. end
  274. act 'Play offensively':
  275. ! this works as the opposite of defensive play
  276. ! offense wins against tactical and aggressive
  277. ! offense loses to conservative and trap
  278. ! offense ties with offense and defense
  279. *clr & cla
  280. if chessM <= 1:
  281. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/conservative' + rand(1,1) + '.jpg"></center>'
  282. *nl
  283. $chess_name+' plays very conservatively and repulses all your attacks.'
  284. gs 'chessplay', 'advantage', 'offense', 'bad'
  285. elseif chessM <= 3:
  286. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/defensive' + rand(1,1) + '.jpg"></center>'
  287. *nl
  288. $chess_name+' plays defensively and manages to absorb all your attacks.'
  289. 'Neither of you gain an advantage from this move.'
  290. elseif chessM <= 5:
  291. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/tactical' + rand(1,1) + '.jpg"></center>'
  292. *nl
  293. $chess_name+' plays tactically, but your offense is able to outmaneuver them.'
  294. gs 'chessplay', 'advantage', 'offense', 'good'
  295. elseif chessM <= 7:
  296. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/trap' + rand(1,1) + '.jpg"></center>'
  297. *nl
  298. $chess_name+' traps some of your pieces. You should think more carefully next time.'
  299. gs 'chessplay', 'advantage', 'offense', 'bad'
  300. elseif chessM <= 9:
  301. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/offensive' + rand(1,1) + '.jpg"></center>'
  302. *nl
  303. $chess_name+' also plays offensively.'
  304. 'Neither of you gain an advantage from this move.'
  305. elseif chessM <= 11:
  306. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/aggressive' + rand(1,1) + '.jpg"></center>'
  307. *nl
  308. $chess_name+' plays aggressively and overextends themselves.'
  309. gs 'chessplay', 'advantage', 'offense', 'good'
  310. end
  311. *nl
  312. 'You are on move '+str(chess_move)+' out of '+str(chess_move_limit)
  313. 'You are on minute '+str(total_chess_time)+' out of '+str(chess_time_limit)
  314. chess_GG -= 1
  315. chess_com -= 1
  316. gs 'chessplay', 'game'
  317. end
  318. act 'Play aggressively':
  319. ! this works as the opposite of conservative play
  320. ! aggressive wins against defense and tactical
  321. ! aggressive loses to offense and trap
  322. ! aggressive ties with conservative and aggressive
  323. *clr & cla
  324. if chessM <= 1:
  325. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/conservative' + rand(1,1) + '.jpg"></center>'
  326. *nl
  327. $chess_name+' plays conservatively and their defenses manage to hold you off.'
  328. 'Neither of you gain an advantage from this move.'
  329. elseif chessM <= 3:
  330. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/defensive' + rand(1,1) + '.jpg"></center>'
  331. *nl
  332. $chess_name+' plays defensively and you overwhelm a few of their pieces.'
  333. gs 'chessplay', 'advantage', 'aggressive', 'good'
  334. elseif chessM <= 5:
  335. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/tactical' + rand(1,1) + '.jpg"></center>'
  336. *nl
  337. $chess_name+' plays tactically and cannot cope with your aggressive moves.'
  338. gs 'chessplay', 'advantage', 'aggressive', 'good'
  339. elseif chessM <= 7:
  340. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/trap' + rand(1,1) + '.jpg"></center>'
  341. *nl
  342. $chess_name+' tries to trap you, but some of your pieces fall for it.'
  343. gs 'chessplay', 'advantage', 'aggressive', 'bad'
  344. elseif chessM <= 9:
  345. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/offensive' + rand(1,1) + '.jpg"></center>'
  346. *nl
  347. $chess_name+' plays offensively, leaving some of your pieces exposed.'
  348. gs 'chessplay', 'advantage', 'aggressive', 'bad'
  349. elseif chessM <= 11:
  350. '<center><img <<$set_imgh>> src="images/locations/pavlovsk/community/chess/aggressive' + rand(1,1) + '.jpg"></center>'
  351. *nl
  352. $chess_name+' also plays aggressively.'
  353. 'Neither of you gain an advantage from this move.'
  354. end
  355. *nl
  356. 'You are on move '+str(chess_move)+' out of '+str(chess_move_limit)
  357. 'You are on minute '+str(total_chess_time)+' out of '+str(chess_time_limit)
  358. chess_GG -= 1
  359. chess_com -= 1
  360. gs 'chessplay', 'game'
  361. end
  362. end
  363. ! $ARGS[1] = move chosen by player - used to set base skill difference and advantage change
  364. ! $ARGS[2] = whether this move was a good choice - whether Sveta should gain or lose advantage
  365. if $ARGS[0] = 'advantage':
  366. ! conservative and aggressive are the most extreme and therefore have the biggest reward and risk
  367. ! but also requires the greatest difference in skill to pull off successfully or prevent your opponent from using successfully
  368. if $ARGS[1] = 'conservative' or $ARGS[1] = 'aggressive':
  369. chess_pos = 4
  370. chess_neg = -4
  371. chess_adv = 4
  372. ! defense and offense are a middle ground and have medium reward and risk
  373. ! requires a medium skill gap to pull off successfully or prevent your opponent from using successfully
  374. elseif $ARGS[1] = 'defense' or $ARGS[1] = 'offense':
  375. chess_pos = 2
  376. chess_neg = -2
  377. chess_adv = 2
  378. ! tactical and trap are the least extreme and therefore have the least reward and risk
  379. ! they require the least difference in skill to pull off successfully or prevent your opponent from using successfully
  380. elseif $ARGS[1] = 'tactical' or $ARGS[1] = 'trap':
  381. chess_pos = 1
  382. chess_neg = -1
  383. chess_adv = 1
  384. end
  385. if $ARGS[2] = 'good':
  386. if chess_ind > chess_pos:
  387. 'You are less skilled than your opponent and cannot capitalize on your advantage.'
  388. 'Try to gain more skill at chess to use this move successfully against this opponent.'
  389. elseif chess_ind < chess_neg:
  390. 'You are more skilled than your opponent and gain a major advantage.'
  391. chess_GG = chess_GG + chess_adv + chess_diff
  392. chess_com = chess_com - chess_adv - chess_diff
  393. else
  394. 'You are about equally skilled as your opponent and gain some advantage.'
  395. chess_GG = chess_GG + chess_adv/2 + chess_diff/2
  396. chess_com = chess_com - chess_adv/2 - chess_diff/2
  397. end
  398. elseif $ARGS[2] = 'bad':
  399. if chess_ind > chess_pos:
  400. 'You are less skilled than your opponent and you lose a major advantage.'
  401. 'Try to gain more skill at chess to prevent your opponent from using this move successfully.'
  402. chess_GG = chess_GG - chess_adv - chess_diff
  403. chess_com = chess_com + chess_adv + chess_diff
  404. elseif chess_ind < chess_neg:
  405. 'You are more skilled than your opponent and prevent them from capitalizing on their advantage.'
  406. else
  407. 'You are about equally skilled as your opponent and you lose some advantage.'
  408. chess_GG = chess_GG - chess_adv/2 - chess_diff/2
  409. chess_com = chess_com + chess_adv/2 + chess_diff/2
  410. end
  411. end
  412. end
  413. --- chessplay ---------------------------------