Browse Source

完成基本系统

aqupa 4 years ago
parent
commit
2c25f46e6b
44 changed files with 536 additions and 0 deletions
  1. 1 0
      data/ltw/functions/init.mcfunction
  2. 1 0
      data/mini/functions/main/player_intro.mcfunction
  3. 15 0
      data/mini/functions/rgb/game/add_rule.mcfunction
  4. 5 0
      data/mini/functions/rgb/game/add_rule_1.mcfunction
  5. 4 0
      data/mini/functions/rgb/game/check_conditions.mcfunction
  6. 8 0
      data/mini/functions/rgb/game/check_rule_exists.mcfunction
  7. 9 0
      data/mini/functions/rgb/game/conditions/destroy_rule.mcfunction
  8. 12 0
      data/mini/functions/rgb/game/conditions/in_water.mcfunction
  9. 9 0
      data/mini/functions/rgb/game/conditions/obtain_rule.mcfunction
  10. 12 0
      data/mini/functions/rgb/game/conditions/on_air.mcfunction
  11. 12 0
      data/mini/functions/rgb/game/conditions/on_pumpkin.mcfunction
  12. 9 0
      data/mini/functions/rgb/game/conditions/place_rule.mcfunction
  13. 12 0
      data/mini/functions/rgb/game/conditions/shift.mcfunction
  14. 12 0
      data/mini/functions/rgb/game/conditions/smokey.mcfunction
  15. 5 0
      data/mini/functions/rgb/game/events/add_blue.mcfunction
  16. 5 0
      data/mini/functions/rgb/game/events/add_green.mcfunction
  17. 5 0
      data/mini/functions/rgb/game/events/add_red.mcfunction
  18. 7 0
      data/mini/functions/rgb/game/give_pickaxe.mcfunction
  19. 38 0
      data/mini/functions/rgb/game/give_random_rule.mcfunction
  20. 4 0
      data/mini/functions/rgb/game/give_random_rule_1.mcfunction
  21. 4 0
      data/mini/functions/rgb/game/give_random_rule_2.mcfunction
  22. 10 0
      data/mini/functions/rgb/game/handle_event.mcfunction
  23. 20 0
      data/mini/functions/rgb/game/player_tick.mcfunction
  24. 6 0
      data/mini/functions/rgb/game/read_data.mcfunction
  25. 6 0
      data/mini/functions/rgb/game/read_data_.mcfunction
  26. 6 0
      data/mini/functions/rgb/game/remove_rule.mcfunction
  27. 6 0
      data/mini/functions/rgb/game/tp_new_item.mcfunction
  28. 8 0
      data/mini/functions/rgb/game/write_data.mcfunction
  29. 8 0
      data/mini/functions/rgb/game/write_data_.mcfunction
  30. 1 0
      data/mini/functions/rgb/game_end.mcfunction
  31. 21 0
      data/mini/functions/rgb/game_init.mcfunction
  32. 13 0
      data/mini/functions/rgb/game_start.mcfunction
  33. 21 0
      data/mini/functions/rgb/init.mcfunction
  34. 25 0
      data/mini/functions/rgb/player_enter.mcfunction
  35. 8 0
      data/mini/functions/rgb/player_intro.mcfunction
  36. 8 0
      data/mini/functions/rgb/tick2.mcfunction
  37. 0 0
      data/mini/functions/rgb/tick20.mcfunction
  38. 14 0
      data/mini/functions/rgb/tick5.mcfunction
  39. 2 0
      data/mini/functions/rgb/watcher_limit.mcfunction
  40. 64 0
      data/mini/loot_tables/rgb/green.json
  41. 75 0
      data/mini/loot_tables/rgb/red.json
  42. 8 0
      data/mini/predicates/rgb/in_water.json
  43. 6 0
      data/mini/predicates/rgb/smokey.json
  44. 11 0
      data/test/functions/mini/rgb.mcfunction

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

@@ -103,6 +103,7 @@ scoreboard players set #const_4 mem 4
 scoreboard players set #const_5 mem 5
 scoreboard players set #const_9 mem 9
 scoreboard players set #const_10 mem 10
