start_game.mcfunction 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. # 开始游戏
  2. # 确认实际玩家
  3. tag @a remove selected_player
  4. tag @a[team=playing,sort=random,limit=8] add selected_player
  5. # 通知队伍
  6. tellraw @a[team=playing,tag=!selected_player] ["",{"text": ">> ","color": "red","bold": true},{"text": "你没有被选中参与, 将旁观本局游戏!","color": "red"}]
  7. team join watching @a[team=playing,tag=!selected_player]
  8. tellraw @a[team=playing,tag=selected_player] ["",{"text": ">> ","color": "green","bold": true},{"text": "游戏开始!","color": "green"}]
  9. tellraw @a[team=watching] ["",{"text": ">> ","color": "green","bold": true},{"text": "游戏开始, 你将旁观本局游戏!","color": "green"}]
  10. tellraw @a[team=debugging] ["",{"text": ">> ","color": "aqua","bold": true},{"text": "你正处于 Debug 模式中, 将忽略游戏开始!","color": "aqua"}]
  11. # 设置数据
  12. scoreboard players reset * total_score
  13. scoreboard players set @a[team=playing] total_score 0
  14. scoreboard players reset * total_score_disp
  15. scoreboard players set @a[team=playing] total_score_disp 0
  16. scoreboard players set $round mem 1
  17. scoreboard players add $ game_id 1
  18. scoreboard players operation @a game_id = $ game_id
  19. # 分配玩家id
  20. scoreboard players set @a[team=playing] player_id 0
  21. scoreboard players set $player_id mem 0
  22. execute if entity @a[team=playing,scores={player_id=0}] run function ltw:state/0/set_player_id
  23. # 重置物品
  24. clear @a[team=playing]
  25. execute as @a[team=playing] at @s run function item:shop/refresh_equip
  26. # 开始小游戏
  27. function lib:sounds/music/stop
  28. function ltw:state/3/state_enter