Name:Preston's Stage
ManaCost:no cost
Types:Plane Las Vegas
T:Mode$ SpellCast | ValidCard$ Instant,Card.hasKeywordFlash | ValidActivatingPlayer$ Player | Execute$ TrigTokenCast | TriggerZones$ Command | TriggerDescription$ Whenever a player performs a magic trick, they create a Hat token. (You perform a magic trick when you cast an instant or spell with flash, or turn a face-down creature face-up. Hat tokens are artifact tokens with "{1}, {T}, Sacrifice this artifact: Create a 1/1 white Rabbit creature token.")
SVar:TrigTokenCast:DB$ Token | TokenScript$ c_a_hat_sac | TokenOwner$ TriggeredActivator
T:Mode$ TurnFaceUp | ValidCard$ Creature | TriggerZones$ Command | Execute$ TrigTokenFaceUp | Secondary$ True | TriggerDescription$ Whenever a player performs a magic trick, they create a Hat token. (You perform a magic trick when you cast an instant or spell with flash, or turn a face-down creature face-up. Hat tokens are artifact tokens with "{1}, {T}, Sacrifice this artifact: Create a 1/1 white Rabbit creature token.")
SVar:TrigTokenFaceUp:DB$ Token | TokenScript$ c_a_hat_sac | TokenOwner$ TriggeredCardController
T:Mode$ ChaosEnsues | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever Chaos ensues, until your next turn, creature cards in your hand have flash.
SVar:RolledChaos:DB$ Effect | StaticAbilities$ GrantFlashHand,GrantFlashStack | Duration$ UntilYourNextTurn
# Flash needs to persist onto the stack too, since the SpellCast trigger checks hasKeywordFlash on the spell itself, and a card loses the hand-only grant the moment it leaves hand. GrantFlashStack keeps that grant alive on the stack, but ONLY for creatures that were actually cast from hand (wasCastFromYourHand) - this stops it from also catching creatures cast from elsewhere (e.g. Gravecrawler from graveyard, Misthollow Griffin from exile) that happen to be on the stack at the same time.
SVar:GrantFlashHand:Mode$ Continuous | Affected$ Creature.YouOwn | AffectedZone$ Hand | AddKeyword$ Flash | Description$ Creature cards in your hand have flash.
SVar:GrantFlashStack:Mode$ Continuous | Affected$ Creature.YouOwn+wasCastFromYourHand | AffectedZone$ Stack | AddKeyword$ Flash
SVar:AIRollPlanarDieParams:Mode$ Random | Chance$ 25
Oracle:Whenever a player performs a magic trick, they create a Hat token. (You perform a magic trick when you cast an instant or spell with flash, or turn a face-down creature face-up. Hat tokens are artifact tokens with "{1}, {T}, Sacrifice this artifact: Create a 1/1 white Rabbit creature token.")\nWhenever Chaos ensues, until your next turn, creature cards in your hand have flash.
