HerobrineXia 6 лет назад
Родитель
Сommit
ea662a7438

+ 2 - 2
data/ltw/functions/clock/tick4.mcfunction

@@ -2,8 +2,8 @@
 schedule function ltw:clock/tick4 4t replace
 
 # 调用其他模块
-function ltw:main/tick4
 execute if score $state mem matches 0 run function ltw:state/0/tick4
 execute if score $state mem matches 4 run function ltw:state/4/tick4
 execute if score $state mem matches 5 run function ltw:state/5/tick4
-execute if score $state mem matches 6 run function ltw:state/6/tick4
+execute if score $state mem matches 6 run function ltw:state/6/tick4
+function ltw:main/tick4

+ 0 - 1
data/ltw/functions/init.mcfunction

@@ -38,4 +38,3 @@ function mini:main/init
 
 # 状态
 function ltw:state/0/state_enter
-# TODO 让玩家离开时触发 ltw:main/player_leave

+ 5 - 4
data/ltw/functions/main/player_changed.mcfunction

@@ -1,8 +1,9 @@
+# 初始化玩家数量
+execute unless score $player_count mem matches -2147483648..2147483647 store result score $player_count mem if entity @a
 # 计算玩家数量
-execute store result score $alive_now mem if entity @a[tag=mini_running,tag=!watcher]
-
+execute store result score $player_count_now mem if entity @a
 # 比较玩家数量
-execute unless score $alive_now mem = $alive mem run function ltw:main/player_leave
+execute unless score $player_count_now mem = $player_count mem run function ltw:main/player_leave
 
 # 重置玩家数量
-execute unless score $alive_now mem = $alive mem run scoreboard players operation $alive mem = $alive_now mem
+execute unless score $player_count_now mem = $player_count mem run scoreboard players operation $player_count mem = $player_count_now mem

+ 6 - 0
data/mini/functions/colormatch/game_end.mcfunction

@@ -0,0 +1,6 @@
+# 结束 TNT Run
+forceload remove 1001 4000 1075 4025
+
+# 开启伤害
+gamerule fallDamage true
+gamerule fireDamage true

+ 22 - 0
data/mini/functions/colormatch/game_init.mcfunction

@@ -0,0 +1,22 @@
+# 初始化地图
+forceload add 1001 4000 1075 4025
+
+fill 1049 10 4025 1075 10 3999 minecraft:bedrock
+fill 1074 11 4000 1050 11 4024 lava
+fill 1074 15 4000 1050 15 4024 stone
+fill 1075 11 3999 1075 40 4025 stone
+fill 1075 11 3999 1049 40 3999 stone
+fill 1049 11 3999 1049 40 4025 stone
+fill 1049 11 4025 1075 40 4025 stone
+
+# 设置分数
+scoreboard players set $color_match_round mem 0
+scoreboard players set $color_match_time mem 15
+
+# 刷新地基
+function mini:colormatch/prepare_round
+schedule function mini:colormatch/start_new_round 28t replace
+
+# 关闭伤害
+gamerule fallDamage false
+gamerule fireDamage false

+ 1 - 1
data/mini/functions/colormatch/generate_parts.mcfunction

@@ -29,4 +29,4 @@ execute if score $floor_generate_part mem matches 25 positioned 1000 10 4000 run
 setblock 1000 9 4000 redstone_block
 setblock 1000 9 4000 air
 setblock 1000 10 4000 air
-execute if score $floor_generate_part mem matches 1..24 run schedule function mini:colormatch/generate_parts 1t
+execute if score $floor_generate_part mem matches 1..24 run schedule function mini:colormatch/generate_parts 1t replace

+ 4 - 0
data/mini/functions/colormatch/get_random_floor.mcfunction

@@ -30,3 +30,7 @@ execute positioned 1000 10 4000 if score $random mem matches 22 run clone ~ ~ ~
 execute positioned 1000 10 4000 if score $random mem matches 23 run clone ~ ~ ~ ~25 ~ ~25 ~ ~1 ~ filtered netherrack
 execute positioned 1000 10 4000 if score $random mem matches 24 run clone ~ ~ ~ ~25 ~ ~25 ~ ~1 ~ filtered red_nether_bricks
 execute positioned 1000 10 4000 if score $random mem matches 25 run clone ~ ~ ~ ~25 ~ ~25 ~ ~1 ~ filtered bricks
