Improved projectile code for spells