Parcourir la source

重构粒子购买

LTCatt il y a 6 ans
Parent
commit
0f421923a7

+ 14 - 12
data/item/functions/shop/buy_particle2.mcfunction

@@ -2,21 +2,23 @@
 # 触发器ID 104
 execute unless entity @s[scores={shop_particle_2=0..}] run scoreboard players set @s shop_particle_2 0
 tag @s remove canbuy
-tag @s[scores={shop_particle_s=1,shop_particle_2=0,green=3..}] add canbuy
+tag @s[scores={shop_particle_s=1..,shop_particle_2=0,green=3..}] add canbuy
 
-tellraw @s[scores={shop_particle_2=1..},tag=!show_particle_2] ["",{"text":">> ","color":"aqua","bold":true},{"text":"成功切换 ","color":"aqua"},{"text":"素雅粒子","color":"green"}]
-tellraw @s[scores={shop_particle_2=1..},tag=show_particle_2] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经激活了 ","color":"aqua"},{"text":"素雅粒子","color":"green"}]
-tellraw @s[scores={shop_particle_2=0,green=..2},tag=particle] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买这个粒子!","color":"red"}]
-tellraw @s[tag=!particle] ["",{"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"}]
+tellraw @s[scores={shop_particle_s=0}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先在左侧购买尾迹特效才能切换尾迹种类!","color":"red"}]
+execute as @s[scores={shop_particle_s=0}] at @s run function lib:sounds/error
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_2=1..}] ["",{"text":">> ","color":"aqua","bold":true},"尾迹特效已切换为 ",{"text":"绿光","color":"aqua"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_2=1..}] at @s run function lib:sounds/hit
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_2=0,green=..2}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买它!","color":"red"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_2=0,green=..2}] at @s run function lib:sounds/error
+
+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_particle_2 1
 scoreboard players remove @s[tag=canbuy] green 3
-execute as @s[scores={shop_particle_2=0}] at @s run function lib:sounds/error
-execute as @s[scores={shop_particle_2=1..}] at @s run function lib:sounds/levelup
 execute as @s[tag=canbuy] run function item:shop/refresh_green
+execute as @s[tag=canbuy] at @s run function lib:sounds/levelup
 tag @s remove canbuy
 
-# 切换粒子
-execute as @s[scores={shop_particle_2=1..},tag=!show_particle_2] run function item:particle/reset_particle
-execute as @s[scores={shop_particle_2=1..},tag=!show_particle_2] run tag @s add show_particle_2
+scoreboard players set @s[scores={shop_particle_2=1..}] particle_type 2

+ 15 - 12
data/item/functions/shop/buy_particle3.mcfunction

@@ -2,20 +2,23 @@
 # 触发器ID 105
 execute unless entity @s[scores={shop_particle_3=0..}] run scoreboard players set @s shop_particle_3 0
 tag @s remove canbuy
-tag @s[scores={shop_particle_3=0,green=3..},tag=particle] add canbuy
-tellraw @s[scores={shop_particle_3=1..},tag=!show_particle_3] ["",{"text":">> ","color":"aqua","bold":true},{"text":"成功切换 ","color":"aqua"},{"text":"水滴粒子","color":"green"}]
-tellraw @s[scores={shop_particle_3=1..},tag=show_particle_3] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经激活了 ","color":"aqua"},{"text":"水滴粒子","color":"green"}]
-tellraw @s[scores={shop_particle_3=0,green=..2},tag=particle] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买这个粒子!","color":"red"}]
-tellraw @s[tag=!particle] ["",{"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"}]
+tag @s[scores={shop_particle_s=1..,shop_particle_3=0,green=3..}] add canbuy
+
+tellraw @s[scores={shop_particle_s=0}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先在左侧购买尾迹特效才能切换尾迹种类!","color":"red"}]
+execute as @s[scores={shop_particle_s=0}] at @s run function lib:sounds/error
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_3=1..}] ["",{"text":">> ","color":"aqua","bold":true},"尾迹特效已切换为 ",{"text":"水滴","color":"aqua"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_3=1..}] at @s run function lib:sounds/hit
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_3=0,green=..2}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买它!","color":"red"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_3=0,green=..2}] at @s run function lib:sounds/error
+
+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_particle_3 1
 scoreboard players remove @s[tag=canbuy] green 3
