#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

kill @e[tag=berry]
tag @a[team=seeker] add player
tag @a[team=seeker] add original_seeker
tp @a[team=seeker] 29 141 81 0 0

execute as @a at @s run playsound minecraft:block.note_block.iron_xylophone master @s ~ ~ ~ 300 1.5
execute as @a at @s run playsound minecraft:item.totem.use master @s ~ ~ ~ 300
execute as @a at @s run playsound minecraft:item.goat_horn.sound.2 master @s ~ ~ ~ 300 2
title @a title {"translate":"game.start.1","color":"red","bold":true}
title @a subtitle ["",{"translate":"game.start.3","color":"gray"}]

team modify teamname7 prefix {"translate":"score.time","color":"gray"}

#Timer
tag @a add start_no_title
scoreboard players set timer click 0
scoreboard players set timer time 301
execute if score option_time pumpkins matches 0 run scoreboard players set timer time 1201
execute if score option_time pumpkins matches -1 run scoreboard players set timer time 901
execute if score option_time pumpkins matches -2 run scoreboard players set timer time 601
execute if score option_time pumpkins matches -3 run scoreboard players set timer time 301
execute if score option_time pumpkins matches -4 run scoreboard players set timer time 151
scoreboard players set timer tick 2000

#Berries
scoreboard players set $10 main 10
scoreboard players operation $berries click = $berries main
scoreboard players operation $berries click /= $10 main

execute if score $berries click matches 1.. run tellraw @a[team=seeker] ["",{"translate":"berries.received"},{"score":{"name":"$berries","objective":"click"},"color":"gold"},{"translate":"game.gold_icon"},{"translate":"berries.collecting"},{"score":{"name":"$berries","objective":"main"},"color":"red"},{"translate":"berries.name2"}]
scoreboard players operation @a[team=seeker] gold = $berries click

execute at @r[team=seeker] run summon minecraft:armor_stand ~ ~-10 ~ {Invisible:1,Marker:1,Tags:["gold_count"],ArmorItems:[{},{},{},{id:"minecraft:gold_ingot",Count:1b,tag:{display:{Name:'{"translate":"game.gold","color":"gold","bold":true,"italic":false}'}}}]}
execute store result entity @e[tag=gold_count,limit=1] ArmorItems[3].Count byte 1 run scoreboard players get $berries click
item replace entity @a[team=seeker] hotbar.0 from entity @e[tag=gold_count,limit=1] armor.head
kill @e[tag=gold_count]