
tag @a[nbt=!{Inventory:[{id:"minecraft:bow"}]},tag=bow4] remove bow4

execute as @a[scores={checkpoint=18,checkpoint_between_18=0}] at @s positioned -2 66 70 if entity @s[distance=..2] run tag @s add return_stage_checkpoint_message
execute as @a[scores={checkpoint=18,checkpoint_between_18=0}] at @s positioned -2 66 70 if entity @s[distance=..2] run spawnpoint @s -2 66 70 -179.70
execute as @a[scores={checkpoint=18,checkpoint_between_18=0}] at @s positioned -2 66 70 if entity @s[distance=..2] run scoreboard players set @s checkpoint_between_18 1

execute as @e[type=minecraft:arrow,nbt={inGround:1b}] at @s positioned 5 67 85 if entity @s[distance=..2] run scoreboard players add @s arrow_kill 1
execute as @e[type=minecraft:arrow,nbt={inGround:1b}] at @s positioned -12 64 63 if entity @s[distance=..2] run scoreboard players add @s arrow_kill 1
execute as @e[type=minecraft:arrow,nbt={inGround:1b}] at @s positioned -10 74 64 if entity @s[distance=..2] run scoreboard players add @s arrow_kill 1
kill @e[type=minecraft:arrow,scores={arrow_kill=50}]


execute as @a[scores={checkpoint=18}] at @s run tag @s remove woter
execute as @a[scores={checkpoint=18}] at @s run tag @s remove woter_22no
execute as @a[scores={checkpoint=18}] at @s run tag @s remove woteryes


execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=500,distance=..1] run scoreboard players add @s wind 1
execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=505,distance=..0.5] run scoreboard players add @s wind 1
execute as @a[scores={checkpoint=18}] at @s run playsound minecraft:custom.wind master @s[scores={wind=10}] ~ ~ ~ 1 1
scoreboard players reset @a[scores={checkpoint=18,wind=20..}] wind




#execute as @e[tag=screw1] at @s run item replace entity @s weapon with minecraft:item_frame{CustomModelData:7}
scoreboard players add @e[tag=screw1] screw 1

execute as @e[tag=screw] at @s run tp @s ~ ~ ~ ~20 0

execute as @e[tag=screw1] at @s store result entity @s Pose.RightArm[2] float 20 run scoreboard players get @s screw



execute as @a[tag=!bow6,scores={checkpoint=18}] at @s if entity @e[type=minecraft:item,tag=bow3,distance=..1] run tag @s add bow5
give @a[tag=bow5] bow[unbreakable={},custom_data={NoPickup:1b},enchantments={infinity:1}] 1
item replace entity @a[tag=bow5] container.9 with arrow[custom_data={NoPickup:1b}] 1
tag @a[tag=bow5] add bow6
tag @a[tag=bow5] remove bow5
execute if block -9 73 64 minecraft:target[power=14] run setblock -9 75 64 minecraft:redstone_lamp[lit=true]

execute if block -11 73 64 minecraft:target[power=14] run setblock -11 75 64 minecraft:redstone_lamp[lit=true]

execute if block -9 75 64 minecraft:redstone_lamp[lit=true] if block -11 75 64 minecraft:redstone_lamp[lit=true] run setblock -12 70 56 minecraft:air
execute if block -9 75 64 minecraft:redstone_lamp[lit=true] if block -11 75 64 minecraft:redstone_lamp[lit=true] run scoreboard players set 115 timer 1
execute if score 115 timer matches 1.. run scoreboard players add 114 timer 1
execute if score 114 timer matches 80.. run execute if block -9 73 64 minecraft:target[power=0] run setblock -9 75 64 minecraft:redstone_lamp[lit=false]
execute if score 114 timer matches 80.. run execute if block -11 73 64 minecraft:target[power=0] run setblock -11 75 64 minecraft:redstone_lamp[lit=false]
execute if score 114 timer matches 80.. run execute positioned -10 73 64 run kill @e[type=minecraft:arrow,distance=..2]
execute if score 114 timer matches 80.. run setblock -12 70 56 minecraft:andesite_wall
execute if score 114 timer matches 80.. run scoreboard players reset 115 timer
execute if score 114 timer matches 80.. run scoreboard players reset 114 timer

execute as @a at @s positioned -13 70 56 if entity @s[tag=bow6,scores={checkpoint=18},distance=..2] run clear @s minecraft:bow
execute as @a at @s positioned -13 70 56 if entity @s[tag=bow6,scores={checkpoint=18},distance=..2] run clear @s minecraft:arrow
execute as @a at @s positioned -13 70 56 if entity @s[tag=bow6,scores={checkpoint=18},distance=..2] run tag @s remove bow6




execute as @a[tag=!bow4,scores={checkpoint=18}] at @s if entity @e[type=minecraft:item,tag=bow2,distance=..1] run tag @s add bow3
give @a[tag=bow3] bow[unbreakable={},custom_data={NoPickup:1b},enchantments={infinity:1}] 1
item replace entity @a[tag=bow3] container.9 with arrow[custom_data={NoPickup:1b}] 1
tag @a[tag=bow3] add bow4
tag @a[tag=bow3] remove bow3
execute positioned -7 65 63 run tag @a[tag=bow2,distance=8..] remove bow2
execute if block 5 67 86 minecraft:target[power=14] run setblock 5 69 86 minecraft:redstone_lamp[lit=true]
execute if block 5 67 86 minecraft:target[power=0] run setblock 5 69 86 minecraft:redstone_lamp[lit=false]
execute if block 5 69 86 minecraft:redstone_lamp[lit=true] run fill 1 65 73 0 65 74 minecraft:smooth_quartz
execute if block 5 69 86 minecraft:redstone_lamp[lit=true] run scoreboard players set 112 timer 1
execute if score 112 timer matches 1.. run scoreboard players add 113 timer 1
execute if score 113 timer matches 80.. run execute positioned 5 67 86 run kill @e[type=minecraft:arrow,distance=..1]
execute if score 113 timer matches 80.. run fill 1 65 73 0 65 74 minecraft:air
execute if score 113 timer matches 80.. run scoreboard players reset 112 timer
execute if score 113 timer matches 80.. run scoreboard players reset 113 timer

