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

    // Draw four cards, then choose X cards in your hand and discard the
    // rest.
    this.addEffect(drawCards(You.instance(), 4, "Draw four cards,"));

    SetGenerator inYourHand = InZone.instance(HandOf.instance(You.instance()));
    EventFactory choose =
        playerChoose(
            You.instance(),
            ValueOfX.instance(This.instance()),
            inYourHand,
            PlayerInterface.ChoiceType.OBJECTS,
            REASON,
            "then choose X cards in your hand");

    EventFactory discard = new EventFactory(EventType.DISCARD_CARDS, "and discard the rest.");
    discard.parameters.put(EventType.Parameter.CAUSE, This.instance());
    discard.parameters.put(
        EventType.Parameter.CARD,
        RelativeComplement.instance(inYourHand, EffectResult.instance(choose)));

    this.addEffect(sequence(choose, discard));
  }
Example #2
0
  public StreetSpasm(GameState state) {
    super(state);

    // Street Spasm deals X damage to target creature without flying you
    // don't control.
    SetGenerator creature = CreaturePermanents.instance();
    SetGenerator creatureWithoutFlying =
        RelativeComplement.instance(creature, HasKeywordAbility.instance(Flying.class));
    SetGenerator creatureWithoutFlyingYouDontControl =
        RelativeComplement.instance(creatureWithoutFlying, ControlledBy.instance(You.instance()));
    SetGenerator target =
        targetedBy(
            this.addTarget(
                creatureWithoutFlyingYouDontControl,
                "target creature without flying you don't control"));
    this.addEffect(
        spellDealDamage(
            ValueOfX.instance(This.instance()),
            target,
            "Street Spasm deals X damage to target creature without flying you don't control."));

    // Overload (X)(X)(R)(R) (You may cast this spell for its overload cost.
    // If you do, change its text by replacing all instances of "target"
    // with "each.")
    this.addAbility(new Overload(state, "(X)(X)(R)(R)"));
  }
Example #3
0
  public CorrosiveGale(GameState state) {
    super(state);

    // ((g/p) can be paid with either (G) or 2 life.)

    // Corrosive Gale deals X damage to each creature with flying.
    this.addEffect(
        spellDealDamage(
            ValueOfX.instance(This.instance()),
            Intersect.instance(
                CreaturePermanents.instance(),
                HasKeywordAbility.instance(org.rnd.jmagic.abilities.keywords.Flying.class)),
            "Corrosive Gale deals X damage to each creature with flying."));
  }
Example #4
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."));
  }
Example #5
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);
  }