Просмотр исходного кода

添加不是钻石风暴……代码完全复制的钻石

LTCatt 5 лет назад
Родитель
Сommit
8e157da55c
31 измененных файлов с 343 добавлено и 5 удалено
  1. 1 0
      data/mini/functions/main/game_end.mcfunction
  2. 1 0
      data/mini/functions/main/game_init.mcfunction
  3. 2 1
      data/mini/functions/main/game_start.mcfunction
  4. 1 0
      data/mini/functions/main/init.mcfunction
  5. 1 0
      data/mini/functions/main/player_death.mcfunction
  6. 2 1
      data/mini/functions/main/player_enter.mcfunction
  7. 2 1
      data/mini/functions/main/player_intro.mcfunction
  8. 2 1
      data/mini/functions/main/tick2.mcfunction
  9. 1 0
      data/mini/functions/main/tick20.mcfunction
  10. 1 0
      data/mini/functions/main/tick5.mcfunction
  11. 2 1
      data/mini/functions/main/watcher_limit.mcfunction
  12. 1 0
      data/mini/functions/trade/game/clear_effect.mcfunction
  13. 3 0
      data/mini/functions/trade/game/give_emerald.mcfunction
  14. 84 0
      data/mini/functions/trade/game/pop_slot.mcfunction
  15. 4 0
      data/mini/functions/trade/game/random_slot.mcfunction
  16. 14 0
      data/mini/functions/trade/game/respawn1.mcfunction
  17. 17 0
      data/mini/functions/trade/game_end.mcfunction
  18. 33 0
      data/mini/functions/trade/game_init.mcfunction
  19. 4 0
      data/mini/functions/trade/game_init2.mcfunction
  20. 21 0
      data/mini/functions/trade/game_init3.mcfunction
  21. 18 0
      data/mini/functions/trade/game_start.mcfunction
  22. 10 0
      data/mini/functions/trade/init.mcfunction
  23. 29 0
      data/mini/functions/trade/player_death.mcfunction
  24. 23 0
      data/mini/functions/trade/player_enter.mcfunction
  25. 2 0
      data/mini/functions/trade/player_finished.mcfunction
  26. 9 0
      data/mini/functions/trade/player_intro.mcfunction
  27. 3 0
      data/mini/functions/trade/tick2.mcfunction
  28. 26 0
      data/mini/functions/trade/tick20.mcfunction
  29. 14 0
      data/mini/functions/trade/tick5.mcfunction
  30. 3 0
      data/mini/functions/trade/watcher_limit.mcfunction
  31. 9 0
      data/test/functions/mini/trade.mcfunction

+ 1 - 0
data/mini/functions/main/game_end.mcfunction

@@ -6,6 +6,7 @@ execute if score $mini_type mem matches 4 run function mini:colormatch/game_end
 execute if score $mini_type mem matches 5 run function mini:phantom/game_end
 execute if score $mini_type mem matches 6 run function mini:diamond/game_end
 execute if score $mini_type mem matches 7 run function mini:koth/game_end
+execute if score $mini_type mem matches 8 run function mini:trade/game_end
 
 # 计算排名
 tag @a remove mini_rank1

+ 1 - 0
data/mini/functions/main/game_init.mcfunction

@@ -11,4 +11,5 @@ execute if score $mini_type mem matches 4 run function mini:colormatch/game_init
 execute if score $mini_type mem matches 5 run function mini:phantom/game_init
 execute if score $mini_type mem matches 6 run function mini:diamond/game_init
 execute if score $mini_type mem matches 7 run function mini:koth/game_init
+execute if score $mini_type mem matches 8 run function mini:trade/game_init
 

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

@@ -4,4 +4,5 @@ execute if score $mini_type mem matches 3 run function mini:hotpm/game_start
 execute if score $mini_type mem matches 4 run function mini:colormatch/game_start
 execute if score $mini_type mem matches 5 run function mini:phantom/game_start
 execute if score $mini_type mem matches 6 run function mini:diamond/game_start
-execute if score $mini_type mem matches 7 run function mini:koth/game_start
+execute if score $mini_type mem matches 7 run function mini:koth/game_start
+execute if score $mini_type mem matches 8 run function mini:trade/game_start

+ 1 - 0
data/mini/functions/main/init.mcfunction