execute as @a at @s positioned 0 66 73 if entity @s[tag=bow4,scores={checkpoint=18},distance=..2] run clear @s minecraft:bow
execute as @a at @s positioned 0 66 73 if entity @s[tag=bow4,scores={checkpoint=18},distance=..2] run clear @s minecraft:arrow
execute as @a at @s positioned 0 66 73 if entity @s[tag=bow4,scores={checkpoint=18},distance=..2] run tag @s remove bow4


###110 14 111 15
execute positioned 6 66 65 if entity @a[distance=..4] run scoreboard players set 110 timer 1
execute if score 110 timer matches 1 run scoreboard players add 111 timer 1
execute if score 111 timer matches 1..51 run execute as @e[type=minecraft:armor_stand,tag=999] at @s run execute as @e[type=minecraft:armor_stand,tag=999] at @s run tp @s ~ ~ ~0.1
execute if score 111 timer matches 51..101 run execute as @e[type=minecraft:armor_stand,tag=999] at @s run execute as @e[type=minecraft:armor_stand,tag=999] at @s run tp @s ~ ~ ~-0.1
execute if score 111 timer matches 101.. run scoreboard players reset 110 timer
execute if score 111 timer matches 101.. run scoreboard players reset 111 timer






execute positioned -5 63 63 if entity @a[distance=..4] run scoreboard players set 90 timer 1
execute if score 90 timer matches 1.. run scoreboard players add 91 timer 1
execute if score 91 timer matches 1..21 run execute as @e[type=minecraft:armor_stand,tag=998] at @s run execute as @e[type=minecraft:armor_stand,tag=998] at @s run tp @s ~ ~ ~-0.1
execute if score 91 timer matches 41..61 run execute as @e[type=minecraft:armor_stand,tag=998] at @s run execute as @e[type=minecraft:armor_stand,tag=998] at @s run tp @s ~ ~ ~0.1
execute if score 91 timer matches 81.. run scoreboard players reset 90 timer
execute if score 91 timer matches 81.. run scoreboard players reset 91 timer




execute as @a at @s positioned -4 64 62 if entity @s[tag=bow2,scores={checkpoint=18},distance=..2] run clear @s minecraft:bow
execute as @a at @s positioned -4 64 62 if entity @s[tag=bow2,scores={checkpoint=18},distance=..2] run clear @s minecraft:arrow
execute as @a at @s positioned -4 64 62 if entity @s[tag=bow2,scores={checkpoint=18},distance=..2] run tag @s remove bow2



execute as @a[tag=!bow2,scores={checkpoint=18}] at @s if entity @e[type=minecraft:item,tag=bow1,distance=..1] run tag @s add bow1
give @a[tag=bow1] bow[unbreakable={},custom_data={NoPickup:1b},enchantments={infinity:1}] 1
item replace entity @a[tag=bow1] container.9 with arrow[custom_data={NoPickup:1b}] 1
tag @a[tag=bow1] add bow2
tag @a[tag=bow1] remove bow1
execute positioned -7 65 63 run tag @a[tag=bow2,distance=8..] remove bow2
execute if block -13 64 63 minecraft:target[power=14] run setblock -13 66 63 minecraft:redstone_lamp[lit=true]
execute if block -13 64 63 minecraft:target[power=0] run setblock -13 66 63 minecraft:redstone_lamp[lit=false]
execute if block -13 66 63 minecraft:redstone_lamp[lit=true] run fill -8 63 62 -8 64 62 minecraft:air
execute if block -13 66 63 minecraft:redstone_lamp[lit=true] run scoreboard players set 93 timer 1
execute if score 93 timer matches 1.. run scoreboard players add 94 timer 1
execute if score 94 timer matches 40.. run execute positioned -12 65 63 run kill @e[type=minecraft:arrow,distance=..1]
execute if score 94 timer matches 40.. run fill -8 63 62 -8 64 62 minecraft:light_gray_stained_glass
execute if score 94 timer matches 40.. run scoreboard players reset 93 timer
execute if score 94 timer matches 40.. run scoreboard players reset 94 timer

execute as @a[scores={checkpoint=18}] at @s unless entity @e[tag=505,distance=..0.5] run effect clear @s minecraft:levitation
execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=505,distance=..0.8] run effect give @s minecraft:levitation 1 0 true
execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=501,distance=..1] run effect give @s minecraft:levitation 1 2 true
execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=500,distance=..1] run tp @s ~ ~ ~0.8
execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=500,distance=..1] run effect give @s minecraft:levitation 1 1 true
execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=502,distance=..0.6] run tp @s ~-0.6 ~ ~
execute as @a[scores={checkpoint=18}] at @s if entity @e[tag=502,distance=..1] run effect give @s minecraft:levitation 1 1 true