execute if entity @e[tag=34levl,type=minecraft:armor_stand] run execute unless entity @a[scores={checkpoint=37}] run tp @e[tag=34levl] 1.02 -11.00 -41.87

execute as @a[scores={checkpoint=38}] at @s run execute positioned 1 57 -27 if entity @s[distance=..1] run tag @s add 38_bow_1
give @a[tag=38_bow_1,tag=!38_bow_2] bow[unbreakable={},custom_data={NoPickup:1b},enchantments={infinity:1}] 1
item replace entity @a[tag=38_bow_1,tag=!38_bow_2] container.9 with arrow[custom_data={NoPickup:1b}] 1
tag @a[tag=38_bow_1] add 38_bow_2

item replace entity @a[tag=38_bow_100,tag=!38_bow_200] container.9 with minecraft:arrow

execute as @e[type=minecraft:arrow,nbt={inGround:1b}] at @s positioned 6 46 -17 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 2 59 -14 if entity @s[distance=..2] run scoreboard players add @s arrow_kill 1
kill @e[type=minecraft:arrow,scores={arrow_kill=50..}]

execute positioned 1 57 -27 unless entity @a[distance=..2.5] run fill 2 57 -14 2 59 -14 minecraft:air

execute positioned 1 57 -27 if entity @a[distance=..2.5] run setblock 2 59 -14 minecraft:target[power=0]
execute positioned 1 57 -27 if entity @a[distance=..2.5] run setblock 2 58 -14 minecraft:diorite_wall[east=none,north=none,south=none,up=true,waterlogged=false,west=none]
execute positioned 1 57 -27 if entity @a[distance=..2.5] run setblock 2 57 -14 minecraft:redstone_lamp[lit=false]

execute if block 2 59 -14 minecraft:target[power=15] run setblock 2 57 -14 minecraft:redstone_lamp[lit=false]

execute as @a[scores={checkpoint=38}] at @s run execute positioned 3 54 -27 if entity @s[distance=..1] run tag @s remove 38_bow_1
execute as @a[scores={checkpoint=38}] at @s run execute positioned 3 54 -27 if entity @s[distance=..1] run tag @s remove 38_bow_2
execute as @a[scores={checkpoint=38}] at @s run execute positioned 3 54 -27 if entity @s[distance=..1] run clear @s minecraft:bow
execute as @a[scores={checkpoint=38}] at @s run execute positioned 3 54 -27 if entity @s[distance=..1] run clear @s minecraft:arrow

execute as @a[scores={checkpoint=38}] at @s run execute positioned 3 54 -27 if entity @s[distance=..1,tag=!38_bow_10] run tp @s 2.65 57.00 -26.30 -1079.84 3.12

execute as @a[scores={checkpoint=38}] at @s run execute positioned 4 51 -27 unless entity @s[distance=..3] run fill 3 52 -9 3 54 -9 minecraft:air

execute as @a[scores={checkpoint=38}] at @s run execute positioned 4 51 -27 if entity @s[distance=..3] run setblock 3 54 -9 minecraft:target[power=0]
execute as @a[scores={checkpoint=38}] at @s run execute positioned 4 51 -27 if entity @s[distance=..3] run setblock 3 53 -9 minecraft:diorite_wall[east=none,north=none,south=none,up=true,waterlogged=false,west=none]
execute as @a[scores={checkpoint=38}] at @s run execute positioned 4 51 -27 if entity @s[distance=..3] run setblock 3 52 -9 minecraft:redstone_lamp[lit=false]

execute as @a[scores={checkpoint=38}] at @s run execute positioned 6 45 -28 if entity @s[distance=..1] run tag @s add 38_bow_44
execute as @a[scores={checkpoint=38}] at @s run execute positioned 4 51 -27 if entity @s[distance=..1] run tag @s add 38_bow_4
execute as @a[scores={checkpoint=38}] at @s run item replace entity @s[tag=38_bow_4,tag=!38_bow_44] container.4 with minecraft:snowball


execute as @a[scores={checkpoint=38}] at @s run execute positioned 5 49 -28 if entity @s[distance=..1] run clear @s minecraft:snowball
execute as @a[scores={checkpoint=38}] at @s run execute positioned 5 49 -28 if entity @s[distance=..1,tag=!38_bow_11] run tp @s 4.45 51.00 -27.59 -0.43 2.60


execute if score 3 timer_an2 matches 1 run scoreboard players add 4 timer_an2 1

execute if score 4 timer_an2 matches 5.. run execute if block 3 52 -9 minecraft:redstone_lamp run setblock 3 52 -9 minecraft:redstone_lamp[lit=true]
execute if score 4 timer_an2 matches 5 run setblock 5 50 -28 minecraft:iron_trapdoor[facing=south,half=top,open=true,powered=true,waterlogged=false]
execute if score 4 timer_an2 matches 5 run execute positioned 5 50 -28 run playsound minecraft:block.iron_trapdoor.open block @a[distance=..6] 5 50 -28 1111 1

execute if score 4 timer_an2 matches 5 run execute if block 3 52 -9 minecraft:redstone_lamp run setblock 3 52 -9 minecraft:redstone_lamp[lit=false]
execute if score 4 timer_an2 matches 150 run setblock 5 50 -28 minecraft:iron_trapdoor[facing=south,half=top,open=false,powered=false,waterlogged=false]
execute if score 4 timer_an2 matches 150 run execute positioned 5 50 -28 run playsound minecraft:block.iron_trapdoor.open block @a[distance=..6] 5 50 -28 1111 1

