Example #1
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 #2
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());
    }
  public DarkConfidantAbility(GameState state) {
    super(
        state,
        "At the beginning of your upkeep, reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost.");
    this.addPattern(atTheBeginningOfYourUpkeep());

    SetGenerator library = LibraryOf.instance(You.instance());
    SetGenerator topCard = TopCards.instance(numberGenerator(1), library);

    EventFactory reveal = reveal(topCard, "Reveal the top card of your library");
    this.addEffect(reveal);
    this.addEffect(
        putIntoHand(topCard, OwnerOf.instance(topCard), "and put that card into your hand."));
    this.addEffect(
        loseLife(
            You.instance(),
            ConvertedManaCostOf.instance(EffectResult.instance(reveal)),
            "You lose life equal to its converted mana cost."));
  }