コード例 #1
0
 public TFloatLinkedList(TFloatList list) {
   no_entry_value = list.getNoEntryValue();
   //
   for (TFloatIterator iterator = list.iterator(); iterator.hasNext(); ) {
     float next = iterator.next();
     add(next);
   }
 }
コード例 #2
0
  private int calculateTotal(int base, TFloatList multipliers, TIntList modifiers) {
    // For now, add all modifiers and multiply by all multipliers. Negative modifiers cap to zero,
    // but negative
    // multipliers remain (so damage can be flipped to healing)

    float total = base;
    TIntIterator modifierIter = modifiers.iterator();
    while (modifierIter.hasNext()) {
      total += modifierIter.next();
    }
    total = Math.max(0, total);
    if (total == 0) {
      return 0;
    }
    TFloatIterator multiplierIter = multipliers.iterator();
    while (multiplierIter.hasNext()) {
      total *= multiplierIter.next();
    }
    return TeraMath.floorToInt(total);
  }