tick20.mcfunction 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # 更新绿宝石数量
  2. execute as @a[team=playing] store result score @s emerald run clear @s emerald 0
  3. # 刷新交易
  4. execute as @e[type=villager,tag=TradePlayer] run function mini:trade/game/villager_update_trade
  5. # 显示倒计时
  6. execute if score $countdown mem matches ..10 run title @a times 3 14 2
  7. execute if score $countdown mem matches ..10 run title @a subtitle {"score":{"name":"$countdown","objective":"mem"}}
  8. execute if score $countdown mem matches ..10 run title @a title [""]
  9. execute if score $countdown mem matches ..10 as @a at @s run function lib:sounds/hit2
  10. # 0s:游戏结束
  11. execute if score $countdown mem matches 0 run function mini:main/game_end
  12. # 回复生命值
  13. execute if score $foursec mem matches 1 run effect give @a[team=playing] regeneration 1 10 true
  14. execute if score $foursec mem matches 1 run schedule function mini:trade/game/clear_effect 1t replace
  15. # 更新下界之星,转换为得分
  16. scoreboard players reset * temp2
  17. execute as @a[team=playing] store result score @s temp2 run clear @s nether_star 0
  18. execute as @a[scores={temp2=1..}] run scoreboard players operation @s total_score += @s temp2
  19. execute as @a[scores={temp2=1..}] run scoreboard players operation @s total_score_disp += @s temp2
  20. execute as @a[scores={temp2=1..}] run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 从交易中获得了 ",{"score": {"name":"@s","objective": "temp2"},"color":"aqua"},{"text": " 分","color":"aqua"},", 当前共有 ",{"score": {"name": "@s","objective": "total_score"}}, " 分"]
  21. clear @a[team=playing] nether_star
  22. # 60s 提示
  23. execute if score $countdown mem matches 60 run tellraw @a ["",{"text": ">> ","color": "gold","bold": true},{"text":"游戏将在 ","color": "gold"}, "60 秒 ",{"text": "后结束","color": "gold"}]
  24. execute if score $countdown mem matches 60 run scoreboard players set $bossbar_color mem 2
  25. execute if score $countdown mem matches 60 run function lib:bossbar/show
  26. # 给予进度
  27. execute as @a[team=playing] if score @s emerald matches 40.. run advancement grant @s only ltw:vs/emerald1
  28. execute as @a[team=playing] if score @s emerald matches 70.. run advancement grant @s only ltw:vs/emerald2
  29. execute as @a[team=playing] if score @s emerald matches 100.. run advancement grant @s only ltw:vs/emerald3