Example #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)."));
    }
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);
    }
    public TentacleRape(GameState state) {
      super(
          state,
          "Whenever Lorthos, the Tidemaker attacks, you may pay (8). If you do, tap up to eight target permanents. Those permanents don't untap during their controllers' next untap steps.");
      this.addPattern(whenThisAttacks());

      Target target = this.addTarget(Permanents.instance(), "up to eight target permanents");
      target.setNumber(0, 8);

      EventFactory mayPay8 = new EventFactory(EventType.PLAYER_MAY_PAY_MANA, "You may pay (8)");
      mayPay8.parameters.put(EventType.Parameter.CAUSE, This.instance());
      mayPay8.parameters.put(EventType.Parameter.PLAYER, You.instance());
      mayPay8.parameters.put(
          EventType.Parameter.COST, Identity.fromCollection(new ManaPool("(8)")));

      EventFactory tapHard =
          new EventFactory(
              EventType.TAP_HARD,
              "Tap up to eight target permanents. Those permanents don't untap during their controllers' next untap steps.");
      tapHard.parameters.put(EventType.Parameter.CAUSE, This.instance());
      tapHard.parameters.put(EventType.Parameter.OBJECT, targetedBy(target));

      EventFactory totalEffect =
          new EventFactory(
              EventType.IF_EVENT_THEN_ELSE,
              "You may pay (R). If you do, return Punishing Fire from your graveyard to your hand.");
      totalEffect.parameters.put(EventType.Parameter.IF, Identity.instance(mayPay8));
      totalEffect.parameters.put(EventType.Parameter.THEN, Identity.instance(tapHard));
      this.addEffect(totalEffect);
    }
Example #4
0
  public Breakthrough(GameState state) {
    super(state);

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

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

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

    this.addEffect(sequence(choose, discard));
  }
Example #5
0
  public ArrowVolleyTrap(GameState state) {
    super(state);

    SetGenerator trapCondition =
        Intersect.instance(Between.instance(4, null), Count.instance(Attacking.instance()));
    this.addAbility(
        new org.rnd.jmagic.abilities.Trap(
            state,
            this.getName(),
            trapCondition,
            "If four or more creatures are attacking",
            "(1)(W)"));

    Target target = this.addTarget(Attacking.instance(), "up to five target attacking creatures");
    target.setNumber(1, 5);

    this.setDivision(Union.instance(numberGenerator(5), Identity.instance("damage")));
    EventType.ParameterMap damageParameters = new EventType.ParameterMap();
    damageParameters.put(EventType.Parameter.SOURCE, This.instance());
    damageParameters.put(
        EventType.Parameter.TAKER,
        ChosenTargetsFor.instance(Identity.instance(target), This.instance()));
    this.addEffect(
        new EventFactory(
            EventType.DISTRIBUTE_DAMAGE,
            damageParameters,
            "Arrow Volley Trap deals 5 damage divided as you choose among any number of target attacking creatures."));
  }
Example #6
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 #7
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 #8
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 #9
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 #10
0
    public DarksteelFaceWrecker(GameState state) {
      super(state, "Darksteel Juggernaut is indestructible and attacks each turn if able.");

      this.addEffectPart(indestructible(This.instance()));

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.ATTACKING_REQUIREMENT);
      part.parameters.put(ContinuousEffectType.Parameter.ATTACKING, This.instance());
      this.addEffectPart(part);
    }
Example #11
0
    public ChaosImpsAbility2(GameState state) {
      super(state, "Chaos Imps has trample as long as it has a +1/+1 counter on it.");

      this.addEffectPart(
          addAbilityToObject(This.instance(), org.rnd.jmagic.abilities.keywords.Trample.class));

      this.canApply =
          Both.instance(
              this.canApply,
              CountersOn.instance(This.instance(), Counter.CounterType.PLUS_ONE_PLUS_ONE));
    }
Example #12
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);
  }
