Example #1
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."));
  }
Example #2
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."));
  }
Example #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."));
  }
Example #4
0
  public IncreasingSavagery(GameState state) {
    super(state);

    // Put five +1/+1 counters on target creature. If Increasing Savagery
    // was cast from a graveyard, put ten +1/+1 counters on that creature
    // instead.
    SetGenerator target =
        targetedBy(this.addTarget(CreaturePermanents.instance(), "target creature"));
    SetGenerator number =
        IfThenElse.instance(
            Intersect.instance(
                ZoneCastFrom.instance(This.instance()), GraveyardOf.instance(Players.instance())),
            numberGenerator(10),
            numberGenerator(5));

    this.addEffect(
        putCounters(
            number,
            Counter.CounterType.PLUS_ONE_PLUS_ONE,
            target,
            "Put five +1/+1 counters on target creature. If Increasing Savagery was cast from a graveyard, put ten +1/+1 counters on that creature instead."));

    // Flashback (5)(G)(G) (You may cast this card from your graveyard for
    // its flashback cost. Then exile it.)
    this.addAbility(new Flashback(state, "(5)(G)(G)"));
  }
Example #5
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."));
    }
Example #6
0
 @Override
 protected EventFactory getKinshipEffect() {
   EventFactory factory =
       new EventFactory(
           DISCARD_AND_DRAW, "Each player discards his or her hand, then draws four cards.");
   factory.parameters.put(EventType.Parameter.CAUSE, This.instance());
   factory.parameters.put(EventType.Parameter.PLAYER, Players.instance());
   return factory;
 }
Example #7
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);
  }
Example #8
0
    public GroundSealAbility1(GameState state) {
      super(state, "Cards in graveyards can't be the targets of spells or abilities.");

      SetGenerator inYards = InZone.instance(GraveyardOf.instance(Players.instance()));

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.CANT_BE_THE_TARGET_OF);
      part.parameters.put(ContinuousEffectType.Parameter.OBJECT, inYards);
      part.parameters.put(
          ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(SetPattern.EVERYTHING));
      this.addEffectPart(part);
    }
Example #9
0
 public ManaDenial(GameState state) {
   super(
       state,
       "When a Faerie is championed with Mistbind Clique, tap all lands target player controls.");
   this.addPattern(
       whenSomethingIsChampioned(ABILITY_SOURCE_OF_THIS, HasSubType.instance(SubType.FAERIE)));
   Target target = this.addTarget(Players.instance(), "target player");
   this.addEffect(
       tap(
           Intersect.instance(
               LandPermanents.instance(), ControlledBy.instance(targetedBy(target))),
           "Tap all lands target player controls."));
 }
Example #10
0
    public DrawThreeDiscardThree(GameState state) {
      super(
          state,
          "Threshold \u2014 (U), (T), Sacrifice Cephalid Coliseum: Target player draws three cards, then discards three cards. Activate this ability only if seven or more cards are in your graveyard.");
      this.setManaCost(new ManaPool("U"));
      this.costsTap = true;
      this.addCost(sacrificeThis("Cephalid Coliseum"));

      Target target = this.addTarget(Players.instance(), "target player");
      this.addEffect(drawCards(targetedBy(target), 3, "Target player draws three cards,"));
      this.addEffect(discardCards(targetedBy(target), 3, "then discards three cards."));
      this.addActivateRestriction(Not.instance(Threshold.instance()));
    }
Example #11
0
 public SelhoffOccultistAbility0(GameState state) {
   super(
       state,
       "Whenever Selhoff Occultist or another creature dies, target player puts the top card of his or her library into his or her graveyard.");
   this.addPattern(
       whenXDies(Union.instance(ABILITY_SOURCE_OF_THIS, CreaturePermanents.instance())));
   SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));
   this.addEffect(
       millCards(
           target,
           1,
           "Target player puts the top card of his or her library into his or her graveyard."));
 }
Example #12
0
    public DeathriteShamanAbility2(GameState state) {
      super(state, "(G), (T): Exile target creature card from a graveyard. You gain 2 life.");
      this.setManaCost(new ManaPool("(G)"));
      this.costsTap = true;

      SetGenerator target =
          targetedBy(
              this.addTarget(
                  Intersect.instance(
                      HasType.instance(Type.CREATURE),
                      InZone.instance(GraveyardOf.instance(Players.instance()))),
                  "target creature card in a graveyard"));
      this.addEffect(exile(target, "Exile target creature card from a graveyard."));
      this.addEffect(gainLife(You.instance(), 2, "You gain 2 life."));
    }