@@ -4,6 +4,7 @@ function mini:parkour/init
 function mini:phantom/init
 function mini:diamond/init
 function mini:koth/init
+function mini:trade/init
 
 # 计分板初始化
 scoreboard objectives remove mini_score

+ 1 - 0
data/mini/functions/main/player_death.mcfunction

@@ -1,3 +1,4 @@
 # 玩家死亡后触发
 execute if score $mini_type mem matches 5 run function mini:phantom/player_failed
 execute if score $mini_type mem matches 6 run function mini:diamond/player_death
+execute if score $mini_type mem matches 8 run function mini:trade/player_death

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

@@ -17,4 +17,5 @@ execute if score $mini_type mem matches 3 run function mini:hotpm/player_enter
 execute if score $mini_type mem matches 4 run function mini:colormatch/player_enter
 execute if score $mini_type mem matches 5 run function mini:phantom/player_enter
 execute if score $mini_type mem matches 6 run function mini:diamond/player_enter
-execute if score $mini_type mem matches 7 run function mini:koth/player_enter
+execute if score $mini_type mem matches 7 run function mini:koth/player_enter
+execute if score $mini_type mem matches 8 run function mini:trade/player_enter

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

@@ -5,4 +5,5 @@ execute if score $mini_type mem matches 3 run function mini:hotpm/player_intro
 execute if score $mini_type mem matches 4 run function mini:colormatch/player_intro
 execute if score $mini_type mem matches 5 run function mini:phantom/player_intro
 execute if score $mini_type mem matches 6 run function mini:diamond/player_intro
-execute if score $mini_type mem matches 7 run function mini:koth/player_intro
+execute if score $mini_type mem matches 7 run function mini:koth/player_intro
+execute if score $mini_type mem matches 8 run function mini:trade/player_intro

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

@@ -4,4 +4,5 @@ execute if score $mini_type mem matches 2 run function mini:tntrun/tick2
 execute if score $mini_type mem matches 3 run function mini:hotpm/tick2
 execute if score $mini_type mem matches 4 run function mini:colormatch/tick2
 execute if score $mini_type mem matches 5 run function mini:phantom/tick2
-execute if score $mini_type mem matches 6 run function mini:diamond/tick2
+execute if score $mini_type mem matches 6 run function mini:diamond/tick2
+execute if score $mini_type mem matches 8 run function mini:trade/tick2

+ 1 - 0
data/mini/functions/main/tick20.mcfunction

@@ -3,6 +3,7 @@
 execute if score $mini_type mem matches 1 run function mini:parkour/tick20
 execute if score $mini_type mem matches 5 run function mini:phantom/tick20
 execute if score $mini_type mem matches 6 run function mini:diamond/tick20
+execute if score $mini_type mem matches 8 run function mini:trade/tick20
 
 # 结束游戏判定
 function mini:main/check_game_end

+ 1 - 0
data/mini/functions/main/tick5.mcfunction

@@ -5,6 +5,7 @@ execute if score $mini_type mem matches 2 run function mini:tntrun/tick5
 execute if score $mini_type mem matches 3 run function mini:hotpm/tick5
 execute if score $mini_type mem matches 5 run function mini:phantom/tick5
 execute if score $mini_type mem matches 6 run function mini:diamond/tick5
+execute if score $mini_type mem matches 8 run function mini:trade/tick5
 
 # 同步生命值
 scoreboard players reset * temp

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

@@ -4,4 +4,5 @@ execute if score $mini_type mem matches 2 run function mini:tntrun/watcher_limit
 execute if score $mini_type mem matches 3 run function mini:hotpm/watcher_limit
 execute if score $mini_type mem matches 4 run function mini:colormatch/watcher_limit
 execute if score $mini_type mem matches 5 run function mini:phantom/watcher_limit
-execute if score $mini_type mem matches 6 run function mini:diamond/watcher_limit
+execute if score $mini_type mem matches 6 run function mini:diamond/watcher_limit
+execute if score $mini_type mem matches 8 run function mini:trade/watcher_limit

+ 1 - 0
data/mini/functions/trade/game/clear_effect.mcfunction

@@ -0,0 +1 @@
+effect clear @a regeneration

+ 3 - 0
data/mini/functions/trade/game/give_emerald.mcfunction

