#DO NOT DO DURING LANTERN EVENT

execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute unless entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run effect give @a[tag=K] blindness 5 0
execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute unless entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run execute if entity @e[name=DayQ,type=armor_stand,scores={DayQ=20..}] run effect give @a[tag=K] blindness 15 0
execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute unless entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run execute if entity @e[name=DayQ,type=armor_stand,scores={DayQ=20..}] run effect give @a[tag=K] night_vision 15 0
execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute unless entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run execute at @a[tag=K] run summon armor_stand ~ ~20 ~ {CustomName:"\"QDK\"",Invisible:1b,Silent:1b,NoGravity:1}
execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute unless entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run execute at @a[tag=K,tag=EternalTorchAdv] positioned ~ ~20 ~ run tag @e[distance=..100,type=armor_stand,name=QDK] add SaveTorch
execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute unless entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run tellraw @a[team=P] ["",{"text":"You are engulfed in darkness!","color":"dark_red","italic":true}]
execute in overworld positioned 999982 128 999980 run execute if entity @e[distance=..3,type=marker,tag=LanternEvent] run tellraw @a[team=P] ["",{"text":"You are engulfed in darkness!...or not, apparently.","color":"dark_red","italic":true}]
execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute if entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run tellraw @a[team=P] ["",{"text":"As darkness attempts to engulf you, its effect is blocked by some mysterious power protecting you. However, you feel the protection fade soon after.","color":"dark_red","italic":true}]


#used to be a timer over 40 ticks, and now it is instant
execute in overworld positioned 999982 128 999980 run execute unless entity @e[distance=..3,type=marker,tag=LanternEvent] run execute unless entity @e[name=DayQ,type=armor_stand,tag=KillNextDarkness] run execute as @e[type=armor_stand,name=QDK] run function zzzzdonotuse:randomevent/darknessfill


tag @e[name=DayQ,type=armor_stand] remove KillNextDarkness