state_enter.mcfunction 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # 要求系统进入状态 3(主要阶段结束,初始化小游戏)
  2. scoreboard players set $state mem 3
  3. execute as @a[team=!debugging] run function ltw:state/3/player_enter
  4. # HUD
  5. scoreboard objectives setdisplay belowName total_score_disp
  6. scoreboard objectives setdisplay sidebar total_score
  7. scoreboard objectives setdisplay list total_score_disp
  8. scoreboard players set $bossbar_type mem 0
  9. function lib:bossbar/show
  10. # 修改时间
  11. time set midnight
  12. # 初始化倒计时
  13. scoreboard players set $countdown mem 3
  14. # 禁用 tempo_block
  15. scoreboard players set $tempo_enable mem 0
  16. # 修改队伍颜色
  17. team modify playing color reset
  18. # 小游戏编号:生成一个 1~[最大游戏编号] 的 randomarray,每次从其中取下一个数。
  19. execute unless data storage ltw:mini types[0] run function ltw:state/3/newarray
  20. execute store result score $mini_type mem run data get storage ltw:mini types[0]
  21. execute if score $round mem matches ..4 run data remove storage ltw:mini types[0]
  22. # 前置/后置小游戏
  23. # 如果为第 1 轮,则有一半概率选用刺客,一半概率不变
  24. # 如果为第 5 轮,则有一半概率选用钻石,一半概率选用贸易
  25. scoreboard players set $random_max mem 1
  26. scoreboard players set $random_min mem 0
  27. function lib:random
  28. execute if score $round mem matches 1 if score $random mem matches 0 run scoreboard players set $mini_type mem 201
  29. execute if score $round mem matches 5 if score $random mem matches 0 run scoreboard players set $mini_type mem 101
  30. execute if score $round mem matches 5 if score $random mem matches 1 run scoreboard players set $mini_type mem 102
  31. # 初始化小游戏
  32. scoreboard players add $ round_id 1
  33. function mini:main/game_init