龙腾猫跃 пре 3 година
родитељ
комит
00267f5355

+ 16 - 18
data/item/functions/bonus_item/add_score.mcfunction

@@ -2,25 +2,23 @@
 execute store result score #bonus_add_score mem run data get storage item:bonus item.tag.bonus_add_score
 
 # 正常的加分
-execute if score #bonus_add_score mem matches ..10 run scoreboard players operation @s total_score += #bonus_add_score mem
-execute if score #bonus_add_score mem matches ..10 run scoreboard players operation @s total_score_disp += #bonus_add_score mem
-execute if score #bonus_add_score mem matches ..0 run tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"selector": "@s","color":"red"}," 没能获得积分……"]
+execute if score #bonus_add_score mem matches 1..10 run scoreboard players operation @s total_score += #bonus_add_score mem
+execute if score #bonus_add_score mem matches 1..10 run scoreboard players operation @s total_score_disp += #bonus_add_score mem
 execute if score #bonus_add_score mem matches 1..10 run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 获得了 ",{"score": {"name":"#bonus_add_score","objective": "mem"},"color":"aqua"},{"text": " 积分","color":"aqua"},", 当前共有 ",{"score": {"name": "@s","objective": "total_score"}}, " 积分"]
 
-# 100:普通硬币 / 101:高级硬币
-scoreboard players set $random_max mem 1
-scoreboard players set $random_min mem 0
-function lib:random
-execute if score #bonus_add_score mem matches 100..101 if score $random mem matches 1 run scoreboard players operation @s total_score *= #2 mem
-execute if score #bonus_add_score mem matches 100..101 if score $random mem matches 1 run scoreboard players operation @s total_score_disp *= #2 mem
-execute if score #bonus_add_score mem matches 100..101 if score $random mem matches 1 run tellraw @a ["",{"text": ">> ","color":"green","bold": true},{"selector": "@s","color":"green"}," 投出了正面, 积分加倍, 当前共有 ",{"score": {"name": "@s","objective": "total_score"},"color":"green"},{"text": " 积分", "color":"green"}]
-execute if score #bonus_add_score mem matches 100 if score $random mem matches 0 run scoreboard players operation @s total_score /= #2 mem
-execute if score #bonus_add_score mem matches 100 if score $random mem matches 0 run scoreboard players operation @s total_score_disp /= #2 mem
-execute if score #bonus_add_score mem matches 100 if score $random mem matches 0 run tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"selector": "@s","color":"red"}," 投出了反面, 积分减半, 当前共有 ",{"score": {"name": "@s","objective": "total_score"},"color":"red"},{"text": " 积分", "color":"red"}]
-execute if score #bonus_add_score mem matches 101 if score $random mem matches 0 run tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"selector": "@s","color":"red"}," 投出了反面, 积分不变, 当前共有 ",{"score": {"name": "@s","objective": "total_score"},"color":"red"},{"text": " 积分", "color":"red"}]
+# 没有加分
+execute if score #bonus_add_score mem matches 0 run tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"selector": "@s","color":"red"}," 没能获得积分……"]
+
+# 清零
+execute if score #bonus_add_score mem matches ..-1 run tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"selector": "@s","color":"red"}," 的积分惨遭清零……"]
+execute if score #bonus_add_score mem matches ..-1 run scoreboard players set @s total_score 0
+execute if score #bonus_add_score mem matches ..-1 run scoreboard players set @s total_score_disp 0
+
+# 刷新显示
+function item:refresh_level
 
 # 给予进度
-execute if entity @s[scores={total_score=10..}] run advancement grant @s only ltw:story/score1
-execute if entity @s[scores={total_score=20..}] run advancement grant @s only ltw:story/score2
-execute if entity @s[scores={total_score=30..}] run advancement grant @s only ltw:story/score3
-execute if entity @s[scores={total_score=40..}] run advancement grant @s only ltw:story/score4
+execute if entity @s[scores={total_score=8..}] run advancement grant @s only ltw:story/score1
+execute if entity @s[scores={total_score=16..}] run advancement grant @s only ltw:story/score2
+execute if entity @s[scores={total_score=24..}] run advancement grant @s only ltw:story/score3
+execute if entity @s[scores={total_score=32..}] run advancement grant @s only ltw:story/score4

