Ejemplo n.º 1
0
  public EvolutionCharm(GameState state) {
    super(state);

    // Choose one

    // Search your library for a basic land card, reveal it, put it into
    // your hand, then shuffle your library
    {
      EventType.ParameterMap searchParameters = new EventType.ParameterMap();
      searchParameters.put(EventType.Parameter.CAUSE, This.instance());
      searchParameters.put(EventType.Parameter.PLAYER, You.instance());
      searchParameters.put(EventType.Parameter.NUMBER, numberGenerator(1));
      searchParameters.put(
          EventType.Parameter.TYPE,
          Identity.instance(
              Intersect.instance(
                  HasSuperType.instance(SuperType.BASIC), HasType.instance(Type.LAND))));
      searchParameters.put(EventType.Parameter.TO, HandOf.instance(You.instance()));
      this.addEffect(
          1,
          new EventFactory(
              EventType.SEARCH_LIBRARY_AND_PUT_INTO,
              searchParameters,
              "Search your library for a basic land card, reveal it, put it into your hand, then shuffle your library."));
    }

    // Return target creature card from your graveyard to your hand
    {
      SetGenerator graveyard = GraveyardOf.instance(You.instance());
      Target target =
          this.addTarget(
              2,
              Intersect.instance(HasType.instance(Type.CREATURE), InZone.instance(graveyard)),
              "target creature from your graveyard");

      EventType.ParameterMap moveParameters = new EventType.ParameterMap();
      moveParameters.put(EventType.Parameter.CAUSE, This.instance());
      moveParameters.put(EventType.Parameter.TO, HandOf.instance(You.instance()));
      moveParameters.put(EventType.Parameter.OBJECT, targetedBy(target));
      this.addEffect(
          2,
          new EventFactory(
              EventType.MOVE_OBJECTS,
              moveParameters,
              "Return target creature card from your graveyard to your hand."));
    }

    // Target creature gains flying until end of turn.
    {
      Target target = this.addTarget(3, CreaturePermanents.instance(), "target creature");
      this.addEffect(
          3,
          addAbilityUntilEndOfTurn(
              targetedBy(target),
              org.rnd.jmagic.abilities.keywords.Flying.class,
              "Target creature gains flying until end of turn."));
    }
  }
Ejemplo n.º 2
0
    public EntomberExarchAbility0(GameState state) {
      super(
          state,
          "When Entomber Exarch enters the battlefield, choose one \u2014\n\u2022 Return target creature card from your graveyard to your hand.\n\u2022 Target opponent reveals his or her hand, you choose a noncreature card from it, then that player discards that card.");
      this.addPattern(whenThisEntersTheBattlefield());

      // Return target creature card from your graveyard to your hand
      {
        SetGenerator yourYard = GraveyardOf.instance(You.instance());
        SetGenerator target =
            targetedBy(
                this.addTarget(
                    1,
                    Intersect.instance(HasType.instance(Type.CREATURE), InZone.instance(yourYard)),
                    "target creature card in your graveyard"));

        EventFactory move =
            new EventFactory(
                EventType.MOVE_OBJECTS,
                "Return target creature card from your graveyard to your hand");
        move.parameters.put(EventType.Parameter.CAUSE, This.instance());
        move.parameters.put(EventType.Parameter.TO, HandOf.instance(You.instance()));
        move.parameters.put(EventType.Parameter.OBJECT, target);
        this.addEffect(1, move);
      }

      // target opponent reveals his or her hand, you choose a noncreature
      // card from it, then that player discards that card
      {
        SetGenerator target =
            targetedBy(this.addTarget(2, OpponentsOf.instance(You.instance()), "target opponent"));

        SetGenerator cards = InZone.instance(HandOf.instance(target));
        EventType.ParameterMap revealParameters = new EventType.ParameterMap();
        revealParameters.put(EventType.Parameter.CAUSE, This.instance());
        revealParameters.put(EventType.Parameter.OBJECT, cards);
        this.addEffect(
            2,
            new EventFactory(
                EventType.REVEAL, revealParameters, "Target opponent reveals his or her hand."));

        SetGenerator choices = RelativeComplement.instance(cards, HasType.instance(Type.CREATURE));

        EventType.ParameterMap parameters = new EventType.ParameterMap();
        parameters.put(EventType.Parameter.CAUSE, This.instance());
        parameters.put(EventType.Parameter.PLAYER, You.instance());
        parameters.put(EventType.Parameter.TARGET, target);
        parameters.put(EventType.Parameter.CHOICE, Identity.instance(choices));
        this.addEffect(
            2,
            new EventFactory(
                EventType.DISCARD_FORCE,
                parameters,
                "You choose a noncreature card from it, then that player discards that card."));
      }
    }
