
tag @s remove ECSpellText
tag @s[scores={KyuSpells=9}] add ECSpellText

##commented spells moved to the latent spell function
#execute as @s[scores={KyuSpells=1}] run execute at @s run function zzzzdonotuse:spell/normalspells/sethome
#execute as @s[scores={KyuSpells=2}] run execute at @s run function zzzzdonotuse:spell/normalspells/tphome
execute as @s[scores={KyuSpells=3}] run function zzzzdonotuse:spell/normalspells/cobblegen
execute as @s[scores={KyuSpells=4}] run function zzzzdonotuse:spell/normalspells/glassgen
#execute as @s[scores={KyuSpells=5}] run function zzzzdonotuse:spell/normalspells/speed
#execute as @s[scores={KyuSpells=6}] run function zzzzdonotuse:spell/normalspells/slowfall
#execute as @s[scores={KyuSpells=7}] run function zzzzdonotuse:spell/normalspells/resist
#execute as @s[scores={KyuSpells=8}] run execute at @s run function zzzzdonotuse:spell/normalspells/escape
execute as @s[scores={KyuSpells=9}] run execute at @s run function zzzzdonotuse:spell/normalspells/eclocator
#execute as @s[scores={KyuSpells=10}] run function zzzzdonotuse:spell/normalspells/horse
execute as @s[scores={KyuSpells=11}] run function zzzzdonotuse:spell/normalspells/clearweather
#execute as @s[scores={KyuSpells=12}] run function zzzzdonotuse:spell/normalspells/invis
#execute as @s[scores={KyuSpells=13}] run execute at @s run function zzzzdonotuse:spell/normalspells/createportal
#execute as @s[scores={KyuSpells=14}] run function zzzzdonotuse:spell/normalspells/farmanimalcap
execute as @s[scores={KyuSpells=15}] run function zzzzdonotuse:spell/normalspells/xptobottle
#execute as @s[tag=K,scores={KyuSpells=20}] run function zzzzdonotuse:spell/blindrageactivate

tag @s remove KyuSpellCooldown
execute at @s run function zzzzdonotuse:spell/checkcooldown

execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=1}] run tag @s add KyuLatentSetHomeSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=2}] run tag @s add KyuLatentTPHomeSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=5}] run tag @s add KyuLatentSpeedSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=6}] run tag @s add KyuLatentSlowfallSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=7}] run tag @s add KyuLatentResistSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=8}] run tag @s add KyuLatentEscapeSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=10}] run tag @s add KyuLatentHorseSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=12}] run tag @s add KyuLatentInvisSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=13}] run tag @s add KyuLatentPortalSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=14}] run tag @s add KyuLatentFarmAnimalSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=20}] run tag @s add KyuLatentBlindRageSpell

execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=1}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=2}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=5}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=6}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=7}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=8}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=10}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=12}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=13}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=14}] run tag @s add KyuLatentSpell
execute as @s[tag=!KyuSpellCooldown,scores={KyuSpells=20}] run tag @s add KyuLatentSpell

scoreboard players set @s[tag=K,scores={KyuSpells=1..15}] KyuSpells 0
scoreboard players set @s[tag=K,scores={KyuSpells=20}] KyuSpells 0



tellraw @s[tag=!ECSpellText,tag=KyuLatentSpell,tag=!KyuSpellCooldown] ["",{"text":"Your spell has been primed. All primed spells will activate the next time you sneak.","color":"yellow"}]


execute as @s[scores={KyuSpells=500..600}] run function zzzzdonotuse:modifyarmor/giverecipe

execute if entity @s[tag=K,scores={KyuSpells=16..18}] run execute in overworld run data merge block 999995 120 999979 {auto:1b}
execute if entity @s[tag=K,scores={KyuSpells=19}] run execute in overworld run data merge block 999992 120 999979 {auto:1b}
#execute if entity @s[tag=K,scores={KyuSpells=20}] run execute in overworld run data merge block 999993 120 999979 {auto:1b}
execute if entity @s[scores={KyuSpells=1000..1020}] run function zzzzdonotuse:misc/starteritem
execute as @s[scores={KyuSpells=1100..1101}] run function zzzzdonotuse:minutetimer/newplayertextoptions
execute as @s[scores={KyuSpells=1200}] run function zzzzdonotuse:misc/progressionbook/progressionbooktextclick


#debug
execute as @s[scores={KyuSpells=2000..2100}] run function zzzzdonotuse:debug/debugmain
