Exemplo n.º 1
0
 @Override
 public void affectCharStats(MOB affected, CharStats affectableStats) {
   super.affectCharStats(affected, affectableStats);
   final int[] breatheables = affectableStats.getBreathables();
   if (breatheables.length == 0) return;
   if ((lastSet != breatheables) || (newSet == null)) {
     newSet =
         Arrays.copyOf(
             affectableStats.getBreathables(), affectableStats.getBreathables().length + 2);
     newSet[newSet.length - 1] = RawMaterial.RESOURCE_SALTWATER;
     newSet[newSet.length - 2] = RawMaterial.RESOURCE_FRESHWATER;
     Arrays.sort(newSet);
     lastSet = breatheables;
   }
   affectableStats.setBreathables(newSet);
 }
Exemplo n.º 2
0
  @Override
  public void addItemDeficiency(final String zapperMask) {
    final DoubleFilterer<Item>[] newerArray =
        Arrays.copyOf(this.proficiencies, this.proficiencies.length + 1);
    newerArray[newerArray.length - 1] =
        new DoubleFilterer<Item>() {
          final MaskingLibrary.CompiledZMask mask = CMLib.masking().getPreCompiledMask(zapperMask);

          @Override
          public DoubleFilterer.Result getFilterResult(Item obj) {
            return CMLib.masking().maskCheck(mask, obj, true)
                ? DoubleFilterer.Result.REJECTED
                : DoubleFilterer.Result.NOTAPPLICABLE;
          }
        };
    this.proficiencies = newerArray;
  }