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 FathomMageAbility1(GameState state) { super(state, "Whenever a +1/+1 counter is placed on Fathom Mage, you may draw a card."); SimpleEventPattern pattern = new SimpleEventPattern(EventType.PUT_ONE_COUNTER); pattern.put(EventType.Parameter.OBJECT, ABILITY_SOURCE_OF_THIS); pattern.put( EventType.Parameter.COUNTER, Identity.instance(Counter.CounterType.PLUS_ONE_PLUS_ONE)); this.addPattern(pattern); this.addEffect(youMay(drawACard())); }
public UntargetableByBU(GameState state) { super(state, "Karplusan Strider can't be the target of blue or black spells."); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.CANT_BE_THE_TARGET_OF); part.parameters.put(ContinuousEffectType.Parameter.OBJECT, This.instance()); SetGenerator blueOrBlackSpells = Intersect.instance(Spells.instance(), HasColor.instance(Color.BLUE, Color.BLACK)); part.parameters.put( ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(new SimpleSetPattern(blueOrBlackSpells))); this.addEffectPart(part); }
@Override public boolean perform(Game game, Event event, Map<Parameter, MagicSet> parameters) { Event damageEvent = createEvent(game, event.getName(), EventType.DEAL_DAMAGE_EVENLY, parameters); boolean ret = damageEvent.perform(event, false); SetPattern affectedCreatures = new SimpleSetPattern( Intersect.instance( TakerOfDamage.instance(EventDamage.instance(Identity.instance(event))), CreaturePermanents.instance())); SimpleEventPattern regenerate = new SimpleEventPattern(EventType.REGENERATE); regenerate.put(EventType.Parameter.OBJECT, affectedCreatures); EventReplacementEffectStopper stopRegen = new EventReplacementEffectStopper( parameters.get(Parameter.SOURCE).getOne(GameObject.class), null, regenerate); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.STOP_REPLACEMENT_EFFECT); part.parameters.put(ContinuousEffectType.Parameter.PROHIBITION, Identity.instance(stopRegen)); Map<EventType.Parameter, MagicSet> stopRegenParameters = new HashMap<EventType.Parameter, MagicSet>(); stopRegenParameters.put(EventType.Parameter.CAUSE, parameters.get(Parameter.SOURCE)); stopRegenParameters.put(EventType.Parameter.EFFECT, new MagicSet(part)); Event regenStopper = createEvent( game, "A creature dealt damage this way can't be regenerated this turn.", EventType.CREATE_FLOATING_CONTINUOUS_EFFECT, stopRegenParameters); ret = regenStopper.perform(event, false) && ret; event.setResult(Empty.set); return ret; }
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 SigardaHostofHeronsAbility1(GameState state) { super( state, "Spells and abilities your opponents control can't cause you to sacrifice permanents."); SimpleEventPattern youSacrificePermanents = new SimpleEventPattern(EventType.SACRIFICE_ONE_PERMANENT); youSacrificePermanents.put( EventType.Parameter.CAUSE, ControlledBy.instance(OpponentsOf.instance(You.instance()), Stack.instance())); youSacrificePermanents.put(EventType.Parameter.PERMANENT, Permanents.instance()); youSacrificePermanents.put(EventType.Parameter.PLAYER, You.instance()); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.PROHIBIT); part.parameters.put( ContinuousEffectType.Parameter.PROHIBITION, Identity.instance(youSacrificePermanents)); this.addEffectPart(part); }
public ShrineofBoundlessGrowthAbility1(GameState state) { super( state, "(T), Sacrifice Shrine of Boundless Growth: Add (1) to your mana pool for each charge counter on Shrine of Boundless Growth."); this.costsTap = true; this.addCost(sacrificeThis("Shrine of Boundless Growth")); SetGenerator counters = Count.instance(CountersOn.instance(ABILITY_SOURCE_OF_THIS, Counter.CounterType.CHARGE)); EventFactory addMana = new EventFactory( EventType.ADD_MANA, "Add (1) to your mana pool for each charge counter on Shrine of Boundless Growth."); addMana.parameters.put(EventType.Parameter.SOURCE, ABILITY_SOURCE_OF_THIS); addMana.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("(1)"))); addMana.parameters.put(EventType.Parameter.NUMBER, counters); addMana.parameters.put(EventType.Parameter.PLAYER, You.instance()); this.addEffect(addMana); }