Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function title(player:player, text:text):
- set {_title} to {_text}
- replace all "&" with "§" in {_title}
- execute console command "/title %{_player}% title {""text"":""%{_title}%""}"
- stop
- function draw(player:player, drawingSide:text):
- set {_number} to random integer between 1 and 13
- if {_drawingSide} is "player":
- if {BJ.%{_player}%.playerCards} is "":
- set {BJ.%{_player}%.playerCards} to card({_number})
- else:
- set {BJ.%{_player}%.playerCards} to "%{BJ.%{_player}%.playerCards}% %card({_number})%"
- total({_player}, "player", card({_number}))
- if {_drawingSide} is "dealer":
- if {BJ.%{_player}%.dealerCards} is "":
- set {BJ.%{_player}%.dealerCards} to card({_number})
- else:
- set {BJ.%{_player}%.dealerCards} to "%{BJ.%{_player}%.dealerCards}% %card({_number})%"
- total({_player}, "dealer", card({_number}))
- stop
- function total(player:player, drawedSide:text, drawedCard:text):
- if {_drawedSide} is "player":
- if {_drawedCard} is "[A]":
- add 11 to {BJ.%{_player}%.playerTotal}
- if {BJ.%{_player}%.dealerTotal} is more than 21:
- subtract 10 from {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[2]":
- add 2 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[3]":
- add 3 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[4]":
- add 4 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[5]":
- add 5 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[6]":
- add 6 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[7]":
- add 7 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[8]":
- add 8 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[9]":
- add 9 to {BJ.%{_player}%.playerTotal}
- if {_drawedCard} is "[10]" or "[J]" or "[Q]" or "[K]":
- add 10 to {BJ.%{_player}%.playerTotal}
- if {_drawedSide} is "dealer":
- if {_drawedCard} is "[A]":
- add 11 to {BJ.%{_player}%.dealerTotal}
- if {BJ.%{_player}%.dealerTotal} is more than 21:
- subtract 10 from {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[2]":
- add 2 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[3]":
- add 3 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[4]":
- add 4 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[5]":
- add 5 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[6]":
- add 6 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[7]":
- add 7 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[8]":
- add 8 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[9]":
- add 9 to {BJ.%{_player}%.dealerTotal}
- if {_drawedCard} is "[10]" or "[J]" or "[Q]" or "[K]":
- add 10 to {BJ.%{_player}%.dealerTotal}
- stop
- function card(number:integer) :: text:
- if {_number} is 1:
- return "[A]"
- else if {_number} is 11:
- return "[J]"
- else if {_number} is 12:
- return "[Q]"
- else if {_number} is 13:
- return "[K]"
- else:
- return "[%{_number}%]"
- function cardInit(player:player):
- set {_random} to random integer between 1 and 13
- loop 2 times:
- draw({_player}, "player")
- draw({_player}, "dealer")
- set {BJ.%{_player}%.dealerCards} to "%{BJ.%{_player}%.dealerCards}% [?]"
- stop
- command /blackjack <text> [<integer>]:
- aliases: /bj
- trigger:
- if arg 1 is "bet":
- if {BJ.%player%.playing} is false:
- if player's money is less than arg 2:
- message "&cお金が足りません" to the player
- else:
- if {BJ.%player%.betted} is true:
- message "&c既にベットしています" to the player
- else:
- if arg 2 is set:
- remove arg 2 from player's money
- set {BJ.%player%.betMoney} to arg 2
- set {BJ.%player%.betted} to true
- message "&aベットが承認されました" to the player
- else:
- message "&cベット額を入力してください" to the player
- else:
- message "&cプレイ中にベットはできません"
- if arg 1 is "reset":
- if {BJ.%player%.playing} is false:
- add {BJ.%player%.betMoney} to player's money
- set {BJ.%player%.betted} to false
- message "&aベットが返却されました" to the player
- else:
- message "&cプレイ中にベットの返却はできません"
- if arg 1 is "start":
- if {BJ.%player%.betted} is true:
- if {BJ.%player%.playing} is false:
- set {BJ.%player%.playing} to true
- set {BJ.%player%.playerCards} to ""
- set {BJ.%player%.dealerCards} to ""
- set {BJ.%player%.playerTotal} to 0
- set {BJ.%player%.dealerTotal} to 0
- set {BJ.%player%.playerPower} to 0
- set {BJ.%player%.dealerPower} to 0
- title(player,"&e&lゲームスタート!")
- cardInit(player)
- set {BJ.%player%.playerPower} to {BJ.%player%.playerTotal}
- set {BJ.%player%.dealerPower} to {BJ.%player%.dealerTotal}
- message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
- message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
- if {BJ.%player%.playerTotal} is 21:
- message "&b&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ブラックジャック!" to the player
- else:
- message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
- message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
- if {BJ.%player%.playerTotal} is 21:
- title(player,"&b&lブラックジャック!")
- set {BJ.%player%.playerPower} to 999
- wait for 3 seconds
- execute player command "/bj stand"
- else:
- message "&c現在プレイ中です" to the player
- else:
- message "&c先にベットしてください" to the player
- if arg 1 is "hit":
- if {BJ.%player%.playing} is true:
- draw(player, "player")
- message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
- message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
- if {BJ.%player%.playerTotal} is more than 21:
- message "&c&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% バースト!" to the player
- else if length of {BJ.%player%.playerCards} is 7 or 8:
- if {BJ.%player%.playerTotal} is 21:
- message "&b&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ブラックジャック!" to the player
- else:
- message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
- else:
- if {BJ.%player%.playerTotal} is 21:
- message "&a&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ナイス21!" to the player
- else:
- message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
- message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
- set {BJ.%player%.playerPower} to {BJ.%player%.playerTotal}
- if {BJ.%player%.playerTotal} is more than 21:
- title(player,"&c&lバースト!")
- set {BJ.%player%.playerPower} to -9999
- wait for a second
- execute player command "/bj stand"
- if {BJ.%player%.playerTotal} is 21:
- title(player,"&a&lナイス21!")
- wait for a second
- execute player command "/bj stand"
- else:
- message "&c先にスタートしてください" to the player
- if arg 1 is "stand":
- if {BJ.%player%.playing} is true:
- replace all " [?]" with "" in {BJ.%player%.dealerCards}
- while {BJ.%player%.dealerTotal} is less than 17:
- draw(player, "dealer")
- message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
- if {BJ.%player%.dealerTotal} is more than 21:
- message "&e&lディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}% バースト!" to the player
- else if length of {BJ.%player%.dealerCards} is 7 or 8:
- if {BJ.%player%.dealerTotal} is 21:
- message "&9&lディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}% ブラックジャック!" to the player
- else:
- message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
- else if {BJ.%player%.dealerTotal} is 21:
- message "&2&lディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}% ナイス21!" to the player
- else:
- message "ディーラー: %{BJ.%player%.dealerCards}% 合計: %{BJ.%player%.dealerTotal}%" to the player
- if {BJ.%player%.playerTotal} is more than 21:
- message "&c&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% バースト!" to the player
- else if length of {BJ.%player%.playerCards} is 7 or 8:
- if {BJ.%player%.playerTotal} is 21:
- message "&b&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ブラックジャック!" to the player
- else:
- message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
- else:
- if {BJ.%player%.playerTotal} is 21:
- message "&a&lプレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}% ナイス21!" to the player
- else:
- message "プレイヤー: %{BJ.%player%.playerCards}% 合計: %{BJ.%player%.playerTotal}%" to the player
- message "&l━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" to the player
- set {BJ.%player%.dealerPower} to {BJ.%player%.dealerTotal}
- if {BJ.%player%.dealerTotal} is more than 21:
- title(player,"&e&lバースト!")
- wait for 3 seconds
- set {BJ.%player%.dealerPower} to -999
- if length of {BJ.%player%.dealerCards} is 7 or 8:
- if {BJ.%player%.dealerTotal} is 21:
- title(player,"&9&lブラックジャック!")
- wait for 3 seconds
- set {BJ.%player%.dealerPower} to 999
- else:
- if {BJ.%player%.dealerTotal} is 21:
- title(player,"&2&lナイス21!")
- wait for 3 seconds
- wait for a second
- wait for a second
- if {BJ.%player%.playerPower} is more than {BJ.%player%.dealerPower}:
- if {BJ.%player%.playerPower} is 999:
- title(player,"&e&l勝ち!")
- add {BJ.%player%.betMoney} * 2.5 to player's money
- wait for 3 seconds
- title(player,"&e&l%{BJ.%player%.betMoney} * 2.5%炎獲得!")
- else:
- title(player,"&c&l勝ち!")
- add {BJ.%player%.betMoney} * 2 to player's money
- wait for 3 seconds
- title(player,"&c&l%{BJ.%player%.betMoney} * 2%炎獲得!")
- if {BJ.%player%.playerPower} is less than {BJ.%player%.dealerPower}:
- title(player,"&b&l負け…")
- if {BJ.%player%.playerPower} is {BJ.%player%.dealerPower}:
- title(player,"&a&l引き分け")
- add {BJ.%player%.betMoney} to player's money
- set {BJ.%player%.playing} to false
- set {BJ.%player%.betted} to false
- else:
- message "&c先にスタートしてください" to the player
- if arg 1 is "init":
- set {BJ.%player%.betMoney} to 0
- set {BJ.%player%.betted} to false
- set {BJ.%player%.playing} to false
- set {BJ.%player%.playerCards} to ""
- set {BJ.%player%.dealerCards} to ""
- set {BJ.%player%.playerTotal} to 0
- set {BJ.%player%.dealerTotal} to 0
- set {BJ.%player%.playerPower} to 0
- set {BJ.%player%.dealerPower} to 0
- message "&a初期化しました。" to the player
Advertisement
Add Comment
Please, Sign In to add comment