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

scoreboard players set $core pumpkins 0
scoreboard players set $core pumpkin_count 0
execute if entity @a[team=blue] run scoreboard players operation $core pumpkin_count > $team_blue pumpkin_count
execute if entity @a[team=red] run scoreboard players operation $core pumpkin_count > $team_red pumpkin_count
execute if entity @a[team=green] run scoreboard players operation $core pumpkin_count > $team_green pumpkin_count
execute if entity @a[team=yellow] run scoreboard players operation $core pumpkin_count > $team_yellow pumpkin_count

execute if score $game_type main matches 0..2 unless score $core pumpkin_count matches 0 run function f:game/end/win/title
execute if score $game_type main matches 0..2 if score $core pumpkin_count matches 0 run title @a subtitle ["",{"translate":"game.end.noone","color":"gray"}]