Przeglądaj źródła

新的结算系统

龙腾猫跃 3 lat temu
rodzic
commit
4b713479c5

+ 1 - 0
data/item/functions/bonus_item/gold.mcfunction

@@ -4,6 +4,7 @@ execute store result score #bonus_gold mem run data get storage item:bonus item.
 # 更改积分
 scoreboard players operation @s gold += #bonus_gold mem
 scoreboard players operation @s gold_total += #bonus_gold mem
+scoreboard players operation @s gold_extra += #bonus_gold mem
 
 # 显示提示
 tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 获得了 ",{"score": {"name": "#bonus_gold","objective": "mem"},"color":"aqua"},{"text": " 金粒","color":"aqua"}]

+ 3 - 3
data/item/functions/bonus_item/stole_score.mcfunction

@@ -17,6 +17,6 @@ scoreboard players operation @a[tag=highest] total_score -= #bonus_stole_score m
 scoreboard players operation @a[tag=highest] total_score_disp -= #bonus_stole_score mem
 
 # 显示提示
-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":"red","bold": true},{"selector": "@a[tag=highest]","color":"red"}," 被偷取了 ",{"score": {"name": "#bonus_stole_score","objective": "mem"},"color":"red"},{"text": " 积分","color":"red"},", 当前共有 ",{"score": {"name": "@a[tag=highest,limit=1]","objective": "total_score"}}, " 积分"]
-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"}}, " 积分"]
+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"}}, " 积分"]
+execute if entity @s[tag=!highest] run tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"selector": "@p[tag=highest]","color":"red"}," 被偷走了 ",{"score": {"name": "#bonus_stole_score","objective": "mem"},"color":"red"},{"text": " 积分","color":"red"},", 当前还剩 ",{"score": {"name": "@p[tag=highest]","objective": "total_score"}}, " 积分"]

+ 4 - 4
data/item/functions/shop/buy/023_arrow.mcfunction

@@ -1,14 +1,14 @@
-# 缓慢之箭 x2 (4g)
+# 缓慢之箭 x2 (8g)
 scoreboard players add @s shop_02_arrow 0
 tag @s remove canbuy
-tag @s[scores={shop_02_arrow=2,gold=36..}] add canbuy
+tag @s[scores={shop_02_arrow=2,gold=72..}] add canbuy
 tellraw @s[scores={shop_02_arrow=3..}] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经购买了这个物品了!","color":"aqua"}]
