Ejemplo n.º 1
0
 @Override
 protected EventFactory getFactory(SetGenerator thisAbility) {
   EventFactory factory = new EventFactory(EventType.PAY_MANA, "Pay " + this.cumulativeUpkeep);
   factory.parameters.put(EventType.Parameter.CAUSE, thisAbility);
   factory.parameters.put(
       EventType.Parameter.COST, Identity.instance(new ManaPool(this.cumulativeUpkeep)));
   factory.parameters.put(EventType.Parameter.PLAYER, ControllerOf.instance(thisAbility));
   return factory;
 }
Ejemplo n.º 2
0
  public VaporSnag(GameState state) {
    super(state);

    // Return target creature to its owner's hand. Its controller loses 1
    // life.
    SetGenerator target =
        targetedBy(this.addTarget(CreaturePermanents.instance(), "target creature"));
    this.addEffect(bounce(target, "Return target creature to its owner's hand."));
    this.addEffect(loseLife(ControllerOf.instance(target), 1, "Its controller loses 1 life."));
  }
Ejemplo n.º 3
0
  public PsychicBarrier(GameState state) {
    super(state);

    // Counter target creature spell. Its controller loses 1 life.
    SetGenerator target =
        targetedBy(
            this.addTarget(
                Intersect.instance(Spells.instance(), HasType.instance(Type.CREATURE)),
                "target creature spell"));
    this.addEffect(counter(target, "Counter target creature spell."));
    this.addEffect(loseLife(ControllerOf.instance(target), 1, "Its controller loses 1 life."));
  }
Ejemplo n.º 4
0
  public Polymorph(GameState state) {
    super(state);

    // Destroy target creature. It can't be regenerated.
    Target target = this.addTarget(CreaturePermanents.instance(), "target creature");
    this.addEffects(
        bury(this, targetedBy(target), "Destroy target creature. It can't be regenerated."));

    // Its controller reveals cards from the top of his or her library until
    // he or she reveals a creature card.
    SetGenerator controller = ControllerOf.instance(targetedBy(target));
    SetGenerator library = LibraryOf.instance(controller);
    SetGenerator cardsToReveal =
        TopMost.instance(library, numberGenerator(1), HasType.instance(Type.CREATURE));

    EventType.ParameterMap revealParameters = new EventType.ParameterMap();
    revealParameters.put(EventType.Parameter.CAUSE, This.instance());
    revealParameters.put(EventType.Parameter.OBJECT, cardsToReveal);
    this.addEffect(
        new EventFactory(
            EventType.REVEAL,
            revealParameters,
            "Its controller reveals cards from the top of his or her library until he or she reveals a creature card."));

    // The player puts that card onto the battlefield,
    SetGenerator firstCreature = Intersect.instance(cardsToReveal, HasType.instance(Type.CREATURE));
    EventType.ParameterMap ontoFieldParameters = new EventType.ParameterMap();
    ontoFieldParameters.put(EventType.Parameter.CAUSE, This.instance());
    ontoFieldParameters.put(EventType.Parameter.CONTROLLER, controller);
    ontoFieldParameters.put(EventType.Parameter.OBJECT, firstCreature);
    this.addEffect(
        new EventFactory(
            EventType.PUT_ONTO_BATTLEFIELD,
            ontoFieldParameters,
            "The player puts that card onto the battlefield,"));

    // then shuffles all other cards revealed this way into his or her
    // library.
    // Since the "other cards" never left the library... this is just a
    // standard shuffle, not a shuffle-into.
    this.addEffect(
        shuffleLibrary(
            controller,
            "then shuffles all other cards revealed this way into his or her library."));
  }
Ejemplo n.º 5
0
    public FinishHim(GameState state) {
      super(
          state,
          "At the beginning of your upkeep, if twenty or more creature cards are in your graveyard, you win the game.");

      SetGenerator numCreatures =
          Count.instance(
              Intersect.instance(
                  HasType.instance(Type.CREATURE),
                  InZone.instance(
                      GraveyardOf.instance(ControllerOf.instance(ABILITY_SOURCE_OF_THIS)))));

      this.addPattern(atTheBeginningOfYourUpkeep());

      this.interveningIf = Intersect.instance(numCreatures, Between.instance(20, null));

      this.addEffect(youWinTheGame());
    }
Ejemplo n.º 6
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));
    }
Ejemplo n.º 7
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."));
    }
Ejemplo n.º 8
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());
  }