예제 #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 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));
    }
예제 #3
0
    public ZombiePT(GameState state) {
      super(
          state,
          "Soulless One's power and toughness are each equal to the number of Zombies on the battlefield plus the number of Zombie cards in all graveyards.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator aliveAndDead =
          InZone.instance(
              Union.instance(Battlefield.instance(), GraveyardOf.instance(Players.instance())));
      SetGenerator zombiesAndDeadZombies =
          Intersect.instance(HasSubType.instance(SubType.ZOMBIE), aliveAndDead);
      SetGenerator number = Count.instance(zombiesAndDeadZombies);

      this.addEffectPart(setPowerAndToughness(This.instance(), number, number));
    }
예제 #4
0
    public TapForThreeDamage(GameState state) {
      super(state, "(T): Lightning Crafter deals 3 damage to target creature or player.");

      this.costsTap = true;

      Target target =
          this.addTarget(
              Union.instance(
                  Players.instance(),
                  Intersect.instance(
                      HasType.instance(Type.CREATURE), InZone.instance(Battlefield.instance()))),
              "target creature or player");
      this.addEffect(
          permanentDealDamage(
              3,
              targetedBy(target),
              "Lightning Crafter deals 3 damage to target creature or player."));
    }
예제 #5
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."));
    }
예제 #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));
    }
예제 #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."));
    }
예제 #8
0
 public GlintHawkIdolAbility0(GameState state) {
   super(
       state,
       "Whenever another artifact enters the battlefield under your control, you may have Glint Hawk Idol become a 2/2 Bird artifact creature with flying until end of turn.");
   this.addPattern(
       new SimpleZoneChangePattern(
           null,
           Battlefield.instance(),
           RelativeComplement.instance(HasType.instance(Type.ARTIFACT), ABILITY_SOURCE_OF_THIS),
           You.instance(),
           false));
   Animator animate = new Animator(ABILITY_SOURCE_OF_THIS, 2, 2);
   animate.addSubType(SubType.BIRD);
   animate.addType(Type.ARTIFACT);
   animate.addType(Type.CREATURE);
   animate.addAbility(org.rnd.jmagic.abilities.keywords.Flying.class);
   this.addEffect(
       youMay(
           createFloatingEffect(
               "Glint Hawk Idol becomes a 2/2 Bird artifact creature with flying until end of turn.",
               animate.getParts()),
           "You may have Glint Hawk Idol become a 2/2 Bird artifact creature with flying until end of turn."));
 }
예제 #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);
    }