scoreboard players set @a Death 0
scoreboard players set game state 2
schedule function lobby:warp/schedule_playing 4s
effect give @a instant_health 1 10
execute as @a run gamemode adventure
execute as @a run scoreboard players operation @s mana = @s mana_capacity
effect clear @a
advancement grant @a only items:inv_update lock
team join players @a
tag @a remove infinite_mana

execute if score new_run state matches 1 run function lobby:warp/new_run
function game:reset
function effects:load

# Warp
tp @a 0 53 0
fill -1 52 1 1 52 -1 air destroy
playsound custom.shulker.open.no_subtitle ambient @a -0.87 53.00 -0.78 1 0.5
effect give @a resistance 5 5 true

kill @e[type=!player,type=!painting,tag=!lobby,tag=!unspellable]

bossbar set generation visible false
title @a actionbar ""

# ----------- Title ------------
title @a title [{"text":">> ","color":"dark_red","bold":true},{"translate":"floor","color":"gold"},{"text":" "},{"score":{"name":"floor","objective":"dungeon"},"color":"gold"},{"text":" <<","color":"dark_red"}]
execute if score floor dungeon matches 1 run title @a subtitle {"translate":"msg.warp.f1","color":"gray","bold":true}
execute if score floor dungeon matches 2 run title @a subtitle {"translate":"msg.warp.f2","color":"gray","bold":true}
execute if score floor dungeon matches 3 run title @a subtitle {"translate":"msg.warp.f3","color":"gray","bold":true}
title @a times 10 60 10


# Clear lobby
kill @e[tag=lobby]
kill @e[tag=tutorial_obj]

function game:music/loop