+scoreboard players set #const_25 mem 25
 scoreboard players set #const_81 mem 81
 scoreboard players set #const_100 mem 100
 

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

@@ -5,5 +5,6 @@ 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 201 run function mini:ass/player_intro
+execute if score $mini_type mem matches 202 run function mini:rgb/player_intro
 execute if score $mini_type mem matches 101 run function mini:diamond/player_intro
 execute if score $mini_type mem matches 102 run function mini:trade/player_intro

+ 15 - 0
data/mini/functions/rgb/game/add_rule.mcfunction

@@ -0,0 +1,15 @@
+# as rule armor_stand at @s
+
+tellraw @a[tag=mini_running] [{"text": ">> ","bold": true,"color": "aqua"}, {"text": "新增了一条规则:","bold": false},{"nbt":"CustomName","entity": "@s","bold": false,"interpret": true}]
+execute as @a[tag=mini_running] at @s facing entity @e[tag=rgb_new_rule,limit=1] eyes positioned ^ ^ ^5 run playsound minecraft:entity.chicken.egg player @s ~ ~ ~
+
+summon marker ~ ~ ~ {Tags:["rgb_rule","rgb_new_rule"]}
+scoreboard players operation @e[tag=rgb_new_rule] rgb_rule_id = $ rgb_rule_id
+scoreboard players add $ rgb_rule_id 1
+data modify entity @e[type=marker,tag=rgb_new_rule,limit=1] data set from entity @s ArmorItems[0].tag
+data modify entity @e[type=marker,tag=rgb_new_rule,limit=1] data.name set from entity @s CustomName
+data modify entity @e[type=marker,tag=rgb_new_rule,limit=1] data.players set value []
+execute as @a[tag=mini_running] run function mini:rgb/game/add_rule_1
+
+tag @s add rgb_rule
+tag @e[tag=rgb_new_rule] remove rgb_new_rule

+ 5 - 0
data/mini/functions/rgb/game/add_rule_1.mcfunction

@@ -0,0 +1,5 @@
+# as player
+# with rgb_new_rule
+
+data modify entity @e[type=marker,tag=rgb_new_rule,limit=1] data.players prepend value {id:0s}
+execute store result entity @e[type=marker,tag=rgb_new_rule,limit=1] data.players[0].id short 1 run scoreboard players get @s player_id

+ 4 - 0
data/mini/functions/rgb/game/check_conditions.mcfunction

@@ -0,0 +1,4 @@
+# 位置相关
+execute as @e[type=marker,tag=rgb_rule,nbt={data:{conditions:[{type:"on_air"}]}}] run function mini:rgb/game/conditions/on_air
+execute as @e[type=marker,tag=rgb_rule,nbt={data:{conditions:[{type:"on_pumpkin"}]}}] run function mini:rgb/game/conditions/on_pumpkin
+execute as @e[type=marker,tag=rgb_rule,nbt={data:{conditions:[{type:"shift"}]}}] run function mini:rgb/game/conditions/shift

+ 8 - 0
data/mini/functions/rgb/game/check_rule_exists.mcfunction

@@ -0,0 +1,8 @@
+# as rule marker
+
+scoreboard players set #temp rgb_sys 0
+tag @s add rgb_temp
+execute as @e[type=armor_stand,tag=rgb_rule] if score @s rgb_rule_id = @e[tag=rgb_temp,limit=1] rgb_rule_id run scoreboard players set #temp rgb_sys 1
+tag @s remove rgb_temp
+
+execute if score #temp rgb_sys matches 0 run function mini:rgb/game/remove_rule

+ 9 - 0
data/mini/functions/rgb/game/conditions/destroy_rule.mcfunction

@@ -0,0 +1,9 @@
+# as rule marker
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.destroy_rule
+scoreboard players operation #temp_scr rgb_sys += @a[tag=rgb_op,limit=1] rgb_destroy_rule
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"destroy_rule"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.destroy_rule short 1 run scoreboard players get #temp_scr rgb_sys

+ 12 - 0
data/mini/functions/rgb/game/conditions/in_water.mcfunction

