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

    SetGenerator trapCondition =
        Intersect.instance(Between.instance(4, null), Count.instance(Attacking.instance()));
    this.addAbility(
        new org.rnd.jmagic.abilities.Trap(
            state,
            this.getName(),
            trapCondition,
            "If four or more creatures are attacking",
            "(1)(W)"));

    Target target = this.addTarget(Attacking.instance(), "up to five target attacking creatures");
    target.setNumber(1, 5);

    this.setDivision(Union.instance(numberGenerator(5), Identity.instance("damage")));
    EventType.ParameterMap damageParameters = new EventType.ParameterMap();
    damageParameters.put(EventType.Parameter.SOURCE, This.instance());
    damageParameters.put(
        EventType.Parameter.TAKER,
        ChosenTargetsFor.instance(Identity.instance(target), This.instance()));
    this.addEffect(
        new EventFactory(
            EventType.DISTRIBUTE_DAMAGE,
            damageParameters,
            "Arrow Volley Trap deals 5 damage divided as you choose among any number of target attacking creatures."));
  }
Example #2
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);
  }
    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 #4
0
  public Ghostform(GameState state) {
    super(state);

    // Up to two target creatures are unblockable this turn.
    Target target = this.addTarget(CreaturePermanents.instance(), "up to two target creatures");
    target.setNumber(0, 2);
    this.addEffect(
        createFloatingEffect(
            "Up to two target creatures are unblockable this turn.",
            unblockable(targetedBy(target))));
  }
Example #5
0
  public Switcheroo(GameState state) {
    super(state);

    // Exchange control of two target creatures.
    Target target = this.addTarget(CreaturePermanents.instance(), "two target creatures");
    target.setNumber(2, 2);

    EventFactory factory =
        new EventFactory(EventType.EXCHANGE_CONTROL, "Exchange control of two target creatures.");
    factory.parameters.put(EventType.Parameter.CAUSE, This.instance());
    factory.parameters.put(EventType.Parameter.OBJECT, targetedBy(target));
    this.addEffect(factory);
  }
Example #6
0
    public InfernoTitanAbility1(GameState state) {
      super(
          state,
          "Whenever Inferno Titan enters the battlefield or attacks, it deals 3 damage divided as you choose among one, two, or three target creatures and/or players.");
      this.addPattern(whenThisEntersTheBattlefield());
      this.addPattern(whenThisAttacks());

      Target target =
          this.addTarget(
              CREATURES_AND_PLAYERS, "one, two, or three target creatures and/or players");
      target.setNumber(1, 3);
      this.setDivision(Union.instance(numberGenerator(3), Identity.instance("damage")));

      EventFactory damage =
          new EventFactory(
              EventType.DISTRIBUTE_DAMAGE,
              "It deals 3 damage divided as you choose among one, two, or three target creatures and/or players.");
      damage.parameters.put(EventType.Parameter.SOURCE, ABILITY_SOURCE_OF_THIS);
      damage.parameters.put(
          EventType.Parameter.TAKER,
          ChosenTargetsFor.instance(Identity.instance(target), This.instance()));
      this.addEffect(damage);
    }