+
+# 存计分板
+scoreboard players operation $floor_next_round mem = $random mem
+

+ 24 - 0
data/mini/functions/colormatch/player_enter.mcfunction

@@ -0,0 +1,24 @@
+# 单个玩家开始小游戏时执行
+gamemode creative
+title @s clear
+
+# 状态效果
+effect clear @s
+effect give @s saturation 1000000 0 true
+effect give @s instant_health 10 0 true
+effect give @s night_vision 1000000 0 true
+effect give @s resistance 1000000 4 true
+
+# 传送玩家
+tp @s[tag=!watcher,tag=!rejoining] 1000 20 4050
+
+# 调整模式
+gamemode spectator @s
+gamemode adventure @s[tag=!watcher,tag=!rejoining]
+
+# 设置玩家生命数量
+scoreboard players set @s mini_heart 3
+function mini:main/player_max_health
+
+# 重新加入处理
+execute if entity @s[tag=rejoining] run function mini:hotpm/player_failed

+ 5 - 0
data/mini/functions/colormatch/player_failed.mcfunction

@@ -0,0 +1,5 @@
+# 告知玩家
+tellraw @a [{"text":">> ","color":"gold","bold": true},{"selector":"@s","color":"yellow","bold": false},{"text":" 被掉入了陷阱!","color":"white","bold": false}]
+
+# 失去一颗心
+function mini:main/player_lose_heart

+ 3 - 0
data/mini/functions/colormatch/player_intro.mcfunction

@@ -0,0 +1,3 @@
+# 向单个玩家展示小游戏介绍
+tp @s 1000 20 4050 180 0
+tellraw @s [{"text":"\n>> 陷阱迷阵 >>\n\n","color":"red","bold":true},{"text": "墙壁上会显示本轮的安全歇脚方块\n在倒计时结束前跑上去躲避陷阱!\n","color":"white","bold": false}]

+ 5 - 0
data/mini/functions/colormatch/prepare_round.mcfunction

@@ -0,0 +1,5 @@
+# 刷新地板
+function mini:colormatch/generate_floor
+
+# 获取保留地板
+schedule function mini:colormatch/get_random_floor 26t replace

+ 100 - 0
data/mini/functions/colormatch/replace_wall.mcfunction