@@ -0,0 +1,12 @@
+# as rule marker
+# 自动归零
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.in_water
+scoreboard players set #temp rgb_sys 0
+execute store success score #temp rgb_sys as @a[tag=rgb_op] if predicate mini:rgb/in_water run scoreboard players add #temp_scr rgb_sys 1
+execute if score #temp rgb_sys matches 0 run scoreboard players set #temp_scr rgb_sys 0
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"in_water"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.in_water short 1 run scoreboard players get #temp_scr rgb_sys

+ 9 - 0
data/mini/functions/rgb/game/conditions/obtain_rule.mcfunction

@@ -0,0 +1,9 @@
+# as rule marker
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.obtain_rule
+scoreboard players operation #temp_scr rgb_sys += @a[tag=rgb_op,limit=1] rgb_obtain_rule
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"obtain_rule"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.obtain_rule short 1 run scoreboard players get #temp_scr rgb_sys

+ 12 - 0
data/mini/functions/rgb/game/conditions/on_air.mcfunction

@@ -0,0 +1,12 @@
+# as rule marker
+# 自动归零
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.on_air
+scoreboard players set #temp rgb_sys 0
+execute store success score #temp rgb_sys if entity @a[tag=rgb_op,nbt={OnGround:0b}] run scoreboard players add #temp_scr rgb_sys 1
+execute if score #temp rgb_sys matches 0 run scoreboard players set #temp_scr rgb_sys 0
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"on_air"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.on_air short 1 run scoreboard players get #temp_scr rgb_sys

+ 12 - 0
data/mini/functions/rgb/game/conditions/on_pumpkin.mcfunction

@@ -0,0 +1,12 @@
+# as rule marker
+# 自动归零
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.on_pumpkin
+scoreboard players set #temp rgb_sys 0
+execute store success score #temp rgb_sys as @a[tag=rgb_op,nbt={OnGround:1b}] at @s if block ~ ~-1 ~ pumpkin run scoreboard players add #temp_scr rgb_sys 1
+execute if score #temp rgb_sys matches 0 run scoreboard players set #temp_scr rgb_sys 0
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"on_pumpkin"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.on_pumpkin short 1 run scoreboard players get #temp_scr rgb_sys

+ 9 - 0
data/mini/functions/rgb/game/conditions/place_rule.mcfunction

@@ -0,0 +1,9 @@
+# as rule marker
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.place_rule
+scoreboard players operation #temp_scr rgb_sys += @a[tag=rgb_op,limit=1] rgb_place_rule
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"place_rule"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.place_rule short 1 run scoreboard players get #temp_scr rgb_sys

+ 12 - 0
data/mini/functions/rgb/game/conditions/shift.mcfunction

@@ -0,0 +1,12 @@
+# as rule marker
+# 自动归零
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.shift
+scoreboard players set #temp rgb_sys 0
+execute store success score #temp rgb_sys if entity @a[tag=rgb_op,nbt={OnGround:1b},scores={rgb_shift=1..}] run scoreboard players add #temp_scr rgb_sys 1
+execute if score #temp rgb_sys matches 0 run scoreboard players set #temp_scr rgb_sys 0
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"shift"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.shift short 1 run scoreboard players get #temp_scr rgb_sys

+ 12 - 0
data/mini/functions/rgb/game/conditions/smokey.mcfunction

@@ -0,0 +1,12 @@
+# as rule marker
+# 自动归零
+
+execute store result score #temp_scr rgb_sys run data get entity @s data.player.conditions.smokey
+scoreboard players set #temp rgb_sys 0
+execute store success score #temp rgb_sys as @a[tag=rgb_op] if predicate mini:rgb/smokey run scoreboard players add #temp_scr rgb_sys 1
+execute if score #temp rgb_sys matches 0 run scoreboard players set #temp_scr rgb_sys 0
+
+execute store result score #temp rgb_sys run data get entity @s data.conditions[{type:"smokey"}].value
+execute if score #temp_scr rgb_sys < #temp rgb_sys run data modify entity @s data.enable set value 0
+
+execute store result entity @s data.player.conditions.smokey short 1 run scoreboard players get #temp_scr rgb_sys

+ 5 - 0
data/mini/functions/rgb/game/events/add_blue.mcfunction

