use of megamek.common.verifier.TestSmallCraft in project megameklab by MegaMek.
the class StatusBar method refresh.
public void refresh() {
int heat = getSmallCraft().getHeatCapacity();
double tonnage = getSmallCraft().getWeight();
double currentTonnage;
int bv = getSmallCraft().calculateBattleValue();
long currentCost = (long) Math.round(getSmallCraft().getCost(false));
testSmallCraft = new TestSmallCraft(getSmallCraft(), entityVerifier.aeroOption, null);
currentTonnage = testSmallCraft.calculateWeight();
currentTonnage += UnitUtil.getUnallocatedAmmoTonnage(getSmallCraft());
double totalHeat = calculateTotalHeat();
heatSink.setText("Heat: " + totalHeat + "/" + heat);
heatSink.setToolTipText("Total Heat Generated/Total Heat Dissipated");
if (totalHeat > heat) {
heatSink.setForeground(Color.red);
} else {
heatSink.setForeground(Color.black);
}
heatSink.setVisible(getSmallCraft().getEntityType() == Entity.ETYPE_AERO);
tons.setText("Tonnage: " + currentTonnage + "/" + tonnage);
tons.setToolTipText("Current Tonnage/Max Tonnage");
if (currentTonnage > tonnage) {
tons.setForeground(Color.red);
} else {
tons.setForeground(Color.black);
}
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");
cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
}
use of megamek.common.verifier.TestSmallCraft in project megameklab by MegaMek.
the class SummaryView method refresh.
public void refresh() {
TestSmallCraft testSmallCraft = new TestSmallCraft(getSmallCraft(), entityVerifier.aeroOption, null);
txtStructTon.setText(Double.toString(testSmallCraft.getWeightStructure()));
txtEngineTon.setText(Double.toString(testSmallCraft.getWeightEngine()));
txtFuelTon.setText(Double.toString(testSmallCraft.getWeightFuel()));
txtControlTon.setText(Double.toString(testSmallCraft.getWeightControls()));
txtHeatTon.setText(Double.toString(testSmallCraft.getWeightHeatSinks()));
txtArmorTon.setText(Double.toString(testSmallCraft.getWeightArmor()));
txtWeapTon.setText(Double.toString(testSmallCraft.getWeightWeapon()));
txtAmmoTon.setText(Double.toString(testSmallCraft.getWeightAmmo()));
txtMiscTon.setText(Double.toString(testSmallCraft.getWeightMiscEquip()));
txtTransportTon.setText(Double.toString(testSmallCraft.getWeightCarryingSpace()));
txtCrewTon.setText(Double.toString(testSmallCraft.getWeightQuarters()));
txtOtherTon.setText(Double.toString(testSmallCraft.getWeightMisc()));
}
use of megamek.common.verifier.TestSmallCraft in project megameklab by MegaMek.
the class UnitUtil method getEntityVerifier.
/**
* Returns a TestEntity instance for the supplied Entity.
*
* @param unit
* @return
*/
public static TestEntity getEntityVerifier(Entity unit) {
EntityVerifier entityVerifier = EntityVerifier.getInstance(new File("data/mechfiles/UnitVerifierOptions.xml"));
TestEntity testEntity = null;
if (unit.hasETypeFlag(Entity.ETYPE_MECH)) {
testEntity = new TestMech((Mech) unit, entityVerifier.mechOption, null);
} else if (unit.hasETypeFlag(Entity.ETYPE_SUPPORT_TANK)) {
testEntity = new TestSupportVehicle((Tank) unit, entityVerifier.tankOption, null);
} else if (unit.hasETypeFlag(Entity.ETYPE_TANK)) {
testEntity = new TestTank((Tank) unit, entityVerifier.tankOption, null);
} else if (unit.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) {
testEntity = new TestSmallCraft((SmallCraft) unit, entityVerifier.aeroOption, null);
} else if (unit.hasETypeFlag(Entity.ETYPE_AERO)) {
testEntity = new TestAero((Aero) unit, entityVerifier.aeroOption, null);
} else if (unit.hasETypeFlag(Entity.ETYPE_BATTLEARMOR)) {
testEntity = new TestBattleArmor((BattleArmor) unit, entityVerifier.baOption, null);
} else if (unit.hasETypeFlag(Entity.ETYPE_INFANTRY)) {
testEntity = new TestInfantry((Infantry) unit, entityVerifier.infOption, null);
}
return testEntity;
}
Aggregations