瀏覽代碼

开始倒计时

LTCatt 6 年之前
父節點
當前提交
373750bb41

+ 1 - 2
data/ltw/functions/main/player_leave.mcfunction

@@ -15,5 +15,4 @@ execute if score $state mem matches 5 if score $mini_type mem matches 3 run func
 # FIXME : <! 紧急> 跑酷中途掉线导致名次判断错误
 # FIXME : <! 紧急> 跑酷中途掉线导致名次判断错误
 # FIXME : <! 紧急> [010] 弩和箭可能给不到人
 # FIXME : <! 紧急> [010] 弩和箭可能给不到人
 # FIXME : [010/HIM] 关闭原版进度,它会给玩家经验值什么的很烦
 # FIXME : [010/HIM] 关闭原版进度,它会给玩家经验值什么的很烦
-# TODO : [010] 制作命运硬币(拾取时得分加倍或减半)、命运骰子(拾取时得分 +1~6)
-# TODO : [LTCat] 游戏开始机制优化
+# TODO : [010] 制作命运硬币(拾取时得分加倍或减半)、命运骰子(拾取时得分 +1~6)

+ 6 - 2
data/ltw/functions/state/0/change_classic.mcfunction

@@ -1,4 +1,8 @@
 # 切换为经典模式
 # 切换为经典模式
-execute if score $game_type mem matches 1 run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"text": "已切换为经典模式!","color":"aqua"}]
+execute if score $game_type mem matches 1 run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},"游戏模式已切换为 ",{"text": " 经典模式","color":"aqua"}]
 scoreboard players set $game_type mem 0
 scoreboard players set $game_type mem 0
-function ltw:state/0/refresh_state
+execute as @a at @s run function lib:sounds/teleport
+function ltw:state/0/refresh_game_type
+
+# 取消倒计时
+scoreboard players set $countdown mem 0

+ 6 - 2
data/ltw/functions/state/0/change_gameparty.mcfunction

@@ -1,4 +1,8 @@
 # 切换为小游戏模式
 # 切换为小游戏模式
-execute if score $game_type mem matches 0 run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"text": "已切换为小游戏模式!","color":"aqua"}]
+execute if score $game_type mem matches 0 run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},"游戏模式已切换为 ",{"text": " 小游戏模式","color":"aqua"}]
 scoreboard players set $game_type mem 1
 scoreboard players set $game_type mem 1
-function ltw:state/0/refresh_state
+execute as @a at @s run function lib:sounds/teleport
+function ltw:state/0/refresh_game_type
+
+# 取消倒计时
+scoreboard players set $countdown mem 0

+ 0 - 0
data/ltw/functions/state/0/refresh_state.mcfunction → data/ltw/functions/state/0/refresh_game_type.mcfunction


+ 2 - 2
data/ltw/functions/state/0/start_gameparty.mcfunction

@@ -1,8 +1,8 @@
 # 开始小游戏模式
 # 开始小游戏模式
 
 
 # 设置旁观
 # 设置旁观
-tag @a remove watcher
-tag @a[tag=hub_watch] add watcher
+tag @a add watcher
+tag @a[tag=hub_ready,sort=random,limit=8] remove watcher
 
 
 # 设置数据
 # 设置数据
 scoreboard players reset * total_score
 scoreboard players reset * total_score

+ 1 - 1
data/ltw/functions/state/0/state_enter.mcfunction

@@ -20,4 +20,4 @@ forceload remove all
 scoreboard players set $countdown mem 0
 scoreboard players set $countdown mem 0
 
 
 # 重置当前状态
 # 重置当前状态
-function ltw:state/0/refresh_state
+function ltw:state/0/refresh_game_type

+ 10 - 0
data/ltw/functions/state/0/tick20.mcfunction

