Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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)."));
    }
Exemplo n.º 3
0
    public AnotherCreatureEntersTheBattlefield(GameState state) {
      super(
          state,
          "Whenever another creature enters the battlefield under your control, if you control both that creature and this one and both are unpaired, you may pair that creature with this creature for as long as both remain creatures on the battlefield under your control.");
      SetGenerator thisCreature = ABILITY_SOURCE_OF_THIS;
      SetGenerator otherCreatures =
          RelativeComplement.instance(CreaturePermanents.instance(), thisCreature);
      this.addPattern(
          new SimpleZoneChangePattern(
              null, Battlefield.instance(), otherCreatures, You.instance(), false));

      SetGenerator thatCreature = NewObjectOf.instance(TriggerZoneChange.instance(This.instance()));
      SetGenerator youControl = ControlledBy.instance(You.instance());
      SetGenerator youControlUnpairedThis =
          Intersect.instance(youControl, Unpaired.instance(), thisCreature);
      SetGenerator youControlUnpairedThat =
          Intersect.instance(youControl, Unpaired.instance(), thatCreature);
      this.interveningIf = Both.instance(youControlUnpairedThis, youControlUnpairedThat);

      ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.PAIR);
      part.parameters.put(
          ContinuousEffectType.Parameter.OBJECT, Union.instance(thisCreature, thatCreature));

      SetGenerator youControlCreatureThis = Intersect.instance(CREATURES_YOU_CONTROL, thisCreature);
      SetGenerator youControlCreatureThat = Intersect.instance(CREATURES_YOU_CONTROL, thatCreature);
      SetGenerator expires =
          Not.instance(Both.instance(youControlCreatureThis, youControlCreatureThat));
      EventFactory floatingEffect =
          createFloatingEffect(expires, "Pair this creature with that creature", part);

      this.addEffect(youMay(floatingEffect));
    }
Exemplo n.º 4
0
    public PsychosisCrawlerAbility0(GameState state) {
      super(
          state,
          "Psychosis Crawler's power and toughness are each equal to the number of cards in your hand.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator number = Count.instance(InZone.instance(HandOf.instance(You.instance())));
      this.addEffectPart(setPowerAndToughness(This.instance(), number, number));
    }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
    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."));
    }
Exemplo n.º 7
0
    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."));
    }
Exemplo n.º 8
0
    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));
    }
Exemplo n.º 9
0
    public Blind(GameState state) {
      super(
          state,
          "Whenever Blinding Angel deals combat damage to a player, that player skips his or her next combat phase.");

      this.addPattern(whenDealsCombatDamageToAPlayer(ABILITY_SOURCE_OF_THIS));

      SetGenerator thatPlayer = TakerOfDamage.instance(TriggerDamage.instance(This.instance()));
      SetGenerator combat = CombatPhaseOf.instance(thatPlayer);

      SimpleEventPattern nextCombatPhase = new SimpleEventPattern(EventType.BEGIN_PHASE);
      nextCombatPhase.put(EventType.Parameter.PHASE, combat);

      EventReplacementEffect skip =
          new EventReplacementEffect(
              state.game, "That player skips his or her next combat phase", nextCombatPhase);
      // skip.addEffect(nothing)

      this.addEffect(
          createFloatingReplacement(skip, "That player skips his or her next combat phase."));
    }
Exemplo n.º 10
0
    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."));
    }
Exemplo n.º 11
0
    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."));
    }