Example #13
0
  public ScrapyardSalvo(GameState state) {
    super(state);

    // Scrapyard Salvo deals damage to target player equal to the number of
    // artifact cards in your graveyard.
    SetGenerator artifacts = HasType.instance(Type.ARTIFACT);
    SetGenerator inYourYard = InZone.instance(GraveyardOf.instance(You.instance()));
    SetGenerator amount = Count.instance(Intersect.instance(artifacts, inYourYard));
    SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));
    this.addEffect(
        spellDealDamage(
            amount,
            target,
            "Scrapyard Salvo deals damage to target player equal to the number of artifact cards in your graveyard."));
  }
Example #14
0
    public ZombiePT(GameState state) {
      super(
          state,
          "Soulless One's power and toughness are each equal to the number of Zombies on the battlefield plus the number of Zombie cards in all graveyards.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator aliveAndDead =
          InZone.instance(
              Union.instance(Battlefield.instance(), GraveyardOf.instance(Players.instance())));
      SetGenerator zombiesAndDeadZombies =
          Intersect.instance(HasSubType.instance(SubType.ZOMBIE), aliveAndDead);
      SetGenerator number = Count.instance(zombiesAndDeadZombies);

      this.addEffectPart(setPowerAndToughness(This.instance(), number, number));
    }
Example #15
0
  public Lavalanche(GameState state) {
    super(state);

    Target target = this.addTarget(Players.instance(), "target player");

    SetGenerator victims =
        Union.instance(
            targetedBy(target),
            Intersect.instance(
                CreaturePermanents.instance(), ControlledBy.instance(targetedBy(target))));
    this.addEffect(
        spellDealDamage(
            ValueOfX.instance(This.instance()),
            victims,
            "Lavalanche deals X damage to target player and each creature he or she controls."));
  }
Example #16
0
    public Ten(GameState state) {
      super(
          state,
          "When Magister Sphinx enters the battlefield, target player's life total becomes 10.");

      this.addPattern(whenThisEntersTheBattlefield());

      Target target = this.addTarget(Players.instance(), "target player");

      EventFactory factory =
          new EventFactory(EventType.SET_LIFE, "Target player's life total becomes 10");
      factory.parameters.put(EventType.Parameter.CAUSE, This.instance());
      factory.parameters.put(EventType.Parameter.NUMBER, numberGenerator(10));
      factory.parameters.put(EventType.Parameter.PLAYER, targetedBy(target));
      this.addEffect(factory);
    }
Example #17
0
    public TapForThreeDamage(GameState state) {
      super(state, "(T): Lightning Crafter deals 3 damage to target creature or player.");

      this.costsTap = true;

      Target target =
          this.addTarget(
              Union.instance(
                  Players.instance(),
                  Intersect.instance(
                      HasType.instance(Type.CREATURE), InZone.instance(Battlefield.instance()))),
              "target creature or player");
      this.addEffect(
          permanentDealDamage(
              3,
              targetedBy(target),
              "Lightning Crafter deals 3 damage to target creature or player."));
    }
Example #18
0
  public BlueSunsZenith(GameState state) {
    super(state);

    // Target player draws X cards.
    SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));

    this.addEffect(
        drawCards(target, ValueOfX.instance(This.instance()), "Target player draws X cards."));

    // Shuffle Blue Sun's Zenith into its owner's library.
    EventFactory shuffle =
        new EventFactory(
            EventType.SHUFFLE_INTO_LIBRARY, "Shuffle Blue Sun's Zenith into its owner's library.");
    shuffle.parameters.put(EventType.Parameter.CAUSE, This.instance());
    shuffle.parameters.put(
        EventType.Parameter.OBJECT, Union.instance(This.instance(), You.instance()));
    this.addEffect(shuffle);
  }
Example #19
0
    public DeathriteShamanAbility0(GameState state) {
      super(
          state,
          "(T): Exile target land card from a graveyard. Add one mana of any color to your mana pool.");
      this.costsTap = true;

      SetGenerator target =
          targetedBy(
              this.addTarget(
                  Intersect.instance(
                      HasType.instance(Type.LAND),
                      InZone.instance(GraveyardOf.instance(Players.instance()))),
                  "target land card in a graveyard"));
      this.addEffect(exile(target, "Exile target land card from a graveyard."));
      this.addEffect(
          addManaToYourManaPoolFromAbility(
              "(WUBRG)", "Add one mana of any color to your mana pool."));
    }
Example #20
0
    public AllyLife(GameState state) {
      super(
          state,
          "Whenever Hagra Diabolist or another Ally enters the battlefield under your control, you may have target player lose life equal to the number of Allies you control.");

      this.addPattern(allyTrigger());

      Target target = this.addTarget(Players.instance(), "target player");
      EventFactory lifeFactory =
          loseLife(
              targetedBy(target),
              Count.instance(ALLIES_YOU_CONTROL),
              "Target player loses life equal to the number of Allies you control");
      this.addEffect(
          youMay(
              lifeFactory,
              "You may have target player lose life equal to the number of Allies you control."));
    }
