start_game.mcfunction 1.5 KB

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