#Project created by the koncept

### Looping functions
# timer
execute if score start bingo.timer.game matches 1 run function koncept.bingo:bingo/timer/main
# Randomization of objects
execute if score start bingo.start.spawn.item matches 1.. run function koncept.bingo:bingo/start/generate_random_object
# Beginning of game
execute if score start bingo.start.enable.trigger matches 1.. run function koncept.bingo:bingo/start/sequence/4_main
# Destroy flask
execute as @e[tag=bingo.destroy,type=minecraft:marker,scores={bingo.destroy=1..}] at @s run function koncept.bingo:bingo/start/destroy
#win
execute if score bingo.win_restart bingo.win_restart matches 1.. run function koncept.bingo:bingo/win/main

###### /trigger

### Rules
scoreboard players enable @a .bingo.rules
execute as @a[scores={.bingo.rules=1..}] at @s run function koncept.bingo:bingo/settings/rules

### Start game
scoreboard players enable @a .bingo.start
execute as @a[scores={.bingo.start=1..}] at @s run function koncept.bingo:bingo/start/sequence/1

execute as @a[scores={bingo.tp_yes=1..}] at @s run function koncept.bingo:bingo/start/sequence/tp_yes
execute as @a[scores={bingo.tp_no=1..}] at @s run function koncept.bingo:bingo/start/sequence/tp_no

execute as @a[scores={bingo.startYes=1}] at @s run function koncept.bingo:bingo/start/sequence/message/bingo.startyes

### Leave game
scoreboard players enable @a .bingo.leave.game
execute as @a[scores={.bingo.leave.game=1..}] at @s run function koncept.bingo:bingo/settings/bingo.leave.game

execute as @a[scores={bingo.leave.game.yes=1..}] at @s run function koncept.bingo:bingo/settings/bingo.leave.game.yes

### Settings
scoreboard players enable @a .bingo.settings
execute as @a[scores={.bingo.settings=1..}] at @s run function koncept.bingo:bingo/settings/start_trigger
execute as @a[scores={bingo.timer.game.yes=1..}] at @s run function koncept.bingo:bingo/settings/timer/yes
execute as @a[scores={bingo.timer.game.no=1..}] at @s run function koncept.bingo:bingo/settings/timer/no

execute as @a[scores={bingo.adjustment_1=1..}] at @s run function koncept.bingo:bingo/settings/space/1
execute as @a[scores={bingo.adjustment_2=1..}] at @s run function koncept.bingo:bingo/settings/space/2
execute as @a[scores={bingo.adjustment_3=1..}] at @s run function koncept.bingo:bingo/settings/space/3
execute as @a[scores={bingo.adjustment_4=1..}] at @s run function koncept.bingo:bingo/settings/space/4
execute as @a[scores={bingo.adjustment_5=1..}] at @s run function koncept.bingo:bingo/settings/space/5
execute as @a[scores={bingo.adjustment_6=1..}] at @s run function koncept.bingo:bingo/settings/space/6

execute as @a[scores={bingo.items_bottom_1=1..}] at @s run function koncept.bingo:bingo/settings/bottom/1
execute as @a[scores={bingo.items_bottom_2=1..}] at @s run function koncept.bingo:bingo/settings/bottom/2
execute as @a[scores={bingo.items_bottom_3=1..}] at @s run function koncept.bingo:bingo/settings/bottom/3
execute as @a[scores={bingo.items_bottom_4=1..}] at @s run function koncept.bingo:bingo/settings/bottom/4
execute as @a[scores={bingo.items_bottom_5=1..}] at @s run function koncept.bingo:bingo/settings/bottom/5
execute as @a[scores={bingo.items_bottom_6=1..}] at @s run function koncept.bingo:bingo/settings/bottom/6

execute as @a[scores={bingo.reset.settings=1..}] at @s run function koncept.bingo:bingo/settings/reset_settings
execute as @a[scores={bingo.items_top=1..}] at @s run function koncept.bingo:bingo/settings/top

execute as @a[scores={bingo.started_game=1..}] at @s run function koncept.bingo:bingo/start/bingo.startyes