Leaves the battlefield

A leaves-the-battlefield ability is a triggered ability that triggers when a permanent leaves the battlefield. Unlike most triggered abilities, the conditions for triggering a leaves-the-battlefield ability are checked based on the state of the game before the event happens, rather than afterwards. A permanent is considered to leave the battlefield when it ceases to exist because its owner leaves the game, unless it's phased out.

Rules
undefined undefined undefined