@@ -0,0 +1,100 @@
+execute if score $floor_next_round mem matches 1 run fill 1075 11 3999 1075 40 4025 iron_block
+execute if score $floor_next_round mem matches 1 run fill 1075 11 3999 1049 40 3999 iron_block
+execute if score $floor_next_round mem matches 1 run fill 1049 11 3999 1049 40 4025 iron_block
+execute if score $floor_next_round mem matches 1 run fill 1049 11 4025 1075 40 4025 iron_block
+execute if score $floor_next_round mem matches 2 run fill 1075 11 3999 1075 40 4025 white_concrete
+execute if score $floor_next_round mem matches 2 run fill 1075 11 3999 1049 40 3999 white_concrete
+execute if score $floor_next_round mem matches 2 run fill 1049 11 3999 1049 40 4025 white_concrete
+execute if score $floor_next_round mem matches 2 run fill 1049 11 4025 1075 40 4025 white_concrete
+execute if score $floor_next_round mem matches 3 run fill 1075 11 3999 1075 40 4025 quartz_block
+execute if score $floor_next_round mem matches 3 run fill 1075 11 3999 1049 40 3999 quartz_block
+execute if score $floor_next_round mem matches 3 run fill 1049 11 3999 1049 40 4025 quartz_block
+execute if score $floor_next_round mem matches 3 run fill 1049 11 4025 1075 40 4025 quartz_block
+execute if score $floor_next_round mem matches 4 run fill 1075 11 3999 1075 40 4025 snow_block
+execute if score $floor_next_round mem matches 4 run fill 1075 11 3999 1049 40 3999 snow_block
+execute if score $floor_next_round mem matches 4 run fill 1049 11 3999 1049 40 4025 snow_block
+execute if score $floor_next_round mem matches 4 run fill 1049 11 4025 1075 40 4025 snow_block
+execute if score $floor_next_round mem matches 5 run fill 1075 11 3999 1075 40 4025 white_wool
+execute if score $floor_next_round mem matches 5 run fill 1075 11 3999 1049 40 3999 white_wool
+execute if score $floor_next_round mem matches 5 run fill 1049 11 3999 1049 40 4025 white_wool
+execute if score $floor_next_round mem matches 5 run fill 1049 11 4025 1075 40 4025 white_wool
+execute if score $floor_next_round mem matches 6 run fill 1075 11 3999 1075 40 4025 gold_block
+execute if score $floor_next_round mem matches 6 run fill 1075 11 3999 1049 40 3999 gold_block
+execute if score $floor_next_round mem matches 6 run fill 1049 11 3999 1049 40 4025 gold_block
+execute if score $floor_next_round mem matches 6 run fill 1049 11 4025 1075 40 4025 gold_block
+execute if score $floor_next_round mem matches 7 run fill 1075 11 3999 1075 40 4025 sponge
+execute if score $floor_next_round mem matches 7 run fill 1075 11 3999 1049 40 3999 sponge
+execute if score $floor_next_round mem matches 7 run fill 1049 11 3999 1049 40 4025 sponge
+execute if score $floor_next_round mem matches 7 run fill 1049 11 4025 1075 40 4025 sponge
+execute if score $floor_next_round mem matches 8 run fill 1075 11 3999 1075 40 4025 sandstone
+execute if score $floor_next_round mem matches 8 run fill 1075 11 3999 1049 40 3999 sandstone
+execute if score $floor_next_round mem matches 8 run fill 1049 11 3999 1049 40 4025 sandstone
+execute if score $floor_next_round mem matches 8 run fill 1049 11 4025 1075 40 4025 sandstone
+execute if score $floor_next_round mem matches 9 run fill 1075 11 3999 1075 40 4025 yellow_concrete
+execute if score $floor_next_round mem matches 9 run fill 1075 11 3999 1049 40 3999 yellow_concrete
+execute if score $floor_next_round mem matches 9 run fill 1049 11 3999 1049 40 4025 yellow_concrete
+execute if score $floor_next_round mem matches 9 run fill 1049 11 4025 1075 40 4025 yellow_concrete
+execute if score $floor_next_round mem matches 10 run fill 1075 11 3999 1075 40 4025 end_stone
+execute if score $floor_next_round mem matches 10 run fill 1075 11 3999 1049 40 3999 end_stone
+execute if score $floor_next_round mem matches 10 run fill 1049 11 3999 1049 40 4025 end_stone
+execute if score $floor_next_round mem matches 10 run fill 1049 11 4025 1075 40 4025 end_stone
+execute if score $floor_next_round mem matches 11 run fill 1075 11 3999 1075 40 4025 emerald_block
+execute if score $floor_next_round mem matches 11 run fill 1075 11 3999 1049 40 3999 emerald_block
+execute if score $floor_next_round mem matches 11 run fill 1049 11 3999 1049 40 4025 emerald_block
+execute if score $floor_next_round mem matches 11 run fill 1049 11 4025 1075 40 4025 emerald_block
+execute if score $floor_next_round mem matches 12 run fill 1075 11 3999 1075 40 4025 lime_concrete
+execute if score $floor_next_round mem matches 12 run fill 1075 11 3999 1049 40 3999 lime_concrete
+execute if score $floor_next_round mem matches 12 run fill 1049 11 3999 1049 40 4025 lime_concrete
+execute if score $floor_next_round mem matches 12 run fill 1049 11 4025 1075 40 4025 lime_concrete
+execute if score $floor_next_round mem matches 13 run fill 1075 11 3999 1075 40 4025 melon
+execute if score $floor_next_round mem matches 13 run fill 1075 11 3999 1049 40 3999 melon
+execute if score $floor_next_round mem matches 13 run fill 1049 11 3999 1049 40 4025 melon
+execute if score $floor_next_round mem matches 13 run fill 1049 11 4025 1075 40 4025 melon
+execute if score $floor_next_round mem matches 14 run fill 1075 11 3999 1075 40 4025 dark_prismarine
+execute if score $floor_next_round mem matches 14 run fill 1075 11 3999 1049 40 3999 dark_prismarine
+execute if score $floor_next_round mem matches 14 run fill 1049 11 3999 1049 40 4025 dark_prismarine
+execute if score $floor_next_round mem matches 14 run fill 1049 11 4025 1075 40 4025 dark_prismarine
+execute if score $floor_next_round mem matches 15 run fill 1075 11 3999 1075 40 4025 green_wool
+execute if score $floor_next_round mem matches 15 run fill 1075 11 3999 1049 40 3999 green_wool
+execute if score $floor_next_round mem matches 15 run fill 1049 11 3999 1049 40 4025 green_wool
+execute if score $floor_next_round mem matches 15 run fill 1049 11 4025 1075 40 4025 green_wool
+execute if score $floor_next_round mem matches 16 run fill 1075 11 3999 1075 40 4025 diamond_block
+execute if score $floor_next_round mem matches 16 run fill 1075 11 3999 1049 40 3999 diamond_block
+execute if score $floor_next_round mem matches 16 run fill 1049 11 3999 1049 40 4025 diamond_block
+execute if score $floor_next_round mem matches 16 run fill 1049 11 4025 1075 40 4025 diamond_block
+execute if score $floor_next_round mem matches 17 run fill 1075 11 3999 1075 40 4025 prismarine
+execute if score $floor_next_round mem matches 17 run fill 1075 11 3999 1049 40 3999 prismarine
+execute if score $floor_next_round mem matches 17 run fill 1049 11 3999 1049 40 4025 prismarine
+execute if score $floor_next_round mem matches 17 run fill 1049 11 4025 1075 40 4025 prismarine
+execute if score $floor_next_round mem matches 18 run fill 1075 11 3999 1075 40 4025 blue_ice
+execute if score $floor_next_round mem matches 18 run fill 1075 11 3999 1049 40 3999 blue_ice
+execute if score $floor_next_round mem matches 18 run fill 1049 11 3999 1049 40 4025 blue_ice
+execute if score $floor_next_round mem matches 18 run fill 1049 11 4025 1075 40 4025 blue_ice
+execute if score $floor_next_round mem matches 19 run fill 1075 11 3999 1075 40 4025 warped_wart_block
+execute if score $floor_next_round mem matches 19 run fill 1075 11 3999 1049 40 3999 warped_wart_block
+execute if score $floor_next_round mem matches 19 run fill 1049 11 3999 1049 40 4025 warped_wart_block
+execute if score $floor_next_round mem matches 19 run fill 1049 11 4025 1075 40 4025 warped_wart_block
+execute if score $floor_next_round mem matches 20 run fill 1075 11 3999 1075 40 4025 prismarine_bricks
+execute if score $floor_next_round mem matches 20 run fill 1075 11 3999 1049 40 3999 prismarine_bricks
+execute if score $floor_next_round mem matches 20 run fill 1049 11 3999 1049 40 4025 prismarine_bricks
+execute if score $floor_next_round mem matches 20 run fill 1049 11 4025 1075 40 4025 prismarine_bricks
+execute if score $floor_next_round mem matches 21 run fill 1075 11 3999 1075 40 4025 red_wool
+execute if score $floor_next_round mem matches 21 run fill 1075 11 3999 1049 40 3999 red_wool
+execute if score $floor_next_round mem matches 21 run fill 1049 11 3999 1049 40 4025 red_wool
+execute if score $floor_next_round mem matches 21 run fill 1049 11 4025 1075 40 4025 red_wool
+execute if score $floor_next_round mem matches 22 run fill 1075 11 3999 1075 40 4025 red_concrete
+execute if score $floor_next_round mem matches 22 run fill 1075 11 3999 1049 40 3999 red_concrete
+execute if score $floor_next_round mem matches 22 run fill 1049 11 3999 1049 40 4025 red_concrete
+execute if score $floor_next_round mem matches 22 run fill 1049 11 4025 1075 40 4025 red_concrete
+execute if score $floor_next_round mem matches 23 run fill 1075 11 3999 1075 40 4025 netherrack
+execute if score $floor_next_round mem matches 23 run fill 1075 11 3999 1049 40 3999 netherrack
+execute if score $floor_next_round mem matches 23 run fill 1049 11 3999 1049 40 4025 netherrack
+execute if score $floor_next_round mem matches 23 run fill 1049 11 4025 1075 40 4025 netherrack
+execute if score $floor_next_round mem matches 24 run fill 1075 11 3999 1075 40 4025 red_nether_bricks
+execute if score $floor_next_round mem matches 24 run fill 1075 11 3999 1049 40 3999 red_nether_bricks
+execute if score $floor_next_round mem matches 24 run fill 1049 11 3999 1049 40 4025 red_nether_bricks
+execute if score $floor_next_round mem matches 24 run fill 1049 11 4025 1075 40 4025 red_nether_bricks
+execute if score $floor_next_round mem matches 25 run fill 1075 11 3999 1075 40 4025 bricks
+execute if score $floor_next_round mem matches 25 run fill 1075 11 3999 1049 40 3999 bricks
+execute if score $floor_next_round mem matches 25 run fill 1049 11 3999 1049 40 4025 bricks
+execute if score $floor_next_round mem matches 25 run fill 1049 11 4025 1075 40 4025 bricks

