Example #1
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 #2
0
  public CribSwap(GameState state) {
    super(state);

    // Changeling (This card is every creature type at all times.)
    this.addAbility(new org.rnd.jmagic.abilities.keywords.Changeling(state));

    // Exile target creature.
    SetGenerator target =
        targetedBy(this.addTarget(CreaturePermanents.instance(), "target creature"));
    this.addEffect(exile(target, "Exile target creature."));

    // Its controller puts a 1/1 colorless Shapeshifter creature token with
    // changeling onto the battlefield.
    CreateTokensFactory token =
        new CreateTokensFactory(
            1,
            1,
            1,
            "Its controller puts a 1/1 colorless Shapeshifter creature token with changeling onto the battlefield.");
    token.setController(ControllerOf.instance(target));
    token.setSubTypes(SubType.SHAPESHIFTER);
    token.addAbility(org.rnd.jmagic.abilities.keywords.Changeling.class);
    this.addEffect(token.getEventFactory());
  }