@@ -0,0 +1,10 @@
+# 尝试进行倒计时
+execute if score $countdown mem matches 1.. if score $game_type mem matches 0 run function ltw:state/0/try_start_classic
+execute if score $countdown mem matches 1.. if score $game_type mem matches 1 run function ltw:state/0/try_start_gameparty
+
+# 显示倒计时,播放音效
+execute if score $countdown mem matches 1.. run title @a times 3 14 2
+execute if score $countdown mem matches 1.. run title @a subtitle {"score":{"name":"$countdown","objective":"mem"}}
+execute if score $countdown mem matches 1.. if score $game_type mem matches 0 run title @a title ["经典模式"]
+execute if score $countdown mem matches 1.. if score $game_type mem matches 1 run title @a title ["小游戏模式"]
+execute if score $countdown mem matches 1.. run execute as @a at @s run function lib:sounds/hit2

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

@@ -1,3 +1,4 @@
 # 尝试开始经典模式
 # 尝试开始经典模式
-tellraw @a[tag=hub_ready] {"text": "经典模式尚未完成, 请开始小游戏模式!","color":"red"}
-execute as @a[tag=hub_ready] at @s run function lib:sounds/error
+tellraw @a[tag=hub_ready] ["",{"text": ">> ","color":"red","bold": true},{"text": "经典模式尚未完成, 请开始小游戏模式!","color":"red"}]
+execute as @a[tag=hub_ready] at @s run function lib:sounds/error
+scoreboard players set $countdown mem 0

+ 3 - 0
data/ltw/functions/state/0/try_start_game.mcfunction

@@ -0,0 +1,3 @@
+# 尝试开始任意游戏
+
+execute if score $countdown mem matches 0 run scoreboard players set $countdown mem 11

+ 11 - 6
data/ltw/functions/state/0/try_start_gameparty.mcfunction

@@ -3,11 +3,16 @@
 # 计算玩家数量
 # 计算玩家数量
 execute store result score $count mem if entity @a[tag=hub_ready]
 execute store result score $count mem if entity @a[tag=hub_ready]
 
 
-# 根据玩家数量判定
+# 判断玩家数量过少
 execute if score $count mem matches ..1 as @a at @s run function lib:sounds/error
 execute if score $count mem matches ..1 as @a at @s run function lib:sounds/error
-execute if score $count mem matches ..1 run tellraw @a [{"text": "需要至少 2 人以开始小游戏模式, 当前仅有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
-execute if score $count mem matches 9.. as @a at @s run function lib:sounds/error
-execute if score $count mem matches 9.. run tellraw @a [{"text": "小游戏模式最多支持 8 人, 当前已有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
+execute if score $count mem matches ..1 run tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"text": "需要至少 2 人以开始小游戏模式, 当前人数不足!","color":"red"}]
+execute if score $count mem matches ..1 run scoreboard players set $countdown mem 0
 
 
-# 判断旁观
-execute if score $count mem matches 2..8 run function ltw:state/0/start_gameparty
+# 判断玩家数量过多
+execute if score $count mem matches 9.. if score $countdown mem matches 10 run tellraw @a [{"text":"","color":"gold"},{"text":">> ","bold": true},"小游戏模式最多支持 8 人, 当前已有 ",{"score": { "name": "$count","objective": "mem"}}, " 人, 将随机抽取 8 人开始游戏!"]
+execute if score $count mem matches 9.. if score $countdown mem matches 1 run tellraw @a [{"text":"","color":"gold"},{"text":">> ","bold": true},"小游戏模式最多支持 8 人, 当前已有 ",{"score": { "name": "$count","objective": "mem"}}, " 人, 将随机抽取 8 人开始游戏!"]
+
+# 开始游戏
+execute if score $countdown mem matches 10 run tellraw @a [{"text":"","color":"green"},{"text": ">> ","bold": true},"即将开始小游戏模式, 请到准备区域准备, 若想旁观则请离开准备区域!"]
+execute if score $countdown mem matches 10 as @a at @s run function lib:sounds/levelup
+execute if score $countdown mem matches 1 run function ltw:state/0/start_gameparty