+ 4 - 0
data/item/functions/bonus_item/stole_score.mcfunction

@@ -16,6 +16,10 @@ scoreboard players operation @s total_score_disp += #bonus_stole_score mem
 scoreboard players operation @a[tag=highest] total_score -= #bonus_stole_score mem
 scoreboard players operation @a[tag=highest] total_score_disp -= #bonus_stole_score mem
 
+# 刷新显示
+function item:refresh_level
+execute as @a[tag=highest] run function item:refresh_level
+
 # 显示提示
 execute if entity @s[tag=highest] run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 保护住了自己的分数!"]
 execute if entity @s[tag=!highest] run tellraw @a ["",{"text": ">> ","color":"green","bold": true},{"selector": "@s","color":"green"}," 偷到了 ",{"score": {"name": "#bonus_stole_score","objective": "mem"},"color":"green"},{"text": " 积分","color":"green"},", 当前共有 ",{"score": {"name": "@s","objective": "total_score"}}, " 积分"]

+ 19 - 0
data/item/functions/refresh_level.mcfunction

@@ -0,0 +1,19 @@
+scoreboard players operation @s temp = @s total_score_disp
+
+# 四分到 0~15
+xp set @s[scores={temp=0..15}] 0 levels
+xp set @s[scores={temp=16..31}] 16 levels
+xp set @s[scores={temp=32..47}] 32 levels
+xp set @s[scores={temp=48..}] 48 levels
+scoreboard players operation @s temp %= #16 mem
+
+# 四分到 0~3
+xp add @s[scores={temp=4..7}] 4 levels
+xp add @s[scores={temp=8..11}] 8 levels
+xp add @s[scores={temp=12..}] 12 levels
+scoreboard players operation @s temp %= #4 mem
+
+# 最终添加
+xp add @s[scores={temp=1}] 1 levels
+xp add @s[scores={temp=2}] 2 levels
+xp add @s[scores={temp=3}] 3 levels

BIN
data/item/loot_tables/item/document.xlsx


+ 4 - 15
data/item/loot_tables/score/blue.json

@@ -77,34 +77,23 @@
 },
 {
     "type": "minecraft:item",
-    "weight": 6,
+    "weight": 5,
     "name": "minecraft:map",
     "functions": [
         {
             "function": "minecraft:set_nbt",
-            "tag": "{item_name:'{\"text\":\"1/2 概率获得 10 积分\",\"color\":\"light_purple\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:0}"
+            "tag": "{item_name:'{\"text\":\"一半概率获得 10 积分\",\"color\":\"light_purple\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:0}"
         }
     ]
 },
 {
     "type": "minecraft:item",
-    "weight": 6,
+    "weight": 5,
     "name": "minecraft:map",
     "functions": [
         {
             "function": "minecraft:set_nbt",
-            "tag": "{item_name:'{\"text\":\"1/2 概率获得 10 积分\",\"color\":\"light_purple\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:10}"
-        }
-    ]
-},
-{
-    "type": "minecraft:item",
-    "weight": 6,
-    "name": "minecraft:magenta_glazed_terracotta",
-    "functions": [
-        {
-            "function": "minecraft:set_nbt",
-            "tag": "{item_name:'{\"text\":\"积分随机翻倍或不变\",\"color\":\"light_purple\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:101}"
+            "tag": "{item_name:'{\"text\":\"一半概率获得 10 积分\",\"color\":\"light_purple\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:10}"
         }
     ]
 }

+ 12 - 1
data/item/loot_tables/score/green.json

@@ -163,7 +163,18 @@
     "functions": [
         {
             "function": "minecraft:set_nbt",
-            "tag": "{item_name:'{\"text\":\"积分随机翻倍或减半\",\"color\":\"aqua\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:100}"
+            "tag": "{item_name:'{\"text\":\"积分随机 +7 或清零\",\"color\":\"aqua\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:-1}"
+        }
+    ]
+},
+{
+    "type": "minecraft:item",
+    "weight": 6,
+    "name": "minecraft:magenta_glazed_terracotta",
+    "functions": [
+        {
+            "function": "minecraft:set_nbt",
+            "tag": "{item_name:'{\"text\":\"积分随机 +7 或清零\",\"color\":\"aqua\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:7}"
         }
     ]
 }

