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);
    }
Exemple #2
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."));
    }
  }
Exemple #3
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."));
      }
    }
Exemple #4
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));
    }
  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());
  }
    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);
    }
Exemple #7
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."));
    }
    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);
    }
  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."));
  }
Exemple #10
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."));
    }
    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);
    }
Exemple #12
0
    public DearlyDepartedAbility1(GameState state) {
      super(
          state,
          "As long as Dearly Departed is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it.");
      this.canApply = THIS_IS_IN_A_GRAVEYARD;

      SetGenerator humanCreatures =
          Intersect.instance(HasSubType.instance(SubType.HUMAN), HasType.instance(Type.CREATURE));

      ZoneChangeReplacementEffect replacement =
          new ZoneChangeReplacementEffect(this.game, this.getName());
      replacement.addPattern(
          new SimpleZoneChangePattern(
              null, Battlefield.instance(), humanCreatures, You.instance(), false));

      SetGenerator zoneChange = ReplacedBy.instance(Identity.instance(replacement));

      EventFactory factory = new EventFactory(EventType.PUT_COUNTERS, this.getName());
      factory.parameters.put(EventType.Parameter.CAUSE, CauseOf.instance(zoneChange));
      factory.parameters.put(
          EventType.Parameter.COUNTER, Identity.instance(Counter.CounterType.PLUS_ONE_PLUS_ONE));
      factory.parameters.put(EventType.Parameter.OBJECT, NewObjectOf.instance(zoneChange));
      replacement.addEffect(factory);

      this.addEffectPart(replacementEffectPart(replacement));
    }
Exemple #13
0
    public MysticRemoraAbility1(GameState state) {
      super(
          state,
          "Whenever an opponent casts a noncreature spell, you may draw a card unless that player pays (4).");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      pattern.put(EventType.Parameter.PLAYER, OpponentsOf.instance(You.instance()));
      pattern.put(
          EventType.Parameter.OBJECT,
          RelativeComplement.instance(Spells.instance(), HasType.instance(Type.CREATURE)));
      this.addPattern(pattern);

      SetGenerator thatPlayer =
          EventParameter.instance(
              TriggerEvent.instance(This.instance()), EventType.Parameter.PLAYER);

      EventFactory mayDraw =
          youMay(drawCards(You.instance(), 1, "Draw a card"), "You may draw a card");

      EventFactory pay = new EventFactory(EventType.PAY_MANA, "Pay (4)");
      pay.parameters.put(EventType.Parameter.CAUSE, This.instance());
      pay.parameters.put(EventType.Parameter.PLAYER, thatPlayer);
      pay.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("4")));
      this.addEffect(
          unless(thatPlayer, mayDraw, pay, "You may draw a card unless that player pays (4)."));
    }
Exemple #14
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."));
  }
Exemple #15
0
    public FirstStrikeForAll(GameState state) {
      super(state, "Creatures you control have first strike.");

      SetGenerator creaturesYouControl =
          Intersect.instance(
              ControlledBy.instance(You.instance()), HasType.instance(Type.CREATURE));

      this.addEffectPart(addAbilityToObject(creaturesYouControl, FirstStrike.class));
    }
Exemple #16
0
    public GolgariDecoyAbility0(GameState state) {
      super(state, "All creatures able to block Golgari Decoy do so.");

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(
              ContinuousEffectType.BLOCKING_REQUIREMENT_FOR_EACH_DEFENDING_CREATURE);
      part.parameters.put(ContinuousEffectType.Parameter.ATTACKING, This.instance());
      part.parameters.put(
          ContinuousEffectType.Parameter.DEFENDING, HasType.instance(Type.CREATURE));
      this.addEffectPart(part);
    }
Exemple #17
0
    public LunarMysticAbility0(GameState state) {
      super(state, "Whenever you cast an instant spell, you may pay (1). If you do, draw a card.");

      SimpleEventPattern whenYouCastASpell = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      whenYouCastASpell.put(EventType.Parameter.PLAYER, You.instance());
      whenYouCastASpell.put(EventType.Parameter.OBJECT, HasType.instance(Type.INSTANT));
      this.addPattern(whenYouCastASpell);

      this.addEffect(
          ifThen(youMayPay("(1)"), drawACard(), "You may pay (1). If you do, draw a card."));
    }