-execute as @s[scores={shop_particle_3=0}] at @s run function lib:sounds/error
-execute as @s[scores={shop_particle_3=1..}] at @s run function lib:sounds/levelup
 execute as @s[tag=canbuy] run function item:shop/refresh_green
+execute as @s[tag=canbuy] at @s run function lib:sounds/levelup
 tag @s remove canbuy
 
-# 切换粒子
-execute if entity @s[scores={shop_particle_3=1..},tag=!show_particle_3] run function item:particle/reset_particle
-execute if entity @s[scores={shop_particle_3=1..},tag=!show_particle_3] run tag @s add show_particle_3
+scoreboard players set @s[scores={shop_particle_3=1..}] particle_type 3

+ 15 - 12
data/item/functions/shop/buy_particle4.mcfunction

@@ -2,20 +2,23 @@
 # 触发器ID 106
 execute unless entity @s[scores={shop_particle_4=0..}] run scoreboard players set @s shop_particle_4 0
 tag @s remove canbuy
-tag @s[scores={shop_particle_4=0,green=6..},tag=particle] add canbuy
-tellraw @s[scores={shop_particle_4=1..},tag=!show_particle_4] ["",{"text":">> ","color":"aqua","bold":true},{"text":"成功切换 ","color":"aqua"},{"text":"烈焰粒子","color":"green"}]
-tellraw @s[scores={shop_particle_4=1..},tag=show_particle_4] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经激活了 ","color":"aqua"},{"text":"烈焰粒子","color":"green"}]
-tellraw @s[scores={shop_particle_4=0,green=..5},tag=particle] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买这个粒子!","color":"red"}]
-tellraw @s[tag=!particle] ["",{"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"}]
+tag @s[scores={shop_particle_s=1..,shop_particle_4=0,green=6..}] add canbuy
+
+tellraw @s[scores={shop_particle_s=0}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先在左侧购买尾迹特效才能切换尾迹种类!","color":"red"}]
+execute as @s[scores={shop_particle_s=0}] at @s run function lib:sounds/error
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_4=1..}] ["",{"text":">> ","color":"aqua","bold":true},"尾迹特效已切换为 ",{"text":"烈焰","color":"aqua"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_4=1..}] at @s run function lib:sounds/hit
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_4=0,green=..5}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买它!","color":"red"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_4=0,green=..5}] at @s run function lib:sounds/error
+
+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_particle_4 1
 scoreboard players remove @s[tag=canbuy] green 6
-execute as @s[scores={shop_particle_4=0}] at @s run function lib:sounds/error
-execute as @s[scores={shop_particle_4=1..}] at @s run function lib:sounds/levelup
 execute as @s[tag=canbuy] run function item:shop/refresh_green
+execute as @s[tag=canbuy] at @s run function lib:sounds/levelup
 tag @s remove canbuy
 
-# 切换粒子
-execute if entity @s[scores={shop_particle_4=1..},tag=!show_particle_4] run function item:particle/reset_particle
-execute if entity @s[scores={shop_particle_4=1..},tag=!show_particle_4] run tag @s add show_particle_4
+scoreboard players set @s[scores={shop_particle_4=1..}] particle_type 4

+ 15 - 12
data/item/functions/shop/buy_particle5.mcfunction

@@ -2,20 +2,23 @@
 # 触发器ID 107
 execute unless entity @s[scores={shop_particle_5=0..}] run scoreboard players set @s shop_particle_5 0
 tag @s remove canbuy
-tag @s[scores={shop_particle_5=0,green=6..},tag=particle] add canbuy
-tellraw @s[scores={shop_particle_5=1..},tag=!show_particle_5] ["",{"text":">> ","color":"aqua","bold":true},{"text":"成功切换 ","color":"aqua"},{"text":"炫彩粒子","color":"green"}]
-tellraw @s[scores={shop_particle_5=1..},tag=show_particle_5] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经激活了 ","color":"aqua"},{"text":"炫彩粒子","color":"green"}]
-tellraw @s[scores={shop_particle_5=0,green=..5},tag=particle] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买这个粒子!","color":"red"}]
-tellraw @s[tag=!particle] ["",{"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"}]
+tag @s[scores={shop_particle_s=1..,shop_particle_5=0,green=6..}] add canbuy
+
+tellraw @s[scores={shop_particle_s=0}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先在左侧购买尾迹特效才能切换尾迹种类!","color":"red"}]
+execute as @s[scores={shop_particle_s=0}] at @s run function lib:sounds/error
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_5=1..}] ["",{"text":">> ","color":"aqua","bold":true},"尾迹特效已切换为 ",{"text":"炫彩","color":"aqua"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_5=1..}] at @s run function lib:sounds/hit
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_5=0,green=..5}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买它!","color":"red"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_5=0,green=..5}] at @s run function lib:sounds/error
+
+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_particle_5 1
 scoreboard players remove @s[tag=canbuy] green 6