Ejemplo n.º 3
0
  public RuneflareTrap(GameState state) {
    super(state);

    // If an opponent drew three or more cards this turn, you may pay (R)
    // rather than pay Runeflare Trap's mana cost.
    state.ensureTracker(new CardsDrawn());
    SetGenerator opponents = OpponentsOf.instance(You.instance());
    SetGenerator cardsDrawn = MaximumPerPlayer.instance(CardsDrawn.class, opponents);
    SetGenerator trapCondition = Intersect.instance(cardsDrawn, Between.instance(3, null));
    this.addAbility(
        new Trap(
            state,
            this.getName(),
            trapCondition,
            "If an opponent drew three or more cards this turn",
            "(R)"));

    // Runeflare Trap deals damage to target player equal to the number of
    // cards in that player's hand.
    Target target = this.addTarget(Players.instance(), "target player");

    SetGenerator amount = Count.instance(InZone.instance(HandOf.instance(targetedBy(target))));
    this.addEffect(
        spellDealDamage(
            amount,
            targetedBy(target),
            "Runeflare Trap deals damage to target player equal to the number of cards in that player's hand."));
  }
Ejemplo n.º 4
0
  public Breakthrough(GameState state) {
    super(state);

    // Draw four cards, then choose X cards in your hand and discard the
    // rest.
    this.addEffect(drawCards(You.instance(), 4, "Draw four cards,"));

    SetGenerator inYourHand = InZone.instance(HandOf.instance(You.instance()));
    EventFactory choose =
        playerChoose(
            You.instance(),
            ValueOfX.instance(This.instance()),
            inYourHand,
            PlayerInterface.ChoiceType.OBJECTS,
            REASON,
            "then choose X cards in your hand");

    EventFactory discard = new EventFactory(EventType.DISCARD_CARDS, "and discard the rest.");
    discard.parameters.put(EventType.Parameter.CAUSE, This.instance());
    discard.parameters.put(
        EventType.Parameter.CARD,
        RelativeComplement.instance(inYourHand, EffectResult.instance(choose)));

    this.addEffect(sequence(choose, discard));
  }
Ejemplo n.º 5
0
    public TidehollowScullerAbility0(GameState state) {
      super(
          state,
          "When Tidehollow Sculler enters the battlefield, target opponent reveals his or her hand and you choose a nonland card from it. Exile that card.");
      this.addPattern(whenThisEntersTheBattlefield());

      SetGenerator target =
          targetedBy(this.addTarget(OpponentsOf.instance(You.instance()), "target opponent"));
      SetGenerator inTargetsHand = InZone.instance(HandOf.instance(target));

      EventFactory reveal =
          new EventFactory(EventType.REVEAL, "Target opponent reveals his or her hand");
      reveal.parameters.put(EventType.Parameter.CAUSE, This.instance());
      reveal.parameters.put(EventType.Parameter.OBJECT, inTargetsHand);
      this.addEffect(reveal);

      EventFactory exile =
          new EventFactory(
              EventType.EXILE_CHOICE, "and you choose a nonland card from it. Exile that card.");
      exile.parameters.put(EventType.Parameter.CAUSE, This.instance());
      exile.parameters.put(
          EventType.Parameter.OBJECT,
          RelativeComplement.instance(inTargetsHand, HasType.instance(Type.LAND)));
      exile.parameters.put(EventType.Parameter.PLAYER, You.instance());
      exile.setLink(this);
      this.addEffect(exile);

      this.getLinkManager().addLinkClass(TidehollowScullerAbility1.class);
    }
