int totalInternal = 0; for (int i = 0; i < locations(); i++) { if (!isRearLocation(i) && getInternal(i) > 0) { totalInternal += getInternal(i); } } dbv += totalInternal * 1.5;
dbv += getTotalInternal() * 1.5;
  public int calculateBattleValue() {    double dbv = 0; // defensive battle value    double obv = 0; // offensive bv        // total armor points    int totalArmor = 0;    for (int i = 0; i < locations(); i++) {      if (getArmor(i) > 0) {        totalArmor += getArmor(i);      }    }    dbv += totalArmor * 2;        // total internal structure    int totalInternal = 0;    for (int i = 0; i < locations(); i++) {      if (!isRearLocation(i) && getInternal(i) > 0) {        totalInternal += getInternal(i);      }    }    dbv += totalInternal * 1.5;        // add weight    dbv += getWeight();        // subtract for explosive ammo    dbv -= (ammo.size() * 20);        // total up maximum heat generated    int maxumumHeatFront = 0;    int maxumumHeatRear = 0;    for (Enumeration i = weapons.elements(); i.hasMoreElements();) {      MountedWeapon weapon = (MountedWeapon)i.nextElement();      if (isRearLocation(weapon.getLocation())) {        maxumumHeatRear += weapon.getType().getHeat();      } else {        maxumumHeatFront += weapon.getType().getHeat();      }    }    int maximumHeat = Math.max(maxumumHeatFront, maxumumHeatRear);    if (getJumpMP() > 0) {      maximumHeat += Math.max(3, getJumpMP());    } else {      maximumHeat += 2;    }    // adjust for heat efficiency    if (maximumHeat > getHeatCapacity()) {      dbv -= ((maximumHeat - getHeatCapacity()) * 5);    }        // adjust for target movement modifier    int tmmRan = Compute.getTargetMovementModifier(getRunMP(), false).getValue();    int tmmJumped = Compute.getTargetMovementModifier(getJumpMP(), true).getValue();    int targetMovementModidifer = Math.max(tmmRan, tmmJumped);    if (targetMovementModidifer > 5) {      targetMovementModidifer = 5;    }    double[] tmmFactors = { 1.0, 1.1, 1.2, 1.3, 1.4, 1.5 };    dbv *= tmmFactors[targetMovementModidifer];        double weaponBV = 0;        // figure out base weapon bv    int weaponsBVFront = 0;    int weaponsBVRear = 0;    for (Enumeration i = weapons.elements(); i.hasMoreElements();) {      MountedWeapon weapon = (MountedWeapon)i.nextElement();      if (isRearLocation(weapon.getLocation())) {        weaponsBVRear += weapon.getType().getBV();      } else {        weaponsBVFront += weapon.getType().getBV();      }    }    if (weaponsBVFront > weaponsBVRear) {      weaponBV += weaponsBVFront;      weaponBV += (weaponsBVRear * 0.5);    } else {      weaponBV += weaponsBVRear;      weaponBV += (weaponsBVFront * 0.5);    }        // add ammo bv    int ammoBV = 0;    for (Enumeration i = ammo.elements(); i.hasMoreElements();) {      Ammo ammunition = (Ammo)i.nextElement();      ammoBV += ammunition.getBV();    }    weaponBV += ammoBV;        // adjust for heat efficiency    if (maximumHeat > getHeatCapacity()) {      double x = (getHeatCapacity()  * weaponBV) / maximumHeat;      double y = (weaponBV - x) / 2;      weaponBV = x + y;    }        // adjust further for speed factor    double speedFactor = getRunMP() + getJumpMP() - 5;    speedFactor /= 10;    speedFactor++;    speedFactor = Math.pow(speedFactor, 1.2);    speedFactor = Math.round(speedFactor * 100) / 100.0;        obv = weaponBV * speedFactor;        return (int)Math.round(dbv + obv);  }