@@ -0,0 +1,5 @@
+# as rule marker
+# with rgb_op
+
+execute store result score #temp rgb_sys run data get entity @s data.events[{type:"add_blue"}].value
+scoreboard players operation @a[tag=rgb_op] rgb_B += #temp rgb_sys

+ 5 - 0
data/mini/functions/rgb/game/events/add_green.mcfunction

@@ -0,0 +1,5 @@
+# as rule marker
+# with rgb_op
+
+execute store result score #temp rgb_sys run data get entity @s data.events[{type:"add_green"}].value
+scoreboard players operation @a[tag=rgb_op] rgb_G += #temp rgb_sys

+ 5 - 0
data/mini/functions/rgb/game/events/add_red.mcfunction

@@ -0,0 +1,5 @@
+# as rule marker
+# with rgb_op
+
+execute store result score #temp rgb_sys run data get entity @s data.events[{type:"add_red"}].value
+scoreboard players operation @a[tag=rgb_op] rgb_R += #temp rgb_sys

+ 7 - 0
data/mini/functions/rgb/game/give_pickaxe.mcfunction

@@ -0,0 +1,7 @@
+clear @s netherite_pickaxe{game_item:1b}
+
+# 返还格子上的物品
+execute if data entity @s Inventory[{Slot:8b}] run scoreboard players set @s item_slot 8
+execute if data entity @s Inventory[{Slot:8b}] at @s run function item:pop_slot/return_item
+
+item replace entity @s hotbar.8 with minecraft:netherite_pickaxe{game_item:1b,display:{Name:'{"text":"镐","italic":false}'},Enchantments:[{id:"minecraft:efficiency",lvl:10s}]} 1

+ 38 - 0
data/mini/functions/rgb/game/give_random_rule.mcfunction

@@ -0,0 +1,38 @@
+# as player
+
+# 随机规则 0-100
+scoreboard players set $random_min mem 0
+scoreboard players set $random_max mem 2
+function lib:random
+
+execute if score $random mem matches 0..2 run loot replace block 0 0 1 container.0 loot mini:rgb/red
+execute if score $random mem matches 3..5 run loot replace block 0 0 1 container.0 loot mini:rgb/green
+#execute if score $random mem matches 6..8 run loot replace block 0 0 1 container.0 loot mini:rgb/blue
+#execute if score $random mem matches 9..12 run loot replace block 0 0 1 container.0 loot mini:rgb/event
+#execute if score $random mem matches 13 run loot replace block 0 0 1 container.0 loot mini:rgb/finish
+
+# 生成文本
+data modify storage ltw:mini rgb set from block 0 0 1 Items[0].tag
+setblock 0 1 0 acacia_wall_sign destroy
+function mini:rgb/game/give_random_rule_1
+data modify block 0 1 0 Text1 set value '[{"nbt":"Text1","block":"0 1 0","interpret":true},{"text":" -> ","color":"white"}]'
+function mini:rgb/game/give_random_rule_2
+data modify block 0 0 1 Items[0].tag.EntityTag.CustomName set from block 0 1 0 Text1
+data modify block 0 1 0 Text1 set value '[{"text":"规则:","color":"white","italic":false},{"nbt":"Text1","block":"0 1 0","interpret":true}]'
+data modify block 0 0 1 Items[0].tag.display.Name set from block 0 1 0 Text1
+data modify block 0 0 1 Items[0].tag.display.Lore set value ['{"text":"右键放置以启用此规则","italic":false,"color":"gray"}']
+
+# 生成物品
+setblock 0 0 0 jukebox replace
+data modify block 0 0 0 RecordItem set from block 0 0 1 Items[0]
+data modify block 0 0 0 RecordItem.tag.game_item set value 1b
+data modify block 0 0 0 RecordItem.tag.rgb_newrule set value 1b
+data modify block 0 0 0 RecordItem.tag.EntityTag.Tags set value ["rgb_new_rule"]
+data modify block 0 0 0 RecordItem.tag.EntityTag.Small set value 1b
+data modify block 0 0 0 RecordItem.tag.EntityTag.ArmorItems set value [{id:"minecraft:stone",Count:1s},{}]
+data modify block 0 0 0 RecordItem.tag.EntityTag.ArmorItems[0].tag.conditions set from block 0 0 0 RecordItem.tag.conditions
+data modify block 0 0 0 RecordItem.tag.EntityTag.ArmorItems[0].tag.events set from block 0 0 0 RecordItem.tag.events
+setblock 0 0 0 air destroy
+tag @s add rgb_temp
+execute as @e[nbt={"Item":{"tag":{"rgb_newrule":1b}}},limit=1] run function mini:rgb/game/tp_new_item
+tag @s remove rgb_temp

