Преглед изворни кода

Merge branch 'master' of github.com:LTCatt/LTW3

HerobrineXia пре 6 година
родитељ
комит
887ea6703c

+ 0 - 2
data/lib/functions/random.mcfunction

@@ -8,5 +8,3 @@ scoreboard players operation $random_max mem -= $random_min mem
 scoreboard players add $random_max mem 1
 scoreboard players operation $random mem %= $random_max mem
 scoreboard players operation $random mem += $random_min mem
-
-# TODO : 血量上限改变依然会触发假死

+ 1 - 0
data/lib/functions/sounds/error.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:block.note_block.didgeridoo block @s ~ ~ ~ 1 1

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

@@ -4,6 +4,7 @@
 forceload remove all
 time set noon
 weather clear
+difficulty normal
 gamerule doDaylightCycle false
 gamerule doFireTick false
 gamerule doMobSpawning false
@@ -29,7 +30,6 @@ scoreboard players set $ game_id 0
 #   minigame总数
 scoreboard players set $global_mini_count mem 4
 
-
 # 队伍
 team remove ltw
 team add ltw "龙猫战争3"

+ 7 - 1
data/ltw/functions/main/player_leave.mcfunction

@@ -1 +1,7 @@
-say [test] 有玩家离开游戏!
+# 任意玩家下线时触发
+
+execute store result score $t_count mem if entity @a[tag=!watcher]
+execute if score $state mem matches 1.. if score $game_type mem matches 1 if score $t_count mem matches ..2 run function ltw:main/game_end
+execute if score $state mem matches 1.. if score $game_type mem matches 1 if score $t_count mem matches ..2 run tellraw @a {"text": "由于玩家人数不足, 游戏直接结束!","color":"red"}
+
+# TODO 小游戏结束逻辑可能导致卡住

+ 5 - 5
data/ltw/functions/state/0/player_enter.mcfunction

@@ -1,17 +1,17 @@
 # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
-gamemode creative
 title @s clear
 title @s actionbar ""
 
+# 重置玩家血量上限
+execute as @a run attribute @s generic.max_health base set 20
+
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
-
-# 设置血量上限
-execute as @a run attribute @s generic.max_health base set 20
+effect give @s weakness 1000000 4 true
 
 # 冒险模式
 gamemode adventure

+ 2 - 0
data/ltw/functions/state/0/try_start_gameparty.mcfunction

@@ -4,7 +4,9 @@
 execute store result score $count mem if entity @a[tag=hub_gameparty]
 
 # 根据玩家数量判定
