Ejemplo n.º 1
0
    public ConsumingAberrationAbility1(GameState state) {
      super(
          state,
          "Whenever you cast a spell, each opponent reveals cards from the top of his or her library until he or she reveals a land card, then puts those cards into his or her graveyard.");

      this.addPattern(whenYouCastASpell());

      DynamicEvaluation eachOpponent = DynamicEvaluation.instance();

      SetGenerator toReveal =
          TopMost.instance(
              LibraryOf.instance(eachOpponent), numberGenerator(1), HasType.instance(Type.LAND));
      EventFactory reveal =
          reveal(
              toReveal,
              "Each opponent reveals cards from the top of his or her library until he or she reveals a land card,");
      EventFactory move =
          putIntoGraveyard(toReveal, "then puts those cards into his or her graveyard.");

      EventFactory forEach =
          new EventFactory(
              FOR_EACH_PLAYER,
              "Each opponent reveals cards from the top of his or her library until he or she reveals a land card, then puts those cards into his or her graveyard.");
      forEach.parameters.put(EventType.Parameter.PLAYER, OpponentsOf.instance(You.instance()));
      forEach.parameters.put(EventType.Parameter.TARGET, Identity.instance(eachOpponent));
      forEach.parameters.put(EventType.Parameter.EFFECT, Identity.instance(sequence(reveal, move)));
      this.addEffect(forEach);
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
0
  public Polymorph(GameState state) {
    super(state);

    // Destroy target creature. It can't be regenerated.
    Target target = this.addTarget(CreaturePermanents.instance(), "target creature");
    this.addEffects(
        bury(this, targetedBy(target), "Destroy target creature. It can't be regenerated."));

    // Its controller reveals cards from the top of his or her library until
    // he or she reveals a creature card.
    SetGenerator controller = ControllerOf.instance(targetedBy(target));
    SetGenerator library = LibraryOf.instance(controller);
    SetGenerator cardsToReveal =
        TopMost.instance(library, numberGenerator(1), HasType.instance(Type.CREATURE));

    EventType.ParameterMap revealParameters = new EventType.ParameterMap();
    revealParameters.put(EventType.Parameter.CAUSE, This.instance());
    revealParameters.put(EventType.Parameter.OBJECT, cardsToReveal);
    this.addEffect(
        new EventFactory(
            EventType.REVEAL,
            revealParameters,
            "Its controller reveals cards from the top of his or her library until he or she reveals a creature card."));

    // The player puts that card onto the battlefield,
    SetGenerator firstCreature = Intersect.instance(cardsToReveal, HasType.instance(Type.CREATURE));
    EventType.ParameterMap ontoFieldParameters = new EventType.ParameterMap();
    ontoFieldParameters.put(EventType.Parameter.CAUSE, This.instance());
    ontoFieldParameters.put(EventType.Parameter.CONTROLLER, controller);
    ontoFieldParameters.put(EventType.Parameter.OBJECT, firstCreature);
    this.addEffect(
        new EventFactory(
            EventType.PUT_ONTO_BATTLEFIELD,
            ontoFieldParameters,
            "The player puts that card onto the battlefield,"));

    // then shuffles all other cards revealed this way into his or her
    // library.
    // Since the "other cards" never left the library... this is just a
    // standard shuffle, not a shuffle-into.
    this.addEffect(
        shuffleLibrary(
            controller,
            "then shuffles all other cards revealed this way into his or her library."));
  }