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

scoreboard players add @s wins 0

scoreboard players set @s pumpkin_count 0
scoreboard players set @s game_kills 0
scoreboard players set @s gold 0
scoreboard players set @s kill-timer 0
scoreboard players set @s milk_time 0
scoreboard players set @s poweruptime 0

tag @s remove original_seeker
tag @s remove p_remember
tag @s remove start_parkour
tag @s remove parkour_winner
tag @s remove win
title @s reset
title @s times 0 80 10
tag @s remove player
tag @s remove text
effect clear @s
effect give @s minecraft:blindness 1 250 true
effect give @s minecraft:slow_falling 1 2 true
clear @s
recipe give @s *
playsound minecraft:item.chorus_fruit.teleport master @s ~ ~ ~ 300


execute if score $core main matches 1 run tp @s 23 154 91
execute if score $core main matches 1 run function f:spec

execute unless score $core main matches 1 run tp @s 317 104 -317 -90 -9
execute unless score $core main matches 1 run gamemode adventure @s
execute unless score $core main matches 1 run title @s title {"translate":"Halloween Chaos","color":"yellow","bold":true}
execute unless score $core main matches 1 run team join lobby @s

#Creator joins
tag @a remove creator
execute unless score $core main matches 1 run tag @s[name=TheSkilerPL,scores={logout=0..}] add creator
execute unless score $core main matches 1 run tag @s[name=Kalendarz2,scores={logout=0..}] add creator
execute if entity @s[tag=creator] run scoreboard players set @a[tag=creator] shift 0
execute unless score $core main matches 1 unless entity @a[tag=creator] run kill @e[tag=dab]
execute at @s[tag=creator] run summon minecraft:lightning_bolt ~ ~5 ~
execute at @s[tag=creator] run function f:game/end/win/effect3_spawn

scoreboard players set @s logout -1