
#tag @s remove KyuLatentSetHomeSpell
#tag @s remove KyuLatentTPHomeSpell
#tag @s remove KyuLatentSpeedSpell
#tag @s remove KyuLatentSlowfallSpell
#tag @s remove KyuLatentResistSpell
#tag @s remove KyuLatentEscapeSpell
#tag @s remove KyuLatentHorseSpell
#tag @s remove KyuLatentInvisSpell
#tag @s remove KyuLatentPortalSpell
#tag @s remove KyuLatentFarmAnimalSpell
#tag @s remove KyuLatentBlindRageSpell
#tag @s remove KyuLatentSpell






execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tellraw @s[tag=HomeCD] ["",{"text":"You have already used this spell today - You may use it again tomorrow.","color":"yellow"}]
execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tellraw @s[level=..4] ["",{"text":"You do not have the xp required to cast this.","color":"gold"}]
execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tellraw @s[nbt=!{Dimension:"minecraft:overworld"}] ["",{"text":"You must be in the overworld to do this.","color":"gold"}]
execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run execute unless entity @e[name=DayQ,tag=HomeMadeQ] run tellraw @s ["",{"text":"You must set a world home first in order to teleport to it!","color":"gold"}]
execute as @s[scores={KyuSpells=2}] run execute if entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tellraw @s ["",{"text":"A mysterious force prevents you from using this spell here.","color":"gold"}]
#
execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tag @s[tag=HomeCD] add KyuSpellCooldown
execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tag @s[level=..4] add KyuSpellCooldown
execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tag @s[nbt=!{Dimension:"minecraft:overworld"}] add KyuSpellCooldown
execute as @s[scores={KyuSpells=2}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run execute unless entity @e[name=DayQ,tag=HomeMadeQ] run tag @s add KyuSpellCooldown
execute as @s[scores={KyuSpells=2}] run execute if entity @e[type=marker,distance=..40,tag=KyuPreventHomeSpell] run tag @s add KyuSpellCooldown


tellraw @s[scores={KyuSpells=5},tag=HasteReset] ["",{"text":"You have already used the Haste spell today - You may use it again tomorrow.","color":"yellow"}]
tag @s[scores={KyuSpells=5},tag=HasteReset] add KyuSpellCooldown



tellraw @s[scores={KyuSpells=6},tag=SlowfallReset] ["",{"text":"You have no more Slowfall charges for today - You may use it again tomorrow.","color":"yellow"}]
tag @s[scores={KyuSpells=6},tag=SlowfallReset] add KyuSpellCooldown




tellraw @s[scores={KyuSpells=7},tag=ResistReset] ["",{"text":"You have already used the Resist spell today - You may use it again tomorrow.","color":"yellow"}]
tag @s[scores={KyuSpells=7},tag=ResistReset] add KyuSpellCooldown




execute as @s[scores={KyuSpells=8}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventEscapeSpell] run tellraw @s[tag=EscapeSpell2,tag=LadderReset] ["",{"text":"You have already used the Escape Ladder spell today - You may use it again tomorrow.","color":"yellow"}]
execute as @s[scores={KyuSpells=8}] run execute if entity @e[type=marker,distance=..40,tag=KyuPreventEscapeSpell] run tellraw @s ["",{"text":"A mysterious force prevents you from using this spell here.","color":"gold"}]
#
execute as @s[scores={KyuSpells=8}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventEscapeSpell] run tag @s[tag=EscapeSpell2,tag=LadderReset] add KyuSpellCooldown
execute as @s[scores={KyuSpells=8}] run execute if entity @e[type=marker,distance=..40,tag=KyuPreventEscapeSpell] run tag @s add KyuSpellCooldown


tellraw @s[scores={KyuSpells=10},tag=HorseReset] ["",{"text":"You have already used the Summon Horse spell today - You may use it again tomorrow.","color":"yellow"}]
tag @s[scores={KyuSpells=10},tag=HorseReset] add KyuSpellCooldown


tellraw @s[scores={KyuSpells=12},tag=InvisReset] ["",{"text":"You have already used the Invisiblity spell today - You may use it again tomorrow.","color":"yellow"}]
execute if score #KyuQStructuresInstall KyuDummy5 matches 1 run tellraw @s[scores={KyuSpells=12},tag=InvisSpell2,level=0..4] ["",{"text":"You do not have the required xp to cast this.","color":"yellow"}]
execute if score #KyuQStructuresInstall KyuDummy5 matches 1 run tag @s[scores={KyuSpells=12},tag=InvisSpell2,level=0..4] add KyuSpellCooldown
tag @s[scores={KyuSpells=12},tag=InvisReset] add KyuSpellCooldown


execute as @s[scores={KyuSpells=13}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventPortalSpell] run tellraw @s[tag=PortalSpell2,tag=PortalReset] ["",{"text":"You have already used this spell today - You may use it again tomorrow.","color":"yellow"}]
execute as @s[scores={KyuSpells=13}] run execute if entity @e[type=marker,distance=..40,tag=KyuPreventPortalSpell] run tellraw @s ["",{"text":"A mysterious force prevents you from using this spell here.","color":"gold"}]
#
execute as @s[scores={KyuSpells=13}] run execute unless entity @e[type=marker,distance=..40,tag=KyuPreventPortalSpell] run tag @s[tag=PortalSpell2,tag=PortalReset] add KyuSpellCooldown
execute as @s[scores={KyuSpells=13}] run execute if entity @e[type=marker,distance=..40,tag=KyuPreventPortalSpell] run tag @s add KyuSpellCooldown



execute as @s[scores={KyuSpells=14}] run tag @s remove FarmCapCheck
execute as @s[scores={KyuSpells=14}] run tag @s[tag=AnimalSpell2,tag=!FarmReset,level=3..,nbt={Inventory:[{id:"minecraft:egg"}]},tag=!FarmUpgrade2] add FarmCapCheck
execute as @s[scores={KyuSpells=14}] run tag @s[tag=AnimalSpell2,tag=!FarmReset,tag=FarmUpgrade2] add FarmCapCheck
execute as @s[scores={KyuSpells=14}] run tellraw @s[tag=AnimalSpell2,tag=!FarmCapCheck] ["",{"text":"You need at least an egg and 3 levels to cast this!","color":"yellow"}]
execute as @s[scores={KyuSpells=14}] run tellraw @s[tag=AnimalSpell2,tag=FarmReset] ["",{"text":"You have already used this spell recently - You may use it again soon.","color":"yellow"}]
#
execute as @s[scores={KyuSpells=14}] run tag @s[tag=AnimalSpell2,tag=!FarmCapCheck] add KyuSpellCooldown
execute as @s[scores={KyuSpells=14}] run tag @s[tag=AnimalSpell2,tag=FarmReset] add KyuSpellCooldown