@@ -0,0 +1,3 @@
+give @s emerald
+scoreboard players remove #emerald_count temp 1
+execute if score #emerald_count temp matches 1.. run function mini:trade/game/give_emerald

+ 84 - 0
data/mini/functions/trade/game/pop_slot.mcfunction

@@ -0,0 +1,84 @@
+execute if block 1000 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 0
+execute if block 1000 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1000 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 1
+execute if block 1000 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1000 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 2
+execute if block 1000 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1000 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 3
+execute if block 1000 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1001 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 4
+execute if block 1001 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1001 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 5
+execute if block 1001 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1001 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 6
+execute if block 1001 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1001 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 7
+execute if block 1001 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1002 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 8
+execute if block 1002 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1002 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 9
+execute if block 1002 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1002 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 10
+execute if block 1002 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1002 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 11
+execute if block 1002 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1003 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 12
+execute if block 1003 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1003 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 13
+execute if block 1003 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1003 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 14
+execute if block 1003 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1003 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 15
+execute if block 1003 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1004 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 16
+execute if block 1004 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1004 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 17
+execute if block 1004 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1004 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 18
+execute if block 1004 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1004 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 19
+execute if block 1004 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1005 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 20
+execute if block 1005 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1005 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 21
+execute if block 1005 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1005 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 22
+execute if block 1005 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1005 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 23
+execute if block 1005 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1006 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 24
+execute if block 1006 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1006 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 25
+execute if block 1006 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1006 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 26
+execute if block 1006 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1006 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 27
+execute if block 1006 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1007 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 28
+execute if block 1007 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1007 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 29
+execute if block 1007 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1007 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 30
+execute if block 1007 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1007 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 31
+execute if block 1007 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1008 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 32
+execute if block 1008 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1008 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 33
+execute if block 1008 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1008 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 34
+execute if block 1008 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1008 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 35
+execute if block 1008 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1009 0 5001 minecraft:bedrock run scoreboard players set @s item_slot 100
+execute if block 1009 0 5001 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1009 0 5002 minecraft:bedrock run scoreboard players set @s item_slot 101
+execute if block 1009 0 5002 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1009 0 5003 minecraft:bedrock run scoreboard players set @s item_slot 102
+execute if block 1009 0 5003 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute if block 1009 0 5004 minecraft:bedrock run scoreboard players set @s item_slot 103
+execute if block 1009 0 5004 minecraft:bedrock at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item
+execute store result score #fill_count temp run fill 1000 0 5001 1009 0 5004 air
+scoreboard players operation #fill_count temp %= #const_2 temp
+execute if score #fill_count temp matches 1 run scoreboard players set @s item_slot -106
+execute if score #fill_count temp matches 1 at @e[type=armor_stand,tag=dead_marker,limit=1] run function item:pop_slot/pop_item

+ 4 - 0
data/mini/functions/trade/game/random_slot.mcfunction

@@ -0,0 +1,4 @@
+setblock 1000 0 5000 minecraft:structure_block{posX:0,posY:0,posZ:1,mode:"LOAD",name:"item:inventory",integrity:0.5f}
+fill 1000 0 5001 1009 0 5004 air
+setblock 1000 1 5000 air
+setblock 1000 1 5000 redstone_block

+ 14 - 0
data/mini/functions/trade/game/respawn1.mcfunction

@@ -0,0 +1,14 @@
+
+# 状态效果
+effect clear @s
+effect give @s saturation 1000000 0 true
+effect give @s night_vision 1000000 0 true
+effect give @s haste 1000000 1 true
+effect give @s slow_falling 4
+effect give @s weakness 5 10 true
+effect give @s resistance 5 10 true
+gamerule naturalRegeneration false
+
+# 传送玩家
+tp @s[team=playing] 1016 280 5016
+tp @s[team=watching] 1016 255 5016

+ 17 - 0
data/mini/functions/trade/game_end.mcfunction

@@ -0,0 +1,17 @@
+# 游戏结束
+forceload remove 1000 5000 1064 5064
+
+# Gamerule 调整
+gamerule doDaylightCycle false
+gamerule doLimitedCrafting true
+gamerule keepInventory true
+gamerule doTileDrops false
+gamerule doEntityDrops false
+gamerule fireDamage false
+gamerule drowningDamage false
+
+# 计算得分
+execute as @a[team=playing] run scoreboard players operation @s mini_score += @s emerald
+
+# 清理物品栏
+clear @a[team=playing]

