golden_apple.mcfunction 1.2 KB

123456789101112131415161718
  1. # 去除进度
  2. advancement revoke @s only item:special/consume_golden_apple
  3. # 计算生命值
  4. execute if score $state mem matches 5 if score @s mini_heart matches 1.. run scoreboard players add @s mini_heart 1
  5. execute if score $state mem matches 5 if score @s mini_heart matches 1.. run function mini:main/player_max_health
  6. execute if score $state mem matches 5 if score @s mini_heart matches 1.. run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 食用了生命果, 生命值 +1!"]
  7. # 归还苹果
  8. execute if score $state mem matches 5 unless score @s mini_heart matches 1.. run tellraw @s ["",{"text": ">> ","color":"aqua","bold": true},{"text":"你只能在存在生命计数的小游戏中食用生命果!","color":"aqua"}]
  9. execute if score $state mem matches 5 unless score @s mini_heart matches 1.. run give @s golden_apple
  10. # 检测小游戏是否去除特殊效果
  11. execute if score $state mem matches 5 if score $mini_type mem matches 5 run scoreboard players set $t_remove_resistance mem 1
  12. # 去除buff
  13. execute if score $state mem matches 5 run tag @s add consume_apple
  14. schedule function item:special/clear_effect 1t replace