6th-level necromancy
Casting Time 1 minute
Range Self
Components V S M (500gp gem, crystal or ornamental container)
Duration Until dispelled

Your soul enters the container you used to cast the spell. While you're in the container, your body is comatose, and you perceive the world from inside the jar. The only action you can do is project your soul up to 100 feet outside of the container. You either return to your body and end the spell, or attempt to possess another humanoid's body. You can't move, use reactions, or perform any other actions while in the jar.

You may only possess humanoids that you can see and that aren't guarded by a Protection from Evil and Good or Magic Circle spell. Your target must make a Charisma save. On a failure, your soul possesses the target and the target's soul is put inside the container. On a success, it knows that you tried to possess it and is immune to your possession for 24 hours.

If you possess a creature, you take control of it and assume all of its game statistics except alignment and Intelligence, Wisdom, and Charisma. You also keep your own class features, and don't use class features the target has.

You can use your action to stop possessing and return to the jar if the container is within 100 feet of you. The creature's soul returns to its body.

If the creature's body dies while you possess it, the creature dies and you must make a Charisma save against your spell DC. On a success, if the container is within 100 feet of you, you return to it. Otherwise, you die too.

A creature trapped in the container can see from inside it as normal, but can't move, take actions, or take reactions.

If the spell ends or the container is destroyed, the soul tries to return to its body. This is successful only if the body is alive and within 100 feet of the container; otherwise, the soul dies.

Once the spell ends, the container is destroyed.