public InfernalGenesisAbility0(GameState state) { super( state, "At the beginning of each player's upkeep, that player puts the top card of his or her library into his or her graveyard. Then he or she puts X 1/1 black Minion creature tokens onto the battlefield, where X is that card's converted mana cost."); this.addPattern(atTheBeginningOfEachPlayersUpkeep()); SetGenerator thatPlayer = OwnerOf.instance( EventParameter.instance( TriggerEvent.instance(This.instance()), EventType.Parameter.STEP)); EventFactory mill = millCards( thatPlayer, 1, "That player puts the top card of his or her library into his or her graveyard."); this.addEffect(mill); SetGenerator thatCard = NewObjectOf.instance(EffectResult.instance(mill)); SetGenerator X = ConvertedManaCostOf.instance(thatCard); CreateTokensFactory f = new CreateTokensFactory( X, numberGenerator(1), numberGenerator(1), "Then he or she puts X 1/1 black Minion creature tokens onto the battlefield, where X is that card's converted mana cost."); f.setController(thatPlayer); f.setColors(Color.BLACK); f.setSubTypes(SubType.MINION); this.addEffect(f.getEventFactory()); }
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 Glass(GameState state) { super( state, "Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability."); SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_TARGET); pattern.put( EventType.Parameter.TARGET, RelativeComplement.instance(ABILITY_SOURCE_OF_THIS, TargetedThisTurn.instance())); state.ensureTracker(new TargetedThisTurn.Tracker()); SetGenerator thatSpell = EventParameter.instance( TriggerEvent.instance(This.instance()), EventType.Parameter.OBJECT); this.addEffect(counter(thatSpell, "Counter that spell or ability.")); }
public DamageTrigger(GameState state) { super( state, "At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Hellfire Mongrel deals 2 damage to him or her."); this.addPattern(atTheBeginningOfEachOpponentsUpkeeps()); SetGenerator twoOrFewer = Between.instance(null, 2); SetGenerator upkeep = EventParameter.instance(TriggerEvent.instance(This.instance()), EventType.Parameter.STEP); SetGenerator thatPlayer = OwnerOf.instance(upkeep); SetGenerator cardsInHand = Count.instance(InZone.instance(HandOf.instance(thatPlayer))); this.interveningIf = Intersect.instance(twoOrFewer, cardsInHand); this.addEffect( permanentDealDamage(2, thatPlayer, "Hellfire Mongrel deals 2 damage to that player.")); }
public Vampiricism(GameState state) { super(state, "Whenever you gain life, target opponent loses that much life."); SimpleEventPattern pattern = new SimpleEventPattern(EventType.GAIN_LIFE); pattern.put(EventType.Parameter.PLAYER, You.instance()); this.addPattern(pattern); Target target = this.addTarget(OpponentsOf.instance(You.instance()), "target opponent"); this.addEffect( loseLife( targetedBy(target), EventParameter.instance( TriggerEvent.instance(This.instance()), EventType.Parameter.NUMBER), "Target opponent loses that much life.")); }
private String getConfigKey(TriggerEvent triggerEvent, int reqNumber, String name) { return triggerEvent.getConfigKeyBase() + ".http." + reqNumber + "." + name; }