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

#Score blue
scoreboard players set §1§a score_blue 10
scoreboard players set §1§9 score_blue 9
scoreboard players set §1§8 score_blue 8
scoreboard players set §1§7 score_blue 7
scoreboard players set §1§6 score_blue 6
scoreboard players set §1§5 score_blue 5
scoreboard players set §1§4 score_blue 4
scoreboard players set §1§3 score_blue 3
scoreboard players set §1§2 score_blue 2
scoreboard players set §1§1 score_blue 1
scoreboard players set §1§0 score_blue 0

team join teamname16 §1§a
team leave §1§9
team join teamname §1§8
team leave §1§7
team join teamname21 §1§6
team join teamname3 §1§5
team join teamname4 §1§4
team join teamname5 §1§3
team join teamname6 §1§2
team leave §1§1
team join teamname7 §1§0

#Score red
scoreboard players set §1§a score_red 10
scoreboard players set §1§9 score_red 9
scoreboard players set §2§8 score_red 8
scoreboard players set §1§7 score_red 7
scoreboard players set §1§6 score_red 6
scoreboard players set §2§5 score_red 5
scoreboard players set §2§4 score_red 4
scoreboard players set §1§3 score_red 3
scoreboard players set §1§2 score_red 2
scoreboard players set §1§1 score_red 1
scoreboard players set §1§0 score_red 0

team join teamname9 §2§8
team join teamname10 §2§5
team join teamname11 §2§4

#Score green
scoreboard players set §1§a score_green 10
scoreboard players set §1§9 score_green 9
scoreboard players set §3§8 score_green 8
scoreboard players set §1§7 score_green 7
scoreboard players set §1§6 score_green 6
scoreboard players set §2§5 score_green 5
scoreboard players set §1§4 score_green 4
scoreboard players set §3§3 score_green 3
scoreboard players set §1§2 score_green 2
scoreboard players set §1§1 score_green 1
scoreboard players set §1§0 score_green 0

team join teamname12 §3§8
team join teamname13 §3§3

#Score yellow
scoreboard players set §1§a score_yellow 10
scoreboard players set §1§9 score_yellow 9
scoreboard players set §4§8 score_yellow 8
scoreboard players set §1§7 score_yellow 7
scoreboard players set §1§6 score_yellow 6
scoreboard players set §2§5 score_yellow 5
scoreboard players set §1§4 score_yellow 4
scoreboard players set §1§3 score_yellow 3
scoreboard players set §4§2 score_yellow 2
scoreboard players set §1§1 score_yellow 1
scoreboard players set §1§0 score_yellow 0

team join teamname14 §4§8
team join teamname15 §4§2

#Score spec
scoreboard players set §1§a score_spec 8
scoreboard players set §1§9 score_spec 7
scoreboard players set §1§6 score_spec 6
scoreboard players set §2§5 score_spec 5
scoreboard players set §1§4 score_spec 4
scoreboard players set §1§3 score_spec 3
scoreboard players set §1§2 score_spec 2
scoreboard players set §1§1 score_spec 1
scoreboard players set §1§0 score_spec 0

#Apply settings
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

#Powerup
schedule function f:game/powerup/summon 30t append

#Team pumpkins
execute if entity @a[team=red] run scoreboard players set $team_red pumpkin_count 4
execute if entity @a[team=blue] run scoreboard players set $team_blue pumpkin_count 4
execute if entity @a[team=yellow] run scoreboard players set $team_yellow pumpkin_count 4
execute if entity @a[team=green] run scoreboard players set $team_green pumpkin_count 4