Example #13
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 #14
0
  public StreetSpasm(GameState state) {
    super(state);

    // Street Spasm deals X damage to target creature without flying you
    // don't control.
    SetGenerator creature = CreaturePermanents.instance();
    SetGenerator creatureWithoutFlying =
        RelativeComplement.instance(creature, HasKeywordAbility.instance(Flying.class));
    SetGenerator creatureWithoutFlyingYouDontControl =
        RelativeComplement.instance(creatureWithoutFlying, ControlledBy.instance(You.instance()));
    SetGenerator target =
        targetedBy(
            this.addTarget(
                creatureWithoutFlyingYouDontControl,
                "target creature without flying you don't control"));
    this.addEffect(
        spellDealDamage(
            ValueOfX.instance(This.instance()),
            target,
            "Street Spasm deals X damage to target creature without flying you don't control."));

    // Overload (X)(X)(R)(R) (You may cast this spell for its overload cost.
    // If you do, change its text by replacing all instances of "target"
    // with "each.")
    this.addAbility(new Overload(state, "(X)(X)(R)(R)"));
  }
Example #15
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 #16
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 #17
0
    public AgoraphobiaAbility1(GameState state) {
      super(state, "Enchanted creature gets -5/-0.");

      SetGenerator enchanted = EnchantedBy.instance(This.instance());

      this.addEffectPart(modifyPowerAndToughness(enchanted, -5, -0));
    }
Example #18
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 #19
0
    public InfernalGenesisAbility0(GameState state) {
      super(
          state,
          "At the beginning of each player's upkeep, that player puts the top card of his or her library into his or her graveyard. Then he or she puts X 1/1 black Minion creature tokens onto the battlefield, where X is that card's converted mana cost.");

      this.addPattern(atTheBeginningOfEachPlayersUpkeep());
      SetGenerator thatPlayer =
          OwnerOf.instance(
              EventParameter.instance(
                  TriggerEvent.instance(This.instance()), EventType.Parameter.STEP));

      EventFactory mill =
          millCards(
              thatPlayer,
              1,
              "That player puts the top card of his or her library into his or her graveyard.");
      this.addEffect(mill);

      SetGenerator thatCard = NewObjectOf.instance(EffectResult.instance(mill));
      SetGenerator X = ConvertedManaCostOf.instance(thatCard);
      CreateTokensFactory f =
          new CreateTokensFactory(
              X,
              numberGenerator(1),
              numberGenerator(1),
              "Then he or she puts X 1/1 black Minion creature tokens onto the battlefield, where X is that card's converted mana cost.");
      f.setController(thatPlayer);
      f.setColors(Color.BLACK);
      f.setSubTypes(SubType.MINION);
      this.addEffect(f.getEventFactory());
    }
Example #20
0
    public TidehollowScullerAbility1(GameState state) {
      super(
          state,
          "When Tidehollow Sculler leaves the battlefield, return the exiled card to its owner's hand.");
      this.addPattern(whenThisLeavesTheBattlefield());

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

      EventFactory move =
          new EventFactory(EventType.MOVE_OBJECTS, "Return the exiled card to its owner's hand.");
      move.parameters.put(EventType.Parameter.CAUSE, This.instance());
      move.parameters.put(EventType.Parameter.TO, HandOf.instance(OwnerOf.instance(exiledCard)));
      move.parameters.put(EventType.Parameter.OBJECT, exiledCard);
      this.addEffect(move);
    }
Example #21
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 #22
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 #23
0
    public ThrowMe(GameState state) {
      super(
          state,
          "(T), Unattach Razor Boomerang: Razor Boomerang deals 1 damage to target creature or player. Return Razor Boomerang to its owner's hand.");
      this.costsTap = true;

      SetGenerator razorBoomerang = Granted.instance(This.instance());

      EventFactory unattach = new EventFactory(EventType.UNATTACH, "Unattach Razor Boomerang");
      unattach.parameters.put(EventType.Parameter.OBJECT, razorBoomerang);
      this.addCost(unattach);

      SetGenerator target =
          targetedBy(this.addTarget(CREATURES_AND_PLAYERS, "target creature or player"));

      EventFactory damage =
          new EventFactory(
              EventType.DEAL_DAMAGE_EVENLY,
              "Razor Boomerang deals 1 damage to target creature or player.");
      damage.parameters.put(EventType.Parameter.SOURCE, razorBoomerang);
      damage.parameters.put(EventType.Parameter.NUMBER, numberGenerator(1));
      damage.parameters.put(EventType.Parameter.TAKER, target);

      this.addEffect(bounce(razorBoomerang, "Return Razor Boomerang to its owner's hand."));
    }
