예제 #1
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)."));
    }
예제 #2
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);
    }
예제 #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."));
  }
예제 #4
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);
    }
예제 #5
0
    public ConsumingAberrationAbility1(GameState state) {
      super(
          state,
          "Whenever you cast a spell, each opponent reveals cards from the top of his or her library until he or she reveals a land card, then puts those cards into his or her graveyard.");

      this.addPattern(whenYouCastASpell());

      DynamicEvaluation eachOpponent = DynamicEvaluation.instance();

      SetGenerator toReveal =
          TopMost.instance(
              LibraryOf.instance(eachOpponent), numberGenerator(1), HasType.instance(Type.LAND));
      EventFactory reveal =
          reveal(
              toReveal,
              "Each opponent reveals cards from the top of his or her library until he or she reveals a land card,");
      EventFactory move =
          putIntoGraveyard(toReveal, "then puts those cards into his or her graveyard.");

      EventFactory forEach =
          new EventFactory(
              FOR_EACH_PLAYER,
              "Each opponent reveals cards from the top of his or her library until he or she reveals a land card, then puts those cards into his or her graveyard.");
      forEach.parameters.put(EventType.Parameter.PLAYER, OpponentsOf.instance(You.instance()));
      forEach.parameters.put(EventType.Parameter.TARGET, Identity.instance(eachOpponent));
      forEach.parameters.put(EventType.Parameter.EFFECT, Identity.instance(sequence(reveal, move)));
      this.addEffect(forEach);
    }
예제 #6
0
  public PermafrostTrap(GameState state) {
    super(state);

    // If an opponent had a green creature enter the battlefield under his
    // or her control this turn, you may pay (U) rather than pay Permafrost
    // Trap's mana cost.
    state.ensureTracker(new GreenCreaturesPutOntoTheBattlefieldThisTurnCounter());
    SetGenerator opponents = OpponentsOf.instance(You.instance());
    SetGenerator maxPerOpponent =
        MaximumPerPlayer.instance(
            GreenCreaturesPutOntoTheBattlefieldThisTurnCounter.class, opponents);
    SetGenerator trapCondition = Intersect.instance(Between.instance(2, null), maxPerOpponent);
    this.addAbility(
        new org.rnd.jmagic.abilities.Trap(
            state,
            this.getName(),
            trapCondition,
            "If an opponent had a green creature enter the battlefield under his or her control this turn",
            "(U)"));

    Target target = this.addTarget(CreaturePermanents.instance(), "up to two target creatures");
    target.setNumber(0, 2);

    // Tap up to two target creatures. Those creatures don't untap during
    // their controller's next untap step.
    EventFactory tap =
        new EventFactory(
            EventType.TAP_HARD,
            "Tap up to two target creatures. Those creatures don't untap during their controller's next untap step.");
    tap.parameters.put(EventType.Parameter.CAUSE, This.instance());
    tap.parameters.put(EventType.Parameter.OBJECT, targetedBy(target));
    this.addEffect(tap);
  }
예제 #7
0
  public PurgetheProfane(GameState state) {
    super(state);

    // Target opponent discards two cards and you gain 2 life.
    SetGenerator target =
        targetedBy(this.addTarget(OpponentsOf.instance(You.instance()), "target opponent"));
    this.addEffect(discardCards(target, 2, "Target opponent discards two cards"));
    this.addEffect(gainLife(You.instance(), 2, "and you gain 2 life."));
  }
예제 #8
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."));
      }
    }
예제 #9
0
    public PsychosisCrawlerAbility1(GameState state) {
      super(state, "Whenever you draw a card, each opponent loses 1 life.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.DRAW_ONE_CARD);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      this.addPattern(pattern);

      this.addEffect(
          loseLife(OpponentsOf.instance(You.instance()), 1, "Each opponent loses 1 life."));
    }
예제 #10
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));
    }
예제 #11
0
  public MindSculpt(GameState state) {
    super(state);

    // Target opponent puts the top seven cards of his or her library into
    // his or her graveyard.
    SetGenerator target =
        targetedBy(this.addTarget(OpponentsOf.instance(You.instance()), "target opponent"));
    this.addEffect(
        millCards(
            target,
            7,
            "Target opponent puts the top seven cards of his or her library into his or her graveyard."));
  }
예제 #12
0
    public Vampiricism(GameState state) {
      super(state, "Whenever you gain life, target opponent loses that much life.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.GAIN_LIFE);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      this.addPattern(pattern);

      Target target = this.addTarget(OpponentsOf.instance(You.instance()), "target opponent");

      this.addEffect(
          loseLife(
              targetedBy(target),
              EventParameter.instance(
                  TriggerEvent.instance(This.instance()), EventType.Parameter.NUMBER),
              "Target opponent loses that much life."));
    }
예제 #13
0
    public SigardaHostofHeronsAbility1(GameState state) {
      super(
          state,
          "Spells and abilities your opponents control can't cause you to sacrifice permanents.");

      SimpleEventPattern youSacrificePermanents =
          new SimpleEventPattern(EventType.SACRIFICE_ONE_PERMANENT);
      youSacrificePermanents.put(
          EventType.Parameter.CAUSE,
          ControlledBy.instance(OpponentsOf.instance(You.instance()), Stack.instance()));
      youSacrificePermanents.put(EventType.Parameter.PERMANENT, Permanents.instance());
      youSacrificePermanents.put(EventType.Parameter.PLAYER, You.instance());

      ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.PROHIBIT);
      part.parameters.put(
          ContinuousEffectType.Parameter.PROHIBITION, Identity.instance(youSacrificePermanents));
      this.addEffectPart(part);
    }
