示例#1
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));
    }
示例#2
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."));
    }
    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."));
    }