Example #1
0
  public Pyroblast(GameState state) {
    super(state);

    {
      Target target = this.addTarget(1, Spells.instance(), "target spell");
      EventFactory counter =
          new EventFactory(EventType.IF_CONDITION_THEN_ELSE, "Counter target spell if it's blue.");
      counter.parameters.put(
          EventType.Parameter.IF,
          Intersect.instance(targetedBy(target), HasColor.instance(Color.BLUE)));
      counter.parameters.put(
          EventType.Parameter.THEN,
          Identity.instance(counter(targetedBy(target), "Counter target spell.")));
      this.addEffect(1, counter);
    }

    {
      Target target = this.addTarget(2, Permanents.instance(), "target permanent");
      EventFactory destroy =
          new EventFactory(
              EventType.IF_CONDITION_THEN_ELSE, "Destroy target permanent if it's blue.");
      destroy.parameters.put(
          EventType.Parameter.IF,
          Intersect.instance(targetedBy(target), HasColor.instance(Color.BLUE)));
      destroy.parameters.put(
          EventType.Parameter.THEN,
          Identity.instance(destroy(targetedBy(target), "Destroy target permanent.")));
      this.addEffect(2, destroy);
    }
  }
    public TentacleRape(GameState state) {
      super(
          state,
          "Whenever Lorthos, the Tidemaker attacks, you may pay (8). If you do, tap up to eight target permanents. Those permanents don't untap during their controllers' next untap steps.");
      this.addPattern(whenThisAttacks());

      Target target = this.addTarget(Permanents.instance(), "up to eight target permanents");
      target.setNumber(0, 8);

      EventFactory mayPay8 = new EventFactory(EventType.PLAYER_MAY_PAY_MANA, "You may pay (8)");
      mayPay8.parameters.put(EventType.Parameter.CAUSE, This.instance());
      mayPay8.parameters.put(EventType.Parameter.PLAYER, You.instance());
      mayPay8.parameters.put(
          EventType.Parameter.COST, Identity.fromCollection(new ManaPool("(8)")));

      EventFactory tapHard =
          new EventFactory(
              EventType.TAP_HARD,
              "Tap up to eight target permanents. Those permanents don't untap during their controllers' next untap steps.");
      tapHard.parameters.put(EventType.Parameter.CAUSE, This.instance());
      tapHard.parameters.put(EventType.Parameter.OBJECT, targetedBy(target));

      EventFactory totalEffect =
          new EventFactory(
              EventType.IF_EVENT_THEN_ELSE,
              "You may pay (R). If you do, return Punishing Fire from your graveyard to your hand.");
      totalEffect.parameters.put(EventType.Parameter.IF, Identity.instance(mayPay8));
      totalEffect.parameters.put(EventType.Parameter.THEN, Identity.instance(tapHard));
      this.addEffect(totalEffect);
    }
Example #3
0
 public ElspethTirelAbility2(GameState state) {
   super(state, -5, "Destroy all other permanents except for lands and tokens.");
   SetGenerator destroy =
       RelativeComplement.instance(
           Permanents.instance(),
           Union.instance(ABILITY_SOURCE_OF_THIS, LandPermanents.instance(), Tokens.instance()));
   this.addEffect(destroy(destroy, "Destroy all other permanents except for lands and tokens."));
 }
Example #4
0
 public MasterChief(GameState state) {
   super(state, "When Halo Hunter enters the battlefield, destroy target Angel.");
   this.addPattern(whenThisEntersTheBattlefield());
   Target target =
       this.addTarget(
           Intersect.instance(HasSubType.instance(SubType.ANGEL), Permanents.instance()),
           "target Angel");
   this.addEffect(destroy(targetedBy(target), "Destroy target Angel."));
 }
    public WhenYouCastDestroyTargetPermanent(GameState state) {
      super(state, "When you cast Ulamog, the Infinite Gyre, destroy target permanent.");
      this.triggersFromStack();

      this.addPattern(whenYouCastThisSpell());

      Target target = this.addTarget(Permanents.instance(), "target permanent");

      this.addEffect(destroy(targetedBy(target), "Destroy target permanent"));
    }