+ 33 - 0
data/mini/functions/trade/game_init.mcfunction

@@ -0,0 +1,33 @@
+# 初始化钻石地图
+forceload add 1000 5000 1064 5064
+
+scoreboard players reset * emerald
+scoreboard players set $finish_mode mem 0
+scoreboard players set $survival mem 1
+
+# 调整时间
+time set 8600t
+
+# 生成地图
+setblock 1000 255 5000 minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:1b,powered:0b,seed:0L,author:"LTCat",rotation:"NONE",posX:0,mode:"LOAD",posY:-24,sizeX:32,posZ:0,integrity:1.0f,showair:0b,name:"mini:emerald_base",sizeY:25,sizeZ:32,showboundingbox:1b}
+setblock 1000 255 5001 redstone_block
+schedule function mini:trade/game_init2 1t append
+
+# 清理残余实体
+tp @e[type=!player,x=950,y=-200,z=4950,dx=100,dy=600,dz=100] ~ -100 ~
+kill @e[type=!player,x=950,y=-200,z=4950,dx=100,dy=600,dz=100]
+
+# 伤害管理
+scoreboard players set $remove_resistance mem 1
+team modify playing friendlyFire true
+team modify playing collisionRule always
+team modify playing deathMessageVisibility always
+gamerule fallDamage false
+gamerule fireDamage true
+gamerule drowningDamage true
+
+# Gamerule 调整
+gamerule doLimitedCrafting false
+gamerule keepInventory true
+gamerule doTileDrops true
+gamerule doEntityDrops true

+ 4 - 0
data/mini/functions/trade/game_init2.mcfunction

@@ -0,0 +1,4 @@
+
+# 矿物生成
+setblock 1028 252 5030 minecraft:redstone_block
+schedule function mini:trade/game_init3 7t

+ 21 - 0
data/mini/functions/trade/game_init3.mcfunction

@@ -0,0 +1,21 @@
+
+# 地牢 1 生成
+scoreboard players set $random_max mem 4
+scoreboard players set $random_min mem 1
+function lib:random
+execute if score $random mem matches 1 run setblock 1028 254 5030 redstone_block
+execute if score $random mem matches 2 run setblock 1028 254 5029 redstone_block
+execute if score $random mem matches 3 run setblock 1028 254 5028 redstone_block
+execute if score $random mem matches 4 run setblock 1028 254 5027 redstone_block
+
+# 地牢 2 生成
+scoreboard players set $random_max mem 4
+scoreboard players set $random_min mem 1
+function lib:random
+execute if score $random mem matches 1 run setblock 1027 254 5030 redstone_block
+execute if score $random mem matches 2 run setblock 1027 254 5029 redstone_block
+execute if score $random mem matches 3 run setblock 1027 254 5028 redstone_block
+execute if score $random mem matches 4 run setblock 1027 254 5027 redstone_block
+
+# 清理区域
+fill 1025 255 5031 1029 251 5025 air

+ 18 - 0
data/mini/functions/trade/game_start.mcfunction

@@ -0,0 +1,18 @@
+gamerule doDaylightCycle true
+scoreboard players set $countdown mem 270
+
+# HUD
+scoreboard objectives setdisplay list health_disp
+scoreboard objectives setdisplay belowName health_disp
+scoreboard objectives setdisplay sidebar emerald
+scoreboard players set $bossbar_color mem 4
+scoreboard players set $countdown_max mem 270
+scoreboard players set $bossbar_type mem 2
+function lib:bossbar/show
+bossbar set mini:red name "剩余时间"
+bossbar set mini:yellow name "剩余时间"
+bossbar set mini:blue name "剩余时间"
+
+# 世界边界
+worldborder center 1016.0 5016.0
+worldborder set 29.999

+ 10 - 0
data/mini/functions/trade/init.mcfunction

@@ -0,0 +1,10 @@
+# 重置计分板
+scoreboard objectives remove emerald
+scoreboard objectives add emerald dummy "绿宝石数"
+
+scoreboard objectives remove posX
+scoreboard objectives add posX dummy "坐标X"
+scoreboard objectives remove posY
+scoreboard objectives add posY dummy "坐标Y"
+scoreboard objectives remove posZ
+scoreboard objectives add posZ dummy "坐标Z"