+ 4 - 0
data/mini/functions/rgb/game/give_random_rule_1.mcfunction

@@ -0,0 +1,4 @@
+data modify block 0 1 0 Text1 set value '[{"nbt":"Text1","block":"0 1 0","interpret":true},{"nbt":"Text2","block":"0 1 0","interpret":true},{"nbt":"rgb.conditions[0].name","storage":"ltw:mini","interpret":true}]'
+data modify block 0 1 0 Text2 set value '{"text":" 且 ","color":"white"}'
+data remove storage ltw:mini rgb.conditions[0]
+execute if data storage ltw:mini rgb.conditions[0] run function mini:rgb/game/give_random_rule_1

+ 4 - 0
data/mini/functions/rgb/game/give_random_rule_2.mcfunction

@@ -0,0 +1,4 @@
+data modify block 0 1 0 Text1 set value '[{"nbt":"Text1","block":"0 1 0","interpret":true},{"nbt":"Text3","block":"0 1 0","interpret":true},{"nbt":"rgb.events[0].name","storage":"ltw:mini","interpret":true}]'
+data modify block 0 1 0 Text3 set value '{"text":" 且 ","color":"white"}'
+data remove storage ltw:mini rgb.events[0]
+execute if data storage ltw:mini rgb.events[0] run function mini:rgb/game/give_random_rule_2

+ 10 - 0
data/mini/functions/rgb/game/handle_event.mcfunction

@@ -0,0 +1,10 @@
+# as rule marker
+# with rgb_op
+
+# 加分类事件
+execute if data entity @s data.events[{type:"add_red"}] run function mini:rgb/game/events/add_red
+execute if data entity @s data.events[{type:"add_green"}] run function mini:rgb/game/events/add_green
+execute if data entity @s data.events[{type:"add_blue"}] run function mini:rgb/game/events/add_blue
+
+# 重置状态
+data remove entity @s data.player.conditions

+ 20 - 0
data/mini/functions/rgb/game/player_tick.mcfunction

@@ -0,0 +1,20 @@
+# as player at @s
+
+# 添加操作者tag
+tag @s add rgb_op
+
+# 读取数据
+execute as @e[type=marker,tag=rgb_rule] run function mini:rgb/game/read_data
+
+# 测试状态
+execute as @e[type=marker,tag=rgb_rule] run data modify entity @s data.enable set value 1b
+function mini:rgb/game/check_conditions
+
+# 执行事件
+execute as @e[type=marker,tag=rgb_rule,nbt={data:{enable:1b}}] run function mini:rgb/game/handle_event
+
+# 写入数据
+execute as @e[type=marker,tag=rgb_rule] run function mini:rgb/game/write_data
+
+# 归还操作者tag
+tag @s remove rgb_op

+ 6 - 0
data/mini/functions/rgb/game/read_data.mcfunction

@@ -0,0 +1,6 @@
+# as rule marker
+# with rgb_op
+
+data modify storage ltw:mini rgb.temp_data set from entity @s data.players
+function mini:rgb/game/read_data_
+data modify entity @s data.player set from storage ltw:mini rgb.temp_data[0]

+ 6 - 0
data/mini/functions/rgb/game/read_data_.mcfunction

@@ -0,0 +1,6 @@
+# as rule marker
+# with rgb_op
+
+execute store result score #temp_id rgb_sys run data get storage ltw:mini rgb.temp_data[0].id
+execute unless score #temp_id rgb_sys = @a[tag=rgb_op,limit=1] player_id run data remove storage ltw:mini rgb.temp_data[0]
+execute unless score #temp_id rgb_sys = @a[tag=rgb_op,limit=1] player_id run function mini:rgb/game/read_data_

