Exemplo n.º 1
0
  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());
  }
Exemplo n.º 2
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));
  }
Exemplo n.º 3
0
    public MotherofRunesAbility0(GameState state) {
      super(
          state,
          "(T): Target creature you control gains protection from the color of your choice until end of turn.");
      this.costsTap = true;
      SetGenerator target =
          targetedBy(
              this.addTarget(
                  Intersect.instance(
                      CreaturePermanents.instance(), ControlledBy.instance(You.instance())),
                  "target creature you control"));

      EventFactory chooseColor =
          playerChoose(
              You.instance(),
              1,
              Identity.fromCollection(Color.allColors()),
              PlayerInterface.ChoiceType.COLOR,
              PlayerInterface.ChooseReason.CHOOSE_COLOR,
              "");
      this.addEffect(chooseColor);

      SetGenerator color = EffectResult.instance(chooseColor);
      this.addEffect(
          addProtectionUntilEndOfTurn(
              target,
              color,
              "Target creature gains protection from the color of your choice until end of turn."));
    }
Exemplo n.º 4
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."));
    }
Exemplo n.º 5
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());
    }
Exemplo n.º 6
0
  public FracturingGust(GameState state) {
    super(state);

    // Destroy all artifacts and enchantments.
    EventFactory destroy =
        destroy(
            Union.instance(ArtifactPermanents.instance(), EnchantmentPermanents.instance()),
            "Destroy artifacts and enchantments.");
    this.addEffect(destroy);

    // You gain 2 life for each permanent destroyed this way.
    SetGenerator X = Count.instance(NewObjectOf.instance(EffectResult.instance(destroy)));
    this.addEffect(
        gainLife(
            You.instance(),
            Multiply.instance(numberGenerator(2), X),
            "You gain 2 life for each permanent destroyed this way."));
  }
Exemplo n.º 7
0
    public ThisEntersTheBattlefield(GameState state) {
      super(
          state,
          "When this creature enters the battlefield, if you control both this creature and another creature and both are unpaired, you may pair this creature with another unpaired creature you control for as long as both remain creatures on the battlefield under your control.");
      SetGenerator thisCreature = ABILITY_SOURCE_OF_THIS;
      this.addPattern(
          new SimpleZoneChangePattern(null, Battlefield.instance(), thisCreature, false));

      SetGenerator otherCreaturesYouControl =
          RelativeComplement.instance(CREATURES_YOU_CONTROL, thisCreature);
      SetGenerator youControl = ControlledBy.instance(You.instance());
      SetGenerator youControlUnpairedThis =
          Intersect.instance(youControl, Unpaired.instance(), thisCreature);
      SetGenerator youControlUnpairedOtherCreatures =
          Intersect.instance(Unpaired.instance(), otherCreaturesYouControl);
      this.interveningIf = Both.instance(youControlUnpairedThis, youControlUnpairedOtherCreatures);

      EventFactory choose =
          playerChoose(
              You.instance(),
              1,
              youControlUnpairedOtherCreatures,
              PlayerInterface.ChoiceType.OBJECTS,
              REASON,
              "Choose another unpaired creature you control");
      SetGenerator thatCreature = EffectResult.instance(choose);

      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, "and pair this creature with the chosen creature.", part);

      this.addEffect(
          youMay(
              sequence(choose, floatingEffect),
              "You may pair this creature with another unpaired creature you control for as long as both remain creatures on the battlefield under your control."));
    }
Exemplo n.º 8
0
  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."));
  }
Exemplo n.º 9
0
    public DiscipleofBolasAbility0(GameState state) {
      super(
          state,
          "When Disciple of Bolas enters the battlefield, sacrifice another creature. You gain X life and draw X cards, where X is that creature's power.");
      this.addPattern(whenThisEntersTheBattlefield());

      EventFactory sacrifice =
          sacrifice(
              You.instance(),
              1,
              RelativeComplement.instance(CREATURES_YOU_CONTROL, ABILITY_SOURCE_OF_THIS),
              "Sacrifice another creature");
      this.addEffect(sacrifice);

      SetGenerator X = PowerOf.instance(OldObjectOf.instance(EffectResult.instance(sacrifice)));

      this.addEffect(gainLife(You.instance(), X, "You gain X life"));
      this.addEffect(drawCards(You.instance(), X, "and draw X cards"));
    }
Exemplo n.º 10
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);
    }