+execute if score $count mem matches ..2 as @a at @s run function lib:sounds/error
 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.. as @a at @s run function lib:sounds/error
 execute if score $count mem matches 9.. run tellraw @a [{"text": "小游戏模式最多支持 8 人, 当前已有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
 
 # 判断旁观

+ 1 - 2
data/ltw/functions/state/3/player_enter.mcfunction

@@ -1,12 +1,11 @@
 # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
-gamemode creative
 title @s clear
 title @s actionbar ""
 
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s blindness 1000000 0 true
 
 # 自由旁观

+ 1 - 2
data/ltw/functions/state/4/player_enter.mcfunction

@@ -1,12 +1,11 @@
 # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
-gamemode creative
 title @s clear
 title @s actionbar ""
 
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 
 # 显示小游戏介绍

+ 1 - 2
data/ltw/functions/state/6/player_enter.mcfunction

@@ -1,12 +1,11 @@
 # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
-gamemode creative
 title @s clear
 title @s actionbar ""
 
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 
 # 显示小游戏结果

+ 4 - 2
data/ltw/functions/state/7/player_enter.mcfunction

@@ -1,12 +1,14 @@
 # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
-gamemode creative
 title @s clear
 title @s actionbar ""
 
+# 重置玩家血量上限
+execute as @a run attribute @s generic.max_health base set 20
+
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
 

+ 2 - 2
data/mini/functions/colormatch/game_init.mcfunction

@@ -1,7 +1,7 @@
 # 初始化地图
 forceload add 1001 4000 1075 4025
-fill 1049 10 4025 1075 10 3999 minecraft:bedrock
-fill 1074 11 4000 1050 11 4024 lava
+fill 1049 10 4025 1075 10 3999 bedrock
+fill 1074 11 4000 1050 11 4024 magma_block
 fill 1074 15 4000 1050 15 4024 stone
 fill 1075 11 3999 1075 40 4025 stone
 fill 1075 11 3999 1049 40 3999 stone

+ 2 - 2
data/mini/functions/colormatch/player_enter.mcfunction

@@ -1,11 +1,11 @@
 # 单个玩家开始小游戏时执行
-gamemode creative
 title @s clear
+title @s actionbar ""
 
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
 

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

@@ -1 +1 @@
-execute as @a[tag=mini_running] at @s if block ~ ~ ~ lava run function mini:colormatch/player_lose_heart
+execute as @a[tag=mini_running] at @s if block ~ ~-1 ~ magma_block run function mini:colormatch/player_lose_heart

+ 6 - 3
data/mini/functions/hotpm/player_enter.mcfunction

@@ -1,11 +1,11 @@
 # 单个玩家开始小游戏时执行
-gamemode creative
 title @s clear
+title @s actionbar ""
 
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
 
@@ -23,10 +23,13 @@ gamemode spectator @s
 gamemode adventure @s[tag=!watcher,tag=!rejoining]
 
 # 设置玩家生命数量
-scoreboard players set @s[tag=!watcher,tag=!rejoining] mini_heart 3
+scoreboard players set @s[tag=!watcher,tag=!rejoining] mini_heart 2
 function mini:main/player_max_health
+<<<<<<< HEAD
 
 # TODO 灭火无效
+=======
+>>>>>>> be7408dcf305894b2fb01b413b2f71757f09249f
 
 # 重新加入处理
 execute if entity @s[tag=rejoining] run function mini:hotpm/player_lose_heart

+ 3 - 6
data/mini/functions/main/game_end.mcfunction

@@ -12,20 +12,17 @@ tag @a remove mini_rank4
 # 1
 scoreboard players set $t_score_max mini_score -2147483648
 execute as @a run function mini:main/get_max_score
-execute as @a unless entity @a[tag=mini_rank1] if score @s mini_score = $t_score_max mini_score run tag @s add mini_rank1
+execute as @a unless entity @a[tag=mini_rank1] if score @s mini_score = $t_score_max mini_score run tag @s[tag=!watcher] add mini_rank1
 # 2
 scoreboard players set $t_score_max mini_score -2147483648
 execute as @a[tag=!mini_rank1] run function mini:main/get_max_score
-execute as @a[tag=!mini_rank1] unless entity @a[tag=mini_rank2] if score @s mini_score = $t_score_max mini_score run tag @s add mini_rank2
+execute as @a[tag=!mini_rank1] unless entity @a[tag=mini_rank2] if score @s mini_score = $t_score_max mini_score run tag @s[tag=!watcher] add mini_rank2
 # 3
 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
+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[tag=!watcher] add mini_rank3
 # 4
 tag @a[tag=!mini_rank1,tag=!mini_rank2,tag=!mini_rank3,tag=!watcher] add mini_rank4
 
-# 重置玩家血量上限
-execute as @a run attribute @s generic.max_health base set 20
-
 # 进入状态 6
 function ltw:state/6/state_enter

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

@@ -1,12 +1,11 @@
 # 单个玩家开始小游戏时执行
-gamemode creative
 title @s clear
 title @s actionbar ""
 
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
 

+ 2 - 2
data/mini/functions/tntrun/player_enter.mcfunction

@@ -1,11 +1,11 @@
 # 单个玩家开始小游戏时执行
-gamemode creative
 title @s clear
+title @s actionbar ""
 
 # 状态效果
 effect clear @s
 effect give @s saturation 1000000 0 true
-effect give @s instant_health 10 0 true
+gamerule naturalRegeneration true
 effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
 

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

@@ -1,2 +1,2 @@
 # 玩家死亡判断
-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 ~ magma_block run function mini:tntrun/player_failed