예제 #1
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."));
  }
예제 #2
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."));
  }
예제 #3
0
    public AgadeemOccultistAbility0(GameState state) {
      super(
          state,
          "(T): Put target creature card from an opponent's graveyard onto the battlefield under your control if its converted mana cost is less than or equal to the number of Allies you control.");
      this.costsTap = true;

      SetGenerator creatureCards = HasType.instance(Type.CREATURE);
      SetGenerator inOpponentsYard =
          InZone.instance(GraveyardOf.instance(OpponentsOf.instance(You.instance())));
      Target t =
          this.addTarget(
              Intersect.instance(creatureCards, inOpponentsYard),
              "target creature card from an opponent's graveyard");

      EventFactory move =
          new EventFactory(
              EventType.PUT_ONTO_BATTLEFIELD,
              "Put target creature card from an opponent's graveyard onto the battlefield under your control");
      move.parameters.put(EventType.Parameter.CAUSE, This.instance());
      move.parameters.put(EventType.Parameter.CONTROLLER, You.instance());
      move.parameters.put(EventType.Parameter.OBJECT, targetedBy(t));

      SetGenerator lessThanOrEqualNumAllies =
          Between.instance(null, Count.instance(ALLIES_YOU_CONTROL));
      SetGenerator condition =
          Intersect.instance(ConvertedManaCostOf.instance(targetedBy(t)), lessThanOrEqualNumAllies);

      EventFactory effect =
          new EventFactory(
              EventType.IF_CONDITION_THEN_ELSE,
              "Put target creature card from an opponent's graveyard onto the battlefield under your control if its converted mana cost is less than or equal to the number of Allies you control.");
      effect.parameters.put(EventType.Parameter.IF, condition);
      effect.parameters.put(EventType.Parameter.THEN, Identity.instance(move));
      this.addEffect(effect);
    }
예제 #4
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);
  }
예제 #5
0
    public DamageTrigger(GameState state) {
      super(
          state,
          "At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Hellfire Mongrel deals 2 damage to him or her.");
      this.addPattern(atTheBeginningOfEachOpponentsUpkeeps());

      SetGenerator twoOrFewer = Between.instance(null, 2);
      SetGenerator upkeep =
          EventParameter.instance(TriggerEvent.instance(This.instance()), EventType.Parameter.STEP);
      SetGenerator thatPlayer = OwnerOf.instance(upkeep);
      SetGenerator cardsInHand = Count.instance(InZone.instance(HandOf.instance(thatPlayer)));
      this.interveningIf = Intersect.instance(twoOrFewer, cardsInHand);

      this.addEffect(
          permanentDealDamage(2, thatPlayer, "Hellfire Mongrel deals 2 damage to that player."));
    }
예제 #6
0
    public BigGameHunterAbility0(GameState state) {
      super(
          state,
          "When Big Game Hunter enters the battlefield, destroy target creature with power 4 or greater. It can't be regenerated.");
      this.addPattern(whenThisEntersTheBattlefield());

      SetGenerator targetable =
          Intersect.instance(
              CreaturePermanents.instance(), HasPower.instance(Between.instance(4, null)));
      SetGenerator target =
          targetedBy(this.addTarget(targetable, "target creature with power 4 or greater"));
      this.addEffects(
          bury(
              this,
              target,
              "Destroy target creature with power 4 or greater. It can't be regenerated."));
    }
예제 #7
0
    public KrakenoftheStraitsAbility0(GameState state) {
      super(
          state,
          "Creatures with power less than the number of Islands you control can't block Kraken of the Straits.");

      SetGenerator yourIslands =
          Intersect.instance(
              ControlledBy.instance(You.instance()), HasSubType.instance(SubType.ISLAND));
      SetGenerator weak =
          HasPower.instance(Between.instance(numberGenerator(0), Count.instance(yourIslands)));
      SetGenerator restriction = Intersect.instance(weak, Blocking.instance(This.instance()));

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.BLOCKING_RESTRICTION);
      part.parameters.put(
          ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(restriction));
      this.addEffectPart(part);
    }