+ 6 - 0
data/mini/functions/rgb/game/remove_rule.mcfunction

@@ -0,0 +1,6 @@
+# as rule marker
+
+tellraw @a[tag=mini_running] [{"text": ">> ","bold": true,"color": "light_purple"}, {"text": "一条规则被销毁:","bold": false},{"nbt":"data.name","entity": "@s","bold": false,"interpret": true}]
+execute as @a[tag=mini_running] at @s facing entity @e[tag=rgb_new_rule,limit=1] eyes positioned ^ ^ ^5 run playsound minecraft:entity.armor_stand.break player @s ~ ~ ~
+
+kill @s

+ 6 - 0
data/mini/functions/rgb/game/tp_new_item.mcfunction

@@ -0,0 +1,6 @@
+# as item
+data modify entity @s Owner set from entity @a[tag=rgb_temp,limit=1] UUID
+data modify entity @s Thrower set from entity @a[tag=rgb_temp,limit=1] UUID
+data modify entity @s PickupDelay set value 0
+data modify entity @s Item.tag.rgb_newrule set value 0
+tp @s @a[tag=rgb_temp,limit=1]

+ 8 - 0
data/mini/functions/rgb/game/write_data.mcfunction

@@ -0,0 +1,8 @@
+# as rule marker
+# with rgb_op
+
+data modify storage ltw:mini rgb.temp_data set from entity @s data.players
+data modify storage ltw:mini rgb.temp_data1 set from entity @s data.player
+data modify storage ltw:mini rgb.temp_data2 set value []
+function mini:rgb/game/write_data_
+data modify entity @s data.players set from storage ltw:mini rgb.temp_data2

+ 8 - 0
data/mini/functions/rgb/game/write_data_.mcfunction

@@ -0,0 +1,8 @@
+# as rule marker
+# with rgb_op
+
+execute store result score #temp_id rgb_sys run data get storage ltw:mini rgb.temp_data[0].id
+execute if score #temp_id rgb_sys = @a[tag=rgb_op,limit=1] player_id run data modify storage ltw:mini rgb.temp_data2 prepend from storage ltw:mini rgb.temp_data1
+execute unless score #temp_id rgb_sys = @a[tag=rgb_op,limit=1] player_id run data modify storage ltw:mini rgb.temp_data2 prepend from storage ltw:mini rgb.temp_data[0]
+data remove storage ltw:mini rgb.temp_data[0]
+execute if data storage ltw:mini rgb.temp_data[0] run function mini:rgb/game/write_data_

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

@@ -0,0 +1 @@
+forceload remove 1000 8000 1032 7032

+ 21 - 0
data/mini/functions/rgb/game_init.mcfunction

@@ -0,0 +1,21 @@
+# 初始化地图
+forceload add 1000 8000 1032 7032
+
+scoreboard players set $finish_mode mem 1
+scoreboard players set $countdown_fast mem 0
+scoreboard players set $survival mem 0
+
+# 生成地图
+# TODO
+
+# 伤害管理
+scoreboard players set $remove_resistance mem 1
+team modify playing friendlyFire false
+team modify playing collisionRule always
+team modify playing deathMessageVisibility always
+gamerule naturalRegeneration false
+gamerule fallDamage true
+
+# 重置系统
+data remove storage ltw:mini rgb
+scoreboard players set $ rgb_rule_id 0

+ 13 - 0
data/mini/functions/rgb/game_start.mcfunction

@@ -0,0 +1,13 @@
+# 游戏结束倒计时
+scoreboard players set $countdown mem 100
+
+# HUD
+scoreboard objectives setdisplay list health_disp
+scoreboard objectives setdisplay belowName health_disp
+scoreboard objectives setdisplay sidebar health_disp
+scoreboard players set $bossbar_color mem 3
+scoreboard players set $countdown_max mem 100
+scoreboard players set $bossbar_type mem 2
+function lib:bossbar/show
+bossbar set mini:green name "剩余时间"
+bossbar set mini:red name "强制死亡模式"

+ 21 - 0
data/mini/functions/rgb/init.mcfunction