+ 1 - 0
data/mini/functions/colormatch/spectator_range.mcfunction

@@ -0,0 +1 @@
+# TODO 观察者限定范围

+ 16 - 0
data/mini/functions/colormatch/start_new_round.mcfunction

@@ -0,0 +1,16 @@
+# 替换墙壁
+function mini:colormatch/replace_wall
+# 复制地板
+execute positioned 1000 10 4000 run clone ~ ~ ~ ~25 ~ ~25 1050 15 4000
+# 设置倒计时
+scoreboard players add $color_match_round mem 1
+execute if score $color_match_round mem matches 2 run scoreboard players remove $color_match_time mem 1
+execute if score $color_match_round mem matches 2 run scoreboard players set $color_match_round mem 0
+scoreboard players operation $countdown mem = $color_match_time mem
+
+# TODO 告知玩家是啥方块
+# 告知玩家
+tellraw @a [{"text":">> ","color":"gold","bold": true},{"text":" 新的一轮开始了!","color":"white","bold": false}]
+
+# 预备下一轮
+function mini:colormatch/prepare_round

+ 4 - 0
data/mini/functions/colormatch/tick20.mcfunction

@@ -0,0 +1,4 @@
+# 每秒函数
+execute if score $countdown mem matches 0 run function mini:colormatch/start_new_round
+
+# TODO 显示当前剩余秒数

