state_enter.mcfunction 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. # 清理奖励物资
  19. kill @e[tag=bonus_item]
  20. # 小游戏编号:生成一个 1~[最大游戏编号] 的 randomarray,每次从其中取下一个数。
  21. execute unless data storage ltw:mini types[0] run function ltw:state/3/newarray
  22. execute store result score $mini_type mem run data get storage ltw:mini types[0]
  23. execute if score $round mem matches ..4 run data remove storage ltw:mini types[0]
  24. # 前置/后置小游戏
  25. # 如果为第 1 轮,则有一半概率选用刺客,一半概率不变
  26. # 如果为第 5 轮,则有一半概率选用钢铁,一半概率选用贸易
  27. scoreboard players set $random_max mem 1
  28. scoreboard players set $random_min mem 0
  29. function lib:random
  30. execute if score $round mem matches 1 if score $random mem matches 0 run scoreboard players set $mini_type mem 201
  31. execute if score $round mem matches 5 if score $random mem matches 0 run scoreboard players set $mini_type mem 101
  32. execute if score $round mem matches 5 if score $random mem matches 1 run scoreboard players set $mini_type mem 102
  33. # 初始化小游戏
  34. scoreboard players add $ round_id 1
  35. function mini:main/game_init