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

    // Exile target creature card from your graveyard.
    SetGenerator deadThings =
        Intersect.instance(
            HasType.instance(Type.CREATURE), InZone.instance(GraveyardOf.instance(You.instance())));
    SetGenerator target =
        targetedBy(
            this.addTarget(
                deadThings,
                "Put a black Zombie creature token onto the battlefield. Its power is equal to that card's power and its toughness is equal to that card's toughness."));
    EventFactory exile = exile(target, "Exile target creature card from your graveyard.");
    this.addEffect(exile);

    // Put a black Zombie creature token onto the battlefield. Its power is
    // equal to that card's power and its toughness is equal to that card's
    // toughness.
    SetGenerator thatCard = NewObjectOf.instance(EffectResult.instance(exile));
    SetGenerator power = PowerOf.instance(thatCard);
    SetGenerator toughness = ToughnessOf.instance(thatCard);
    CreateTokensFactory zombie =
        new CreateTokensFactory(
            numberGenerator(1),
            power,
            toughness,
            "Put a black Zombie creature token onto the battlefield. Its power is equal to that card's power and its toughness is equal to that card's toughness.");
    zombie.setColors(Color.BLACK);
    zombie.setSubTypes(SubType.ZOMBIE);
    this.addEffect(zombie.getEventFactory());
  }
Example #5
0
    public AgadeemOccultistAbility0(GameState state) {
      super(
          state,
          "(T): Put target creature card from an opponent's graveyard onto the battlefield under your control if its converted mana cost is less than or equal to the number of Allies you control.");
      this.costsTap = true;

      SetGenerator creatureCards = HasType.instance(Type.CREATURE);
      SetGenerator inOpponentsYard =
          InZone.instance(GraveyardOf.instance(OpponentsOf.instance(You.instance())));
      Target t =
          this.addTarget(
              Intersect.instance(creatureCards, inOpponentsYard),
              "target creature card from an opponent's graveyard");

      EventFactory move =
          new EventFactory(
              EventType.PUT_ONTO_BATTLEFIELD,
              "Put target creature card from an opponent's graveyard onto the battlefield under your control");
      move.parameters.put(EventType.Parameter.CAUSE, This.instance());
      move.parameters.put(EventType.Parameter.CONTROLLER, You.instance());
      move.parameters.put(EventType.Parameter.OBJECT, targetedBy(t));

      SetGenerator lessThanOrEqualNumAllies =
          Between.instance(null, Count.instance(ALLIES_YOU_CONTROL));
      SetGenerator condition =
          Intersect.instance(ConvertedManaCostOf.instance(targetedBy(t)), lessThanOrEqualNumAllies);

      EventFactory effect =
          new EventFactory(
              EventType.IF_CONDITION_THEN_ELSE,
              "Put target creature card from an opponent's graveyard onto the battlefield under your control if its converted mana cost is less than or equal to the number of Allies you control.");
      effect.parameters.put(EventType.Parameter.IF, condition);
      effect.parameters.put(EventType.Parameter.THEN, Identity.instance(move));
      this.addEffect(effect);
    }
Example #6
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));
  }
Example #7
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));
  }
Example #8
0
    public SnapcasterMageAbility1(GameState state) {
      super(
          state,
          "When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost.");
      this.addPattern(whenThisEntersTheBattlefield());

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

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.GRANT_COSTED_KEYWORD);
      part.parameters.put(
          ContinuousEffectType.Parameter.ABILITY,
          Identity.instance(org.rnd.jmagic.abilities.keywords.Flashback.class));
      part.parameters.put(ContinuousEffectType.Parameter.OBJECT, target);
      this.addEffect(
          createFloatingEffect(
              "Target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost.",
              part));
    }
Example #9
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);
    }
Example #10
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 #11
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 #12
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."));
    }
Example #13
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."));
    }
  }
Example #14
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));
    }
Example #15
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 #16
0
    public ConsumingAberrationAbility0(GameState state) {
      super(
          state,
          "Consuming Aberration's power and toughness are each equal to the number of cards in your opponents' graveyards.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator number =
          Count.instance(
              InZone.instance(GraveyardOf.instance(OpponentsOf.instance(You.instance()))));
      this.addEffectPart(setPowerAndToughness(This.instance(), number, number));
    }
Example #17
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 #18
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 #19
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."));
    }
Example #20
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 #21
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 #22
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 #23
0
    public FinishHim(GameState state) {
      super(
          state,
          "At the beginning of your upkeep, if twenty or more creature cards are in your graveyard, you win the game.");

      SetGenerator numCreatures =
          Count.instance(
              Intersect.instance(
                  HasType.instance(Type.CREATURE),
                  InZone.instance(
                      GraveyardOf.instance(ControllerOf.instance(ABILITY_SOURCE_OF_THIS)))));

      this.addPattern(atTheBeginningOfYourUpkeep());

      this.interveningIf = Intersect.instance(numCreatures, Between.instance(20, null));

      this.addEffect(youWinTheGame());
    }
Example #24
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 #25
0
    public AngelofGlorysRiseAbility1(GameState state) {
      super(
          state,
          "When Angel of Glory's Rise enters the battlefield, exile all Zombies, then return all Human creature cards from your graveyard to the battlefield.");
      this.addPattern(whenThisEntersTheBattlefield());

      this.addEffect(
          exile(
              Intersect.instance(Permanents.instance(), HasSubType.instance(SubType.ZOMBIE)),
              "Exile all Zombies."));

      this.addEffect(
          putOntoBattlefield(
              Intersect.instance(
                  InZone.instance(GraveyardOf.instance(You.instance())),
                  HasSubType.instance(SubType.HUMAN),
                  HasType.instance(Type.CREATURE)),
              "Return all Human creature cards from your graveyard to the battlefield."));
    }
Example #26
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 #27
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 #28
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 #29
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);
    }
    public SheoldredWhisperingOneAbility1(GameState state) {
      super(
          state,
          "At the beginning of your upkeep, return target creature card from your graveyard to the battlefield.");
      this.addPattern(atTheBeginningOfYourUpkeep());

      SetGenerator creatureCards = HasType.instance(Type.CREATURE);
      SetGenerator inYourGraveyard = InZone.instance(GraveyardOf.instance(You.instance()));
      SetGenerator targeting = Intersect.instance(creatureCards, inYourGraveyard);

      SetGenerator target =
          targetedBy(this.addTarget(targeting, "target creature card from your graveyard"));
      EventFactory returnToBattlefield =
          new EventFactory(
              EventType.PUT_ONTO_BATTLEFIELD,
              "Return target creature card from your graveyard to the battlefield.");
      returnToBattlefield.parameters.put(EventType.Parameter.CAUSE, This.instance());
      returnToBattlefield.parameters.put(EventType.Parameter.CONTROLLER, You.instance());
      returnToBattlefield.parameters.put(EventType.Parameter.OBJECT, target);
      this.addEffect(returnToBattlefield);
    }