Esempio n. 1
0
  public TimeReversal(GameState state) {
    super(state);

    // Each player shuffles his or her hand and graveyard into his or her
    // library,
    SetGenerator handsAndGraveyards =
        InZone.instance(
            Union.instance(
                HandOf.instance(Players.instance()), GraveyardOf.instance(Players.instance())));

    EventFactory shuffle =
        new EventFactory(
            EventType.SHUFFLE_INTO_LIBRARY,
            "Each player shuffles his or her hand and graveyard into his or her library,");
    shuffle.parameters.put(EventType.Parameter.CAUSE, This.instance());
    shuffle.parameters.put(
        EventType.Parameter.OBJECT, Union.instance(handsAndGraveyards, Players.instance()));
    this.addEffect(shuffle);

    // then draws seven cards.
    this.addEffect(drawCards(Players.instance(), 7, "then draws seven cards."));

    // Exile Time Reversal.
    this.addEffect(exile(This.instance(), "Exile Time Reversal."));
  }
Esempio n. 2
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. 3
0
  public SurgicalExtraction(GameState state) {
    super(state);

    // Choose target card in a graveyard other than a basic land card.
    SetGenerator inGraveyards = InZone.instance(GraveyardOf.instance(Players.instance()));
    SetGenerator basicLands =
        Intersect.instance(HasSuperType.instance(SuperType.BASIC), HasType.instance(Type.LAND));
    SetGenerator legalTargets = RelativeComplement.instance(inGraveyards, basicLands);
    Target t =
        this.addTarget(legalTargets, "target card in a graveyard other than a basic land card");

    // Search its owner's graveyard, hand, and library for all cards with
    // the same name as that card and exile them.
    SetGenerator itsOwner = OwnerOf.instance(targetedBy(t));
    SetGenerator graveyard = GraveyardOf.instance(itsOwner);
    SetGenerator hand = HandOf.instance(itsOwner);
    SetGenerator library = LibraryOf.instance(itsOwner);
    SetGenerator zones = Union.instance(graveyard, hand, library);

    EventFactory effect =
        new EventFactory(
            EventType.SEARCH_FOR_ALL_AND_PUT_INTO,
            "Choose target card in a graveyard other than a basic land card. Search its owner's graveyard, hand, and library for all cards with the same name as that card and exile them.");
    effect.parameters.put(EventType.Parameter.CAUSE, This.instance());
    effect.parameters.put(EventType.Parameter.PLAYER, You.instance());
    effect.parameters.put(EventType.Parameter.ZONE, zones);
    effect.parameters.put(
        EventType.Parameter.TYPE,
        Identity.instance(HasName.instance(NameOf.instance(targetedBy(t)))));
    effect.parameters.put(EventType.Parameter.TO, ExileZone.instance());
    this.addEffect(effect);

    // Then that player shuffles his or her library.
    this.addEffect(shuffleLibrary(targetedBy(t), "Then that player shuffles his or her library."));
  }
Esempio n. 4
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."));
  }
Esempio n. 5
0
 public ExileAGoblinOrShaman(GameState state) {
   super(
       state,
       "Goblin or Shaman",
       Union.instance(
           HasSubType.instance(SubType.GOBLIN), HasSubType.instance(SubType.SHAMAN)),
       ReturnAGoblinOrShaman.class);
 }
Esempio n. 6
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."));
 }
Esempio n. 7
0
 public SelhoffOccultistAbility0(GameState state) {
   super(
       state,
       "Whenever Selhoff Occultist or another creature dies, target player puts the top card of his or her library into his or her graveyard.");
   this.addPattern(
       whenXDies(Union.instance(ABILITY_SOURCE_OF_THIS, CreaturePermanents.instance())));
   SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));
   this.addEffect(
       millCards(
           target,
           1,
           "Target player puts the top card of his or her library into his or her graveyard."));
 }
Esempio n. 8
0
  public PredatorsRapport(GameState state) {
    super(state);

    // Choose target creature you control. You gain life equal to that
    // creature's power plus its toughness.
    SetGenerator target =
        targetedBy(this.addTarget(CREATURES_YOU_CONTROL, "target creature you control"));
    this.addEffect(
        gainLife(
            You.instance(),
            Sum.instance(Union.instance(PowerOf.instance(target), ToughnessOf.instance(target))),
            "Choose target creature you control. You gain life equal to that creature's power plus its toughness."));
  }
Esempio n. 9
0
  public BloodFeud(GameState state) {
    super(state);

    // Target creature fights another target creature. (Each deals damage
    // equal to its power to the other.)
    Target target1 = this.addTarget(CreaturePermanents.instance(), "target creature");
    target1.restrictFromLaterTargets = true;
    Target target2 = this.addTarget(CreaturePermanents.instance(), "another target creature");
    this.addEffect(
        fight(
            Union.instance(targetedBy(target1), targetedBy(target2)),
            "Target creature fights another target creature."));
  }
Esempio n. 10
0
    public LensofClarityAbility0(GameState state) {
      super(
          state,
          "You may look at the top card of your library and at face-down creatures you don't control.");

      SetGenerator top = TopCards.instance(1, LibraryOf.instance(You.instance()));
      SetGenerator morphs = Intersect.instance(FaceDown.instance(), CreaturePermanents.instance());
      SetGenerator otherPlayersMorphs =
          RelativeComplement.instance(morphs, ControlledBy.instance(You.instance()));

      ContinuousEffect.Part lookAtMorphs = new ContinuousEffect.Part(ContinuousEffectType.LOOK);
      lookAtMorphs.parameters.put(ContinuousEffectType.Parameter.PLAYER, You.instance());
      lookAtMorphs.parameters.put(
          ContinuousEffectType.Parameter.OBJECT, Union.instance(top, otherPlayersMorphs));
      this.addEffectPart(lookAtMorphs);
    }
