int weaponsBVFront = 0; int weaponsBVRear = 0;
double weaponsBVFront = 0; double weaponsBVRear = 0;
    public int calculateBattleValue() {        double dbv = 0; // defensive battle value        double obv = 0; // offensive bv                // total armor points        dbv += getTotalArmor() * 2.0;                // total internal structure        dbv += getTotalInternal() * 1.5;                // add weight        dbv += getWeight();                // subtract for explosive ammo        dbv -= (ammoList.size() * 20);                // total up maximum heat generated        int maxumumHeatFront = 0;        int maxumumHeatRear = 0;        for (Enumeration i = weaponList.elements(); i.hasMoreElements();) {            Mounted mounted = (Mounted)i.nextElement();            WeaponType wtype = (WeaponType)mounted.getType();            if (mounted.isRearMounted()) {                maxumumHeatRear += wtype.getHeat();            } else {                maxumumHeatFront += wtype.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 = weaponList.elements(); i.hasMoreElements();) {            Mounted mounted = (Mounted)i.nextElement();            WeaponType wtype = (WeaponType)mounted.getType();            if (mounted.isRearMounted()) {                weaponsBVRear += wtype.getBV(this);            } else {                weaponsBVFront += wtype.getBV(this);            }        }        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 = ammoList.elements(); i.hasMoreElements();) {            Mounted mounted = (Mounted)i.nextElement();            AmmoType atype = (AmmoType)mounted.getType();            ammoBV += atype.getBV(this);        }        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;                // and then factor in pilot        double pilotFactor = crew.getBVSkillMultiplier();                return (int)Math.round((dbv + obv) * pilotFactor);    }