Răsfoiți Sursa

增加不死图腾兼容性

HerobrineXia 5 ani în urmă
părinte
comite
23bed6b3b4

+ 15 - 0
data/item/advancements/special/consume_totem.json

@@ -0,0 +1,15 @@
+{
+    "criteria": {
+        "consume_ga": {
+            "trigger": "minecraft:consume_item",
+            "conditions": {
+                "item": {
+                    "item": "minecraft:totem_of_undying"
+                }
+            }
+        }
+    },
+    "rewards": {
+        "function": "item:special/totem"
+    }
+}

+ 19 - 0
data/item/functions/special/totem.mcfunction

@@ -0,0 +1,19 @@
+# 去除进度
+advancement revoke @s only item:special/consume_totem
+
+# 有生命计数
+execute if score @s mini_heart matches 1.. run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 使用了不死图腾, 抵挡了一次死亡!"]
+
+
+# 无生命计数:恢复所有生命
+execute unless score @s mini_heart matches 1.. run effect give @s instant_health 1 4 true
+execute unless score @s mini_heart matches 1.. run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 使用了不死图腾, 并恢复到了满血!"]
+
+## 归还苹果
+#execute unless score @s mini_heart matches 1.. run tellraw @s ["",{"text": ">> ","color":"aqua","bold": true},{"text":"你只能在存在生命计数的小游戏中食用生命果!","color":"aqua"}]
+#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"}'}
+
+# $remove_resistance 信息在小游戏初始化时提供
+# 去除buff
+execute unless score @s mini_heart matches 1.. run tag @s add have_totem
+schedule function mini:main/lose_heart_effect 1t

+ 4 - 0
data/mini/functions/ass/give_effect.mcfunction

@@ -0,0 +1,4 @@
+# 状态效果
+effect clear @s
+effect give @s saturation 1000000 0 true
+effect give @s night_vision 1000000 0 true

+ 2 - 1
data/mini/functions/main/give_effect.mcfunction

@@ -4,4 +4,5 @@ execute if score $mini_type mem matches 3 run function mini:hotpm/give_effect
 execute if score $mini_type mem matches 4 run function mini:colormatch/give_effect
 execute if score $mini_type mem matches 5 run function mini:phantom/give_effect
 execute if score $mini_type mem matches 101 run function mini:diamond/give_effect
-execute if score $mini_type mem matches 102 run function mini:trade/give_effect
+execute if score $mini_type mem matches 102 run function mini:trade/give_effect
+execute if score $mini_type mem matches 201 run function mini:ass/give_effect

+ 2 - 1
data/mini/functions/main/player_lose_heart.mcfunction

@@ -5,7 +5,8 @@ execute if score @s mini_heart matches 1 if entity @s[nbt={SelectedItem:{id:"min
 execute if score @s mini_heart matches 1 if entity @s[nbt={Inventory:[{Slot:-106b,id:"minecraft:totem_of_undying"}]}] run tag @s add have_totem
 execute if entity @s[tag=have_totem] run effect clear @s resistance
 execute if entity @s[tag=have_totem] run effect give @s instant_damage 1 10 true
-schedule function mini:main/lose_heart_effect 1t
+# schedule function mini:main/lose_heart_effect 1t 
+# 现在触发图腾会默认清除效果了
 
 # 减少命
 execute if score @s[tag=!have_totem] mini_heart matches 1.. run scoreboard players remove @s mini_heart 1