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