execute if score 4 timer_an2 matches 150 run scoreboard players reset 3 timer_an2
execute if score 4 timer_an2 matches 150 run scoreboard players reset 4 timer_an2

clear @a[tag=38_bow_100,tag=!38_bow_200] minecraft:snowball
execute as @a[scores={checkpoint=38}] at @s run execute positioned 5 45 -28 if entity @s[distance=..1] run tag @s add 38_bow_100
give @a[tag=38_bow_100,tag=!38_bow_200] crossbow[unbreakable={},custom_data={NoPickup:1b},enchantments={infinity:1}] 1
item replace entity @a[tag=38_bow_100,tag=!38_bow_200] container.9 with arrow 1
tag @a[tag=38_bow_100] add 38_bow_200

item replace entity @a[tag=38_bow_100] container.9 with arrow[custom_data={NoPickup:1b}] 1


execute positioned 5 46 -28 unless entity @a[distance=..3] run fill 6 46 -16 6 48 -16 minecraft:air

execute positioned 5 46 -28 if entity @a[distance=..3] run setblock 6 46 -16 minecraft:target[power=0]
execute positioned 5 46 -28 if entity @a[distance=..3] run setblock 6 47 -16 minecraft:diorite_wall[east=none,north=none,south=none,up=true,waterlogged=false,west=none]
execute positioned 5 46 -28 if entity @a[distance=..3] run setblock 6 48 -16 minecraft:redstone_lamp[lit=false]


#5 6

execute if score 5 timer_an2 matches 1 run scoreboard players add 6 timer_an2 1

execute if score 6 timer_an2 matches 5.. run execute if block 6 48 -16 minecraft:redstone_lamp run setblock 6 48 -16 minecraft:redstone_lamp[lit=true]
execute if score 6 timer_an2 matches 5 run execute positioned 6 45 -28 run playsound minecraft:block.iron_trapdoor.open block @a[distance=..6] 6 45 -28 1111 1
execute if score 6 timer_an2 matches 5 run setblock 7 44 -28 minecraft:iron_trapdoor[facing=south,half=top,open=true,powered=true,waterlogged=false]

execute if score 6 timer_an2 matches 150 run execute positioned 6 45 -28 run playsound minecraft:block.iron_trapdoor.open block @a[distance=..6] 6 45 -28 1111 1
execute if score 6 timer_an2 matches 150 run setblock 7 44 -28 minecraft:iron_trapdoor[facing=east,half=top,open=false,powered=false,waterlogged=false]
execute if score 6 timer_an2 matches 150 run execute if block 6 48 -16 minecraft:redstone_lamp run setblock 6 48 -16 minecraft:redstone_lamp[lit=false]

execute if score 6 timer_an2 matches 150 run scoreboard players reset 5 timer_an2
execute if score 6 timer_an2 matches 150 run scoreboard players reset 6 timer_an2

execute as @a[scores={checkpoint=38}] at @s run execute positioned 9 42 -28 if entity @s[distance=..1,tag=!38_bow_12,tag=!38hav] run tp @s 6.53 45.00 -28.70 -360.23 -3.51
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run tag @s remove 38_bow_44
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run tag @s remove 38_bow_4
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run tag @s remove 38_bow_100
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run tag @s remove 38_bow_200
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run tag @s remove 38_bow_11
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run tag @s remove 38_bow_10
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run clear @s minecraft:crossbow
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run clear @s minecraft:arrow
execute as @a[scores={checkpoint=38}] at @s run execute positioned 7 43 -28 if entity @s[distance=..1,tag=38_bow_12] run clear @s minecraft:snowball
execute as @a[scores={checkpoint=38}] at @s run execute positioned 9 42 -27 if entity @s[distance=..1,tag=38_bow_12] run tag @s add 38hav
execute as @a[scores={checkpoint=38}] at @s run execute positioned 9 42 -27 if entity @s[distance=..1,tag=38_bow_12] run tag @s remove 38_bow_12

execute as @a[scores={checkpoint=38}] at @s run execute positioned 9 42 -27 if entity @s[distance=..5] run clear @s minecraft:snowball


#1 2

execute if score 1 timer_an2 matches 1 run scoreboard players add 2 timer_an2 1

execute if score 2 timer_an2 matches 5.. run execute if block 2 57 -14 minecraft:redstone_lamp run setblock 2 57 -14 minecraft:redstone_lamp[lit=true]
execute if score 2 timer_an2 matches 5 run setblock 3 56 -27 minecraft:iron_trapdoor[facing=south,half=top,open=true,powered=false,waterlogged=false]

execute if score 2 timer_an2 matches 150 run setblock 3 56 -27 minecraft:iron_trapdoor[facing=south,half=top,open=false,powered=false,waterlogged=false]

execute if score 2 timer_an2 matches 5 run execute positioned 3 56 -27 run playsound minecraft:block.iron_trapdoor.open block @a[distance=..6] 3 56 -27 1111 1
execute if score 2 timer_an2 matches 150 run execute positioned 3 56 -27 run playsound minecraft:block.iron_trapdoor.open block @a[distance=..6] 3 56 -27 1111 1
execute if score 2 timer_an2 matches 150 run execute if block 2 57 -14 minecraft:redstone_lamp run setblock 2 57 -14 minecraft:redstone_lamp[lit=false]

execute if score 2 timer_an2 matches 150 run scoreboard players reset 1 timer_an2
execute if score 2 timer_an2 matches 150 run scoreboard players reset 2 timer_an2



