totem.mcfunction 1.3 KB

12345678910111213141516171819
  1. # 去除进度
  2. advancement revoke @s only item:special/consume_totem
  3. # 有生命计数
  4. execute if score @s mini_heart matches 1.. run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 使用了不死图腾, 抵挡了一次死亡!"]
  5. # 无生命计数:恢复所有生命
  6. execute unless score @s mini_heart matches 1.. run effect give @s instant_health 1 4 true
  7. execute unless score @s mini_heart matches 1.. run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 使用了不死图腾, 并恢复到了满血!"]
  8. ## 归还苹果
  9. #execute unless score @s mini_heart matches 1.. run tellraw @s ["",{"text": ">> ","color":"aqua","bold": true},{"text":"你只能在存在生命计数的小游戏中食用生命果!","color":"aqua"}]
  10. #execute unless score @s mini_heart matches 1.. run give @s minecraft:golden_apple{display:{Name:'{"text":"生命果","italic":false}',Lore:['{"text":"恢复 4 颗心或生命 +1","italic":false,"color":"gray"}']},bonus_new:0b,bonus_return:1b,is_bonus:1b,item_name:'{"text":"生命果","color":"green"}'}
  11. # $remove_resistance 信息在小游戏初始化时提供
  12. # 去除buff
  13. execute unless score @s mini_heart matches 1.. run tag @s add have_totem
  14. schedule function mini:main/lose_heart_effect 1t