Пример #1
0
    public DearlyDepartedAbility1(GameState state) {
      super(
          state,
          "As long as Dearly Departed is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it.");
      this.canApply = THIS_IS_IN_A_GRAVEYARD;

      SetGenerator humanCreatures =
          Intersect.instance(HasSubType.instance(SubType.HUMAN), HasType.instance(Type.CREATURE));

      ZoneChangeReplacementEffect replacement =
          new ZoneChangeReplacementEffect(this.game, this.getName());
      replacement.addPattern(
          new SimpleZoneChangePattern(
              null, Battlefield.instance(), humanCreatures, You.instance(), false));

      SetGenerator zoneChange = ReplacedBy.instance(Identity.instance(replacement));

      EventFactory factory = new EventFactory(EventType.PUT_COUNTERS, this.getName());
      factory.parameters.put(EventType.Parameter.CAUSE, CauseOf.instance(zoneChange));
      factory.parameters.put(
          EventType.Parameter.COUNTER, Identity.instance(Counter.CounterType.PLUS_ONE_PLUS_ONE));
      factory.parameters.put(EventType.Parameter.OBJECT, NewObjectOf.instance(zoneChange));
      replacement.addEffect(factory);

      this.addEffectPart(replacementEffectPart(replacement));
    }
Пример #2
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));
    }
Пример #3
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());
  }
Пример #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."));
    }
Пример #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());
    }
Пример #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."));
  }
Пример #7
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));
    }
Пример #8
0
    public LazavDimirMastermindAbility1(GameState state) {
      super(
          state,
          "Whenever a creature card is put into an opponent's graveyard from anywhere, you may have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability.");

      this.addPattern(
          new SimpleZoneChangePattern(
              null,
              GraveyardOf.instance(OpponentsOf.instance(You.instance())),
              HasType.instance(Type.CREATURE),
              false));

      SetGenerator thatCard = NewObjectOf.instance(TriggerZoneChange.instance(This.instance()));

      ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.COPY_OBJECT);
      part.parameters.put(
          ContinuousEffectType.Parameter.ABILITY,
          Identity.instance(
              new SimpleAbilityFactory(LazavDimirMastermindAbility1.class),
              new SimpleAbilityFactory(Hexproof.class)));
      part.parameters.put(ContinuousEffectType.Parameter.OBJECT, ABILITY_SOURCE_OF_THIS);
      part.parameters.put(ContinuousEffectType.Parameter.ORIGINAL, thatCard);
      part.parameters.put(
          ContinuousEffectType.Parameter.RETAIN,
          Identity.instance(Characteristics.Characteristic.NAME));
      part.parameters.put(
          ContinuousEffectType.Parameter.TYPE, Identity.instance(SuperType.LEGENDARY));

      EventFactory copy =
          createFloatingEffect(
              Empty.instance(),
              "Have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability.",
              part);
      this.addEffect(
          youMay(
              copy,
              "Have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability."));
    }
Пример #9
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);
    }