コード例 #1
0
ファイル: Soulbond.java プロジェクト: jmagicdev/jmagic
    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));
    }
コード例 #2
0
ファイル: MotherofRunes.java プロジェクト: jmagicdev/jmagic
    public MotherofRunesAbility0(GameState state) {
      super(
          state,
          "(T): Target creature you control gains protection from the color of your choice until end of turn.");
      this.costsTap = true;
      SetGenerator target =
          targetedBy(
              this.addTarget(
                  Intersect.instance(
                      CreaturePermanents.instance(), ControlledBy.instance(You.instance())),
                  "target creature you control"));

      EventFactory chooseColor =
          playerChoose(
              You.instance(),
              1,
              Identity.fromCollection(Color.allColors()),
              PlayerInterface.ChoiceType.COLOR,
              PlayerInterface.ChooseReason.CHOOSE_COLOR,
              "");
      this.addEffect(chooseColor);

      SetGenerator color = EffectResult.instance(chooseColor);
      this.addEffect(
          addProtectionUntilEndOfTurn(
              target,
              color,
              "Target creature gains protection from the color of your choice until end of turn."));
    }
コード例 #3
0
ファイル: StreetSpasm.java プロジェクト: NorthFury/jmagic
  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)"));
  }
コード例 #4
0
    public EveryoneTapsForTwoGreen(GameState state) {
      super(state, "Elves you control have \"(T): Add (G)(G) to your mana pool.\"");

      SetGenerator elvesYouControl =
          Intersect.instance(
              HasSubType.instance(SubType.ELF), ControlledBy.instance(You.instance()));
      this.addEffectPart(addAbilityToObject(elvesYouControl, TapForTwoGreen.class));
    }
コード例 #5
0
ファイル: Knighthood.java プロジェクト: NorthFury/jmagic
    public FirstStrikeForAll(GameState state) {
      super(state, "Creatures you control have first strike.");

      SetGenerator creaturesYouControl =
          Intersect.instance(
              ControlledBy.instance(You.instance()), HasType.instance(Type.CREATURE));

      this.addEffectPart(addAbilityToObject(creaturesYouControl, FirstStrike.class));
    }
コード例 #6
0
ファイル: PrizedElephant.java プロジェクト: NorthFury/jmagic
 public PrizedElephantAbility0(GameState state) {
   super(state, "Prized Elephant gets +1/+1 as long as you control a Forest.");
   this.addEffectPart(modifyPowerAndToughness(This.instance(), +1, +1));
   this.canApply =
       Both.instance(
           this.canApply,
           Intersect.instance(
               ControlledBy.instance(You.instance()), HasSubType.instance(SubType.FOREST)));
 }
コード例 #7
0
ファイル: BearUmbra.java プロジェクト: ranjan-rk/jmagic
      public UntapLands(GameState state) {
        super(state, "Whenever this creature attacks, untap all lands you control.");

        this.addPattern(whenThisAttacks());

        this.addEffect(
            untap(
                Intersect.instance(
                    LandPermanents.instance(), ControlledBy.instance(You.instance())),
                "Untap all lands you control."));
      }
コード例 #8
0
ファイル: MistbindClique.java プロジェクト: NorthFury/jmagic
 public ManaDenial(GameState state) {
   super(
       state,
       "When a Faerie is championed with Mistbind Clique, tap all lands target player controls.");
   this.addPattern(
       whenSomethingIsChampioned(ABILITY_SOURCE_OF_THIS, HasSubType.instance(SubType.FAERIE)));
   Target target = this.addTarget(Players.instance(), "target player");
   this.addEffect(
       tap(
           Intersect.instance(
               LandPermanents.instance(), ControlledBy.instance(targetedBy(target))),
           "Tap all lands target player controls."));
 }
コード例 #9
0
    public DarksteelCDA(GameState state) {
      super(
          state,
          "Darksteel Juggernaut's power and toughness are each equal to the number of artifacts you control.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator count =
          Count.instance(
              Intersect.instance(
                  ArtifactPermanents.instance(), ControlledBy.instance(You.instance())));

      this.addEffectPart(setPowerAndToughness(This.instance(), count, count));
    }
コード例 #10
0
ファイル: Lavalanche.java プロジェクト: jmagicdev/jmagic
  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."));
  }
コード例 #11
0
ファイル: Mutilate.java プロジェクト: NorthFury/jmagic
  public Mutilate(GameState state) {
    super(state);

    // All creatures get -1/-1 until end of turn for each Swamp you control.
    SetGenerator count =
        Count.instance(
            Intersect.instance(
                ControlledBy.instance(You.instance()), HasSubType.instance(SubType.SWAMP)));
    SetGenerator amount = Subtract.instance(numberGenerator(0), count);
    this.addEffect(
        ptChangeUntilEndOfTurn(
            CreaturePermanents.instance(),
            amount,
            amount,
            "All creatures get -1/-1 until end of turn for each Swamp you control."));
  }
