コード例 #1
0
ファイル: ArrowVolleyTrap.java プロジェクト: ranjan-rk/jmagic
  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."));
  }
コード例 #2
0
ファイル: ElephantGrass.java プロジェクト: jmagicdev/jmagic
    public ElephantGrassAbility1(GameState state) {
      super(state, "Black creatures can't attack you.");

      SetGenerator restriction =
          Intersect.instance(HasColor.instance(Color.BLACK), Attacking.instance(You.instance()));

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.ATTACKING_RESTRICTION);
      part.parameters.put(
          ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(restriction));
      this.addEffectPart(part);
    }
コード例 #3
0
ファイル: ArrowsofJustice.java プロジェクト: NorthFury/jmagic
  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."));
  }
コード例 #4
0
ファイル: QuilledSliver.java プロジェクト: NorthFury/jmagic
    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."));
    }
コード例 #5
0
ファイル: Attacking.java プロジェクト: NorthFury/jmagic
  @Override
  public MagicSet evaluate(GameState state, Identified thisObject) {
    MagicSet allAttackers = Attacking.get(state);
    if (this.what == null) return allAttackers;

    Set<Integer> beingAttackedIDs = new HashSet<Integer>();
    MagicSet evaluateWhat = this.what.evaluate(state, thisObject);
    for (GameObject o : evaluateWhat.getAll(GameObject.class))
      if (o.getTypes().contains(Type.PLANESWALKER)) beingAttackedIDs.add(o.ID);
    for (Player p : evaluateWhat.getAll(Player.class)) beingAttackedIDs.add(p.ID);

    Set<GameObject> attackingThisPlayer = allAttackers.getAll(GameObject.class);
    Iterator<GameObject> objectIterator = attackingThisPlayer.iterator();
    while (objectIterator.hasNext()) {
      GameObject attacker = objectIterator.next();
      if (!beingAttackedIDs.contains(attacker.getAttackingID())) objectIterator.remove();
    }

    return new MagicSet(attackingThisPlayer);
  }
コード例 #6
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);
    }