tick20.mcfunction 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. xp set @a 0 points
  2. # 更新绿宝石数量
  3. execute as @a[team=playing] store result score @s emerald run clear @s emerald 0
  4. # 显示倒计时
  5. execute if score $countdown mem matches ..10 run title @a times 3 14 2
  6. execute if score $countdown mem matches ..10 run title @a subtitle {"score":{"name":"$countdown","objective":"mem"}}
  7. execute if score $countdown mem matches ..10 run title @a title [""]
  8. execute if score $countdown mem matches ..10 as @a at @s run function lib:sounds/hit2
  9. # 180s:教学
  10. execute if score $countdown mem matches 180 run tellraw @s[team=playing,scores={green_total=..10,emerald=0}] [{"text":"\n>> ","color":"light_purple","bold": true},{"text":"提示:手持最后一格的交易契约召唤村民,与村民交易,尽量获取绿宝石!","bold":false},"\n"]
  11. execute if score $countdown mem matches 180 run tellraw @s[team=playing,scores={green_total=..10,emerald=1..}] [{"text":"\n>> ","color":"light_purple","bold": true},{"text":"提示:地牢的箱子中有积分与不少资源,寻找地牢也是不错的选择!","bold":false},"\n"]
  12. # 120s:时间提示
  13. execute if score $countdown mem matches 120 run title @a subtitle {"text":"⚠ 还剩两分钟! ⚠","color":"yellow"}
  14. execute if score $countdown mem matches 120 run title @a times 1 50 3
  15. execute if score $countdown mem matches 120 run title @a title ""
  16. # 60s:时间提示
  17. execute if score $countdown mem matches 60 run title @a subtitle {"text":"⚠ 还剩一分钟! ⚠","color":"yellow"}
  18. execute if score $countdown mem matches 60 run title @a times 1 50 3
  19. execute if score $countdown mem matches 60 run title @a title ""
  20. execute if score $countdown mem matches 60 run scoreboard players set $bossbar_color mem 2
  21. execute if score $countdown mem matches 60 run function lib:bossbar/show
  22. # 30s:时间提示
  23. execute if score $countdown mem matches 30 run title @a subtitle {"text":"⚠ 最后三十秒! ⚠","color":"gold"}
  24. execute if score $countdown mem matches 30 run title @a times 1 50 3
  25. execute if score $countdown mem matches 30 run title @a title ""
  26. # 升级
  27. execute as @e[tag=TradePlayer] run function mini:trade/game/villager_try_level_up
  28. # 移除空交易
  29. execute as @e[tag=TradePlayer,x=999,y=0,z=4999,dx=500,dy=200,dz=500,nbt={Offers:{Recipes:[{uses:1}]}}] run function mini:trade/game/remove_trade
  30. # 0s:游戏结束
  31. execute if score $countdown mem matches 0 run function mini:main/game_end
  32. # 回复生命值
  33. execute if score $foursec mem matches 1 run effect give @a[team=playing] regeneration 1 10 true
  34. execute if score $foursec mem matches 1 run schedule function mini:trade/game/clear_effect 1t replace
  35. # 更新下界之星,转换为积分
  36. scoreboard players reset * temp2
  37. execute as @a[team=playing] store result score @s temp2 run clear @s nether_star
  38. execute as @a[scores={temp2=1..}] at @s run function mini:trade/game/get_score
  39. # 给予进度
  40. execute as @a[team=playing] if score @s emerald matches 8.. run advancement grant @s only ltw:vs/emerald1
  41. execute as @e[tag=TradePlayer,tag=!adv3_checked] unless entity @s[nbt={Offers:{Recipes:[{sell:{id:"minecraft:emerald"},uses:0}]}}] run tag @s add adv3_achieved
  42. execute as @a[team=playing] if score @s player_id = @e[tag=TradePlayer,tag=adv3_achieved,tag=!adv3_checked,limit=1] player_id run advancement grant @s only ltw:vs/emerald3
  43. tag @e[tag=TradePlayer,tag=adv3_achieved,tag=!adv3_checked] add adv3_checked