Name:Ingenious Mastery
ManaCost:X 2 U
Types:Sorcery
S:Mode$ AlternativeCost | ValidSA$ Spell.Self | EffectZone$ All | Cost$ 2 U | Description$ You may pay {2}{U} rather than pay this spell's mana cost. | StackDescription$ If the {2}{U} cost was paid, you draw three cards, then an opponent creates two Treasure tokens and they scry 2. If that cost wasn't paid, you draw X cards.
A:SP$ Branch | BranchConditionSVar$ AltCostPaid | BranchConditionSVarCompare$ GE1 | TrueSubAbility$ DBAltCostEffect | FalseSubAbility$ DBDrawX | SpellDescription$ If the {2}{U} cost was paid, you draw three cards, then an opponent creates two Treasure tokens and they scry 2. If that cost wasn't paid, you draw X cards.
SVar:DBAltCostEffect:DB$ Draw | Defined$ You | NumCards$ 3 | SubAbility$ OppTreasureScry
SVar:OppTreasureScry:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | ChoiceTitle$ Choose an opponent to create treasure tokens and scry 2 | SubAbility$ OppTreasure
SVar:OppTreasure:DB$ Token | TokenAmount$ 2 | TokenScript$ c_a_treasure_sac | TokenOwner$ ChosenPlayer | SubAbility$ OppScry
SVar:OppScry:DB$ Scry | ScryNum$ 2 | Defined$ ChosenPlayer
SVar:DBDrawX:DB$ Draw | Defined$ You | NumCards$ X
SVar:X:Count$xPaid
SVar:AltCostPaid:Count$AltCost.1.0
Oracle:You may pay {2}{U} rather than pay this spell's mana cost.\nIf the {2}{U} cost was paid, you draw three cards, then an opponent creates two Treasure tokens and they scry 2. If that cost wasn't paid, you draw X cards.
