Explorar el Código

传土豆测试1

HerobrineXia hace 6 años
padre
commit
47e72a105b

+ 1 - 1
data/lib/functions/damage_indicator/damage_dealt.mcfunction

@@ -2,7 +2,7 @@
 tag @s add damage_dealt
 
 # 播放攻击音效
-playsound minecraft:entity.arrow.hit_player ambient @s ~ ~ ~ 1 1 1
+# playsound minecraft:entity.arrow.hit_player ambient @s ~ ~ ~ 1 1 1
 
 # 移除造成伤害advancement
 advancement revoke @s only lib:damage_dealt

+ 6 - 4
data/mini/functions/hotpm/damage_dealt.mcfunction

@@ -1,9 +1,11 @@
 # 造成伤害加tag
-tag @s add pm_damage_dealt
+execute if score $state mem matches 5 if score mini_type mem matches 3 run tag @s add pm_damage_dealt
 
 # 播放攻击音效
-playsound minecraft:entity.arrow.hit_player ambient @s ~ ~ ~ 1 1 1
-say 我打人了
+execute if score $state mem matches 5 if score mini_type mem matches 3 run playsound minecraft:entity.arrow.hit_player ambient @s ~ ~ ~ 1 1 1
 
 # 移除造成伤害advancement
-advancement revoke @s only mini:hotpm/pm_damage_dealt
+advancement revoke @s only mini:pm_damage_dealt
+
+# 检测土豆
+execute if score $state mem matches 5 if score mini_type mem matches 3 run function mini:hotpm/damage_event

+ 6 - 0
data/mini/functions/hotpm/damage_event.mcfunction

@@ -0,0 +1,6 @@
+# 检测造成伤害者是否有土豆,有就转移
+execute if entity @s[tag=hpm_holding] run function mini:hotpm/potato_transfer
+
+# 清理tag
+tag @a remove pm_damage_dealt
+tag @a remove pm_damage_taken

+ 2 - 4
data/mini/functions/hotpm/damage_taken.mcfunction

@@ -1,7 +1,5 @@
 # 收到伤害加tag
-tag @s add pm_damage_taken
-
-say 我被打了!
+execute if score $state mem matches 5 if score mini_type mem matches 3 run tag @s add pm_damage_taken
 
 # 移除造成伤害advancement
-advancement revoke @s only mini:hotpm/pm_damage_taken
+advancement revoke @s only mini:pm_damage_taken

+ 3 - 0
data/mini/functions/hotpm/potato_transfer.mcfunction

@@ -0,0 +1,3 @@
+tag @s remove hpm_holding
+tag @a[tag=pm_damage_taken] add hpm_holding
+tellraw @a [{"text":">>","color":"red"},{"selector":"@s"},{"text":"将土豆拍在了","color":"gold"},{"selector":"pm_damage_taken"},{"text":"的脸上!","color":"gold"}]