Explorar o código

简化土豆转移代码

LTCatt %!s(int64=6) %!d(string=hai) anos
pai
achega
d40808b363

+ 0 - 0
data/mini/advancements/pm_damage_dealt.json → data/mini/advancements/hotpm/damage_dealt.json


+ 0 - 0
data/mini/advancements/pm_damage_taken.json → data/mini/advancements/hotpm/damage_taken.json


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

@@ -1,11 +1,5 @@
-# 造成伤害加tag
-execute if score $state mem matches 5 if score $mini_type mem matches 3 run tag @s add pm_damage_dealt
+# 造成伤害时由玩家触发
+advancement revoke @s only mini:hotpm/damage_dealt
 
-# 播放攻击音效
-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:pm_damage_dealt
-
-# 检测是否在土豆游戏中
-execute if score $state mem matches 5 if score $mini_type mem matches 3 run function mini:hotpm/damage_event
+# 如果是土豆持有者在热土豆游戏中打到人,才执行下一步
+execute as @s[tag=pm_hoding] at @s if score $state mem matches 5 if score $mini_type mem matches 3 run function mini:hotpm/damage_dealt2

+ 9 - 2
data/mini/functions/hotpm/potato_transfer.mcfunction → data/mini/functions/hotpm/damage_dealt2.mcfunction

@@ -1,4 +1,11 @@
-# 传土豆+提示
+# 土豆持有者打到人时执行
+
+tag @s add pm_damage_dealt
+playsound minecraft:entity.arrow.hit_player ambient @s ~ ~ ~ 1 1 1
+
+# 转移土豆
 function mini:hotpm/pm_lost
 execute as @a[tag=pm_damage_taken] run function mini:hotpm/pm_get
-tellraw @a [{"text":">> ","color":"gold","bold":true},{"selector":"@s","color":"yellow","bold":false},{"text":" 将土豆拍在了 ","color":"white","bold":false},{"selector":"@a[tag=pm_damage_taken]","color":"yellow","bold":false},{"text":" 的脸上!","color":"white","bold":false}]
+tellraw @a [{"text":">> ","color":"gold","bold":true},{"selector":"@s","color":"yellow","bold":false},{"text":" 将土豆拍在了 ","color":"white","bold":false},{"selector":"@a[tag=pm_damage_taken]","color":"yellow","bold":false},{"text":" 的脸上!","color":"white","bold":false}]
+tag @a remove pm_damage_dealt
+tag @a remove pm_damage_taken

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

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

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

@@ -1,5 +1,5 @@
-# 收到伤害加tag
-execute if score $state mem matches 5 if score $mini_type mem matches 3 run tag @s add pm_damage_taken
+# 受到伤害时由玩家触发
+advancement revoke @s only mini:hotpm/damage_taken
 
-# 移除造成伤害advancement
-advancement revoke @s only mini:pm_damage_taken
+# 添加受伤 Tag
+execute if score $state mem matches 5 if score $mini_type mem matches 3 run tag @s add pm_damage_taken

+ 2 - 2
data/mini/functions/hotpm/spectator_range.mcfunction

@@ -1,3 +1,3 @@
 # 观察者限制飞行范围
-execute as @a[gamemode=spectator,x=1022,y=27,z=3022,distance=22..] run spectate
-tp @a[gamemode=spectator,x=1022,y=27,z=3022,distance=22..] 1022 29 3038 180 0
+execute as @a[gamemode=spectator,x=1022,y=27,z=3022,distance=21..] run spectate
+tp @a[gamemode=spectator,x=1022,y=27,z=3022,distance=21..] 1022 29 3038 180 0