Exemple #18
0
  public PsychicBarrier(GameState state) {
    super(state);

    // Counter target creature spell. Its controller loses 1 life.
    SetGenerator target =
        targetedBy(
            this.addTarget(
                Intersect.instance(Spells.instance(), HasType.instance(Type.CREATURE)),
                "target creature spell"));
    this.addEffect(counter(target, "Counter target creature spell."));
    this.addEffect(loseLife(ControllerOf.instance(target), 1, "Its controller loses 1 life."));
  }
    public CountrysideCrusherAbility1(GameState state) {
      super(
          state,
          "Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on Countryside Crusher.");

      ZoneChangePattern pitchedLand =
          new SimpleZoneChangePattern(
              null, GraveyardOf.instance(You.instance()), HasType.instance(Type.LAND), false);
      this.addPattern(pitchedLand);

      this.addEffect(
          putCountersOnThis(1, Counter.CounterType.PLUS_ONE_PLUS_ONE, "Countryside Crusher"));
    }
    public TezzeretAgentofBolasAbility0(GameState state) {
      super(
          state,
          1,
          "Look at the top five cards of your library. You may reveal an artifact card from among them and put it into your hand. Put the rest on the bottom of your library in any order.");

      this.addEffect(
          Sifter.start()
              .look(5)
              .take(1, HasType.instance(Type.ARTIFACT))
              .dumpToBottom()
              .getEventFactory(
                  "Look at the top five cards of your library. You may reveal an artifact card from among them and put it into your hand. Put the rest on the bottom of your library in any order."));
    }
Exemple #21
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."));
  }
Exemple #22
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."));
    }
        @Override
        public boolean perform(Game game, Event event, Map<Parameter, MagicSet> parameters) {
          MagicSet cause = parameters.get(Parameter.CAUSE);
          event.setResult(Empty.set);

          Set<Color> choices = parameters.get(Parameter.CHOICE).getAll(Color.class);
          Player player = parameters.get(Parameter.PLAYER).getOne(Player.class);

          PlayerInterface.ChooseParameters<Color> chooseParameters =
              new PlayerInterface.ChooseParameters<Color>(
                  1,
                  1,
                  new LinkedList<Color>(choices),
                  PlayerInterface.ChoiceType.COLOR,
                  PlayerInterface.ChooseReason.CHOOSE_COLOR);
          chooseParameters.thisID = cause.getOne(GameObject.class).ID;
          List<Color> chosenList = player.choose(chooseParameters);
          if (chosenList.isEmpty()) return false;

          Color color = chosenList.get(0);

          Class<? extends Protection> ability = Protection.from(color);

          ContinuousEffect.Part part =
              new ContinuousEffect.Part(ContinuousEffectType.ADD_ABILITY_TO_OBJECT);
          part.parameters.put(
              ContinuousEffectType.Parameter.OBJECT,
              Intersect.instance(
                  HasColor.instance(Color.WHITE),
                  Intersect.instance(
                      HasType.instance(Type.CREATURE), ControlledBy.instance(You.instance()))));
          part.parameters.put(
              ContinuousEffectType.Parameter.ABILITY,
              Identity.instance(new SimpleAbilityFactory(ability)));

          Map<Parameter, MagicSet> fceParameters = new HashMap<Parameter, MagicSet>();
          fceParameters.put(Parameter.CAUSE, cause);
          fceParameters.put(Parameter.EFFECT, new MagicSet(part));
          Event protection =
              createEvent(
                  game,
                  "White creatures you control gain protection from the chosen color until end of turn.",
                  EventType.CREATE_FLOATING_CONTINUOUS_EFFECT,
                  fceParameters);
          protection.perform(event, false);

          return true;
        }
Exemple #24
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."));
    }
Exemple #25
0
    public LandfallShenanigans(GameState state) {
      super(
          state,
          "When Khalni Gem enters the battlefield, return two lands you control to their owner's hand.");

      this.addPattern(whenThisEntersTheBattlefield());

      EventFactory factory =
          new EventFactory(
              EventType.PUT_INTO_HAND_CHOICE, "Return two lands you control to their owner's hand");
      factory.parameters.put(EventType.Parameter.CAUSE, This.instance());
      factory.parameters.put(EventType.Parameter.PLAYER, You.instance());
      factory.parameters.put(EventType.Parameter.NUMBER, numberGenerator(2));
      factory.parameters.put(
          EventType.Parameter.CHOICE,
          Intersect.instance(HasType.instance(Type.LAND), ControlledBy.instance(You.instance())));
      this.addEffect(factory);
    }
    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."));
    }
Exemple #27
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());
    }
Exemple #28
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."));
    }
    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."));
    }
Exemple #30
0
    public GolemFoundryAbility0(GameState state) {
      super(
          state,
          "Whenever you cast an artifact spell, you may put a charge counter on Golem Foundry.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      pattern.withResult(HasType.instance(Type.ARTIFACT));
      this.addPattern(pattern);

      this.addEffect(
          youMay(
              putCounters(
                  1,
                  Counter.CounterType.CHARGE,
                  ABILITY_SOURCE_OF_THIS,
                  "Put a charge counter on Golem Foundry."),
              "You may put a charge counter on Golem Foundry."));
    }