# Upgrades bow level
scoreboard players add bow_level zombData 1
# Takes points off score
scoreboard players operation points zombData -= cost zombData

# Fanfare
particle minecraft:firework 11.5 56.0 60.5 0.1 0 0.1 0.1 40
execute as @a[scores={location=3}] at @s run playsound minecraft:entity.player.levelup master @a ~ ~ ~ 1 1.5
tellraw @a[scores={location=3}] [{"text":"\n ","color":"gray"},{"selector":"@s","color":"white"},{"text":" purchased "},{"text":"Bow Damage","color":"green"},{"text":" upgrade level "},{"score":{"name":"bow_level","objective":"zombData"},"color":"white"},{"text":" !\n"}]

# Changes the text display for bow
execute if score bow_level zombData matches 1 run data modify entity @e[type=text_display,limit=1,tag=bow_upgrade_text] text set value '[{"text":"","color":"gray"},{"text":"Cost: "},\
{"text":"1500","color":"white"},{"text":" points\\n"},{"text":"- "},\
{"text":"🏹🏹","color":"green"},\
{"text":"🏹🏹","color":"dark_gray"},{"text":" -"}]'
execute if score bow_level zombData matches 2 run data modify entity @e[type=text_display,limit=1,tag=bow_upgrade_text] text set value '[{"text":"","color":"gray"},{"text":"Cost: "},\
{"text":"2000","color":"white"},{"text":" points\\n"},{"text":"- "},\
{"text":"🏹🏹🏹","color":"green"},\
{"text":"🏹","color":"dark_gray"},{"text":" -"}]'
execute if score bow_level zombData matches 3 run data modify entity @e[type=text_display,limit=1,tag=bow_upgrade_text] text set value '[{"text":"","color":"gray"},\
{"text":"MAX LEVEL\\n","color":"gray"},{"text":"- "},\
{"text":"🏹🏹🏹🏹","color":"green"},\
{"text":"","color":"dark_gray"},{"text":" -"}]'

# Clears players of their armor
clear @a[scores={location=3}] bow