Esempio n. 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));
    }
Esempio n. 2
0
    public MysticRemoraAbility1(GameState state) {
      super(
          state,
          "Whenever an opponent casts a noncreature spell, you may draw a card unless that player pays (4).");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      pattern.put(EventType.Parameter.PLAYER, OpponentsOf.instance(You.instance()));
      pattern.put(
          EventType.Parameter.OBJECT,
          RelativeComplement.instance(Spells.instance(), HasType.instance(Type.CREATURE)));
      this.addPattern(pattern);

      SetGenerator thatPlayer =
          EventParameter.instance(
              TriggerEvent.instance(This.instance()), EventType.Parameter.PLAYER);

      EventFactory mayDraw =
          youMay(drawCards(You.instance(), 1, "Draw a card"), "You may draw a card");

      EventFactory pay = new EventFactory(EventType.PAY_MANA, "Pay (4)");
      pay.parameters.put(EventType.Parameter.CAUSE, This.instance());
      pay.parameters.put(EventType.Parameter.PLAYER, thatPlayer);
      pay.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("4")));
      this.addEffect(
          unless(thatPlayer, mayDraw, pay, "You may draw a card unless that player pays (4)."));
    }
Esempio n. 3
0
    public PsychosisCrawlerAbility1(GameState state) {
      super(state, "Whenever you draw a card, each opponent loses 1 life.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.DRAW_ONE_CARD);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      this.addPattern(pattern);

      this.addEffect(
          loseLife(OpponentsOf.instance(You.instance()), 1, "Each opponent loses 1 life."));
    }
Esempio n. 4
0
    public Vampiricism(GameState state) {
      super(state, "Whenever you gain life, target opponent loses that much life.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.GAIN_LIFE);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      this.addPattern(pattern);

      Target target = this.addTarget(OpponentsOf.instance(You.instance()), "target opponent");

      this.addEffect(
          loseLife(
              targetedBy(target),
              EventParameter.instance(
                  TriggerEvent.instance(This.instance()), EventType.Parameter.NUMBER),
              "Target opponent loses that much life."));
    }
Esempio n. 5
0
    public CountrysideCrusherAbility0(GameState state) {
      super(
          state,
          "At the beginning of your upkeep, reveal the top card of your library. If it's a land card, put it into your graveyard and repeat this process.");
      this.addPattern(atTheBeginningOfYourUpkeep());

      SetGenerator yourLibrary = LibraryOf.instance(You.instance());
      SetGenerator toReveal =
          TopMost.instance(
              yourLibrary,
              numberGenerator(1),
              RelativeComplement.instance(
                  InZone.instance(yourLibrary), HasType.instance(Type.LAND)));

      EventFactory reveal =
          new EventFactory(
              EventType.REVEAL,
              "Reveal cards from the top of your library until you reveal a nonland card.");
      reveal.parameters.put(EventType.Parameter.CAUSE, This.instance());
      reveal.parameters.put(EventType.Parameter.OBJECT, toReveal);
      this.addEffect(reveal);

      SetGenerator landsRevealed = Intersect.instance(toReveal, HasType.instance(Type.LAND));

      EventFactory pitch =
          new EventFactory(
              EventType.PUT_INTO_GRAVEYARD, "Put all revealed nonland cards into your graveyard.");
      pitch.parameters.put(EventType.Parameter.CAUSE, This.instance());
      pitch.parameters.put(EventType.Parameter.OBJECT, landsRevealed);
      this.addEffect(pitch);
    }
Esempio n. 6
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));
    }
Esempio n. 7
0
    public SigardaHostofHeronsAbility1(GameState state) {
      super(
          state,
          "Spells and abilities your opponents control can't cause you to sacrifice permanents.");

      SimpleEventPattern youSacrificePermanents =
          new SimpleEventPattern(EventType.SACRIFICE_ONE_PERMANENT);
      youSacrificePermanents.put(
          EventType.Parameter.CAUSE,
          ControlledBy.instance(OpponentsOf.instance(You.instance()), Stack.instance()));
      youSacrificePermanents.put(EventType.Parameter.PERMANENT, Permanents.instance());
      youSacrificePermanents.put(EventType.Parameter.PLAYER, You.instance());

      ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.PROHIBIT);
      part.parameters.put(
          ContinuousEffectType.Parameter.PROHIBITION, Identity.instance(youSacrificePermanents));
      this.addEffectPart(part);
    }