@@ -0,0 +1,21 @@
+# 重置计分板
+scoreboard objectives remove rgb_sys
+scoreboard objectives add rgb_sys dummy "RGB小游戏系统变量"
+scoreboard objectives remove rgb_rule_id
+scoreboard objectives add rgb_rule_id dummy "RGB小游戏规则ID"
+
+scoreboard objectives remove rgb_R
+scoreboard objectives add rgb_R dummy {"text": "R","color": "red"}
+scoreboard objectives remove rgb_G
+scoreboard objectives add rgb_R dummy {"text": "G","color": "green"}
+scoreboard objectives remove rgb_B
+scoreboard objectives add rgb_R dummy {"text": "B","color": "blue"}
+
+scoreboard objectives remove rgb_obtain_rule
+scoreboard objectives add rgb_obtain_rule minecraft.mined:minecraft.pumpkin "RGB小游戏获得规则计分板"
+scoreboard objectives remove rgb_place_rule
+scoreboard objectives add rgb_place_rule minecraft.used:armor_stand "RGB小游戏放置规则计分板"
+scoreboard objectives remove rgb_destroy_rule
+scoreboard objectives add rgb_destroy_rule minecraft.killed:armor_stand "RGB小游戏销毁规则计分板"
+scoreboard objectives remove rgb_shift
+scoreboard objectives add rgb_shift custom:sneak_time "RGB小游戏潜行时间"

+ 25 - 0
data/mini/functions/rgb/player_enter.mcfunction

@@ -0,0 +1,25 @@
+# 单个玩家开始小游戏时执行
+function lib:sounds/music/mini_secret
+title @s clear
+title @s actionbar ""
+
+# 状态效果
+effect clear @s
+effect give @s night_vision 1000000 0 true
+
+# 设置玩家生命
+attribute @s generic.max_health base set 20
+gamerule naturalRegeneration false
+
+
+# 计分板重置
+scoreboard players set @s rgb_R 0
+scoreboard players set @s rgb_G 0
+scoreboard players set @s rgb_B 0
+
+# 传送玩家
+spreadplayers 1015 8015 1 10 under 15 false @s[team=playing,tag=!rejoining]
+
+# 调整模式
+gamemode spectator @s[team=!debugging]
+gamemode adventure @s[team=playing,tag=!rejoining]

+ 8 - 0
data/mini/functions/rgb/player_intro.mcfunction

