Example #1
0
    @Override
    public DamageAssignment.Batch match(Event context, DamageAssignment.Batch damageAssignments) {
      DamageAssignment.Batch ret = new DamageAssignment.Batch();

      Set valid =
          CREATURES_YOU_CONTROL.evaluate(context.state, this.getSourceObject(context.state));

      for (DamageAssignment damage : damageAssignments)
        if (!damage.isCombatDamage && valid.contains(context.state.get(damage.takerID)))
          ret.add(damage);

      return ret;
    }
    @Override
    public DamageAssignment.Batch match(Event context, DamageAssignment.Batch damageAssignments) {
      DamageAssignment.Batch batch = new DamageAssignment.Batch();

      GameObject source = (GameObject) this.getStaticSourceObject(context.game.actualState);
      int enchantedPlayer = source.getAttachedTo();

      for (DamageAssignment assignment : damageAssignments)
        if (context.state.<Identified>get(assignment.takerID).ID == enchantedPlayer)
          batch.add(assignment);

      return batch;
    }
    @Override
    public List<EventFactory> replace(DamageAssignment.Batch damageAssignments) {
      Collection<DamageAssignment> duplicates = new LinkedList<DamageAssignment>();
      for (DamageAssignment assignment : damageAssignments)
        duplicates.add(new DamageAssignment(assignment));
      damageAssignments.addAll(duplicates);

      return new LinkedList<EventFactory>();
    }
Example #4
0
 @Override
 public java.util.List<EventFactory> prevent(DamageAssignment.Batch damageAssignments) {
   damageAssignments.clear();
   return new java.util.LinkedList<EventFactory>();
 }