@@ -1,2 +1,3 @@
# 单个玩家开始小游戏时执行
+tag @s add mini_running
execute if score $mini_type mem matches 2 run function mini:tntrun/player_enter
@@ -0,0 +1,11 @@
+# 玩家失败时由玩家自己触发
+
+# 失败提示与计数
+tag @s remove mini_running
+scoreboard players set $temp mem 0
+execute as @a[tag=mini_running] run scoreboard players add $temp mem 1
+tellraw @a [{"selector": "@s","color":"red"}," 已失败! 剩余 ",{"score": {"name": "$temp","objective": "mem"}}," 人!"]
+# 进入旁观
+gamemode spectator @s
+spectate @r[tag=mini_running]
@@ -9,12 +9,16 @@ effect give @s instant_health 10 0 true
effect give @s night_vision 1000000 0 true
effect give @s resistance 1000000 4 true
+# 关闭伤害
+gamerule fallDamage false
+gamerule fireDamage false
# 传送玩家
spreadplayers 1011.5 2011.5 7 7 false @s
schedule function mini:tntrun/player_enter2 1t replace
# schedule: tp @a ~ ~-3 ~
-# 三秒后才开始 TNT 掉落
+# 两秒后才开始 TNT 掉落
tag @s remove tntrun_pc
schedule function mini:tntrun/player_enter3 2s replace
# schedule: tag @a add tntrun_pc
@@ -0,0 +1,4 @@
+function mini:main/player_failed
+tag @s remove tntrun_pc
@@ -1,3 +1,3 @@
# 向单个玩家展示小游戏时执行
-tp @s 1011.5 28 2011.5
+tp @s 1011.5 27.5 2011.5
tellraw @s [{"text":"\n>> TNT Run >>\n\n","color":"red","bold":true},{"text": "你脚下的方块会不断塌陷, 所以, 不要停下来啊!\n场地一共有三层, 掉到最下面则为失败!\n","color":"white","bold": false}]
@@ -0,0 +1,2 @@
+# 玩家死亡判断
+execute as @a[tag=tntrun_pc] at @s if block ~ ~ ~ lava run function mini:tntrun/player_failed
@@ -0,0 +1,6 @@
+# 测试用:快速开始随机小游戏
+say 已开始随机小游戏!
+function ltw:state/3/state_enter
+function ltw:state/4/state_enter
+scoreboard players set $countdown mem 5