-tellraw @s[scores={shop_02_arrow=2,gold=..35}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的金锭来购买这个物品!","color":"red"}]
+tellraw @s[scores={shop_02_arrow=2,gold=..71}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的金锭来购买这个物品!","color":"red"}]
 tellraw @s[scores={shop_02_arrow=..1}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先购买上一级的物品!","color":"red"}]
 tellraw @s[tag=canbuy] ["",{"text":">> ","color":"green","bold":true},"你购买了 ",{"text":"缓慢之箭 x2","color":"green"}]
 execute as @s[tag=canbuy] run tellraw @a[tag=!canbuy] ["",{"text":">> ","color":"green","bold":true},{"selector": "@s","color":"green"}," 购买了 ",{"text":"缓慢之箭 x2","color":"green"}]
 scoreboard players add @s[tag=canbuy] shop_02_arrow 1
-scoreboard players remove @s[tag=canbuy] gold 36
+scoreboard players remove @s[tag=canbuy] gold 72
 execute as @s[tag=!canbuy] at @s run function lib:sounds/error
 execute as @s[tag=canbuy] at @s run function lib:sounds/levelup
 execute as @s[tag=canbuy] run function item:shop/refresh_gold

+ 4 - 4
data/item/functions/shop/buy/053_axe.mcfunction

@@ -1,14 +1,14 @@
-# 金斧耐久升级 (4g)
+# 金斧耐久升级 (8g)
 scoreboard players add @s shop_05_axe 0
 tag @s remove canbuy
-tag @s[scores={shop_05_axe=2,gold=36..}] add canbuy
+tag @s[scores={shop_05_axe=2,gold=72..}] add canbuy
 tellraw @s[scores={shop_05_axe=3..}] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经购买了这个物品了!","color":"aqua"}]
-tellraw @s[scores={shop_05_axe=2,gold=..35}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的金锭来购买这个物品!","color":"red"}]
+tellraw @s[scores={shop_05_axe=2,gold=..71}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的金锭来购买这个物品!","color":"red"}]
 tellraw @s[scores={shop_05_axe=..1}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先购买上一级的物品!","color":"red"}]
 tellraw @s[tag=canbuy] ["",{"text":">> ","color":"green","bold":true},"你购买了 ",{"text":"金斧耐久升级","color":"green"}]
 execute as @s[tag=canbuy] run tellraw @a[tag=!canbuy] ["",{"text":">> ","color":"green","bold":true},{"selector": "@s","color":"green"}," 购买了 ",{"text":"金斧耐久升级","color":"green"}]
 scoreboard players add @s[tag=canbuy] shop_05_axe 1
-scoreboard players remove @s[tag=canbuy] gold 36
+scoreboard players remove @s[tag=canbuy] gold 72
 execute as @s[tag=!canbuy] at @s run function lib:sounds/error
 execute as @s[tag=canbuy] at @s run function lib:sounds/levelup
 execute as @s[tag=canbuy] run function item:shop/refresh_gold

+ 2 - 0
data/item/functions/shop/init.mcfunction

@@ -2,8 +2,10 @@
 # 商店系统
 scoreboard objectives add gold dummy "金粒"
 scoreboard objectives add gold_total dummy "总金粒"
+scoreboard objectives add gold_extra dummy "局内获得的金粒"
 scoreboard objectives add green dummy "绿宝石"
 scoreboard objectives add green_total dummy "总绿宝石"
+scoreboard objectives add green_extra dummy "局内获得的绿宝石"
 scoreboard objectives add buy_trigger trigger "触发器_购买物品"
 scoreboard objectives add particle_type dummy "粒子种类"
 

+ 3 - 1
data/ltw/functions/advancement/bonus_1.mcfunction

@@ -1,4 +1,6 @@
 scoreboard players add @s green 1
 scoreboard players add @s green_total 1
+scoreboard players add @s green_extra 1
 execute if score $state mem matches 0 run function item:shop/refresh_green
-execute at @s run function lib:sounds/levelup
+execute at @s run function lib:sounds/levelup
+tellraw @s ["",{"text": ">> ","color":"green","bold": true},"你获得了 ",{"text":"1 绿宝石","color":"green"}," 完成奖励!"]

+ 3 - 1
data/ltw/functions/advancement/bonus_2.mcfunction

@@ -1,4 +1,6 @@
 scoreboard players add @s green 2
 scoreboard players add @s green_total 2
+scoreboard players add @s green_extra 2
 execute if score $state mem matches 0 run function item:shop/refresh_green
-execute at @s run function lib:sounds/levelup
+execute at @s run function lib:sounds/levelup
+tellraw @s ["",{"text": ">> ","color":"green","bold": true},"你获得了 ",{"text":"2 绿宝石","color":"green"}," 完成奖励!"]

+ 3 - 1
data/ltw/functions/advancement/bonus_3.mcfunction

@@ -1,4 +1,6 @@
 scoreboard players add @s green 3
 scoreboard players add @s green_total 3
+scoreboard players add @s green_extra 3
 execute if score $state mem matches 0 run function item:shop/refresh_green
-# MC 自己会播放完成音效
+# MC 自己会播放完成音效
+tellraw @s ["",{"text": ">> ","color":"green","bold": true},"你获得了 ",{"text":"3 绿宝石","color":"green"}," 完成奖励!"]

+ 3 - 1
data/ltw/functions/advancement/bonus_4.mcfunction

@@ -1,4 +1,6 @@
 scoreboard players add @s green 4
 scoreboard players add @s green_total 4
+scoreboard players add @s green_extra 4
 execute if score $state mem matches 0 run function item:shop/refresh_green
-# MC 自己会播放完成音效
+# MC 自己会播放完成音效
+tellraw @s ["",{"text": ">> ","color":"green","bold": true},"你获得了 ",{"text":"4 绿宝石","color":"green"}," 完成奖励!"]

+ 37 - 20
data/ltw/functions/main/game_end.mcfunction

@@ -4,6 +4,8 @@
 tag @a remove total_rank1
 tag @a remove total_rank2
 tag @a remove total_rank3
+tag @a remove total_rankl
+tag @a remove total_rankx
 # 1
 function ltw:main/get_max_score
 execute as @a if score @s total_score = #score_max mem run tag @s add total_rank1
@@ -16,6 +18,12 @@ tag @a[tag=total_rank2] add max_uncounted
 function ltw:main/get_max_score
 execute as @a[tag=!max_uncounted] if score @s total_score = #score_max mem run tag @s add total_rank3
 tag @a[tag=max_uncounted] remove max_uncounted
+# 最低分
+scoreboard players set #score_min mem 2147483647
+scoreboard players operation #score_min mem < @a[team=playing] total_score
+execute as @a if score @s total_score = #score_min mem run tag @s add total_rankl
+# 没有名次
+tag @a[team=playing,tag=!total_rank1,tag=!total_rank2,tag=!total_rank3] add total_rankx
 
 # 给予进度
 scoreboard players add @a[team=playing] stat_total 1
@@ -26,54 +34,63 @@ advancement grant @a[scores={stat_win=20..}] only ltw:story/win3
 
 # 计算金粒奖励
 scoreboard players set #total_gold mem 0
-execute as @a[team=playing] run scoreboard players add #total_gold mem 400
-# 无名次
-execute as @a[tag=!total_rank1,tag=!total_rank2,tag=!total_rank3,team=playing] run scoreboard players remove #total_gold mem 100
+execute as @a[team=playing] run scoreboard players add #total_gold mem 300
 # 计算总权重与单份奖励
 scoreboard players set #total_weight mem 0
-execute as @a[tag=total_rank1] run scoreboard players add #total_weight mem 3
-execute as @a[tag=total_rank2] run scoreboard players add #total_weight mem 2
-execute as @a[tag=total_rank3] run scoreboard players add #total_weight mem 1
+execute as @a[tag=total_rank1] run scoreboard players add #total_weight mem 4
+execute as @a[tag=total_rank2] run scoreboard players add #total_weight mem 3
+execute as @a[tag=total_rank3] run scoreboard players add #total_weight mem 2
+execute as @a[tag=total_rankx] run scoreboard players add #total_weight mem 1
 scoreboard players operation #total_gold mem /= #total_weight mem
 # 计算名次奖励
-scoreboard players set #rank1_gold mem 3
+scoreboard players set #rank1_gold mem 4
 scoreboard players operation #rank1_gold mem *= #total_gold mem
 scoreboard players operation #rank1_gold mem /= #100 mem
-scoreboard players set #rank2_gold mem 2
+scoreboard players set #rank2_gold mem 3
 scoreboard players operation #rank2_gold mem *= #total_gold mem
 scoreboard players operation #rank2_gold mem /= #100 mem
-scoreboard players set #rank3_gold mem 1
+scoreboard players set #rank3_gold mem 2
 scoreboard players operation #rank3_gold mem *= #total_gold mem
 scoreboard players operation #rank3_gold mem /= #100 mem
+scoreboard players set #rankl_gold mem 1
+scoreboard players operation #rankl_gold mem *= #total_gold mem
+scoreboard players operation #rankl_gold mem /= #100 mem
 # 如果因为掉线强制结束则无名次奖励
 execute store result score #count mem if entity @a[team=playing]
 execute if score #count mem matches ..2 run scoreboard players set #rank1_gold mem 0
 execute if score #count mem matches ..2 run scoreboard players set #rank2_gold mem 0
 execute if score #count mem matches ..2 run scoreboard players set #rank3_gold mem 0
+execute if score #count mem matches ..2 run scoreboard players set #rankl_gold mem 0
 
 # 显示排名
-tellraw @a [" ",{"text":"\n----- 游戏结束 -----\n","color":"green","bold":true}]
-tellraw @a [" ",{"text": "第一名 - ","color":"green"},{"selector": "@a[tag=total_rank1]","color":"white"},{"text":" (","color":"gray"},{"score":{"name": "@p[tag=total_rank1]","objective": "total_score"},"color":"gray"},{"text":")","color":"gray"}]
-execute if entity @a[tag=total_rank2] run tellraw @a [" ",{"text": "第二名 - ","color":"green"},{"selector": "@a[tag=total_rank2]","color":"white"},{"text":" (","color":"gray"},{"score":{"name": "@p[tag=total_rank2]","objective": "total_score"},"color":"gray"},{"text":")","color":"gray"}]
-execute if entity @a[tag=total_rank3] run tellraw @a [" ",{"text": "第三名 - ","color":"green"},{"selector": "@a[tag=total_rank3]","color":"white"},{"text":" (","color":"gray"},{"score":{"name": "@p[tag=total_rank3]","objective": "total_score"},"color":"gray"},{"text":")","color":"gray"}]
+tellraw @a ["",{"text":"\n------  全部游戏结束! ------\n","color":"light_purple","bold":true}]
+tellraw @a ["  ",{"text": "第一名 - ","color":"red"},{"selector": "@a[tag=total_rank1]","color":"red"},{"text":" (","color":"gray"},{"score":{"name": "@p[tag=total_rank1]","objective": "total_score"},"color":"gray"},{"text":" 积分)","color":"gray"}]
+execute if entity @a[tag=total_rank2] run tellraw @a ["  ",{"text": "第二名 - ","color":"gold"},{"selector": "@a[tag=total_rank2]","color":"gold"},{"text":" (","color":"gray"},{"score":{"name": "@p[tag=total_rank2]","objective": "total_score"},"color":"gray"},{"text":" 积分)","color":"gray"}]
+execute if entity @a[tag=total_rank3] run tellraw @a ["  ",{"text": "第三名 - ","color":"yellow"},{"selector": "@a[tag=total_rank3]","color":"yellow"},{"text":" (","color":"gray"},{"score":{"name": "@p[tag=total_rank3]","objective": "total_score"},"color":"gray"},{"text":" 积分)","color":"gray"}]
 tellraw @a ""
 
 # 积分金粒奖励
-execute as @a[team=playing] run scoreboard players operation @s temp2 = @s total_score
-execute as @a[team=playing] run scoreboard players operation @s temp2 /= #2 mem
-execute as @a[team=playing] run scoreboard players operation @s gold += @s temp2
-execute as @a[team=playing] run scoreboard players operation @s gold_total += @s temp2
-tellraw @a[team=playing] [" ",{"text": "积分奖励: ","color":"gold"},{"score":{"name": "*","objective": "temp2"}}," 金粒"]
+execute as @a[team=playing] run scoreboard players operation @s gold += @s total_score
+execute as @a[team=playing] run scoreboard players operation @s gold_total += @s total_score
+tellraw @a[team=playing,scores={total_score=1..}] [" 你得到的 ",{"score":{"name": "*","objective": "total_score"},"color":"gold"},{"text": " 积分","color":"gold"}," 已转换为 ",{"score":{"name": "*","objective": "total_score"},"color":"gold"},{"text": " 金粒","color":"gold"},"!"]
+
+# 局中金粒
+tellraw @a[team=playing,scores={gold_extra=1..}] [" 在游戏过程中,你拿到了额外的 ",{"score":{"name": "*","objective": "gold_extra"},"color":"gold"},{"text": " 金粒","color":"gold"},"!"]
+
+# 局中绿宝石
+tellraw @a[team=playing,scores={green_extra=1..}] [" 由于达成了进度,你得到了 ",{"score":{"name": "*","objective": "green_extra"},"color":"green"},{"text": " 绿宝石","color":"green"}," 完成奖励!"]
 
 # 名次金粒奖励
 scoreboard players set @a temp 0
 execute as @a[tag=total_rank1] run scoreboard players operation @s temp = #rank1_gold mem
 execute as @a[tag=total_rank2] run scoreboard players operation @s temp = #rank2_gold mem
 execute as @a[tag=total_rank3] run scoreboard players operation @s temp = #rank3_gold mem
-scoreboard players set @a[tag=!total_rank1,tag=!total_rank2,tag=!total_rank3,team=playing] temp 1
+execute as @a[tag=total_rankx] run scoreboard players operation @s temp = #rankl_gold mem
 execute as @a run scoreboard players operation @s gold += @s temp
 execute as @a run scoreboard players operation @s gold_total += @s temp
-tellraw @a[team=playing] [" ",{"text": "名次奖励: ","color":"gold"},{"score":{"name": "*","objective": "temp"}}," 金粒"]
+tellraw @a[team=playing,tag=!total_rankx,tag=!total_rankl,scores={temp=1..}] [" 最后,由于你的出色名次,还获得了 ",{"score":{"name": "*","objective": "temp"},"color":"gold"},{"text": " 金粒","color":"gold"}," 奖励!"]
+tellraw @a[team=playing,tag=!total_rankx,tag=total_rankl,scores={temp=1..}] [" 不要气馁,收下 ",{"score":{"name": "*","objective": "temp"},"color":"gold"},{"text": " 金粒","color":"gold"}," 奖励,继续加油吧!"]
+tellraw @a[team=playing,tag=total_rankx,scores={temp=1..}] [" 不要气馁,收下 ",{"score":{"name": "*","objective": "temp"},"color":"gold"},{"text": " 金粒","color":"gold"}," 奖励,继续加油吧!"]
 
 # 奖励结束
 tellraw @a[team=playing] ""

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

@@ -16,6 +16,8 @@ scoreboard players reset * total_score
 scoreboard players set @a[team=playing] total_score 0
 scoreboard players reset * total_score_disp
 scoreboard players set @a[team=playing] total_score_disp 0
+scoreboard players set @a gold_extra 0
+scoreboard players set @a green_extra 0
 scoreboard players set $round mem 1
 scoreboard players add $ game_id 1
 scoreboard players operation @a game_id = $ game_id