Ejemplo n.º 6
0
  public RuthlessRipper(GameState state) {
    super(state);

    this.setPower(1);
    this.setToughness(1);

    // Deathtouch
    this.addAbility(new org.rnd.jmagic.abilities.keywords.Deathtouch(state));

    // Morph\u2014Reveal a black card in your hand. (You may cast this card
    // face down as a 2/2 creature for (3). Turn it face up any time for its
    // morph cost.)
    SetGenerator blueStuff =
        Intersect.instance(
            HasColor.instance(Color.BLACK), InZone.instance(HandOf.instance(You.instance())));
    EventFactory reveal =
        new EventFactory(EventType.REVEAL_CHOICE, "Reveal a black card in your hand");
    reveal.parameters.put(EventType.Parameter.CAUSE, This.instance());
    reveal.parameters.put(EventType.Parameter.OBJECT, blueStuff);
    reveal.parameters.put(EventType.Parameter.PLAYER, You.instance());

    CostCollection morphCost =
        new CostCollection(org.rnd.jmagic.abilities.keywords.Morph.COST_TYPE, reveal);
    this.addAbility(
        new org.rnd.jmagic.abilities.keywords.Morph(
            state, "Morph\u2014Reveal a black card in your hand.", morphCost));

    // When Ruthless Ripper is turned face up, target player loses 2 life.
    this.addAbility(new RuthlessRipperAbility2(state));
  }
Ejemplo n.º 7
0
  public TimeReversal(GameState state) {
    super(state);

    // Each player shuffles his or her hand and graveyard into his or her
    // library,
    SetGenerator handsAndGraveyards =
        InZone.instance(
            Union.instance(
                HandOf.instance(Players.instance()), GraveyardOf.instance(Players.instance())));

    EventFactory shuffle =
        new EventFactory(
            EventType.SHUFFLE_INTO_LIBRARY,
            "Each player shuffles his or her hand and graveyard into his or her library,");
    shuffle.parameters.put(EventType.Parameter.CAUSE, This.instance());
    shuffle.parameters.put(
        EventType.Parameter.OBJECT, Union.instance(handsAndGraveyards, Players.instance()));
    this.addEffect(shuffle);

    // then draws seven cards.
    this.addEffect(drawCards(Players.instance(), 7, "then draws seven cards."));

    // Exile Time Reversal.
    this.addEffect(exile(This.instance(), "Exile Time Reversal."));
  }
Ejemplo n.º 8
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."));
  }
Ejemplo n.º 9
0
    public MnemonicWallAbility1(GameState state) {
      super(
          state,
          "When Mnemonic Wall enters the battlefield, you may return target instant or sorcery card from your graveyard to your hand.");
      this.addPattern(whenThisEntersTheBattlefield());

      SetGenerator yourGraveyard = GraveyardOf.instance(You.instance());
      SetGenerator spellsInYard =
          Intersect.instance(
              HasType.instance(Type.INSTANT, Type.SORCERY), InZone.instance(yourGraveyard));
      SetGenerator target =
          targetedBy(
              this.addTarget(spellsInYard, "target instant or sorcery card from your graveyard"));

      EventFactory move =
          new EventFactory(
              EventType.MOVE_OBJECTS,
              "Return target instant or sorcery card from your graveyard to your hand");
      move.parameters.put(EventType.Parameter.CAUSE, This.instance());
      move.parameters.put(EventType.Parameter.TO, HandOf.instance(You.instance()));
      move.parameters.put(EventType.Parameter.OBJECT, target);
      this.addEffect(
          youMay(
              move,
              "You may return target instant or sorcery card from your graveyard to your hand."));
    }
Ejemplo n.º 10
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));
    }
Ejemplo n.º 11
0
    public TidehollowScullerAbility1(GameState state) {
      super(
          state,
          "When Tidehollow Sculler leaves the battlefield, return the exiled card to its owner's hand.");
      this.addPattern(whenThisLeavesTheBattlefield());

      this.getLinkManager().addLinkClass(TidehollowScullerAbility0.class);
      SetGenerator exiledCard = ChosenFor.instance(LinkedTo.instance(This.instance()));

      EventFactory move =
          new EventFactory(EventType.MOVE_OBJECTS, "Return the exiled card to its owner's hand.");
      move.parameters.put(EventType.Parameter.CAUSE, This.instance());
      move.parameters.put(EventType.Parameter.TO, HandOf.instance(OwnerOf.instance(exiledCard)));
      move.parameters.put(EventType.Parameter.OBJECT, exiledCard);
      this.addEffect(move);
    }
