Пример #1
0
  public PermafrostTrap(GameState state) {
    super(state);

    // If an opponent had a green creature enter the battlefield under his
    // or her control this turn, you may pay (U) rather than pay Permafrost
    // Trap's mana cost.
    state.ensureTracker(new GreenCreaturesPutOntoTheBattlefieldThisTurnCounter());
    SetGenerator opponents = OpponentsOf.instance(You.instance());
    SetGenerator maxPerOpponent =
        MaximumPerPlayer.instance(
            GreenCreaturesPutOntoTheBattlefieldThisTurnCounter.class, opponents);
    SetGenerator trapCondition = Intersect.instance(Between.instance(2, null), maxPerOpponent);
    this.addAbility(
        new org.rnd.jmagic.abilities.Trap(
            state,
            this.getName(),
            trapCondition,
            "If an opponent had a green creature enter the battlefield under his or her control this turn",
            "(U)"));

    Target target = this.addTarget(CreaturePermanents.instance(), "up to two target creatures");
    target.setNumber(0, 2);

    // Tap up to two target creatures. Those creatures don't untap during
    // their controller's next untap step.
    EventFactory tap =
        new EventFactory(
            EventType.TAP_HARD,
            "Tap up to two target creatures. Those creatures don't untap during their controller's next untap step.");
    tap.parameters.put(EventType.Parameter.CAUSE, This.instance());
    tap.parameters.put(EventType.Parameter.OBJECT, targetedBy(target));
    this.addEffect(tap);
  }
Пример #2
0
  public RuneflareTrap(GameState state) {
    super(state);

    // If an opponent drew three or more cards this turn, you may pay (R)
    // rather than pay Runeflare Trap's mana cost.
    state.ensureTracker(new CardsDrawn());
    SetGenerator opponents = OpponentsOf.instance(You.instance());
    SetGenerator cardsDrawn = MaximumPerPlayer.instance(CardsDrawn.class, opponents);
    SetGenerator trapCondition = Intersect.instance(cardsDrawn, Between.instance(3, null));
    this.addAbility(
        new Trap(
            state,
            this.getName(),
            trapCondition,
            "If an opponent drew three or more cards this turn",
            "(R)"));

    // Runeflare Trap deals damage to target player equal to the number of
    // cards in that player's hand.
    Target target = this.addTarget(Players.instance(), "target player");

    SetGenerator amount = Count.instance(InZone.instance(HandOf.instance(targetedBy(target))));
    this.addEffect(
        spellDealDamage(
            amount,
            targetedBy(target),
            "Runeflare Trap deals damage to target player equal to the number of cards in that player's hand."));
  }
Пример #3
0
    public MarduWarshriekerAbility0(GameState state) {
      super(
          state,
          "When Mardu Warshrieker enters the battlefield, if you attacked with a creature this turn, add (R)(W)(B) to your mana pool.");
      this.addPattern(whenThisEntersTheBattlefield());

      state.ensureTracker(new org.rnd.jmagic.engine.trackers.AttackTracker());
      this.interveningIf = Raid.instance();

      this.addEffect(addManaToYourManaPoolFromAbility("(R)(W)(B)"));
    }
Пример #4
0
  public Monstrosity(GameState state, String manaCost, int N) {
    super(state, manaCost + ": Monstrosity " + N + ".");
    this.manaCost = manaCost;
    this.N = N;

    this.setManaCost(new ManaPool(manaCost));

    state.ensureTracker(new org.rnd.jmagic.engine.eventTypes.Monstrosity.MonstrousTracker());
    EventFactory monstrosity = monstrosity(N);
    this.addEffect(monstrosity);
  }
Пример #5
0
    public BecomeHuman(GameState state, String cardName) {
      super(
          state,
          "At the beginning of each upkeep, if a player cast two or more spells last turn, transform "
              + cardName
              + ".");
      this.cardName = cardName;

      this.addPattern(atTheBeginningOfEachUpkeep());

      state.ensureTracker(new Tracker());
      this.interveningIf = NewMoon.instance();

      this.addEffect(transformThis(cardName));
    }
Пример #6
0
    public BecomeFuzzy(GameState state, String cardName) {
      super(
          state,
          "At the beginning of each upkeep, if no spells were cast last turn, transform "
              + cardName
              + ".");
      this.cardName = cardName;

      this.addPattern(atTheBeginningOfEachUpkeep());

      state.ensureTracker(new Tracker());
      this.interveningIf = FullMoon.instance();

      this.addEffect(transformThis(cardName));
    }
Пример #7
0
    public Glass(GameState state) {
      super(
          state,
          "Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_TARGET);
      pattern.put(
          EventType.Parameter.TARGET,
          RelativeComplement.instance(ABILITY_SOURCE_OF_THIS, TargetedThisTurn.instance()));
      state.ensureTracker(new TargetedThisTurn.Tracker());

      SetGenerator thatSpell =
          EventParameter.instance(
              TriggerEvent.instance(This.instance()), EventType.Parameter.OBJECT);
      this.addEffect(counter(thatSpell, "Counter that spell or ability."));
    }