+ 29 - 0
data/mini/functions/trade/player_death.mcfunction

@@ -0,0 +1,29 @@
+# 执行重生方法
+function mini:trade/game/respawn1
+
+# 复活特效
+execute as @a at @s run function lib:sounds/error
+effect give @s blindness 3 0 true
+
+# 处理玩家掉落物品
+# 获取玩家死亡位置
+kill @e[type=armor_stand,tag=dead_marker]
+summon armor_stand 1000 0 5000 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["dead_marker"]}
+execute store result entity @e[type=armor_stand,tag=dead_marker,limit=1] Pos[0] double 1 run scoreboard players get @s posX
+execute store result entity @e[type=armor_stand,tag=dead_marker,limit=1] Pos[1] double 1 run scoreboard players get @s posY
+execute store result entity @e[type=armor_stand,tag=dead_marker,limit=1] Pos[2] double 1 run scoreboard players get @s posZ
+# 单独处理绿宝石
+execute store result score #emerald_count temp run clear @s emerald
+scoreboard players add #emerald_count temp 1
+execute at @e[type=armor_stand,tag=dead_marker,limit=1] run summon item ~ ~ ~ {Tags:["temp_emerald"],Item:{id:"minecraft:emerald",Count:1b},Glowing:1b}
+execute as @e[type=item,tag=temp_emerald,limit=1] store result entity @s Item.Count byte 0.5 run scoreboard players get #emerald_count temp
+tag @e[type=item,tag=temp_emerald,limit=1] remove temp_emerald
+# 随机槽位掉落
+function mini:trade/game/random_slot
+function mini:trade/game/pop_slot
+# 返还绿宝石
+scoreboard players remove #emerald_count temp 1
+scoreboard players operation #emerald_count temp /= #const_2 mem
+execute if score #emerald_count temp matches 1.. run function mini:trade/game/give_emerald
+# 删除marker
+kill @e[type=armor_stand,tag=dead_marker]

+ 23 - 0
data/mini/functions/trade/player_enter.mcfunction

@@ -0,0 +1,23 @@
+# 单个玩家开始小游戏时执行
+function lib:sounds/music/mini_slow
+title @s clear
+title @s actionbar ""
+
+# 解锁配方
+recipe give @s *
+
+# 设置玩家生命
+attribute @s generic.max_health base set 20
+
+# 计分板重置
+tag @s remove emerald_got
+scoreboard players reset @s emerald
+scoreboard players set @s[team=playing,tag=!rejoining] emerald 0
+
+# 调整模式
+gamemode spectator @s[team=!debugging]
+gamemode survival @s[team=playing,tag=!rejoining]
+
+# 执行重生方法
+tag @s remove respawning
+function mini:trade/game/respawn1

+ 2 - 0
data/mini/functions/trade/player_finished.mcfunction

@@ -0,0 +1,2 @@
+# 玩家成功时由玩家自己触发
+function mini:main/player_finished

+ 9 - 0
data/mini/functions/trade/player_intro.mcfunction

@@ -0,0 +1,9 @@
+# 向单个玩家展示小游戏介绍
+tp @s[team=!debugging] 1013.47 247.63 5045.62 -178.86 17.18
+worldborder set 1000000
+effect give @s[team=!debugging] night_vision 1000000 0 true
+tellraw @s ["",{"text":"\n >> 不是钻石风暴 >>\n\n","color":"gold","bold":true}," 制作铁镐, 挖取钻石, 然后保住自己的小命!\n 不过, 或许也可以去地牢碰碰运气……\n"]
+tellraw @s ["",{"text": " <积分制> ","color":"red","bold": true}, {"text":"太阳落山时游戏即会结束, 然后根据持有的钻石数排名。","color":"gray"}]
+tellraw @s ["",{"text": " <PVP> ","color":"light_purple","bold": true}, {"text":"死亡会掉落一半物品, 被击杀后能立即复活。","color":"gray"}]
+tellraw @s ["",{"text": " <原型> ","color":"gold","bold": true}, {"text":"此游戏目前仅用于玩法测试, 尚未进行修缮。","color":"gray"}]
+tellraw @s ""

