#spell book
execute as @s[tag=sorcerer_cast,tag=!sorcerer_choice,predicate=main:holding/characters/sorcerer_lightning] run function main:characters/sorcerer/rc/id1/inventory/lightning
execute as @s[tag=sorcerer_cast,tag=!sorcerer_choice,predicate=main:holding/characters/sorcerer_water] run function main:characters/sorcerer/rc/id1/inventory/water
execute as @s[tag=sorcerer_cast,tag=!sorcerer_choice,predicate=main:holding/characters/sorcerer_earth] run function main:characters/sorcerer/rc/id1/inventory/earth

execute as @s[tag=!sorcerer_cast,predicate=main:holding/characters/sorcerer_map] run tag @s add sorcerer_cast
execute as @s[tag=sorcerer_cast,predicate=main:holding/characters/sorcerer_map] run function main:characters/sorcerer/rc/id1/reset

#ticks
function main:characters/sorcerer/rc/id1/spells/e_e/tick
function main:characters/sorcerer/rc/id1/spells/w_e/tick
function main:characters/sorcerer/rc/id1/spells/w_l/tick
function main:characters/sorcerer/rc/id1/spells/w_w/tick

#ui
function main:characters/sorcerer/rc/id1/ui
function main:characters/sorcerer/rc/id1/inventory/tick

#reset
execute if score .w_e_cost sorcerer matches ..19 run scoreboard players set .w_e_cost sorcerer 20
execute if score .w_l_cost sorcerer matches ..19 run scoreboard players set .w_l_cost sorcerer 20
execute if score .l_l_cost sorcerer matches ..19 run scoreboard players set .l_l_cost sorcerer 20
execute if score .e_l_cost sorcerer matches ..19 run scoreboard players set .e_l_cost sorcerer 20
execute if score .e_e_cost sorcerer matches ..19 run scoreboard players set .e_e_cost sorcerer 20
execute if score .w_w_cost sorcerer matches ..19 run scoreboard players set .w_w_cost sorcerer 20

execute if score .w_e_cost sorcerer matches 101.. run scoreboard players set .w_e_cost sorcerer 100
execute if score .w_l_cost sorcerer matches 101.. run scoreboard players set .w_l_cost sorcerer 100
execute if score .l_l_cost sorcerer matches 101.. run scoreboard players set .l_l_cost sorcerer 100
execute if score .e_l_cost sorcerer matches 101.. run scoreboard players set .e_l_cost sorcerer 100
execute if score .e_e_cost sorcerer matches 101.. run scoreboard players set .e_e_cost sorcerer 100
execute if score .w_w_cost sorcerer matches 101.. run scoreboard players set .w_w_cost sorcerer 100