Browse Source

新版赌博系统

LTCatt 6 years ago
parent
commit
4b021ea9d3

+ 3 - 3
data/item/functions/shop/buy_dice.mcfunction

@@ -6,9 +6,9 @@ tag @s[scores={shop_dice=0,gold=9..}] add canbuy
 tellraw @s[scores={shop_dice=1..}] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经购赌了这个骰子了!","color":"aqua"}]
 tellraw @s[scores={shop_dice=0,gold=..8}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的金粒来赌骰子!","color":"red"}]
 tellraw @s[scores={shop_dice=..-1}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先赌上一级的骰子!","color":"red"}]
-tellraw @s[tag=canbuy] ["",{"text":">> ","color":"green","bold":true},"你赌了一次 ",{"text":"20面骰子","color":"green"}]
-execute as @s[tag=canbuy] run tellraw @a[tag=!canbuy] ["",{"text":">> ","color":"green","bold":true},{"selector": "@s","color":"green"}," 赌了一次 ",{"text":"20面骰子","color":"green"}]
-execute as @s[tag=canbuy] run function item:shop/special_dice
+# tellraw @s[tag=canbuy] ["",{"text":">> ","color":"green","bold":true},"你赌了一次 ",{"text":"20面骰子","color":"green"}]
+# execute as @s[tag=canbuy] run tellraw @a[tag=!canbuy] ["",{"text":">> ","color":"green","bold":true},{"selector": "@s","color":"green"}," 赌了一次 ",{"text":"20面骰子","color":"green"}]
+execute as @s[tag=canbuy] run function ltw:state/0/roll_dice/roll
 scoreboard players remove @s[tag=canbuy] gold 9
 execute as @s[tag=!canbuy] at @s run function lib:sounds/error
 execute as @s[tag=canbuy] at @s run function lib:sounds/levelup

+ 0 - 5
data/item/functions/shop/special_dice.mcfunction

@@ -1,5 +0,0 @@
-# 跟老板玩骰子
-function ltw:state/0/roll_dice/d20
-scoreboard players operation @s temp = $random mem
-execute as @e[type=piglin,tag=shop_piglin_11,tag=lobby_entity] run function ltw:state/0/roll_dice/d20
-function ltw:state/0/roll_dice/show_result

+ 0 - 7
data/ltw/functions/state/0/roll_dice/d20.mcfunction

@@ -1,7 +0,0 @@
-scoreboard players set $random_min mem 1
-scoreboard players set $random_max mem 20
-function lib:random
-execute if score $random mem matches 20 run tellraw @a [{"text":">> ","color":"gold","bold":true},{"selector":"@s","color":"gold","bold":false},{"text":"扔了个二十面幸运骰,掷出了D20=","color":"white","bold":false},{"score": {"name": "$random","objective": "mem"},"color":"gold"},{"text":",大成功!","color":"white"}]
-execute if score $random mem matches 11..19 run tellraw @a [{"text":">> ","color":"dark_green","bold":true},{"selector":"@s","color":"dark_green","bold":false},{"text":"扔了个二十面幸运骰,掷出了D20=","color":"white","bold":false},{"score": {"name": "$random","objective": "mem"},"color":"dark_green"},{"text":"!","color":"white"}]
-execute if score $random mem matches 2..10 run tellraw @a [{"text":">> ","color":"dark_red","bold":true},{"selector":"@s","color":"dark_red","bold":false},{"text":"扔了个二十面幸运骰,掷出了D20=","color":"white","bold":false},{"score": {"name": "$random","objective": "mem"},"color":"dark_red"},{"text":"!","color":"white"}]
-execute if score $random mem matches 1 run tellraw @a [{"text":">> ","color":"dark_purple","bold":true},{"selector":"@s","color":"dark_purple","bold":false},{"text":"扔了个二十面幸运骰,掷出了D20=","color":"white","bold":false},{"score": {"name": "$random","objective": "mem"},"color":"dark_purple"},{"text":",大失败!","color":"white"}]

+ 0 - 3
data/ltw/functions/state/0/roll_dice/draw.mcfunction

@@ -1,3 +0,0 @@
-scoreboard players add @s gold 9
-tag @a remove self
-scoreboard players set @s temp 0

+ 1 - 3
data/ltw/functions/state/0/roll_dice/lose.mcfunction

@@ -1,3 +1 @@
-# 无事发生
-scoreboard players set @s temp 0
-tag @a remove self
+tellraw @a ["",{"text":">> ","color":"aqua","bold":true},{"selector": "@s","color":"green"}," 买了一颗二十面骰, 掷出了 ",{"score": {"name": "$random","objective": "mem"},"color":"aqua"}, ", 无事发生……"]

+ 51 - 0
data/ltw/functions/state/0/roll_dice/roll.mcfunction

@@ -0,0 +1,51 @@
+
+# 丢骰子
+scoreboard players set $random_min mem 1
+scoreboard players set $random_max mem 20
+function lib:random
+
+# 20 大成功:获得 2 金块
+execute if score $random mem matches 20 run function ltw:state/0/roll_dice/super_win
+
+# 19-18 / 10% 成功:返还 1 金锭
+execute if score $random mem matches 18..19 run function ltw:state/0/roll_dice/win
+
+# 17-2 / 80% 失败:不返还
+execute if score $random mem matches 2..17 run function ltw:state/0/roll_dice/lose
+
+# 1 大失败:归零
+execute if score $random mem matches 1 run function ltw:state/0/roll_dice/super_lose
+
+
+
+
+
+# 老板大成功,玩家非大成功/玩家大失败,老板非大失败:玩家失去所有金粒,被丢出赌博房
+# execute if score $random mem matches 20 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"老板丢出了 ",{"text":"大成功","color":"dark_purple","bold":true}," ,你丢出了 ",{"text":"大失败","color":"dark_purple","bold":true}," ,你是超级非酋,你失去了所有金粒,被丢出了赌博房!"]
+# execute if score $random mem matches 20 if score @s temp matches 2..19 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"老板丢出了 ",{"text":"大成功","color":"dark_purple","bold":true}," ,你失去了所有金粒,被丢出了赌博房!"]
+# execute if score $random mem matches 2..19 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"你丢出了 ",{"text":"大失败","color":"dark_purple","bold":true}," ,你失去了所有金粒,被丢出了赌博房!"]
+
+# execute if score $random mem matches 20 if score @s temp matches 1..19 run function ltw:state/0/roll_dice/super_lose
+# execute if score $random mem matches 2..19 if score @s temp matches 1 run function ltw:state/0/roll_dice/super_lose
+
+# 玩家大成功,老板非大成功/老板大失败,玩家非大失败:玩家获得3金块
+# execute if score $random mem matches 1 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"你丢出了 ",{"text":"大成功","color":"gold","bold":true}," ,老板丢出了 ",{"text":"大失败","color":"gold","bold":true}," ,你是超级欧皇,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
+# execute if score $random mem matches 2..19 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"你丢出了 ",{"text":"大成功","color":"gold","bold":true}," ,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
+# execute if score $random mem matches 1 if score @s temp matches 2..19 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"老板丢出了 ",{"text":"大失败","color":"gold","bold":true}," ,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
+
+# execute if score $random mem matches 1 if score @s temp matches 2..20 run function ltw:state/0/roll_dice/super_win
+# execute if score $random mem matches 2..19 if score @s temp matches 20 run function ltw:state/0/roll_dice/super_win
+
+# 老板比玩家大:无事发生
+# execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem > @s temp run tellraw @s ["",{"text":">> ","color":"dark_red","bold":true},"老板的点数比你大,你输了,你失去了 ",{"text":"1金锭","color":"dark_red","bold":true} ," !"]
+# execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem > @s temp run function ltw:state/0/roll_dice/lose
+
+# 玩家比老板大:获得18金粒
+# execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem < @s temp run tellraw @s ["",{"text":">> ","color":"dark_green","bold":true},"你的点数比老板大,你赢了,你获得了",{"text":"1金锭","color":"dark_green","bold":true} ," !"]
+# execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem < @s temp run function ltw:state/0/roll_dice/win
+
+# 老板和玩家一样大:玩家获得9金粒
+# execute if score $random mem matches 20 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你和老板一样欧,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
+# execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem = @s temp run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你的点数和老板一样大,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
+# execute if score $random mem matches 1 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你和老板一样非,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
+# execute if score $random mem = @s temp run function ltw:state/0/roll_dice/draw

+ 0 - 29
data/ltw/functions/state/0/roll_dice/show_result.mcfunction

@@ -1,29 +0,0 @@
-# 老板大成功,玩家非大成功/玩家大失败,老板非大失败:玩家失去所有金粒,被丢出赌博房
-execute if score $random mem matches 20 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"老板丢出了 ",{"text":"大成功","color":"dark_purple","bold":true}," ,你丢出了 ",{"text":"大失败","color":"dark_purple","bold":true}," ,你是超级非酋,你失去了所有金粒,被丢出了赌博房!"]
-execute if score $random mem matches 20 if score @s temp matches 2..19 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"老板丢出了 ",{"text":"大成功","color":"dark_purple","bold":true}," ,你失去了所有金粒,被丢出了赌博房!"]
-execute if score $random mem matches 2..19 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"你丢出了 ",{"text":"大失败","color":"dark_purple","bold":true}," ,你失去了所有金粒,被丢出了赌博房!"]
-
-execute if score $random mem matches 20 if score @s temp matches 1..19 run function ltw:state/0/roll_dice/super_lose
-execute if score $random mem matches 2..19 if score @s temp matches 1 run function ltw:state/0/roll_dice/super_lose
-
-# 玩家大成功,老板非大成功/老板大失败,玩家非大失败:玩家获得3金块
-execute if score $random mem matches 1 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"你丢出了 ",{"text":"大成功","color":"gold","bold":true}," ,老板丢出了 ",{"text":"大失败","color":"gold","bold":true}," ,你是超级欧皇,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
-execute if score $random mem matches 2..19 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"你丢出了 ",{"text":"大成功","color":"gold","bold":true}," ,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
-execute if score $random mem matches 1 if score @s temp matches 2..19 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"老板丢出了 ",{"text":"大失败","color":"gold","bold":true}," ,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
-
-execute if score $random mem matches 1 if score @s temp matches 2..20 run function ltw:state/0/roll_dice/super_win
-execute if score $random mem matches 2..19 if score @s temp matches 20 run function ltw:state/0/roll_dice/super_win
-
-# 老板比玩家大:无事发生
-execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem > @s temp run tellraw @s ["",{"text":">> ","color":"dark_red","bold":true},"老板的点数比你大,你输了,你失去了 ",{"text":"1金锭","color":"dark_red","bold":true} ," !"]
-execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem > @s temp run function ltw:state/0/roll_dice/lose
-
-# 玩家比老板大:获得18金粒
-execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem < @s temp run tellraw @s ["",{"text":">> ","color":"dark_green","bold":true},"你的点数比老板大,你赢了,你获得了",{"text":"1金锭","color":"dark_green","bold":true} ," !"]
-execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem < @s temp run function ltw:state/0/roll_dice/win
-
-# 老板和玩家一样大:玩家获得9金粒
-execute if score $random mem matches 20 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你和老板一样欧,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
-execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem = @s temp run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你的点数和老板一样大,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
-execute if score $random mem matches 1 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你和老板一样非,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
-execute if score $random mem = @s temp run function ltw:state/0/roll_dice/draw