+ 3 - 0
data/mini/functions/trade/tick2.mcfunction

@@ -0,0 +1,3 @@
+execute as @a[team=playing] store result score @s posX run data get entity @s Pos[0]
+execute as @a[team=playing] store result score @s posY run data get entity @s Pos[1]
+execute as @a[team=playing] store result score @s posZ run data get entity @s Pos[2]

+ 26 - 0
data/mini/functions/trade/tick20.mcfunction

@@ -0,0 +1,26 @@
+
+# 显示倒计时
+execute if score $countdown mem matches ..10 run title @a times 3 14 2
+execute if score $countdown mem matches ..10 run title @a subtitle {"score":{"name":"$countdown","objective":"mem"}}
+execute if score $countdown mem matches ..10 run title @a title [""]
+execute if score $countdown mem matches ..10 as @a at @s run function lib:sounds/hit2
+
+# 170s:关闭循环播放
+execute if score $countdown mem matches 170 run scoreboard players set @a music_time 999
+
+# 90s / 60s:雷达提示
+execute if score $countdown mem matches 90 run tellraw @a ["",{"text": ">> ","color": "gold","bold": true},{"text":"玩家雷达将在 ","color": "gold"}, "30 秒 ",{"text": "后开启","color": "gold"}]
+execute if score $countdown mem matches 90 run scoreboard players set $bossbar_color mem 2
+execute if score $countdown mem matches 90 run function lib:bossbar/show
+execute if score $countdown mem matches 61 as @a run function lib:sounds/music/mini_fast
+execute if score $countdown mem matches 60 run tellraw @a ["",{"text": ">> ","color": "gold","bold": true},{"text": "玩家雷达已开启, 游戏将在 ","color": "gold"},"60 秒 ", {"text": "后结束","color": "gold"}]
+execute if score $countdown mem matches 60 run scoreboard players set $bossbar_color mem 1
+execute if score $countdown mem matches 60 run scoreboard objectives setdisplay belowName emerald
+execute if score $countdown mem matches 60 run function lib:bossbar/show
+
+# 0s:游戏结束
+execute if score $countdown mem matches 0 run function mini:main/game_end
+
+# 回复生命值
+execute if score $foursec mem matches 1 run effect give @a[team=playing] regeneration 1 10 true
+execute if score $foursec mem matches 1 run schedule function mini:trade/game/clear_effect 1t replace

+ 14 - 0
data/mini/functions/trade/tick5.mcfunction

@@ -0,0 +1,14 @@
+
+# 更新钻石数量
+execute as @a[team=playing] store result score @s emerald run clear @s emerald 0
+execute if score $countdown mem matches ..60 run effect give @a[team=playing] glowing 1000000 0 true
+# effect give @a[scores={emerald=1..}] glowing 5 0 true
+
+# 显示提示
+execute as @a[scores={emerald=1..},tag=!emerald_got,x=1000,y=0,z=5000,dx=32,dy=253,dz=32] run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s"},{"text":" 获得了闪闪发光的绿宝石","color":"aqua"}]
+execute as @a[scores={emerald=1..},tag=!emerald_got,x=1000,y=0,z=5000,dx=32,dy=253,dz=32] as @a run function lib:sounds/hit
+tag @a remove emerald_got
+tag @a[scores={emerald=1..}] add emerald_got
+
+# 钻石发光
+execute as @e[type=minecraft:item,nbt={Item:{id:"minecraft:emerald"}}] run data modify entity @s Glowing set value 1b

+ 3 - 0
data/mini/functions/trade/watcher_limit.mcfunction

@@ -0,0 +1,3 @@
+# 观察者限制飞行范围
+execute as @a[gamemode=spectator,x=1016,y=240,z=5016,distance=70..] run spectate
+tp @a[gamemode=spectator,x=1016,y=240,z=5016,distance=70..,team=!debugging] 1016 255 5016

+ 9 - 0
data/test/functions/mini/trade.mcfunction

@@ -0,0 +1,9 @@
+# 测试用:快速开始不是钻石风暴
+team join playing @a[team=watching]
+clear @a[team=!debugging]
+function ltw:state/0/start_game
+scoreboard players set $round mem 8
+scoreboard players set $mini_type mem 6
+function mini:main/game_init
+function ltw:state/4/state_enter
+say 已开始单个测试游戏!