コード例 #1
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."));
  }
コード例 #2
0
ファイル: EnsnaringBridge.java プロジェクト: jmagicdev/jmagic
    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);
    }