Name:Disorienting Choice
ManaCost:3 G
Types:Sorcery
A:SP$ Pump | ValidTgts$ Artifact.OppCtrl,Enchantment.OppCtrl | TgtPrompt$ Choose up to one target artifact or enchantment each opponent controls | TargetMin$ 0 | TargetMax$ OneEach | TargetsForEachPlayer$ True | SubAbility$ DBRepeat | SpellDescription$ For each opponent, choose up to one target artifact or enchantment that player controls. For each permanent chosen this way, its controller may exile it. Then if one or more of the chosen permanents are still on the battlefield, you search your library for up to that many land cards, put them onto the battlefield tapped, then shuffle.
SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ TargetedController | RepeatSubAbility$ DBChoice | SubAbility$ DBExile
SVar:DBChoice:DB$ GenericChoice | Choices$ DBDoNotKeep,DBIncrease | Defined$ Remembered | AILogic$ Random | ShowChoice$ ExceptSelf
SVar:DBDoNotKeep:DB$ Pump | Defined$ Targeted.RememberedPlayerCtrl | RememberPumped$ True | SpellDescription$ Exile targeted card
SVar:DBIncrease:DB$ StoreSVar | SVar$ X | Type$ CountSVar | Expression$ X/Plus.1 | SpellDescription$ Keep targeted card
SVar:DBExile:DB$ ChangeZoneAll | Origin$ Battlefield | Destination$ Exile | ChangeType$ Card.IsRemembered | SubAbility$ DBSearchLibrary
SVar:DBSearchLibrary:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Land | Tapped$ True | ChangeNum$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Number$0
SVar:OneEach:PlayerCountOpponents$Amount
Oracle:For each opponent, choose up to one target artifact or enchantment that player controls. For each permanent chosen this way, its controller may exile it. Then if one or more of the chosen permanents are still on the battlefield, you search your library for up to that many land cards, put them onto the battlefield tapped, then shuffle.