예제 #14
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."));
    }
예제 #15
0
    public BlindObedienceAbility1(GameState state) {
      super(state, "Artifacts and creatures your opponents control enter the battlefield tapped.");
      SetGenerator controller = ControllerOf.instance(This.instance());

      SetGenerator stuff = HasType.instance(Type.ARTIFACT, Type.CREATURE);
      SetGenerator opponents = OpponentsOf.instance(controller);

      ZoneChangeReplacementEffect gatekeeping =
          new ZoneChangeReplacementEffect(
              this.game,
              "Artifacts and creatures your opponents control enter the battlefield tapped");
      gatekeeping.addPattern(
          new SimpleZoneChangePattern(null, Battlefield.instance(), stuff, opponents, false));
      gatekeeping.addEffect(
          tap(
              NewObjectOf.instance(gatekeeping.replacedByThis()),
              "An artifact or creature an opponent controls enters the battlefield tapped."));
      this.addEffectPart(replacementEffectPart(gatekeeping));
    }
예제 #16
0
    public AntiWarden(GameState state) {
      super(
          state,
          "Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life.");

      this.addPattern(
          new SimpleZoneChangePattern(
              null,
              Battlefield.instance(),
              HasType.instance(Type.CREATURE),
              OpponentsOf.instance(You.instance()),
              false));

      this.addEffect(
          youMay(
              loseLife(
                  ControllerOf.instance(TriggerZoneChange.instance(This.instance())),
                  1,
                  "That player loses 1 life."),
              "You may have that player lose 1 life."));
    }
예제 #17
0
    public LazavDimirMastermindAbility1(GameState state) {
      super(
          state,
          "Whenever a creature card is put into an opponent's graveyard from anywhere, you may have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability.");

      this.addPattern(
          new SimpleZoneChangePattern(
              null,
              GraveyardOf.instance(OpponentsOf.instance(You.instance())),
              HasType.instance(Type.CREATURE),
              false));

      SetGenerator thatCard = NewObjectOf.instance(TriggerZoneChange.instance(This.instance()));

      ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.COPY_OBJECT);
      part.parameters.put(
          ContinuousEffectType.Parameter.ABILITY,
          Identity.instance(
              new SimpleAbilityFactory(LazavDimirMastermindAbility1.class),
              new SimpleAbilityFactory(Hexproof.class)));
      part.parameters.put(ContinuousEffectType.Parameter.OBJECT, ABILITY_SOURCE_OF_THIS);
      part.parameters.put(ContinuousEffectType.Parameter.ORIGINAL, thatCard);
      part.parameters.put(
          ContinuousEffectType.Parameter.RETAIN,
          Identity.instance(Characteristics.Characteristic.NAME));
      part.parameters.put(
          ContinuousEffectType.Parameter.TYPE, Identity.instance(SuperType.LEGENDARY));

      EventFactory copy =
          createFloatingEffect(
              Empty.instance(),
              "Have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability.",
              part);
      this.addEffect(
          youMay(
              copy,
              "Have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability."));
    }
예제 #18
0
    public SylvanPrimordialAbility1(GameState state) {
      super(
          state,
          "When Sylvan Primordial enters the battlefield, for each opponent, destroy target noncreature permanent that player controls. For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library.");
      this.addPattern(whenThisEntersTheBattlefield());

      SetGenerator noncreaturePermanents =
          RelativeComplement.instance(Permanents.instance(), HasType.instance(Type.CREATURE));
      SetGenerator legalTargets =
          Intersect.instance(
              noncreaturePermanents, ControlledBy.instance(OpponentsOf.instance(You.instance())));
      Target t =
          new SylvanTarget(legalTargets, "target noncreature permanent each oppenent controls");
      this.addTarget(t);

      EventFactory destroy =
          destroy(
              targetedBy(t),
              "For each opponent, destroy target noncreature permanent that player controls.");
      this.addEffect(destroy);

      SetGenerator X = Count.instance(NewObjectOf.instance(EffectResult.instance(destroy)));

      EventFactory search =
          new EventFactory(
              EventType.SEARCH_LIBRARY_AND_PUT_INTO,
              "For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library.");
      search.parameters.put(EventType.Parameter.CAUSE, This.instance());
      search.parameters.put(EventType.Parameter.CONTROLLER, You.instance());
      search.parameters.put(EventType.Parameter.PLAYER, You.instance());
      search.parameters.put(EventType.Parameter.NUMBER, X);
      search.parameters.put(EventType.Parameter.TAPPED, Empty.instance());
      search.parameters.put(EventType.Parameter.TO, Battlefield.instance());
      search.parameters.put(
          EventType.Parameter.TYPE, Identity.instance(HasSubType.instance(SubType.FOREST)));
      this.addEffect(search);
    }