コード例 #12
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);
    }
コード例 #13
0
ファイル: KhalniGem.java プロジェクト: NorthFury/jmagic
    public LandfallShenanigans(GameState state) {
      super(
          state,
          "When Khalni Gem enters the battlefield, return two lands you control to their owner's hand.");

      this.addPattern(whenThisEntersTheBattlefield());

      EventFactory factory =
          new EventFactory(
              EventType.PUT_INTO_HAND_CHOICE, "Return two lands you control to their owner's hand");
      factory.parameters.put(EventType.Parameter.CAUSE, This.instance());
      factory.parameters.put(EventType.Parameter.PLAYER, You.instance());
      factory.parameters.put(EventType.Parameter.NUMBER, numberGenerator(2));
      factory.parameters.put(
          EventType.Parameter.CHOICE,
          Intersect.instance(HasType.instance(Type.LAND), ControlledBy.instance(You.instance())));
      this.addEffect(factory);
    }
コード例 #14
0
ファイル: Soulbond.java プロジェクト: jmagicdev/jmagic
    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."));
    }
コード例 #15
0
    public DefenderMana(GameState state) {
      super(state, "(T): Add (G) to your mana pool for each creature with defender you control.");

      this.costsTap = true;

      SetGenerator hasDefender = HasKeywordAbility.instance(Defender.class);
      SetGenerator creaturesWithDefender =
          Intersect.instance(CreaturePermanents.instance(), hasDefender);
      SetGenerator youControl = ControlledBy.instance(You.instance());
      SetGenerator creaturesWithDefenderYouControl =
          Intersect.instance(creaturesWithDefender, youControl);

      EventFactory factory =
          new EventFactory(
              EventType.ADD_MANA,
              "Add (G) to your mana pool for each creature with defender you control");
      factory.parameters.put(EventType.Parameter.SOURCE, ABILITY_SOURCE_OF_THIS);
      factory.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("G")));
      factory.parameters.put(
          EventType.Parameter.NUMBER, Count.instance(creaturesWithDefenderYouControl));
      factory.parameters.put(EventType.Parameter.PLAYER, You.instance());
      this.addEffect(factory);
    }
コード例 #16
0
    public TezzeretAgentofBolasAbility2(GameState state) {
      super(
          state,
          -4,
          "Target player loses X life and you gain X life, where X is twice the number of artifacts you control.");

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

      SetGenerator X =
          Multiply.instance(
              numberGenerator(2),
              Count.instance(
                  Intersect.instance(
                      ArtifactPermanents.instance(), ControlledBy.instance(You.instance()))));

      EventFactory loseLife = loseLife(target, X, "Target player loses X life");
      EventFactory gainLife =
          gainLife(
              You.instance(),
              X,
              "and you gain X life, where X is twice the number of artifacts you control.");
      this.addEffect(simultaneous(loseLife, gainLife));
    }
コード例 #17
0
    public SylvanPrimordialAbility1(GameState state) {
      super(
          state,
          "When Sylvan Primordial enters the battlefield, for each opponent, destroy target noncreature permanent that player controls. For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library.");
      this.addPattern(whenThisEntersTheBattlefield());

      SetGenerator noncreaturePermanents =
          RelativeComplement.instance(Permanents.instance(), HasType.instance(Type.CREATURE));
      SetGenerator legalTargets =
          Intersect.instance(
              noncreaturePermanents, ControlledBy.instance(OpponentsOf.instance(You.instance())));
      Target t =
          new SylvanTarget(legalTargets, "target noncreature permanent each oppenent controls");
      this.addTarget(t);

      EventFactory destroy =
          destroy(
              targetedBy(t),
              "For each opponent, destroy target noncreature permanent that player controls.");
      this.addEffect(destroy);

      SetGenerator X = Count.instance(NewObjectOf.instance(EffectResult.instance(destroy)));

      EventFactory search =
          new EventFactory(
              EventType.SEARCH_LIBRARY_AND_PUT_INTO,
              "For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library.");
      search.parameters.put(EventType.Parameter.CAUSE, This.instance());
      search.parameters.put(EventType.Parameter.CONTROLLER, You.instance());
      search.parameters.put(EventType.Parameter.PLAYER, You.instance());
      search.parameters.put(EventType.Parameter.NUMBER, X);
      search.parameters.put(EventType.Parameter.TAPPED, Empty.instance());
      search.parameters.put(EventType.Parameter.TO, Battlefield.instance());
      search.parameters.put(
          EventType.Parameter.TYPE, Identity.instance(HasSubType.instance(SubType.FOREST)));
      this.addEffect(search);
    }