+ 22 - 0
data/item/loot_tables/score/white.json

@@ -58,6 +58,28 @@
             "tag": "{item_name:'{\"text\":\"1/4 概率获得 5 积分\",\"color\":\"white\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:5}"
         }
     ]
+},
+{
+    "type": "minecraft:item",
+    "weight": 4,
+    "name": "minecraft:magenta_glazed_terracotta",
+    "functions": [
+        {
+            "function": "minecraft:set_nbt",
+            "tag": "{item_name:'{\"text\":\"积分随机 +4 或清零\",\"color\":\"white\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:-1}"
+        }
+    ]
+},
+{
+    "type": "minecraft:item",
+    "weight": 4,
+    "name": "minecraft:magenta_glazed_terracotta",
+    "functions": [
+        {
+            "function": "minecraft:set_nbt",
+            "tag": "{item_name:'{\"text\":\"积分随机 +4 或清零\",\"color\":\"white\"}',is_bonus:1b,bonus_new:1b,bonus_add_score:4}"
+        }
+    ]
 }
 
 ]}]}

+ 1 - 1
data/ltw/advancements/story/score1.json

@@ -8,7 +8,7 @@
         "text": "积分猎手 · α "
       },
       "description": [
-        {"text": "在单局游戏中达到 10 积分\n", "color":"gray"},
+        {"text": "在单局游戏中达到 8 积分\n", "color":"gray"},
         {"text": "奖励: ","color":"green"},
         {"text": "1 绿宝石","color":"white"}
       ],

+ 1 - 1
data/ltw/advancements/story/score2.json

@@ -8,7 +8,7 @@
         "text": "积分猎手 · β "
       },
       "description": [
-        {"text": "在单局游戏中达到 20 积分\n", "color":"gray"},
+        {"text": "在单局游戏中达到 16 积分\n", "color":"gray"},
         {"text": "奖励: ","color":"green"},
         {"text": "2 绿宝石","color":"white"}
       ],

+ 1 - 1
data/ltw/advancements/story/score3.json

@@ -8,7 +8,7 @@
         "text": "积分猎手 · γ "
       },
       "description": [
-        {"text": "在单局游戏中达到 30 积分\n", "color":"gray"},
+        {"text": "在单局游戏中达到 24 积分\n", "color":"gray"},
         {"text": "奖励: ","color":"green"},
         {"text": "2 绿宝石","color":"white"}
       ],

+ 1 - 1
data/ltw/advancements/story/score4.json

@@ -8,7 +8,7 @@
         "text": "积分猎手 · Ω "
       },
       "description": [
-        {"text": "在单局游戏中达到 40 积分\n", "color":"gray"},
+        {"text": "在单局游戏中达到 32 积分\n", "color":"gray"},
         {"text": "究极隐藏挑战!","color":"dark_gray","italic": true}
       ],
       "frame": "challenge",

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

@@ -95,6 +95,7 @@ scoreboard players set #7 mem 7
 scoreboard players set #8 mem 8
 scoreboard players set #9 mem 9
 scoreboard players set #10 mem 10
+scoreboard players set #16 mem 16
 scoreboard players set #81 mem 81
 scoreboard players set #100 mem 100
 

+ 1 - 0
data/mini/functions/iron/tick20.mcfunction

@@ -1,3 +1,4 @@
+xp set @a 0 points
 
 # 显示倒计时
 execute if score $countdown mem matches ..10 run title @a times 3 14 2

+ 1 - 0
data/mini/functions/trade/tick20.mcfunction

@@ -1,3 +1,4 @@
+xp set @a 0 points
 
 # 更新绿宝石数量
 execute as @a[team=playing] store result score @s emerald run clear @s emerald 0

+ 1 - 1
data/mini/loot_tables/diamond.json

@@ -34,7 +34,7 @@
           {
             "function": "minecraft:set_count",
             "count": {
-              "min": 1.0,
+              "min": 2.0,
               "max": 3.0,
               "type": "minecraft:uniform"
             }