-execute as @s[scores={shop_particle_5=0}] at @s run function lib:sounds/error
-execute as @s[scores={shop_particle_5=1..}] at @s run function lib:sounds/levelup
 execute as @s[tag=canbuy] run function item:shop/refresh_green
+execute as @s[tag=canbuy] at @s run function lib:sounds/levelup
 tag @s remove canbuy
 
-# 切换粒子
-execute if entity @s[scores={shop_particle_5=1..},tag=!show_particle_5] run function item:particle/reset_particle
-execute if entity @s[scores={shop_particle_5=1..},tag=!show_particle_5] run tag @s add show_particle_5
+scoreboard players set @s[scores={shop_particle_5=1..}] particle_type 5

+ 16 - 13
data/item/functions/shop/buy_particle6.mcfunction

@@ -1,21 +1,24 @@
-# 灵魂之焰粒子 (9 e)
+# 魂焰粒子 (1 eb)
 # 触发器ID 108
 execute unless entity @s[scores={shop_particle_6=0..}] run scoreboard players set @s shop_particle_6 0
 tag @s remove canbuy
-tag @s[scores={shop_particle_6=0,green=9..},tag=particle] add canbuy
-tellraw @s[scores={shop_particle_6=1..},tag=!show_particle_6] ["",{"text":">> ","color":"aqua","bold":true},{"text":"成功切换 ","color":"aqua"},{"text":"灵魂之焰","color":"green"}]
-tellraw @s[scores={shop_particle_6=1..},tag=show_particle_6] ["",{"text":">> ","color":"aqua","bold":true},{"text":"你已经激活了 ","color":"aqua"},{"text":"灵魂之焰","color":"green"}]
-tellraw @s[scores={shop_particle_6=0,green=..8},tag=particle] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石来购买这个粒子!","color":"red"}]
-tellraw @s[tag=!particle] ["",{"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"}]
+tag @s[scores={shop_particle_s=1..,shop_particle_6=0,green=9..}] add canbuy
+
+tellraw @s[scores={shop_particle_s=0}] ["",{"text":">> ","color":"red","bold":true},{"text":"你需要先在左侧购买尾迹特效才能切换尾迹种类!","color":"red"}]
+execute as @s[scores={shop_particle_s=0}] at @s run function lib:sounds/error
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_6=1..}] ["",{"text":">> ","color":"aqua","bold":true},"尾迹特效已切换为 ",{"text":"魂焰","color":"aqua"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_6=1..}] at @s run function lib:sounds/hit
+
+tellraw @s[scores={shop_particle_s=1..,shop_particle_6=0,green=..8}] ["",{"text":">> ","color":"red","bold":true},{"text":"你没有足够的绿宝石块来购买它!","color":"red"}]
+execute as @s[scores={shop_particle_s=1..,shop_particle_6=0,green=..8}] at @s run function lib:sounds/error
+
+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_particle_6 1
 scoreboard players remove @s[tag=canbuy] green 9
-execute as @s[scores={shop_particle_6=0}] at @s run function lib:sounds/error
-execute as @s[scores={shop_particle_6=1..}] at @s run function lib:sounds/levelup
 execute as @s[tag=canbuy] run function item:shop/refresh_green
+execute as @s[tag=canbuy] at @s run function lib:sounds/levelup
 tag @s remove canbuy
 
-# 切换粒子
-execute if entity @s[scores={shop_particle_6=1..},tag=!show_particle_6] run function item:particle/reset_particle
-execute if entity @s[scores={shop_particle_6=1..},tag=!show_particle_6] run tag @s add show_particle_6
+scoreboard players set @s[scores={shop_particle_6=1..}] particle_type 6