Esempio n. 8
0
    public PsychosisCrawlerAbility0(GameState state) {
      super(
          state,
          "Psychosis Crawler's power and toughness are each equal to the number of cards in your hand.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator number = Count.instance(InZone.instance(HandOf.instance(You.instance())));
      this.addEffectPart(setPowerAndToughness(This.instance(), number, number));
    }
Esempio n. 9
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."));
    }
Esempio n. 10
0
    public LunarMysticAbility0(GameState state) {
      super(state, "Whenever you cast an instant spell, you may pay (1). If you do, draw a card.");

      SimpleEventPattern whenYouCastASpell = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      whenYouCastASpell.put(EventType.Parameter.PLAYER, You.instance());
      whenYouCastASpell.put(EventType.Parameter.OBJECT, HasType.instance(Type.INSTANT));
      this.addPattern(whenYouCastASpell);

      this.addEffect(
          ifThen(youMayPay("(1)"), drawACard(), "You may pay (1). If you do, draw a card."));
    }
Esempio n. 11
0
    public CountrysideCrusherAbility1(GameState state) {
      super(
          state,
          "Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on Countryside Crusher.");

      ZoneChangePattern pitchedLand =
          new SimpleZoneChangePattern(
              null, GraveyardOf.instance(You.instance()), HasType.instance(Type.LAND), false);
      this.addPattern(pitchedLand);

      this.addEffect(
          putCountersOnThis(1, Counter.CounterType.PLUS_ONE_PLUS_ONE, "Countryside Crusher"));
    }
Esempio n. 12
0
    public GolemFoundryAbility0(GameState state) {
      super(
          state,
          "Whenever you cast an artifact spell, you may put a charge counter on Golem Foundry.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      pattern.withResult(HasType.instance(Type.ARTIFACT));
      this.addPattern(pattern);

      this.addEffect(
          youMay(
              putCounters(
                  1,
                  Counter.CounterType.CHARGE,
                  ABILITY_SOURCE_OF_THIS,
                  "Put a charge counter on Golem Foundry."),
              "You may put a charge counter on Golem Foundry."));
    }
    public ShrineofBoundlessGrowthAbility0(GameState state) {
      super(
          state,
          "At the beginning of your upkeep or whenever you cast a green spell, put a charge counter on Shrine of Boundless Growth.");
      this.addPattern(atTheBeginningOfYourUpkeep());

      SimpleEventPattern castABlueSpell = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      castABlueSpell.put(EventType.Parameter.PLAYER, You.instance());
      castABlueSpell.put(
          EventType.Parameter.OBJECT,
          Intersect.instance(Spells.instance(), HasColor.instance(Color.GREEN)));
      this.addPattern(castABlueSpell);

      this.addEffect(
          putCounters(
              1,
              Counter.CounterType.CHARGE,
              ABILITY_SOURCE_OF_THIS,
              "Put a charge counter on Shrine of Boundless Growth."));
    }
    public ShrineofBoundlessGrowthAbility1(GameState state) {
      super(
          state,
          "(T), Sacrifice Shrine of Boundless Growth: Add (1) to your mana pool for each charge counter on Shrine of Boundless Growth.");
      this.costsTap = true;
      this.addCost(sacrificeThis("Shrine of Boundless Growth"));

      SetGenerator counters =
          Count.instance(CountersOn.instance(ABILITY_SOURCE_OF_THIS, Counter.CounterType.CHARGE));

      EventFactory addMana =
          new EventFactory(
              EventType.ADD_MANA,
              "Add (1) to your mana pool for each charge counter on Shrine of Boundless Growth.");
      addMana.parameters.put(EventType.Parameter.SOURCE, ABILITY_SOURCE_OF_THIS);
      addMana.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("(1)")));
      addMana.parameters.put(EventType.Parameter.NUMBER, counters);
      addMana.parameters.put(EventType.Parameter.PLAYER, You.instance());
      this.addEffect(addMana);
    }
Esempio n. 15
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."));
    }
Esempio n. 16
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."));
    }
Esempio n. 17
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."));
 }