Esempio n. 11
0
  public Lavalanche(GameState state) {
    super(state);

    Target target = this.addTarget(Players.instance(), "target player");

    SetGenerator victims =
        Union.instance(
            targetedBy(target),
            Intersect.instance(
                CreaturePermanents.instance(), ControlledBy.instance(targetedBy(target))));
    this.addEffect(
        spellDealDamage(
            ValueOfX.instance(This.instance()),
            victims,
            "Lavalanche deals X damage to target player and each creature he or she controls."));
  }
Esempio n. 12
0
    public ZombiePT(GameState state) {
      super(
          state,
          "Soulless One's power and toughness are each equal to the number of Zombies on the battlefield plus the number of Zombie cards in all graveyards.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator aliveAndDead =
          InZone.instance(
              Union.instance(Battlefield.instance(), GraveyardOf.instance(Players.instance())));
      SetGenerator zombiesAndDeadZombies =
          Intersect.instance(HasSubType.instance(SubType.ZOMBIE), aliveAndDead);
      SetGenerator number = Count.instance(zombiesAndDeadZombies);

      this.addEffectPart(setPowerAndToughness(This.instance(), number, number));
    }
Esempio n. 13
0
  public ArrowsofJustice(GameState state) {
    super(state);

    // Arrows of Justice deals 4 damage to target attacking or blocking
    // creature.
    Target target =
        this.addTarget(
            Intersect.instance(
                CreaturePermanents.instance(),
                Union.instance(Attacking.instance(), Blocking.instance())),
            "target attacking or blocking creature");
    this.addEffect(
        spellDealDamage(
            4,
            targetedBy(target),
            "Arrows of Justice deals 4 damage to target attacking or blocking creature."));
  }
Esempio n. 14
0
    public SliverPing(GameState state) {
      super(state, "(T): This permanent deals 1 damage to target attacking or blocking creature.");

      this.costsTap = true;

      Target target =
          this.addTarget(
              Intersect.instance(
                  CreaturePermanents.instance(),
                  Union.instance(Attacking.instance(), Blocking.instance())),
              "target attacking or blocking creature");

      this.addEffect(
          permanentDealDamage(
              1,
              targetedBy(target),
              "This permanent deals 1 damage to target attacking or blocking creature."));
    }
Esempio n. 15
0
    public TapForThreeDamage(GameState state) {
      super(state, "(T): Lightning Crafter deals 3 damage to target creature or player.");

      this.costsTap = true;

      Target target =
          this.addTarget(
              Union.instance(
                  Players.instance(),
                  Intersect.instance(
                      HasType.instance(Type.CREATURE), InZone.instance(Battlefield.instance()))),
              "target creature or player");
      this.addEffect(
          permanentDealDamage(
              3,
              targetedBy(target),
              "Lightning Crafter deals 3 damage to target creature or player."));
    }
Esempio n. 16
0
  public FracturingGust(GameState state) {
    super(state);

    // Destroy all artifacts and enchantments.
    EventFactory destroy =
        destroy(
            Union.instance(ArtifactPermanents.instance(), EnchantmentPermanents.instance()),
            "Destroy artifacts and enchantments.");
    this.addEffect(destroy);

    // You gain 2 life for each permanent destroyed this way.
    SetGenerator X = Count.instance(NewObjectOf.instance(EffectResult.instance(destroy)));
    this.addEffect(
        gainLife(
            You.instance(),
            Multiply.instance(numberGenerator(2), X),
            "You gain 2 life for each permanent destroyed this way."));
  }
Esempio n. 17
0
  public BlueSunsZenith(GameState state) {
    super(state);

    // Target player draws X cards.
    SetGenerator target = targetedBy(this.addTarget(Players.instance(), "target player"));

    this.addEffect(
        drawCards(target, ValueOfX.instance(This.instance()), "Target player draws X cards."));

    // Shuffle Blue Sun's Zenith into its owner's library.
    EventFactory shuffle =
        new EventFactory(
            EventType.SHUFFLE_INTO_LIBRARY, "Shuffle Blue Sun's Zenith into its owner's library.");
    shuffle.parameters.put(EventType.Parameter.CAUSE, This.instance());
    shuffle.parameters.put(
        EventType.Parameter.OBJECT, Union.instance(This.instance(), You.instance()));
    this.addEffect(shuffle);
  }
Esempio n. 18
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. 19
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);
  }
Esempio n. 20
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);
    }
Esempio n. 21
0
  public Bandage(GameState state) {
    super(state);

    // Prevent the next 1 damage that would be dealt to target creature or
    // player this turn.
    Target target =
        this.addTarget(
            Union.instance(CreaturePermanents.instance(), Players.instance()),
            "target creature or player");

    EventFactory prevent =
        new EventFactory(
            EventType.CREATE_FLOATING_CONTINUOUS_EFFECT,
            "Prevent the next 1 damage that would be dealt to target creature or player this turn.");
    prevent.parameters.put(EventType.Parameter.CAUSE, This.instance());
    prevent.parameters.put(EventType.Parameter.PREVENT, Identity.instance(targetedBy(target), 1));
    this.addEffect(prevent);

    // Draw a card.
    this.addEffect(drawCards(You.instance(), 1, "\n\nDraw a card."));
  }
Esempio n. 22
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);
    }