コード例 #1
0
ファイル: ManaTithe.java プロジェクト: NorthFury/jmagic
  public ManaTithe(GameState state) {
    super(state);

    // Counter target spell unless its controller pays (1).
    Target target = this.addTarget(Spells.instance(), "target spell");
    this.addEffect(counterTargetUnlessControllerPays("(1)", target));
  }
コード例 #2
0
ファイル: Pyroblast.java プロジェクト: jmagicdev/jmagic
  public Pyroblast(GameState state) {
    super(state);

    {
      Target target = this.addTarget(1, Spells.instance(), "target spell");
      EventFactory counter =
          new EventFactory(EventType.IF_CONDITION_THEN_ELSE, "Counter target spell if it's blue.");
      counter.parameters.put(
          EventType.Parameter.IF,
          Intersect.instance(targetedBy(target), HasColor.instance(Color.BLUE)));
      counter.parameters.put(
          EventType.Parameter.THEN,
          Identity.instance(counter(targetedBy(target), "Counter target spell.")));
      this.addEffect(1, counter);
    }

    {
      Target target = this.addTarget(2, Permanents.instance(), "target permanent");
      EventFactory destroy =
          new EventFactory(
              EventType.IF_CONDITION_THEN_ELSE, "Destroy target permanent if it's blue.");
      destroy.parameters.put(
          EventType.Parameter.IF,
          Intersect.instance(targetedBy(target), HasColor.instance(Color.BLUE)));
      destroy.parameters.put(
          EventType.Parameter.THEN,
          Identity.instance(destroy(targetedBy(target), "Destroy target permanent.")));
      this.addEffect(2, destroy);
    }
  }
コード例 #3
0
ファイル: MysticRemora.java プロジェクト: ranjan-rk/jmagic
    public MysticRemoraAbility1(GameState state) {
      super(
          state,
          "Whenever an opponent casts a noncreature spell, you may draw a card unless that player pays (4).");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      pattern.put(EventType.Parameter.PLAYER, OpponentsOf.instance(You.instance()));
      pattern.put(
          EventType.Parameter.OBJECT,
          RelativeComplement.instance(Spells.instance(), HasType.instance(Type.CREATURE)));
      this.addPattern(pattern);

      SetGenerator thatPlayer =
          EventParameter.instance(
              TriggerEvent.instance(This.instance()), EventType.Parameter.PLAYER);

      EventFactory mayDraw =
          youMay(drawCards(You.instance(), 1, "Draw a card"), "You may draw a card");

      EventFactory pay = new EventFactory(EventType.PAY_MANA, "Pay (4)");
      pay.parameters.put(EventType.Parameter.CAUSE, This.instance());
      pay.parameters.put(EventType.Parameter.PLAYER, thatPlayer);
      pay.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("4")));
      this.addEffect(
          unless(thatPlayer, mayDraw, pay, "You may draw a card unless that player pays (4)."));
    }
コード例 #4
0
ファイル: PsychicBarrier.java プロジェクト: jmagicdev/jmagic
  public PsychicBarrier(GameState state) {
    super(state);

    // Counter target creature spell. Its controller loses 1 life.
    SetGenerator target =
        targetedBy(
            this.addTarget(
                Intersect.instance(Spells.instance(), HasType.instance(Type.CREATURE)),
                "target creature spell"));
    this.addEffect(counter(target, "Counter target creature spell."));
    this.addEffect(loseLife(ControllerOf.instance(target), 1, "Its controller loses 1 life."));
  }
コード例 #5
0
    public UntargetableByBU(GameState state) {
      super(state, "Karplusan Strider can't be the target of blue or black spells.");

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.CANT_BE_THE_TARGET_OF);
      part.parameters.put(ContinuousEffectType.Parameter.OBJECT, This.instance());
      SetGenerator blueOrBlackSpells =
          Intersect.instance(Spells.instance(), HasColor.instance(Color.BLUE, Color.BLACK));
      part.parameters.put(
          ContinuousEffectType.Parameter.RESTRICTION,
          Identity.instance(new SimpleSetPattern(blueOrBlackSpells)));
      this.addEffectPart(part);
    }
コード例 #6
0
ファイル: Swerve.java プロジェクト: NorthFury/jmagic
  public Swerve(GameState state) {
    super(state);

    // Change the target of target spell with a single target.
    Target target =
        this.addTarget(
            Intersect.instance(Spells.instance(), HasOneTarget.instance()),
            "target spell with a single target");

    EventFactory swerve =
        new EventFactory(
            EventType.CHANGE_TARGETS, "Change the target of target spell with a single target.");
    swerve.parameters.put(EventType.Parameter.OBJECT, targetedBy(target));
    swerve.parameters.put(EventType.Parameter.PLAYER, You.instance());
    this.addEffect(swerve);
  }
コード例 #7
0
ファイル: StubbornDenial.java プロジェクト: jmagicdev/jmagic
  public StubbornDenial(GameState state) {
    super(state);

    // Counter target noncreature spell unless its controller pays (1).
    SetGenerator noncreatureSpells =
        RelativeComplement.instance(Spells.instance(), HasType.instance(Type.CREATURE));
    Target target = this.addTarget(noncreatureSpells, "target noncreature spell");
    EventFactory softCounter = counterTargetUnlessControllerPays("(1)", target);

    // Ferocious \u2014 If you control a creature with power 4 or greater,
    // counter that spell instead.
    EventFactory hardCounter = counter(targetedBy(target), "Counter target noncreature spell.");

    this.addEffect(
        ifThenElse(
            Ferocious.instance(),
            hardCounter,
            softCounter,
            "Counter target noncreature spell unless its controller pays (1).\n\nFerocious \u2014 If you control a creature with power 4 or greater, counter that spell instead."));
  }
コード例 #8
0
    public ShrineofBoundlessGrowthAbility0(GameState state) {
      super(
          state,
          "At the beginning of your upkeep or whenever you cast a green spell, put a charge counter on Shrine of Boundless Growth.");
      this.addPattern(atTheBeginningOfYourUpkeep());

      SimpleEventPattern castABlueSpell = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      castABlueSpell.put(EventType.Parameter.PLAYER, You.instance());
      castABlueSpell.put(
          EventType.Parameter.OBJECT,
          Intersect.instance(Spells.instance(), HasColor.instance(Color.GREEN)));
      this.addPattern(castABlueSpell);

      this.addEffect(
          putCounters(
              1,
              Counter.CounterType.CHARGE,
              ABILITY_SOURCE_OF_THIS,
              "Put a charge counter on Shrine of Boundless Growth."));
    }