Explorar o código

Merge branch 'master' of github.com:00ll00/LTW3

00ll00 %!s(int64=5) %!d(string=hai) anos
pai
achega
863fbb37dd

+ 2 - 2
data/mini/functions/colormatch/tick2.mcfunction

@@ -1,7 +1,7 @@
 
 # 检测玩家死亡
-execute as @a[tag=mini_running] at @s if block ~ ~-1 ~ magma_block run function mini:colormatch/player_lose_heart
-execute as @a[tag=mini_running] at @s if block ~ ~-2 ~ magma_block run function mini:colormatch/player_lose_heart
+execute as @a[tag=mini_running] at @s if block ~ ~-1 ~ magma_block if score $state mem matches 5 run function mini:colormatch/player_lose_heart
+execute as @a[tag=mini_running] at @s if block ~ ~-2 ~ magma_block if score $state mem matches 5 run function mini:colormatch/player_lose_heart
 
 # 检测玩家背包
 execute as @a[tag=mini_running] unless data entity @s Inventory[{Slot:8b,tag:{game_item:1b},Count:1b}] run function mini:colormatch/game/show_floor_block

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

@@ -0,0 +1,6 @@
+effect clear @a[tag=have_totem] regeneration
+effect clear @a[tag=have_totem] fire_resistance
+effect clear @a[tag=have_totem] absorption
+effect give @a[tag=have_totem] resistance 999999 4
+effect give @a[tag=have_totem] instant_health 1 10
+tag @a[tag=have_totem] remove have_totem

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

@@ -1,7 +1,15 @@
 # 玩家失去一条命时调用此函数
 
+# 检测不死图腾
+execute if score @s mini_heart matches 1 if entity @s[nbt={SelectedItem:{id:"minecraft:totem_of_undying"}}] run tag @s add have_totem
+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
+execute if entity @s[tag=have_totem] run effect give @s instant_damage 1 10 true
+schedule function mini:main/lose_heart_effect 1t
+
 # 减少命
-execute if score @s mini_heart matches 1.. run scoreboard players remove @s mini_heart 1
+execute if score @s[tag=!have_totem] mini_heart matches 1.. run scoreboard players remove @s mini_heart 1
 execute at @s run function lib:sounds/hurt
 # 计算血量
 function mini:main/player_max_health