+ 1 - 4
data/ltw/functions/state/0/roll_dice/super_lose.mcfunction

@@ -1,6 +1,3 @@
 scoreboard players set @s gold 0
-scoreboard players set @s temp 0
-tag @a remove self
-tag @s add self
-tellraw @a[tag=!self] ["",{"text":">> ","color":"red","bold":true},{"selector": "@s","color":"red"}," 非到了一个境界,倾家荡产,被老板丢出了赌博房!"]
+tellraw @a ["",{"text":">> ","color":"red","bold":true},{"selector": "@s","color":"green"}," 买了一颗二十面骰, 掷出了 ",{"text": "1, 大失败","color":"red"}, ", 倾家荡产, 被丢了出去!"]
 tp @s 20 23 -58

+ 2 - 5
data/ltw/functions/state/0/roll_dice/super_win.mcfunction

@@ -1,5 +1,2 @@
-scoreboard players add @s gold 243
-scoreboard players set @s temp 0
-tag @a remove self
-tag @s add self
-tellraw @a[tag=!self] ["",{"text":">> ","color":"gold","bold":true},{"selector": "@s","color":"gold"}," 欧到了一个境界,从老板那赢得了3金块!"]
+scoreboard players add @s gold 162
+tellraw @a ["",{"text":">> ","color":"green","bold":true},{"selector": "@s","color":"green"}," 买了一颗二十面骰, 掷出了 ",{"text": "20, 大成功","color":"green"}, ", 获得了 2 金块!"]

+ 2 - 3
data/ltw/functions/state/0/roll_dice/win.mcfunction

@@ -1,3 +1,2 @@
-scoreboard players add @s gold 18
-scoreboard players set @s temp 0
-tag @a remove self
+scoreboard players add @s gold 9
+tellraw @a ["",{"text":">> ","color":"green","bold":true},{"selector": "@s","color":"green"}," 买了一颗二十面骰, 掷出了 ",{"score": {"name": "$random","objective": "mem"},"color":"green"}, ", 返还了购买骰子的 1 金锭!"]