+ 3 - 0
data/mini/functions/colormatch/tick4.mcfunction

@@ -0,0 +1,3 @@
+execute as @a[tag=mini_running] at @s if block ~ ~ ~ lava run function mini:tntrun/player_failed
+execute as @a[tag=mini_running] at @s if block ~ ~-1 ~ lava run function mini:tntrun/player_failed
+execute as @a[tag=mini_running] at @s if block ~ ~-2 ~ lava run function mini:tntrun/player_failed

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

@@ -2,6 +2,7 @@
 execute if score $mini_type mem matches 1 run function mini:parkour/game_end
 execute if score $mini_type mem matches 2 run function mini:tntrun/game_end
 execute if score $mini_type mem matches 3 run function mini:hotpm/game_end
+execute if score $mini_type mem matches 4 run function mini:colormatch/game_end
 
 # 计算排名
 tag @a remove mini_rank1

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

@@ -1,3 +1,4 @@
 execute if score $mini_type mem matches 1 run function mini:parkour/tick4
 execute if score $mini_type mem matches 2 run function mini:tntrun/tick4
-execute if score $mini_type mem matches 3 run function mini:hotpm/tick4
+execute if score $mini_type mem matches 3 run function mini:hotpm/tick4
+execute if score $mini_type mem matches 4 run function mini:colormatch/tick4

+ 3 - 3
data/mini/functions/tntrun/tick4.mcfunction

@@ -1,4 +1,4 @@
 # 玩家死亡判断
-execute as @a[tag=tntrun_pc] at @s if block ~ ~ ~ lava run function mini:tntrun/player_failed
-execute as @a[tag=tntrun_pc] at @s if block ~ ~-1 ~ lava run function mini:tntrun/player_failed
-execute as @a[tag=tntrun_pc] at @s if block ~ ~-2 ~ lava run function mini:tntrun/player_failed
+execute as @a[tag=mini_running] at @s if block ~ ~ ~ lava run function mini:tntrun/player_failed
+execute as @a[tag=mini_running] at @s if block ~ ~-1 ~ lava run function mini:tntrun/player_failed
+execute as @a[tag=mini_running] at @s if block ~ ~-2 ~ lava run function mini:tntrun/player_failed