Example #21
0
    public DeathriteShamanAbility1(GameState state) {
      super(
          state,
          "(B), (T): Exile target instant or sorcery card from a graveyard. Each opponent loses 2 life.");
      this.setManaCost(new ManaPool("(B)"));
      this.costsTap = true;

      SetGenerator target =
          targetedBy(
              this.addTarget(
                  Intersect.instance(
                      HasType.instance(Type.INSTANT, Type.SORCERY),
                      InZone.instance(GraveyardOf.instance(Players.instance()))),
                  "target instant or sorcery card in a graveyard"));
      this.addEffect(exile(target, "Exile target instant or sorcery card from a graveyard."));
      this.addEffect(
          loseLife(OpponentsOf.instance(You.instance()), 2, "Each opponent loses 2 life."));
    }
Example #22
0
    public VentSentinelAbility1(GameState state) {
      super(
          state,
          "(1)(R), (T): Vent Sentinel deals damage to target player equal to the number of creatures with defender you control.");
      this.setManaCost(new ManaPool("(1)(R)"));
      this.costsTap = true;

      SetGenerator amount =
          Count.instance(
              Intersect.instance(
                  CREATURES_YOU_CONTROL, HasKeywordAbility.instance(Defender.class)));
      SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));
      this.addEffect(
          permanentDealDamage(
              amount,
              target,
              "Vent Sentinel deals damage to target player equal to the number of creatures with defender you control."));
    }
Example #23
0
  public OpentheVaults(GameState state) {
    super(state);

    // Return all artifact and enchantment cards from all graveyards

    SetGenerator cardTypes = HasType.instance(Type.ARTIFACT, Type.ENCHANTMENT);
    SetGenerator inGraveyards = InZone.instance(GraveyardOf.instance(Players.instance()));
    SetGenerator toReturn = Intersect.instance(cardTypes, inGraveyards);

    // to the battlefield under their owners' control.
    EventType.ParameterMap parameters = new EventType.ParameterMap();
    parameters.put(EventType.Parameter.CAUSE, This.instance());
    parameters.put(EventType.Parameter.OBJECT, toReturn);
    this.addEffect(
        new EventFactory(
            EventType.PUT_ONTO_BATTLEFIELD_UNDER_OWNER_CONTROL,
            parameters,
            "Return all artifact and enchantment cards from all graveyards to the battlefield under their owner's control."));
  }
Example #24
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);
  }
Example #25
0
  public Bandage(GameState state) {
    super(state);

    // Prevent the next 1 damage that would be dealt to target creature or
    // player this turn.
    Target target =
        this.addTarget(
            Union.instance(CreaturePermanents.instance(), Players.instance()),
            "target creature or player");

    EventFactory prevent =
        new EventFactory(
            EventType.CREATE_FLOATING_CONTINUOUS_EFFECT,
            "Prevent the next 1 damage that would be dealt to target creature or player this turn.");
    prevent.parameters.put(EventType.Parameter.CAUSE, This.instance());
    prevent.parameters.put(EventType.Parameter.PREVENT, Identity.instance(targetedBy(target), 1));
    this.addEffect(prevent);

    // Draw a card.
    this.addEffect(drawCards(You.instance(), 1, "\n\nDraw a card."));
  }
    public TezzeretAgentofBolasAbility2(GameState state) {
      super(
          state,
          -4,
          "Target player loses X life and you gain X life, where X is twice the number of artifacts you control.");

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

      SetGenerator X =
          Multiply.instance(
              numberGenerator(2),
              Count.instance(
                  Intersect.instance(
                      ArtifactPermanents.instance(), ControlledBy.instance(You.instance()))));

      EventFactory loseLife = loseLife(target, X, "Target player loses X life");
      EventFactory gainLife =
          gainLife(
              You.instance(),
              X,
              "and you gain X life, where X is twice the number of artifacts you control.");
      this.addEffect(simultaneous(loseLife, gainLife));
    }
Example #27
0
 public Howl(GameState state) {
   super(state, "When Howling Banshee enters the battlefield, each player loses 3 life.");
   this.addPattern(whenThisEntersTheBattlefield());
   this.addEffect(loseLife(Players.instance(), 3, "Each player loses 3 life."));
 }
Example #28
0
 public RunedServitorAbility0(GameState state) {
   super(state, "When Runed Servitor dies, each player draws a card.");
   this.addPattern(whenThisDies());
   this.addEffect(drawCards(Players.instance(), 1, "Each player draws a card."));
 }
Example #29
0
 public RuthlessRipperAbility2(GameState state) {
   super(state, "When Ruthless Ripper is turned face up, target player loses 2 life.");
   this.addPattern(whenThisIsTurnedFaceUp());
   SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));
   this.addEffect(loseLife(target, 2, "Target player loses 2 life."));
 }