@@ -0,0 +1,8 @@
+# 向单个玩家展示小游戏介绍
+tp @s[team=!debugging] 1010 23 7010 -45 45
+effect give @s night_vision 1000000 0 true
+tellraw @s ["",{"text":"\n >> RGB >>\n\n","color":"gold","bold":true},{"text": " R! ","color": "red"},{"text": "G! ","color": "green"},{"text": "B! ","color": "blue"},"\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 ""

+ 8 - 0
data/mini/functions/rgb/tick2.mcfunction

@@ -0,0 +1,8 @@
+# 给予镐子
+execute as @a[tag=mini_running] unless data entity @s Inventory[{Slot:8b,id:"minecraft:netherite_pickaxe",tag:{game_item:1b}}] run function mini:rgb/game/give_pickaxe
+
+# 新增规则
+execute as @e[type=armor_stand,tag=rgb_new_rule] at @s run function mini:rgb/game/add_rule
+
+# 销毁规则
+execute as @e[type=marker,tag=rgb_rule] run function mini:rgb/game/check_rule_exists

+ 0 - 0
data/mini/functions/rgb/tick20.mcfunction


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

@@ -0,0 +1,14 @@
+# 挖出规则
+execute as @a[tag=mini_running] if score @s rgb_obtain_rule matches 1.. at @s run function mini:rgb/game/give_random_rule
+
+# 对每一个玩家进行条件检定和事件执行
+execute as @a[tag=mini_running] at @s run function mini:rgb/game/player_tick
+
+# 清理计分板
+scoreboard players set @a[tag=mini_running] rgb_obtain_rule 0
+scoreboard players set @a[tag=mini_running] rgb_place_rule 0
+scoreboard players set @a[tag=mini_running] rgb_destroy_rule 0
+scoreboard players set @a[tag=mini_running] rgb_shift 0
+
+# 展示RGB计分
+execute as @a[tag=mini_running] run title @s actionbar [{"text":"R=","color": "red","bold": true},{"score":{"name": "@s","objective": "rgb_R"},"color": "red"},"  ",{"text":"G=","color": "green"},{"score":{"name": "@s","objective": "rgb_G"},"color": "green"},"  ",{"text":"B=","color": "blue"},{"score":{"name": "@s","objective": "rgb_B"},"color": "blue"}]

+ 2 - 0
data/mini/functions/rgb/watcher_limit.mcfunction

@@ -0,0 +1,2 @@
+# 观察者限制飞行范围
+# TODO

+ 64 - 0
data/mini/loot_tables/rgb/green.json

@@ -0,0 +1,64 @@
+{
+    "pools": [
+        {
+            "rolls": 1,
+            "entries": [
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'下蹲',type:'shift'}],events:[{name:'{\"text\":\"+1\",\"color\":\"green\"}',type:'add_green',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'在水中',type:'in_water'}],events:[{name:'{\"text\":\"+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'离开地面',type:'on_air'}],events:[{name:'{\"text\":\"+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'在阳光直射处',type:'sky_light_15'}],events:[{name:'{\"text\":\"+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'在黑暗中',type:'in_dark'}],events:[{name:'{\"text\":\"+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}

+ 75 - 0
data/mini/loot_tables/rgb/red.json

@@ -0,0 +1,75 @@
+{
+    "pools": [
+        {
+            "rolls": 1,
+            "entries": [
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'{\"text\":\"下蹲5秒\",\"color\":\"yellow\"}',type:'shift',value:3s}],events:[{name:'{\"text\":\"R+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'{\"text\":\"在水中3秒\",\"color\":\"yellow\"}',type:'in_water',value:3s}],events:[{name:'{\"text\":\"R+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'{\"text\":\"离开地面3秒\",\"color\":\"yellow\"}',type:'on_air',value:3s}],events:[{name:'{\"text\":\"R+2\",\"color\":\"red\"}',type:'add_red',value:2s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'{\"text\":\"晒太阳5秒\",\"color\":\"yellow\"}',type:'sky_light_15',value:5s}],events:[{name:'{\"text\":\"R+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'{\"text\":\"站在黑曜石上3秒\",\"color\":\"yellow\"}',type:'on_obsidian',value:3s}],events:[{name:'{\"text\":\"R+1\",\"color\":\"red\"}',type:'add_red',value:1s}]}"
+                        }
+                    ]
+                },
+                {
+                    "type": "minecraft:item",
+                    "name": "minecraft:armor_stand",
+                    "weight": 1,
+                    "functions": [
+                        {
+                            "function": "minecraft:set_nbt",
+                            "tag": "{conditions:[{name:'{\"text\":\"站在南瓜上\",\"color\":\"yellow\"}',type:'on_pumpkin',value:0s}],events:[{name:'{\"text\":\"R=30\",\"color\":\"red\"}',type:'set_red',value:30s},{name:'{\"text\":\"清除下方的南瓜\",\"color\":\"yellow\"}',type:'remove_block',value:-1s}]}"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}

+ 8 - 0
data/mini/predicates/rgb/in_water.json

@@ -0,0 +1,8 @@
+{
+    "condition": "location_check",
+    "predicate": {
+        "fluid": {
+            "tag": "minecraft:water"
+        }
+    }
+}

+ 6 - 0
data/mini/predicates/rgb/smokey.json

@@ -0,0 +1,6 @@
+{
+    "condition": "location_check",
+    "predicate": {
+        "smokey": true
+    }
+}

+ 11 - 0
data/test/functions/mini/rgb.mcfunction

@@ -0,0 +1,11 @@
+# 测试用:快速开始 RGB
+team join playing @a[team=watching]
+clear @a[team=!debugging]
+function ltw:state/0/start_game
+scoreboard players set $round mem 5
+scoreboard players set $mini_type mem 202
+function mini:main/game_init
+function ltw:state/4/state_enter
+say 已开始单个测试游戏!
+
+schedule function test:countdown/quick 20t