public CountrysideCrusherAbility0(GameState state) { super( state, "At the beginning of your upkeep, reveal the top card of your library. If it's a land card, put it into your graveyard and repeat this process."); this.addPattern(atTheBeginningOfYourUpkeep()); SetGenerator yourLibrary = LibraryOf.instance(You.instance()); SetGenerator toReveal = TopMost.instance( yourLibrary, numberGenerator(1), RelativeComplement.instance( InZone.instance(yourLibrary), HasType.instance(Type.LAND))); EventFactory reveal = new EventFactory( EventType.REVEAL, "Reveal cards from the top of your library until you reveal a nonland card."); reveal.parameters.put(EventType.Parameter.CAUSE, This.instance()); reveal.parameters.put(EventType.Parameter.OBJECT, toReveal); this.addEffect(reveal); SetGenerator landsRevealed = Intersect.instance(toReveal, HasType.instance(Type.LAND)); EventFactory pitch = new EventFactory( EventType.PUT_INTO_GRAVEYARD, "Put all revealed nonland cards into your graveyard."); pitch.parameters.put(EventType.Parameter.CAUSE, This.instance()); pitch.parameters.put(EventType.Parameter.OBJECT, landsRevealed); this.addEffect(pitch); }
public DearlyDepartedAbility1(GameState state) { super( state, "As long as Dearly Departed is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it."); this.canApply = THIS_IS_IN_A_GRAVEYARD; SetGenerator humanCreatures = Intersect.instance(HasSubType.instance(SubType.HUMAN), HasType.instance(Type.CREATURE)); ZoneChangeReplacementEffect replacement = new ZoneChangeReplacementEffect(this.game, this.getName()); replacement.addPattern( new SimpleZoneChangePattern( null, Battlefield.instance(), humanCreatures, You.instance(), false)); SetGenerator zoneChange = ReplacedBy.instance(Identity.instance(replacement)); EventFactory factory = new EventFactory(EventType.PUT_COUNTERS, this.getName()); factory.parameters.put(EventType.Parameter.CAUSE, CauseOf.instance(zoneChange)); factory.parameters.put( EventType.Parameter.COUNTER, Identity.instance(Counter.CounterType.PLUS_ONE_PLUS_ONE)); factory.parameters.put(EventType.Parameter.OBJECT, NewObjectOf.instance(zoneChange)); replacement.addEffect(factory); this.addEffectPart(replacementEffectPart(replacement)); }
public MysticRemoraAbility1(GameState state) { super( state, "Whenever an opponent casts a noncreature spell, you may draw a card unless that player pays (4)."); SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED); pattern.put(EventType.Parameter.PLAYER, OpponentsOf.instance(You.instance())); pattern.put( EventType.Parameter.OBJECT, RelativeComplement.instance(Spells.instance(), HasType.instance(Type.CREATURE))); this.addPattern(pattern); SetGenerator thatPlayer = EventParameter.instance( TriggerEvent.instance(This.instance()), EventType.Parameter.PLAYER); EventFactory mayDraw = youMay(drawCards(You.instance(), 1, "Draw a card"), "You may draw a card"); EventFactory pay = new EventFactory(EventType.PAY_MANA, "Pay (4)"); pay.parameters.put(EventType.Parameter.CAUSE, This.instance()); pay.parameters.put(EventType.Parameter.PLAYER, thatPlayer); pay.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("4"))); this.addEffect( unless(thatPlayer, mayDraw, pay, "You may draw a card unless that player pays (4).")); }
public LunarMysticAbility0(GameState state) { super(state, "Whenever you cast an instant spell, you may pay (1). If you do, draw a card."); SimpleEventPattern whenYouCastASpell = new SimpleEventPattern(EventType.BECOMES_PLAYED); whenYouCastASpell.put(EventType.Parameter.PLAYER, You.instance()); whenYouCastASpell.put(EventType.Parameter.OBJECT, HasType.instance(Type.INSTANT)); this.addPattern(whenYouCastASpell); this.addEffect( ifThen(youMayPay("(1)"), drawACard(), "You may pay (1). If you do, draw a card.")); }
public CountrysideCrusherAbility1(GameState state) { super( state, "Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on Countryside Crusher."); ZoneChangePattern pitchedLand = new SimpleZoneChangePattern( null, GraveyardOf.instance(You.instance()), HasType.instance(Type.LAND), false); this.addPattern(pitchedLand); this.addEffect( putCountersOnThis(1, Counter.CounterType.PLUS_ONE_PLUS_ONE, "Countryside Crusher")); }
public GolemFoundryAbility0(GameState state) { super( state, "Whenever you cast an artifact spell, you may put a charge counter on Golem Foundry."); SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED); pattern.put(EventType.Parameter.PLAYER, You.instance()); pattern.withResult(HasType.instance(Type.ARTIFACT)); this.addPattern(pattern); this.addEffect( youMay( putCounters( 1, Counter.CounterType.CHARGE, ABILITY_SOURCE_OF_THIS, "Put a charge counter on Golem Foundry."), "You may put a charge counter on Golem Foundry.")); }
public BlindObedienceAbility1(GameState state) { super(state, "Artifacts and creatures your opponents control enter the battlefield tapped."); SetGenerator controller = ControllerOf.instance(This.instance()); SetGenerator stuff = HasType.instance(Type.ARTIFACT, Type.CREATURE); SetGenerator opponents = OpponentsOf.instance(controller); ZoneChangeReplacementEffect gatekeeping = new ZoneChangeReplacementEffect( this.game, "Artifacts and creatures your opponents control enter the battlefield tapped"); gatekeeping.addPattern( new SimpleZoneChangePattern(null, Battlefield.instance(), stuff, opponents, false)); gatekeeping.addEffect( tap( NewObjectOf.instance(gatekeeping.replacedByThis()), "An artifact or creature an opponent controls enters the battlefield tapped.")); this.addEffectPart(replacementEffectPart(gatekeeping)); }
public AntiWarden(GameState state) { super( state, "Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life."); this.addPattern( new SimpleZoneChangePattern( null, Battlefield.instance(), HasType.instance(Type.CREATURE), OpponentsOf.instance(You.instance()), false)); this.addEffect( youMay( loseLife( ControllerOf.instance(TriggerZoneChange.instance(This.instance())), 1, "That player loses 1 life."), "You may have that player lose 1 life.")); }
public LazavDimirMastermindAbility1(GameState state) { super( state, "Whenever a creature card is put into an opponent's graveyard from anywhere, you may have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability."); this.addPattern( new SimpleZoneChangePattern( null, GraveyardOf.instance(OpponentsOf.instance(You.instance())), HasType.instance(Type.CREATURE), false)); SetGenerator thatCard = NewObjectOf.instance(TriggerZoneChange.instance(This.instance())); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.COPY_OBJECT); part.parameters.put( ContinuousEffectType.Parameter.ABILITY, Identity.instance( new SimpleAbilityFactory(LazavDimirMastermindAbility1.class), new SimpleAbilityFactory(Hexproof.class))); part.parameters.put(ContinuousEffectType.Parameter.OBJECT, ABILITY_SOURCE_OF_THIS); part.parameters.put(ContinuousEffectType.Parameter.ORIGINAL, thatCard); part.parameters.put( ContinuousEffectType.Parameter.RETAIN, Identity.instance(Characteristics.Characteristic.NAME)); part.parameters.put( ContinuousEffectType.Parameter.TYPE, Identity.instance(SuperType.LEGENDARY)); EventFactory copy = createFloatingEffect( Empty.instance(), "Have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability.", part); this.addEffect( youMay( copy, "Have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability.")); }
public GlintHawkIdolAbility0(GameState state) { super( state, "Whenever another artifact enters the battlefield under your control, you may have Glint Hawk Idol become a 2/2 Bird artifact creature with flying until end of turn."); this.addPattern( new SimpleZoneChangePattern( null, Battlefield.instance(), RelativeComplement.instance(HasType.instance(Type.ARTIFACT), ABILITY_SOURCE_OF_THIS), You.instance(), false)); Animator animate = new Animator(ABILITY_SOURCE_OF_THIS, 2, 2); animate.addSubType(SubType.BIRD); animate.addType(Type.ARTIFACT); animate.addType(Type.CREATURE); animate.addAbility(org.rnd.jmagic.abilities.keywords.Flying.class); this.addEffect( youMay( createFloatingEffect( "Glint Hawk Idol becomes a 2/2 Bird artifact creature with flying until end of turn.", animate.getParts()), "You may have Glint Hawk Idol become a 2/2 Bird artifact creature with flying until end of turn.")); }