예제 #8
0
    public FinishHim(GameState state) {
      super(
          state,
          "At the beginning of your upkeep, if twenty or more creature cards are in your graveyard, you win the game.");

      SetGenerator numCreatures =
          Count.instance(
              Intersect.instance(
                  HasType.instance(Type.CREATURE),
                  InZone.instance(
                      GraveyardOf.instance(ControllerOf.instance(ABILITY_SOURCE_OF_THIS)))));

      this.addPattern(atTheBeginningOfYourUpkeep());

      this.interveningIf = Intersect.instance(numCreatures, Between.instance(20, null));

      this.addEffect(youWinTheGame());
    }
예제 #9
0
  public IllGottenGains(GameState state) {
    super(state);

    // Exile Ill-Gotten Gains.
    this.addEffect(exile(This.instance(), "Exile Ill-Gotten Gains."));

    // Each player discards his or her hand,
    this.addEffect(discardHand(Players.instance(), "Each player discards his or her hand,"));

    // then returns up to three cards from his or her graveyard to his or
    // her hand.
    SetGenerator eachPlayer = DynamicEvaluation.instance();
    SetGenerator graveyard = GraveyardOf.instance(eachPlayer);
    EventFactory chooseCards =
        new EventFactory(EventType.PLAYER_CHOOSE, "Choose up to three cards in your graveyard");
    chooseCards.parameters.put(EventType.Parameter.PLAYER, eachPlayer);
    chooseCards.parameters.put(EventType.Parameter.NUMBER, Between.instance(0, 3));
    chooseCards.parameters.put(EventType.Parameter.CHOICE, InZone.instance(graveyard));
    chooseCards.parameters.put(
        EventType.Parameter.TYPE, Identity.instance(PlayerInterface.ChoiceType.OBJECTS, REASON));

    EventFactory eachPlayerChooses = new EventFactory(FOR_EACH_PLAYER, "");
    eachPlayerChooses.parameters.put(EventType.Parameter.TARGET, Identity.instance(eachPlayer));
    eachPlayerChooses.parameters.put(EventType.Parameter.EFFECT, Identity.instance(chooseCards));
    this.addEffect(eachPlayerChooses);

    SetGenerator chosenCards = ForEachResult.instance(eachPlayerChooses, eachPlayer);

    EventFactory returnCards =
        new EventFactory(EventType.MOVE_OBJECTS, "Return those cards to your hand");
    returnCards.parameters.put(EventType.Parameter.CAUSE, This.instance());
    returnCards.parameters.put(EventType.Parameter.TO, HandOf.instance(eachPlayer));
    returnCards.parameters.put(EventType.Parameter.OBJECT, chosenCards);

    EventFactory effect =
        new EventFactory(
            FOR_EACH_PLAYER,
            "then returns up to three cards from his or her graveyard to his or her hand.");
    effect.parameters.put(EventType.Parameter.TARGET, Identity.instance(eachPlayer));
    effect.parameters.put(EventType.Parameter.EFFECT, Identity.instance(returnCards));
    this.addEffect(effect);
  }
예제 #10
0
    public EnsnaringBridgeAbility0(GameState state) {
      super(
          state,
          "Creatures with power greater than the number of cards in your hand can't attack.");

      SetGenerator numberOfCardsInYourHand =
          Count.instance(InZone.instance(HandOf.instance(You.instance())));
      SetGenerator hasPowerGreater =
          HasPower.instance(
              Between.instance(
                  Sum.instance(Union.instance(numberGenerator(1), numberOfCardsInYourHand)),
                  Empty.instance()));
      SetGenerator restriction = Intersect.instance(Attacking.instance(), hasPowerGreater);

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.ATTACKING_RESTRICTION);
      part.parameters.put(
          ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(restriction));
      this.addEffectPart(part);
    }