فهرست منبع

跑酷小游戏已加入豪华套餐

LTCatt 6 سال پیش
والد
کامیت
c44e06cffb

+ 1 - 1
data/ltw/functions/clock/tick20.mcfunction

@@ -7,4 +7,4 @@ execute if score $state mem matches 4 run function ltw:state/4/tick20
 execute if score $state mem matches 6 run function ltw:state/6/tick20
 
 # 全局倒计时
-scoreboard players remove $countdown mem 1
+execute if score $countdown mem matches 1.. run scoreboard players remove $countdown mem 1

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

@@ -1,4 +1,5 @@
 # 小游戏结束
+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
 
 # 进入状态 6

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

@@ -1,2 +1,3 @@
 # 小游戏初始化
+execute if score $mini_type mem matches 1 run function mini:parkour/game_init
 execute if score $mini_type mem matches 2 run function mini:tntrun/game_init

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

@@ -1,2 +1,3 @@
-# tntrun小游戏初始化
+# 初始化
 function mini:tntrun/init
+function mini:parkour/init

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

@@ -1,3 +1,4 @@
 # 单个玩家开始小游戏时执行
 tag @s add mini_running
+execute if score $mini_type mem matches 1 run function mini:parkour/player_enter
 execute if score $mini_type mem matches 2 run function mini:tntrun/player_enter

+ 3 - 3
data/mini/functions/main/player_failed.mcfunction

@@ -2,8 +2,8 @@
 
 # 失败提示与计数
 tag @s remove mini_running
-scoreboard players set $alive mem 0
-execute as @a[tag=mini_running] run scoreboard players add $alive mem 1
+scoreboard players set $t_alive mem 0
+execute as @a[tag=mini_running] run scoreboard players add $t_alive mem 1
 tellraw @a [{"selector": "@s","color":"red"}," 已失败! 剩余 ",{"score": {"name": "$alive","objective": "mem"}}," 人!"]
 
 # 记录名次
@@ -14,4 +14,4 @@ gamemode spectator @s
 spectate @r[tag=mini_running]
 
 # 如果只有一个玩家没有失败,则游戏结束
-execute if score $alive mem matches ..1 run function mini:main/game_end
+execute if score $t_alive mem matches ..1 run function mini:main/game_end

+ 17 - 0
data/mini/functions/main/player_finished.mcfunction

@@ -0,0 +1,17 @@
+# 玩家成功时由玩家自己触发
+
+# 成功提示与计数
+tag @s remove mini_running
+scoreboard players set $t_finish mem 0
+execute as @a[tag=!mini_running] run scoreboard players add $t_finish mem 1
+tellraw @a [{"selector": "@s","color":"green"}," 已成功! 已完成 ",{"score": {"name": "$finish","objective": "mem"}}," 人!"]
+
+# 记录名次
+# UNDONE
+
+# 进入旁观
+gamemode spectator @s
+spectate @r[tag=mini_running]
+
+# 如果有三个玩家成功,则游戏结束
+execute if score $t_finish mem matches 3.. run function mini:main/game_end

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

@@ -1,2 +1,3 @@
 # 向单个玩家展示小游戏时执行
+execute if score $mini_type mem matches 1 run function mini:parkour/player_intro
 execute if score $mini_type mem matches 2 run function mini:tntrun/player_intro

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

@@ -1,2 +1,3 @@
 # 限制观察者范围
+execute if score $mini_type mem matches 1 run function mini:parkour/spectator_range
 execute if score $mini_type mem matches 2 run function mini:tntrun/spectator_range

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

@@ -1 +1,2 @@
+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

+ 5 - 0
data/mini/functions/parkour/game_end.mcfunction

@@ -0,0 +1,5 @@
+# 结束跑酷
+forceload remove 1000 1000 1050 1050
+
+# 开启伤害
+gamerule fallDamage true

+ 6 - 0
data/mini/functions/parkour/game_init.mcfunction

@@ -0,0 +1,6 @@
+# 初始化跑酷地图
+forceload add 1000 1000 1050 1050
+
+# 生成地图
+setblock 1000 10 1000 minecraft:structure_block{mode:"LOAD",name:"mini:parkour"}
+setblock 1000 11 1000 minecraft:redstone_block

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

@@ -0,0 +1 @@
+# 跑酷没有用到记分板,不需要初始化

+ 16 - 0
data/mini/functions/parkour/player_enter.mcfunction

@@ -0,0 +1,16 @@
+# 单个玩家开始小游戏时执行
+title @s clear
+gamemode adventure @s
+
+# 状态效果
+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
+
+# 关闭伤害
+gamerule fallDamage false
+
+# 传送玩家
+tp @s 1005 15 1005

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

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

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

@@ -0,0 +1,3 @@
+# 向单个玩家展示小游戏介绍
+tp @s 1007 24 1005
+tellraw @s [{"text":"\n>> 跑酷 >>\n\n","color":"red","bold":true},{"text": "到达最上层即可获胜, 规则就是这么简单!\n","color":"white","bold": false}]

+ 2 - 0
data/mini/functions/parkour/spectator_range.mcfunction

@@ -0,0 +1,2 @@
+# 观察者限制飞行范围
+execute as @a[gamemode=spectator] unless entity @s[x=1001,y=11,z=1001,dx=11,dz=17,dy=24] run tp @s 1007 24 1005

+ 2 - 0
data/mini/functions/parkour/tick4.mcfunction

@@ -0,0 +1,2 @@
+# 玩家获胜判断
+execute as @a[tag=mini_running,z=1022,dz=10] run function mini:parkour/player_finished

+ 1 - 1
data/mini/functions/tntrun/player_intro.mcfunction

@@ -1,3 +1,3 @@
-# 向单个玩家展示小游戏时执行
+# 向单个玩家展示小游戏介绍
 tp @s 1011.5 27.5 2011.5
 tellraw @s [{"text":"\n>> TNT Run >>\n\n","color":"red","bold":true},{"text": "你脚下的方块会不断塌陷, 所以, 不要停下来啊!\n场地一共有三层, 掉到最下面则为失败!\n","color":"white","bold": false}]