Example #6
0
 public LuxCannonAbility1(GameState state) {
   super(state, "(T), Remove three charge counters from Lux Cannon: Destroy target permanent.");
   this.costsTap = true;
   this.addCost(
       removeCounters(
           3,
           Counter.CounterType.CHARGE,
           ABILITY_SOURCE_OF_THIS,
           "Remove three charge counters from Lux Cannon"));
   SetGenerator target = targetedBy(this.addTarget(Permanents.instance(), "target permanent"));
   this.addEffect(destroy(target, "Destroy target permanent."));
 }
Example #7
0
    public AngelofGlorysRiseAbility1(GameState state) {
      super(
          state,
          "When Angel of Glory's Rise enters the battlefield, exile all Zombies, then return all Human creature cards from your graveyard to the battlefield.");
      this.addPattern(whenThisEntersTheBattlefield());

      this.addEffect(
          exile(
              Intersect.instance(Permanents.instance(), HasSubType.instance(SubType.ZOMBIE)),
              "Exile all Zombies."));

      this.addEffect(
          putOntoBattlefield(
              Intersect.instance(
                  InZone.instance(GraveyardOf.instance(You.instance())),
                  HasSubType.instance(SubType.HUMAN),
                  HasType.instance(Type.CREATURE)),
              "Return all Human creature cards from your graveyard to the battlefield."));
    }
Example #8
0
  public Worldfire(GameState state) {
    super(state);

    // Exile all permanents. Exile all cards from all hands and graveyards.
    // Each player's life total becomes 1.
    this.addEffect(exile(Permanents.instance(), "Exile all permanents."));

    this.addEffect(
        exile(
            InZone.instance(
                Union.instance(
                    HandOf.instance(Players.instance()), GraveyardOf.instance(Players.instance()))),
            "Exile all cards from all hands and graveyards."));

    EventFactory life = new EventFactory(EventType.SET_LIFE, "Each player's life total becomes 1.");
    life.parameters.put(EventType.Parameter.CAUSE, This.instance());
    life.parameters.put(EventType.Parameter.NUMBER, numberGenerator(1));
    life.parameters.put(EventType.Parameter.PLAYER, Players.instance());
    this.addEffect(life);
  }
Example #9
0
    public CumulativeUpkeepAbility(GameState state, CumulativeUpkeep parent) {
      super(
          state,
          "At the beginning of your upkeep, if this permanent is on the battlefield, put an age counter on this permanent. Then you may pay its cumulative upkeep cost for each age counter on it. If you don't, sacrifice it.");
      this.parent = parent;

      SetGenerator thisCard = ABILITY_SOURCE_OF_THIS;

      EventFactory cost = parent.getFactory(This.instance());

      this.addPattern(atTheBeginningOfYourUpkeep());
      this.interveningIf = Intersect.instance(ABILITY_SOURCE_OF_THIS, Permanents.instance());
      this.addEffect(putCountersOnThis(1, Counter.CounterType.AGE, "this permanent"));

      EventFactory payFactory =
          new EventFactory(
              EventType.PAY_CUMULATIVE_UPKEEP, (cost.name + " for each age counter on it."));
      payFactory.parameters.put(EventType.Parameter.CAUSE, This.instance());
      payFactory.parameters.put(EventType.Parameter.EVENT, Identity.instance(cost));
      payFactory.parameters.put(
          EventType.Parameter.NUMBER,
          Count.instance(CountersOn.instance(thisCard, Counter.CounterType.AGE)));

      EventFactory mayFactory =
          youMay(payFactory, "You may " + cost.name + " for each age counter on it.");
      EventFactory sacFactory = sacrificeThis("it");

      EventFactory mainFactory =
          new EventFactory(
              EventType.IF_EVENT_THEN_ELSE,
              ("You may "
                  + cost.name
                  + " for each age counter on it.  If you don't, sacrifice it."));
      mainFactory.parameters.put(EventType.Parameter.IF, Identity.instance(mayFactory));
      mainFactory.parameters.put(EventType.Parameter.ELSE, Identity.instance(sacFactory));
      this.addEffect(mainFactory);
    }
Example #10
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);
    }