ソースを参照

小游戏记分

LTCatt 6 年 前
親
コミット
2684ad41e6

+ 9 - 2
data/ltw/functions/init.mcfunction

@@ -11,9 +11,11 @@ gamerule keepInventory true
 gamerule doWeatherCycle false
 gamerule doImmediateRespawn true
 
-# 全局变量
+# 记分板
 scoreboard objectives remove mem
-scoreboard objectives add mem dummy ["全局变量"]
+scoreboard objectives add mem dummy "全局变量"
+scoreboard objectives remove gameparty_score
+scoreboard objectives add gameparty_score dummy "积分"
 
 # 时钟
 schedule function ltw:clock/tick4 4t replace
@@ -21,3 +23,8 @@ schedule function ltw:clock/tick20 20t replace
 
 # 其他模块
 function mini:main/init
+
+# 状态
+function ltw:state/0/state_enter
+
+# TODO 关闭玩家碰撞箱

+ 5 - 2
data/ltw/functions/state/0/start_gameparty.mcfunction

@@ -4,8 +4,11 @@
 execute store result score $count mem if entity @a[tag=hub_gameparty]
 
 # 根据玩家数量判定
-execute if score $count mem matches ..2 run tellraw @a[tag=hub_gameparty] [{"text": "人数不足, 需要至少 3 人, 当前仅有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
-execute if score $count mem matches 9.. run tellraw @a[tag=hub_gameparty] [{"text": "人数过多, 最多支持 8 人, 当前已有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
+execute if score $count mem matches ..2 run tellraw @a [{"text": "需要至少 3 人以开始小游戏模式, 当前仅有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
+execute if score $count mem matches 9.. run tellraw @a [{"text": "小游戏模式最多支持 8 人, 当前已有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
+
+# 重置积分
+scoreboard players reset gameparty_score
 
 # 开始小游戏
 execute if score $count mem matches 3..8 run tag @a remove watcher

+ 0 - 3
data/ltw/functions/state/7/player_enter.mcfunction

@@ -7,6 +7,3 @@ 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
-
-# TODO : 继续阶段 7
-gamemode creative

+ 0 - 1
data/ltw/functions/state/7/state_enter.mcfunction

@@ -2,5 +2,4 @@
 scoreboard players set $state mem 7
 execute as @a run function ltw:state/7/player_enter
 
-# TODO : 继续阶段 7
 schedule function ltw:state/0/state_enter 5t replace

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

@@ -24,4 +24,5 @@ schedule function mini:hotpm/player_enter2 1t replace
 # schedule: tp @a ~ 25 ~
 
 # 3秒后给予土豆
-schedule function mini:hotpm/pm_init_first 3s replace
+schedule function mini:hotpm/pm_init_first 3s replace
+# TODO 灭火无效

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

@@ -21,7 +21,7 @@ scoreboard players set $t_score_max mini_score -2147483648
 execute as @a[tag=!mini_rank1,tag=!mini_rank2] run function mini:main/get_max_score
 execute as @a[tag=!mini_rank1,tag=!mini_rank2] unless entity @a[tag=mini_rank3] if score @s mini_score = $t_score_max mini_score run tag @s add mini_rank3
 # 4
-tag @a[tag=!mini_rank1,tag=!mini_rank2,tag=!mini_rank3] add mini_rank4
+tag @a[tag=!mini_rank1,tag=!mini_rank2,tag=!mini_rank3,tag=!watcher] add mini_rank4
 
 # 进入状态 6
 function ltw:state/6/state_enter

+ 8 - 2
data/mini/functions/main/show_result.mcfunction

@@ -1,3 +1,9 @@
-# 显示小游戏排名
+# 显示小游戏排名并给分
 
-tellraw @s [{"text":"\n>> 小游戏结束 >>\n\n","color":"gold","bold":true},{"text": "第一名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank1]","color":"white","bold": false},{"text": "\n第二名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank2]","color":"white","bold": false},{"text": "\n第三名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank3]","color":"white","bold": false},"\n"]
+tellraw @s [{"text":"\n>> 小游戏结束 >>\n\n","color":"gold","bold":true},{"text": "第一名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank1]","color":"white","bold": false},{"text": "\n第二名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank2]","color":"white","bold": false},{"text": "\n第三名 - ","color":"green","bold": false},{"selector": "@a[tag=mini_rank3]","color":"white","bold": false},"\n"]
+
+# 记分
+scoreboard players add @s[tag=mini_rank1] gameparty_score 3
+scoreboard players add @s[tag=mini_rank2] gameparty_score 2
+scoreboard players add @s[tag=mini_rank3] gameparty_score 1
+scoreboard players add @s[tag=mini_rank4] gameparty_score 0