SUPERFIRE777

ブラックジャック/SUPERFIRESERVER

Jul 18th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.69 KB | None | 0 0
  1. function title(player:player, text:text):
  2. set {_title} to {_text}
  3. replace all "&" with "§" in {_title}
  4. execute console command "/title %{_player}% title {""text"":""%{_title}%""}"
  5. stop
  6. function draw(player:player, drawingSide:text):
  7. set {_number} to random integer between 1 and 13
  8. if {_drawingSide} is "player":
  9. if {BJ.%{_player}%.playerCards} is "":
  10. set {BJ.%{_player}%.playerCards} to card({_number})
  11. else:
  12. set {BJ.%{_player}%.playerCards} to "%{BJ.%{_player}%.playerCards}% %card({_number})%"
  13. total({_player}, "player", card({_number}))
  14. if {_drawingSide} is "dealer":
  15. if {BJ.%{_player}%.dealerCards} is "":
  16. set {BJ.%{_player}%.dealerCards} to card({_number})
  17. else:
  18. set {BJ.%{_player}%.dealerCards} to "%{BJ.%{_player}%.dealerCards}% %card({_number})%"
  19. total({_player}, "dealer", card({_number}))
  20. stop
  21. function total(player:player, drawedSide:text, drawedCard:text):
  22. if {_drawedSide} is "player":
  23. if {_drawedCard} is "[A]":
  24. add 11 to {BJ.%{_player}%.playerTotal}
  25. if {BJ.%{_player}%.dealerTotal} is more than 21:
  26. subtract 10 from {BJ.%{_player}%.dealerTotal}
  27. if {_drawedCard} is "[2]":
  28. add 2 to {BJ.%{_player}%.playerTotal}
  29. if {_drawedCard} is "[3]":
  30. add 3 to {BJ.%{_player}%.playerTotal}
  31. if {_drawedCard} is "[4]":
  32. add 4 to {BJ.%{_player}%.playerTotal}
  33. if {_drawedCard} is "[5]":
  34. add 5 to {BJ.%{_player}%.playerTotal}
  35. if {_drawedCard} is "[6]":
  36. add 6 to {BJ.%{_player}%.playerTotal}
  37. if {_drawedCard} is "[7]":
  38. add 7 to {BJ.%{_player}%.playerTotal}
  39. if {_drawedCard} is "[8]":
  40. add 8 to {BJ.%{_player}%.playerTotal}
  41. if {_drawedCard} is "[9]":
  42. add 9 to {BJ.%{_player}%.playerTotal}
  43. if {_drawedCard} is "[10]" or "[J]" or "[Q]" or "[K]":
  44. add 10 to {BJ.%{_player}%.playerTotal}
  45. if {_drawedSide} is "dealer":
  46. if {_drawedCard} is "[A]":
  47. add 11 to {BJ.%{_player}%.dealerTotal}
  48. if {BJ.%{_player}%.dealerTotal} is more than 21:
  49. subtract 10 from {BJ.%{_player}%.dealerTotal}
  50. if {_drawedCard} is "[2]":
  51. add 2 to {BJ.%{_player}%.dealerTotal}
  52. if {_drawedCard} is "[3]":
  53. add 3 to {BJ.%{_player}%.dealerTotal}
  54. if {_drawedCard} is "[4]":
  55. add 4 to {BJ.%{_player}%.dealerTotal}
  56. if {_drawedCard} is "[5]":
  57. add 5 to {BJ.%{_player}%.dealerTotal}
  58. if {_drawedCard} is "[6]":
  59. add 6 to {BJ.%{_player}%.dealerTotal}
  60. if {_drawedCard} is "[7]":
  61. add 7 to {BJ.%{_player}%.dealerTotal}
  62. if {_drawedCard} is "[8]":
  63. add 8 to {BJ.%{_player}%.dealerTotal}
  64. if {_drawedCard} is "[9]":
  65. add 9 to {BJ.%{_player}%.dealerTotal}
  66. if {_drawedCard} is "[10]" or "[J]" or "[Q]" or "[K]":
  67. add 10 to {BJ.%{_player}%.dealerTotal}
  68. stop
  69. function card(number:integer) :: text:
  70. if {_number} is 1:
  71. return "[A]"
  72. else if {_number} is 11:
  73. return "[J]"
  74. else if {_number} is 12:
  75. return "[Q]"
  76. else if {_number} is 13:
  77. return "[K]"
  78. else:
  79. return "[%{_number}%]"
  80. function cardInit(player:player):
  81. set {_random} to random integer between 1 and 13
  82. loop 2 times:
  83. draw({_player}, "player")
  84. draw({_player}, "dealer")
  85. set {BJ.%{_player}%.dealerCards} to "%{BJ.%{_player}%.dealerCards}% [?]"
  86. stop
  87. command /blackjack <text> [<integer>]:
  88. aliases: /bj
  89. trigger:
  90. if arg 1 is "bet":
  91. if {BJ.%player%.playing} is false:
  92. if player's money is less than arg 2:
  93. message "&cお金が足りません" to the player
  94. else:
  95. if {BJ.%player%.betted} is true:
  96. message "&c既にベットしています" to the player
  97. else:
  98. if arg 2 is set:
  99. remove arg 2 from player's money
  100. set {BJ.%player%.betMoney} to arg 2
  101. set {BJ.%player%.betted} to true
  102. message "&aベットが承認されました" to the player
  103. else:
  104. message "&cベット額を入力してください" to the player
  105. else:
  106. message "&cプレイ中にベットはできません"
  107. if arg 1 is "reset":
  108. if {BJ.%player%.playing} is false:
  109. add {BJ.%player%.betMoney} to player's money
  110. set {BJ.%player%.betted} to false
  111. message "&aベットが返却されました" to the player
  112. else:
  113. message "&cプレイ中にベットの返却はできません"
  114. if arg 1 is "start":
  115. if {BJ.%player%.betted} is true:
  116. if {BJ.%player%.playing} is false:
  117. set {BJ.%player%.playing} to true
  118. set {BJ.%player%.playerCards} to ""
  119. set {BJ.%player%.dealerCards} to ""
  120. set {BJ.%player%.playerTotal} to 0
  121. set {BJ.%player%.dealerTotal} to 0
  122. set {BJ.%player%.playerPower} to 0
  123. set {BJ.%player%.dealerPower} to 0
  124. title(player,"&e&lゲームスタート!")
  125. cardInit(player)
  126. set {BJ.%player%.playerPower} to {BJ.%player%.playerTotal}
  127. set {BJ.%player%.dealerPower} to {BJ.%player%.dealerTotal}
  128. message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
  129. message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
  130. if {BJ.%player%.playerTotal} is 21:
  131. message "&b&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ブラックジャック!" to the player
  132. else:
  133. message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
  134. message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
  135. if {BJ.%player%.playerTotal} is 21:
  136. title(player,"&b&lブラックジャック!")
  137. set {BJ.%player%.playerPower} to 999
  138. wait for 3 seconds
  139. execute player command "/bj stand"
  140. else:
  141. message "&c現在プレイ中です" to the player
  142. else:
  143. message "&c先にベットしてください" to the player
  144. if arg 1 is "hit":
  145. if {BJ.%player%.playing} is true:
  146. draw(player, "player")
  147. message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
  148. message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
  149. if {BJ.%player%.playerTotal} is more than 21:
  150. message "&c&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% バースト!" to the player
  151. else if length of {BJ.%player%.playerCards} is 7 or 8:
  152. if {BJ.%player%.playerTotal} is 21:
  153. message "&b&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ブラックジャック!" to the player
  154. else:
  155. message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
  156. else:
  157. if {BJ.%player%.playerTotal} is 21:
  158. message "&a&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ナイス21!" to the player
  159. else:
  160. message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
  161. message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
  162. set {BJ.%player%.playerPower} to {BJ.%player%.playerTotal}
  163. if {BJ.%player%.playerTotal} is more than 21:
  164. title(player,"&c&lバースト!")
  165. set {BJ.%player%.playerPower} to -9999
  166. wait for a second
  167. execute player command "/bj stand"
  168. if {BJ.%player%.playerTotal} is 21:
  169. title(player,"&a&lナイス21!")
  170. wait for a second
  171. execute player command "/bj stand"
  172. else:
  173. message "&c先にスタートしてください" to the player
  174. if arg 1 is "stand":
  175. if {BJ.%player%.playing} is true:
  176. replace all " [?]" with "" in {BJ.%player%.dealerCards}
  177. while {BJ.%player%.dealerTotal} is less than 17:
  178. draw(player, "dealer")
  179. message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
  180. if {BJ.%player%.dealerTotal} is more than 21:
  181. message "&e&lディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}% バースト!" to the player
  182. else if length of {BJ.%player%.dealerCards} is 7 or 8:
  183. if {BJ.%player%.dealerTotal} is 21:
  184. message "&9&lディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}% ブラックジャック!" to the player
  185. else:
  186. message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
  187. else if {BJ.%player%.dealerTotal} is 21:
  188. message "&2&lディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}% ナイス21!" to the player
  189. else:
  190. message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
  191. if {BJ.%player%.playerTotal} is more than 21:
  192. message "&c&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% バースト!" to the player
  193. else if length of {BJ.%player%.playerCards} is 7 or 8:
  194. if {BJ.%player%.playerTotal} is 21:
  195. message "&b&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ブラックジャック!" to the player
  196. else:
  197. message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
  198. else:
  199. if {BJ.%player%.playerTotal} is 21:
  200. message "&a&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ナイス21!" to the player
  201. else:
  202. message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
  203. message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
  204. set {BJ.%player%.dealerPower} to {BJ.%player%.dealerTotal}
  205. if {BJ.%player%.dealerTotal} is more than 21:
  206. title(player,"&e&lバースト!")
  207. wait for 3 seconds
  208. set {BJ.%player%.dealerPower} to -999
  209. if length of {BJ.%player%.dealerCards} is 7 or 8:
  210. if {BJ.%player%.dealerTotal} is 21:
  211. title(player,"&9&lブラックジャック!")
  212. wait for 3 seconds
  213. set {BJ.%player%.dealerPower} to 999
  214. else:
  215. if {BJ.%player%.dealerTotal} is 21:
  216. title(player,"&2&lナイス21!")
  217. wait for 3 seconds
  218. wait for a second
  219. wait for a second
  220. if {BJ.%player%.playerPower} is more than {BJ.%player%.dealerPower}:
  221. if {BJ.%player%.playerPower} is 999:
  222. title(player,"&e&l勝ち!")
  223. add {BJ.%player%.betMoney} * 2.5 to player's money
  224. wait for 3 seconds
  225. title(player,"&e&l%{BJ.%player%.betMoney} * 2.5%炎獲得!")
  226. else:
  227. title(player,"&c&l勝ち!")
  228. add {BJ.%player%.betMoney} * 2 to player's money
  229. wait for 3 seconds
  230. title(player,"&c&l%{BJ.%player%.betMoney} * 2%炎獲得!")
  231. if {BJ.%player%.playerPower} is less than {BJ.%player%.dealerPower}:
  232. title(player,"&b&l負け…")
  233. if {BJ.%player%.playerPower} is {BJ.%player%.dealerPower}:
  234. title(player,"&a&l引き分け")
  235. add {BJ.%player%.betMoney} to player's money
  236. set {BJ.%player%.playing} to false
  237. set {BJ.%player%.betted} to false
  238. else:
  239. message "&c先にスタートしてください" to the player
  240. if arg 1 is "init":
  241. set {BJ.%player%.betMoney} to 0
  242. set {BJ.%player%.betted} to false
  243. set {BJ.%player%.playing} to false
  244. set {BJ.%player%.playerCards} to ""
  245. set {BJ.%player%.dealerCards} to ""
  246. set {BJ.%player%.playerTotal} to 0
  247. set {BJ.%player%.dealerTotal} to 0
  248. set {BJ.%player%.playerPower} to 0
  249. set {BJ.%player%.dealerPower} to 0
  250. message "&a初期化しました。" to the player
Advertisement
Add Comment
Please, Sign In to add comment