Example #24
0
    public AnotherCreatureEntersTheBattlefield(GameState state) {
      super(
          state,
          "Whenever another creature enters the battlefield under your control, if you control both that creature and this one and both are unpaired, you may pair that creature with this creature for as long as both remain creatures on the battlefield under your control.");
      SetGenerator thisCreature = ABILITY_SOURCE_OF_THIS;
      SetGenerator otherCreatures =
          RelativeComplement.instance(CreaturePermanents.instance(), thisCreature);
      this.addPattern(
          new SimpleZoneChangePattern(
              null, Battlefield.instance(), otherCreatures, You.instance(), false));

      SetGenerator thatCreature = NewObjectOf.instance(TriggerZoneChange.instance(This.instance()));
      SetGenerator youControl = ControlledBy.instance(You.instance());
      SetGenerator youControlUnpairedThis =
          Intersect.instance(youControl, Unpaired.instance(), thisCreature);
      SetGenerator youControlUnpairedThat =
          Intersect.instance(youControl, Unpaired.instance(), thatCreature);
      this.interveningIf = Both.instance(youControlUnpairedThis, youControlUnpairedThat);

      ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.PAIR);
      part.parameters.put(
          ContinuousEffectType.Parameter.OBJECT, Union.instance(thisCreature, thatCreature));

      SetGenerator youControlCreatureThis = Intersect.instance(CREATURES_YOU_CONTROL, thisCreature);
      SetGenerator youControlCreatureThat = Intersect.instance(CREATURES_YOU_CONTROL, thatCreature);
      SetGenerator expires =
          Not.instance(Both.instance(youControlCreatureThis, youControlCreatureThat));
      EventFactory floatingEffect =
          createFloatingEffect(expires, "Pair this creature with that creature", part);

      this.addEffect(youMay(floatingEffect));
    }
Example #25
0
 public GhostlyPossessionAbility1(GameState state) {
   super(state, "Enchanted creature has flying.");
   this.addEffectPart(
       addAbilityToObject(
           EnchantedBy.instance(This.instance()),
           org.rnd.jmagic.abilities.keywords.Flying.class));
 }
Example #26
0
 public SwiftfootBootsAbility0(GameState state) {
   super(state, "Equipped creature has hexproof and haste.");
   this.addEffectPart(
       addAbilityToObject(
           EquippedBy.instance(This.instance()),
           org.rnd.jmagic.abilities.keywords.Hexproof.class,
           org.rnd.jmagic.abilities.keywords.Haste.class));
 }
Example #27
0
    public SkeletalGrimaceAbility1(GameState state) {
      super(state, "Enchanted creature gets +1/+1 and has \"(B): Regenerate this creature.\"");

      SetGenerator enchantedCreature = EnchantedBy.instance(This.instance());

      this.addEffectPart(modifyPowerAndToughness(enchantedCreature, +1, +1));
      this.addEffectPart(addAbilityToObject(enchantedCreature, RegenerateB.class));
    }
Example #28
0
    public SpiritAwayAbility2(GameState state) {
      super(state, "Enchanted creature gets +2/+2 and has flying.");

      SetGenerator enchantedCreature = EnchantedBy.instance(This.instance());
      this.addEffectPart(modifyPowerAndToughness(enchantedCreature, +2, +2));
      this.addEffectPart(
          addAbilityToObject(enchantedCreature, org.rnd.jmagic.abilities.keywords.Flying.class));
    }
Example #29
0
    public GrantShroud(GameState state) {
      super(state, "Other Faeries you control have shroud.");

      SetGenerator faeries =
          Intersect.instance(HasSubType.instance(SubType.FAERIE), CREATURES_YOU_CONTROL);
      SetGenerator who = RelativeComplement.instance(faeries, This.instance());
      this.addEffectPart(addAbilityToObject(who, org.rnd.jmagic.abilities.keywords.Shroud.class));
    }
Example #30
0
    public CommandersAuthorityAbility1(GameState state) {
      super(
          state,
          "Enchanted creature has \"At the beginning of your upkeep, put a 1/1 white Human creature token onto the battlefield.\"");

      this.addEffectPart(
          addAbilityToObject(EnchantedBy.instance(This.instance()), BabyBoomers.class));
    }