Ejemplo n.º 12
0
    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."));
    }
Ejemplo n.º 13
0
  public IllGottenGains(GameState state) {
    super(state);

    // Exile Ill-Gotten Gains.
    this.addEffect(exile(This.instance(), "Exile Ill-Gotten Gains."));

    // Each player discards his or her hand,
    this.addEffect(discardHand(Players.instance(), "Each player discards his or her hand,"));

    // then returns up to three cards from his or her graveyard to his or
    // her hand.
    SetGenerator eachPlayer = DynamicEvaluation.instance();
    SetGenerator graveyard = GraveyardOf.instance(eachPlayer);
    EventFactory chooseCards =
        new EventFactory(EventType.PLAYER_CHOOSE, "Choose up to three cards in your graveyard");
    chooseCards.parameters.put(EventType.Parameter.PLAYER, eachPlayer);
    chooseCards.parameters.put(EventType.Parameter.NUMBER, Between.instance(0, 3));
    chooseCards.parameters.put(EventType.Parameter.CHOICE, InZone.instance(graveyard));
    chooseCards.parameters.put(
        EventType.Parameter.TYPE, Identity.instance(PlayerInterface.ChoiceType.OBJECTS, REASON));

    EventFactory eachPlayerChooses = new EventFactory(FOR_EACH_PLAYER, "");
    eachPlayerChooses.parameters.put(EventType.Parameter.TARGET, Identity.instance(eachPlayer));
    eachPlayerChooses.parameters.put(EventType.Parameter.EFFECT, Identity.instance(chooseCards));
    this.addEffect(eachPlayerChooses);

    SetGenerator chosenCards = ForEachResult.instance(eachPlayerChooses, eachPlayer);

    EventFactory returnCards =
        new EventFactory(EventType.MOVE_OBJECTS, "Return those cards to your hand");
    returnCards.parameters.put(EventType.Parameter.CAUSE, This.instance());
    returnCards.parameters.put(EventType.Parameter.TO, HandOf.instance(eachPlayer));
    returnCards.parameters.put(EventType.Parameter.OBJECT, chosenCards);

    EventFactory effect =
        new EventFactory(
            FOR_EACH_PLAYER,
            "then returns up to three cards from his or her graveyard to his or her hand.");
    effect.parameters.put(EventType.Parameter.TARGET, Identity.instance(eachPlayer));
    effect.parameters.put(EventType.Parameter.EFFECT, Identity.instance(returnCards));
    this.addEffect(effect);
  }
Ejemplo n.º 14
0
    public EnsnaringBridgeAbility0(GameState state) {
      super(
          state,
          "Creatures with power greater than the number of cards in your hand can't attack.");

      SetGenerator numberOfCardsInYourHand =
          Count.instance(InZone.instance(HandOf.instance(You.instance())));
      SetGenerator hasPowerGreater =
          HasPower.instance(
              Between.instance(
                  Sum.instance(Union.instance(numberGenerator(1), numberOfCardsInYourHand)),
                  Empty.instance()));
      SetGenerator restriction = Intersect.instance(Attacking.instance(), hasPowerGreater);

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.ATTACKING_RESTRICTION);
      part.parameters.put(
          ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(restriction));
      this.addEffectPart(part);
    }
Ejemplo n.º 15
0
  public Worldfire(GameState state) {
    super(state);

    // Exile all permanents. Exile all cards from all hands and graveyards.
    // Each player's life total becomes 1.
    this.addEffect(exile(Permanents.instance(), "Exile all permanents."));

    this.addEffect(
        exile(
            InZone.instance(
                Union.instance(
                    HandOf.instance(Players.instance()), GraveyardOf.instance(Players.instance()))),
            "Exile all cards from all hands and graveyards."));

    EventFactory life = new EventFactory(EventType.SET_LIFE, "Each player's life total becomes 1.");
    life.parameters.put(EventType.Parameter.CAUSE, This.instance());
    life.parameters.put(EventType.Parameter.NUMBER, numberGenerator(1));
    life.parameters.put(EventType.Parameter.PLAYER, Players.instance());
    this.addEffect(life);
  }