Browse Source

增加金苹果使用效果

HerobrineXia 6 years ago
parent
commit
c199e66699

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

@@ -0,0 +1,15 @@
+{
+    "criteria": {
+        "hurt": {
+            "trigger": "minecraft:consume_item",
+            "conditions": {
+                "item": {
+                    "item": "minecraft:enchanted_golden_apple"
+                }
+            }
+        }
+    },
+    "rewards": {
+        "function": "item:special/enchanted_apple"
+    }
+}

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

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

+ 11 - 0
data/item/functions/special/enchanted_apple.mcfunction

@@ -0,0 +1,11 @@
+# 去除进度
+advancement revoke @s only item:special/consume_enchanted_apple
+
+# 计算生命值
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run scoreboard players operation @s mini_heart += @s mini_heart
+
+# 去除buff
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run effect clear @s absorption
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run effect clear @s fire_resistance
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run effect clear @s regeneration
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run effect give @s minecraft:resistance 999999 4 true

+ 9 - 0
data/item/functions/special/golden_apple.mcfunction

@@ -0,0 +1,9 @@
+# 去除进度
+advancement revoke @s only item:special/consume_golden_apple
+
+# 计算生命值
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run scoreboard players add @s mini_heart 1
+
+# 去除buff
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run effect clear @s absorption
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run effect clear @s regeneration

+ 6 - 0
data/mini/functions/main/player_max_health.mcfunction

@@ -1,5 +1,11 @@
 # 如小游戏有多条命,需在小游戏中设置给玩家mini_heart生命上限并调用此函数
+# 设置生命值上限
+execute if score @s mini_heart matches 13.. run tellraw @a ["",{"text": ">> ","color":"gold","bold": true},"小游戏生命值上限是12哦,请不要太贪心!"]
+execute if score @s mini_heart matches 13.. run scoreboard players set @s mini_heart 12
+
 # 根据玩家mini_heart数量决定生命值上限
+execute if score @s mini_heart matches 12 run attribute @s generic.max_health base set 24
+execute if score @s mini_heart matches 11 run attribute @s generic.max_health base set 22
 execute if score @s mini_heart matches 10 run attribute @s generic.max_health base set 20
 execute if score @s mini_heart matches 9 run attribute @s generic.max_health base set 18
 execute if score @s mini_heart matches 8 run attribute @s generic.max_health base set 16