示例#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);
    }
示例#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);
    }
示例#3
0
    public CellarDoorAbility0(GameState state) {
      super(
          state,
          "(3), (T): Target player puts the bottom card of his or her library into his or her graveyard. If it's a creature card, you put a 2/2 black Zombie creature token onto the battlefield.");
      this.setManaCost(new ManaPool("(3)"));
      this.costsTap = true;

      SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));
      SetGenerator library = LibraryOf.instance(target);

      EventFactory putIntoGraveyard =
          new EventFactory(
              EventType.MOVE_OBJECTS,
              "Target player puts the bottom card of his or her library into his or her graveyard.");
      putIntoGraveyard.parameters.put(EventType.Parameter.CAUSE, This.instance());
      putIntoGraveyard.parameters.put(EventType.Parameter.TO, GraveyardOf.instance(target));
      putIntoGraveyard.parameters.put(EventType.Parameter.OBJECT, BottomCards.instance(1, library));
      this.addEffect(putIntoGraveyard);

      SetGenerator object = NewObjectOf.instance(EffectResult.instance(putIntoGraveyard));
      SetGenerator isCreature = Intersect.instance(object, HasType.instance(Type.CREATURE));

      CreateTokensFactory token =
          new CreateTokensFactory(
              1, 2, 2, "you put a 2/2 black Zombie creature token onto the battlefield.");
      token.setColors(Color.BLACK);
      token.setSubTypes(SubType.ZOMBIE);

      this.addEffect(
          ifThen(
              isCreature,
              token.getEventFactory(),
              "If it's a creature card, you put a 2/2 black Zombie creature token onto the battlefield."));
    }
示例#4
0
  public SurgicalExtraction(GameState state) {
    super(state);

    // Choose target card in a graveyard other than a basic land card.
    SetGenerator inGraveyards = InZone.instance(GraveyardOf.instance(Players.instance()));
    SetGenerator basicLands =
        Intersect.instance(HasSuperType.instance(SuperType.BASIC), HasType.instance(Type.LAND));
    SetGenerator legalTargets = RelativeComplement.instance(inGraveyards, basicLands);
    Target t =
        this.addTarget(legalTargets, "target card in a graveyard other than a basic land card");

    // Search its owner's graveyard, hand, and library for all cards with
    // the same name as that card and exile them.
    SetGenerator itsOwner = OwnerOf.instance(targetedBy(t));
    SetGenerator graveyard = GraveyardOf.instance(itsOwner);
    SetGenerator hand = HandOf.instance(itsOwner);
    SetGenerator library = LibraryOf.instance(itsOwner);
    SetGenerator zones = Union.instance(graveyard, hand, library);

    EventFactory effect =
        new EventFactory(
            EventType.SEARCH_FOR_ALL_AND_PUT_INTO,
            "Choose target card in a graveyard other than a basic land card. Search its owner's graveyard, hand, and library for all cards with the same name as that card and exile them.");
    effect.parameters.put(EventType.Parameter.CAUSE, This.instance());
    effect.parameters.put(EventType.Parameter.PLAYER, You.instance());
    effect.parameters.put(EventType.Parameter.ZONE, zones);
    effect.parameters.put(
        EventType.Parameter.TYPE,
        Identity.instance(HasName.instance(NameOf.instance(targetedBy(t)))));
    effect.parameters.put(EventType.Parameter.TO, ExileZone.instance());
    this.addEffect(effect);

    // Then that player shuffles his or her library.
    this.addEffect(shuffleLibrary(targetedBy(t), "Then that player shuffles his or her library."));
  }
示例#5
0
  public ThievesFortune(GameState state) {
    super(state);

    this.addAbility(new org.rnd.jmagic.abilities.keywords.Prowl(state, "(U)"));

    EventType.ParameterMap parameters = new EventType.ParameterMap();
    parameters.put(EventType.Parameter.CAUSE, This.instance());
    parameters.put(EventType.Parameter.NUMBER, numberGenerator(4));
    parameters.put(EventType.Parameter.PLAYER, You.instance());
    parameters.put(EventType.Parameter.ZONE, LibraryOf.instance(You.instance()));
    this.addEffect(
        new EventFactory(
            LOOK_AT_THE_TOP_N_CARDS_PUT_ONE_INTO_HAND_AND_THE_REST_ON_BOTTOM,
            parameters,
            "Look at the top four cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order."));
  }
示例#6
0
    public LensofClarityAbility0(GameState state) {
      super(
          state,
          "You may look at the top card of your library and at face-down creatures you don't control.");

      SetGenerator top = TopCards.instance(1, LibraryOf.instance(You.instance()));
      SetGenerator morphs = Intersect.instance(FaceDown.instance(), CreaturePermanents.instance());
      SetGenerator otherPlayersMorphs =
          RelativeComplement.instance(morphs, ControlledBy.instance(You.instance()));

      ContinuousEffect.Part lookAtMorphs = new ContinuousEffect.Part(ContinuousEffectType.LOOK);
      lookAtMorphs.parameters.put(ContinuousEffectType.Parameter.PLAYER, You.instance());
      lookAtMorphs.parameters.put(
          ContinuousEffectType.Parameter.OBJECT, Union.instance(top, otherPlayersMorphs));
      this.addEffectPart(lookAtMorphs);
    }
示例#7
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."));
  }
示例#8
0
  public GraspofPhantoms(GameState state) {
    super(state);

    // Put target creature on top of its owner's library.
    SetGenerator target =
        targetedBy(this.addTarget(CreaturePermanents.instance(), "target creature"));
    EventFactory put =
        new EventFactory(
            EventType.MOVE_OBJECTS, "Put target creature on top of its owner's library.");
    put.parameters.put(EventType.Parameter.CAUSE, This.instance());
    put.parameters.put(EventType.Parameter.TO, LibraryOf.instance(OwnerOf.instance(target)));
    put.parameters.put(EventType.Parameter.OBJECT, target);
    this.addEffect(put);

    // Flashback (7)(U) (You may cast this card from your graveyard for its
    // flashback cost. Then exile it.)
    this.addAbility(new org.rnd.jmagic.abilities.keywords.Flashback(state, "(7)(U)"));
  }
  public DarkConfidantAbility(GameState state) {
    super(
        state,
        "At the beginning of your upkeep, reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost.");
    this.addPattern(atTheBeginningOfYourUpkeep());

    SetGenerator library = LibraryOf.instance(You.instance());
    SetGenerator topCard = TopCards.instance(numberGenerator(1), library);

    EventFactory reveal = reveal(topCard, "Reveal the top card of your library");
    this.addEffect(reveal);
    this.addEffect(
        putIntoHand(topCard, OwnerOf.instance(topCard), "and put that card into your hand."));
    this.addEffect(
        loseLife(
            You.instance(),
            ConvertedManaCostOf.instance(EffectResult.instance(reveal)),
            "You lose life equal to its converted mana cost."));
  }