execute if score @s[tag=magus_tier_4_unlocked] magus_spell_tier_4 matches 0 run function kiwi2:upgrades/classes/magus/spells/tier_4/magic_missile_storm
execute if score @s[tag=magus_tier_4_unlocked] magus_spell_tier_4 matches 1 run function kiwi2:upgrades/classes/magus/spells/tier_4/gravitron/gravitron
execute if score @s[tag=magus_tier_4_unlocked] magus_spell_tier_4 matches 2 run function kiwi2:upgrades/classes/magus/spells/tier_4/geyser/geyser
execute if score @s[tag=magus_tier_4_unlocked] magus_spell_tier_4 matches 3 run function kiwi2:upgrades/classes/magus/spells/tier_4/lightning_ball/lightning_ball
execute if score @s[tag=magus_tier_4_unlocked] magus_spell_tier_4 matches 4 run function kiwi2:upgrades/classes/magus/spells/tier_4/flashfreeze/flashfreeze
execute if score @s[tag=magus_tier_4_unlocked] magus_spell_tier_4 matches 5 run function kiwi2:upgrades/classes/magus/spells/tier_4/implode/implode
tag @s[tag=magus_tier_4_unlocked] add magus_casted_spell_tier_4
tag @s[tag=magus_tier_4_unlocked] add magus_unstable_check_tier_4
schedule function kiwi2:upgrades/classes/magus/spells/remove_casted_spell_tag 1t