1+ package mage .cards .o ;
2+
3+ import java .util .UUID ;
4+
5+ import mage .ConditionalMana ;
6+ import mage .MageInt ;
7+ import mage .MageObject ;
8+ import mage .Mana ;
9+ import mage .abilities .Ability ;
10+ import mage .abilities .common .SpellCastControllerTriggeredAbility ;
11+ import mage .abilities .condition .Condition ;
12+ import mage .abilities .effects .CreateTokenCopySourceEffect ;
13+ import mage .abilities .effects .OneShotEffect ;
14+ import mage .abilities .effects .common .CastSourceTriggeredAbility ;
15+ import mage .abilities .effects .common .CopyStackObjectEffect ;
16+ import mage .abilities .effects .common .CopyTargetStackObjectEffect ;
17+ import mage .abilities .effects .keyword .InvestigateEffect ;
18+ import mage .abilities .mana .ConditionalColoredManaAbility ;
19+ import mage .abilities .mana .builder .ConditionalManaBuilder ;
20+ import mage .constants .*;
21+ import mage .cards .CardImpl ;
22+ import mage .cards .CardSetInfo ;
23+ import mage .filter .FilterSpell ;
24+ import mage .filter .predicate .Predicates ;
25+ import mage .filter .predicate .card .CastFromZonePredicate ;
26+ import mage .game .Game ;
27+ import mage .game .stack .Spell ;
28+ import mage .util .functions .RemoveTypeCopyApplier ;
29+
30+ /**
31+ * @author balazskristof
32+ */
33+ public final class OsgoodOperationDouble extends CardImpl {
34+
35+ private static final FilterSpell filter = new FilterSpell ("a spell from anywhere other than your hand" );
36+
37+ static {
38+ filter .add (Predicates .not (new CastFromZonePredicate (Zone .HAND )));
39+ }
40+
41+ public OsgoodOperationDouble (UUID ownerId , CardSetInfo setInfo ) {
42+ super (ownerId , setInfo , new CardType []{CardType .CREATURE }, "{2}{U}{U}" );
43+
44+ this .supertype .add (SuperType .LEGENDARY );
45+ this .subtype .add (SubType .HUMAN );
46+ this .subtype .add (SubType .ALIEN );
47+ this .subtype .add (SubType .SHAPESHIFTER );
48+ this .power = new MageInt (2 );
49+ this .toughness = new MageInt (2 );
50+
51+ // When you cast this spell, create a token that's a copy of it, except it isn't legendary.
52+ this .addAbility (new CastSourceTriggeredAbility (new OsgoodOperationDoubleEffect ()));
53+
54+ // {T}: Add {C}. Spend this mana only to cast an artifact spell or activate an ability of an artifact.
55+ this .addAbility (new ConditionalColoredManaAbility (Mana .ColorlessMana (1 ), new OsgoodOperationDoubleManaBuilder ()));
56+
57+ // Paradox -- Whenever you cast a spell from anywhere other than your hand, investigate.
58+ this .addAbility (new SpellCastControllerTriggeredAbility (
59+ new InvestigateEffect (),
60+ filter , false
61+ ).setAbilityWord (AbilityWord .PARADOX ));
62+ }
63+
64+ private OsgoodOperationDouble (final OsgoodOperationDouble card ) {
65+ super (card );
66+ }
67+
68+ @ Override
69+ public OsgoodOperationDouble copy () {
70+ return new OsgoodOperationDouble (this );
71+ }
72+ }
73+
74+ class OsgoodOperationDoubleEffect extends OneShotEffect {
75+
76+ OsgoodOperationDoubleEffect () {
77+ super (Outcome .Benefit );
78+ staticText = "create a token that's a copy of it, except it isn't legendary" ;
79+ }
80+
81+ protected OsgoodOperationDoubleEffect (final OsgoodOperationDoubleEffect effect ) {
82+ super (effect );
83+ }
84+
85+ @ Override
86+ public boolean apply (Game game , Ability source ) {
87+ Spell spell = game .getSpell (source .getSourceId ());
88+ if (spell == null ) {
89+ return false ;
90+ }
91+ spell .createCopyOnStack (game , source , source .getControllerId (), false , 1 , new RemoveTypeCopyApplier (SuperType .LEGENDARY ));
92+ return true ;
93+ }
94+
95+ @ Override
96+ public OsgoodOperationDoubleEffect copy () { return new OsgoodOperationDoubleEffect (this ); }
97+ }
98+
99+ class OsgoodOperationDoubleManaBuilder extends ConditionalManaBuilder {
100+
101+ @ Override
102+ public ConditionalMana build (Object ... options ) {
103+ return new mage .cards .o .OsgoodOperationDoubleConditionalMana (this .mana );
104+ }
105+
106+ @ Override
107+ public String getRule () {
108+ return "Spend this mana only to cast an artifact spell or activate an ability of an artifact." ;
109+ }
110+ }
111+
112+ class OsgoodOperationDoubleConditionalMana extends ConditionalMana {
113+
114+ OsgoodOperationDoubleConditionalMana (Mana mana ) {
115+ super (mana );
116+ addCondition (mage .cards .o .OsgoodOperationDoubleCondition .instance );
117+ }
118+ }
119+
120+ enum OsgoodOperationDoubleCondition implements Condition {
121+ instance ;
122+
123+ @ Override
124+ public boolean apply (Game game , Ability source ) {
125+ MageObject object = game .getObject (source );
126+ return object != null && object .isArtifact (game );
127+ }
128+ }
0 commit comments