if (a.getAvionicsHits() > 0) { critVal = critVal.concat(" avionics=\""); critVal = critVal.concat(Integer.toString(a.getAvionicsHits())); critVal = critVal.concat("\""); if (a.getSensorHits() > 0) { critVal = critVal.concat(" sensors=\""); critVal = critVal.concat(Integer.toString(a.getSensorHits())); critVal = critVal.concat("\""); if (a.getEngineHits() > 0) { critVal = critVal.concat(" engine=\""); critVal = critVal.concat(Integer.toString(a.getEngineHits())); critVal = critVal.concat("\""); if (a.getFCSHits() > 0) { critVal = critVal.concat(" fcs=\""); critVal = critVal.concat(Integer.toString(a.getFCSHits())); critVal = critVal.concat("\""); if (a.getCICHits() > 0) { critVal = critVal.concat(" cic=\""); critVal = critVal.concat(Integer.toString(a.getCICHits())); critVal = critVal.concat("\""); if (a.getLeftThrustHits() > 0) { critVal = critVal.concat(" leftThrust=\""); critVal = critVal.concat(Integer.toString(a.getLeftThrustHits())); critVal = critVal.concat("\"");
@Override public boolean hasCommandConsoleBonus() { return getCockpitType() == COCKPIT_COMMAND_CONSOLE && getCrew().hasActiveCommandConsole() && getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY; }
/** * get modifications to the cluster hit table for critical hits */ @Override public int getClusterMods() { return -1 * (getFCSHits() + getSensorHits()); }
/** * Computes and returns the number of days the unit can spend accelerating at 1G * * @param aero * @return */ public static double calculateDaysAt1G(Aero aero) { double stratUse = aero.getStrategicFuelUse(); if (stratUse > 0) { return aero.getFuelTonnage() / aero.getStrategicFuelUse(); } else { return 0.0; } }
bvText.append(getChassis()); bvText.append(" "); bvText.append(getModel()); bvText.append("</b></CENTER>"); bvText.append(nl); boolean blueShield = hasWorkingMisc(MiscType.F_BLUE_SHIELD); for (int loc = 0; loc < (this instanceof SmallCraft ? locations() : (locations() - 1)); loc++) { for (Mounted mounted : getEquipment()) { if ((mounted.getType() instanceof MiscType) && mounted.getType().hasFlag(MiscType.F_MODULAR_ARMOR) && (mounted.getLocation() == loc)) { switch (getArmorType(loc)) { case EquipmentType.T_ARMOR_COMMERCIAL: armorMultiplier = 0.5; int armor = getArmor(loc) + modularArmor; bvText.append("Total Armor " + this.getLocationAbbr(loc) + " (" + armor + ") x "); bvText.append(armorMultiplier); bvText.append(endColumn); bvText.append(endColumn); bvText.append(startColumn); double armorBV = (getArmor(loc) + modularArmor) * armorMultiplier; bvText.append(armorBV); dbv += armorBV;
int a = 1; int a0 = 1; for(int i = 0; i < t.locations(); i++){ a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double)a/(double)a0); a = t.getSI(); a0 = t.get0SI(); vLabels[4].setValue(Integer.toString(t.getSI())); WidgetUtils.setAreaColor(areas[4], vLabels[4], (double)a/(double)a0); vLabels[5].setValue(getCriticalHitTally(t.getAvionicsHits(),3)); vLabels[6].setValue(getCriticalHitTally(t.getEngineHits(),t.getMaxEngineHits())); vLabels[7].setValue(getCriticalHitTally(t.getFCSHits(),3)); vLabels[8].setValue(getCriticalHitTally(t.getSensorHits(),3)); if(t instanceof SmallCraft) {
Justification.CENTER, Justification.CENTER })); addFluff(); setModelData("isOmni", aero.isOmni()); setModelData("isConventional", aero.hasETypeFlag(Entity.ETYPE_CONV_FIGHTER)); final TestAero testAero = new TestAero(aero, verifier.aeroOption, null); setModelData("engineName", stripNotes(aero.getEngine().getEngineName())); setModelData("engineMass", NumberFormat.getInstance().format(testAero.getWeightEngine())); setModelData("safeThrust", aero.getWalkMP()); setModelData("maxThrust", aero.getRunMP()); setModelData("si", aero.get0SI()); setModelData("hsCount", aero.getHeatType() == Aero.HEAT_DOUBLE ? aero.getOHeatSinks() + " [" + (aero.getOHeatSinks() * 2) + "]" : aero.getOHeatSinks()); setModelData("fuelPoints", aero.getFuel()); setModelData("fuelMass", aero.getFuelTonnage()); setModelData("hsMass", NumberFormat.getInstance().format(testAero.getWeightHeatSinks())); if (aero.getCockpitType() == Aero.COCKPIT_STANDARD) { setModelData("cockpitType", "Cockpit"); } else { setModelData("cockpitType", Aero.getCockpitTypeString(aero.getCockpitType())); setModelData("armorType", ""); setModelData("armorFactor", aero.getTotalOArmor()); setModelData("armorMass", NumberFormat.getInstance().format(testAero.getWeightArmor())); if (aero.isOmni()) { addFixedOmni(aero);
int avihits = getAvionicsHits(); int pilothits = getCrew().getHits(); if ((getPartialRepairs() != null) && (avihits < 3)) { if (getPartialRepairs().booleanOption("aero_avionics_crit")) { prd.addModifier(1, "Partial repair of Avionics"); if (getPartialRepairs().booleanOption("aero_avionics_replace")) { prd.addModifier(1, "Misreplaced Avionics"); int vel = getCurrentVelocity(); int vmod = vel - (2 * getWalkMP()); if (!getGame().getBoard().inSpace() && (vmod > 0)) { prd.addModifier(vmod, "Velocity greater than 2x safe thrust"); if (!(game.getBoard().inSpace() || (atmoCond == PlanetaryConditions.ATMO_VACUUM)) && isAirborne()) { prd.addModifier(+2, "Atmospheric operations"); if (isSpheroid()) { prd.addModifier(+1, "spheroid dropship"); } else { if (!hasLifeSupport()) { prd.addModifier(+2, "No life support"); if (hasModularArmor()) { prd.addModifier(1, "Modular Armor"); if (hasAbility(OptionsConstants.MD_VDNI)
cost += 50000 * getSI(); cost += 25000 + (10 * getWeight()); if (hasEngine()) { cost += (getEngine().getBaseCost() * getEngine().getRating() * weight) / 75.0; cost += (200 * getFuel()) / 80.0; if (hasPatchworkArmor()) { for (int loc = 0; loc < locations(); loc++) { cost += getArmorWeight(loc) * EquipmentType.getArmorCost(armorType[loc]); cost += getArmorWeight() * EquipmentType.getArmorCost(armorType[0]); int sinkCost = 2000 + (4000 * getHeatType());// == HEAT_DOUBLE ? 6000: cost += sinkCost * getHeatSinks(); cost += getWeaponsAndEquipmentCost(ignoreAmmo); if (isOmni()) { omniMultiplier = 1.25f;
StringBuilder hsString = new StringBuilder(String.valueOf(a.getHeatSinks())); if (a.getPodHeatSinks() > 0) { hsString.append(" (").append(a.getPodHeatSinks()).append(" ") .append(Messages.getString("MechView.Pod")).append(")"); //$NON-NLS-1$ if (a.getHeatCapacity() > a.getHeatSinks()) { hsString.append(" [") //$NON-NLS-1$ .append(a.getHeatCapacity()).append("]"); //$NON-NLS-1$ if (a.getHeatSinkHits() > 0) { hsString.append(" ").append(warningStart()).append(a.getHeatSinkHits()) .append(" damaged)").append(warningEnd()); if (a.getCockpitType() != Mech.COCKPIT_STANDARD) { sBasic.add(new LabeledElement(Messages.getString("MechView.Cockpit"), // $NON-NLS-1$ a.getCockpitTypeString())); if (!a.getCritDamageString().equals("")) { sBasic.add(new LabeledElement(Messages.getString("MechView.SystemDamage"), //$NON-NLS-1$ warningStart() + a.getCritDamageString() + warningEnd())); String fuel = String.valueOf(a.getCurrentFuel()); if (a.getCurrentFuel() < a.getFuel()) { fuel += "/" + a.getFuel(); //$NON-NLS-1$ String.format(Messages.getString("MechView.Fuel.format"), fuel, a.getFuelTonnage()))); //$NON-NLS-1$ String.format("%2.2f", a.getStrategicFuelUse()))); //$NON-NLS-1$
if (isDestroyed() || isDoomed()) { int loc = Compute.randomInt(4); dealt = getArmor(loc); setArmor(0, loc); int finalSI = Math.min(getSI(), getSI() / 2); dealt += getSI() - finalSI; setSI(finalSI); setEngineHits(Math.max(3, getEngineHits())); int damage = getCap0Armor() - getCapArmor(); if ((null != game) || !game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_AERO_SANITY)) { damage *= 10; for (int i = 0; i < hits; i++) { int loc = Compute.randomInt(4); setArmor(getArmor(loc) - Math.max(damPerHit, damage), loc); if (getArmor(loc) < 0) { if (getSI() > 1) { int si = getSI() + (getArmor(loc) / 2); si = Math.max(si, isDestroyed() || isDoomed() ? 0 : 1); setSI(si); setArmor(0, loc);
@Override public boolean isCrippled() { double internalPercent = getInternalRemainingPercent(); String msg = getDisplayName() + " CRIPPLED: "; if (internalPercent < 0.5) { System.out.println(msg + "only " + NumberFormat.getPercentInstance().format(internalPercent) if (getEngineHits() > 0) { System.out.println(msg + engineHits + " Engine Hits."); return true; if (getPotCrit() == CRIT_FUEL_TANK) { System.out.println(msg + " Fuel Tank Hit."); return true; if ((getCrew() != null) && (getCrew().getHits() >= 4)) { System.out.println(msg + getCrew().getHits() + " Crew Hits."); return true; if (getFCSHits() >= 3) { System.out.println(msg + fcsHits + " Fire Control Destroyed."); return true; if (getCICHits() >= 3) { System.out.println(msg + cicHits + " Combat Information Center Destroyed."); return true; if (!isMilitary()) { return false;
public void setEntity(Entity e) { Aero t = (Aero) e; int armor = t.getCapArmor(); int armorO = t.getCap0Armor(); armorVLabel.setValue(Integer.toString(armor)); if (t.getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_AERO_SANITY)) { armor = (int) Math.ceil(armor / 10.0); armorO = (int) Math.ceil(armorO / 10.0); } drawArmorImage(armorImage, armor, armorO); drawCrits(avCritImage, t.getAvionicsHits()); drawCrits(engineCritImage, t.getEngineHits()); drawCrits(fcsCritImage, t.getFCSHits()); drawCrits(sensorCritImage, t.getSensorHits()); drawCrits(pilotCritImage, t.getCrew().getHits()); }
public String getCritDamageString() { String toReturn = ""; boolean first = true; if (getSensorHits() > 0) { if (!first) { toReturn += ", "; toReturn += "Sensors (" + getSensorHits() + ")"; first = false; if (getAvionicsHits() > 0) { if (!first) { toReturn += ", "; toReturn += "Avionics (" + getAvionicsHits() + ")"; first = false; if (getFCSHits() > 0) { if (!first) { toReturn += ", "; toReturn += "FCS (" + getFCSHits() + ")"; first = false; if (isGearHit()) { if (!first) { toReturn += ", "; if (getLeftThrustHits() > 0) { if (!first) {
if (t instanceof Aero){ if (t.isFighter()) { blk.writeBlockData("cockpit_type", ((Aero)t).getCockpitType()); } else if ((t instanceof Dropship) && ((Aero)t).isPrimitive()) { blk.writeBlockData("collartype", ((Dropship)t).getCollarType()); blk.writeBlockData("heatsinks", ((Aero)t).getHeatSinks()); blk.writeBlockData("sink_type", ((Aero)t).getHeatType()); if (((Aero)t).getPodHeatSinks() > 0) { blk.writeBlockData("omnipodheatsinks", ((Aero)t).getPodHeatSinks()); blk.writeBlockData("fuel", ((Aero)t).getFuel()); blk.writeBlockData("structural_integrity", ((Aero)t).get0SI());
int eccm = 0; if (ae.isLargeCraft()) { eccm = ((Aero) ae).getECCMBonus(); int sensors = aero.getSensorHits(); if (!aero.isCapitalFighter()) { if ((sensors > 0) && (sensors < 3)) { toHit.addModifier(sensors, "sensor damage"); int fcs = aero.getFCSHits(); if ((fcs > 0) && !aero.isCapitalFighter()) { toHit.addModifier(fcs * 2, "fcs damage"); && ((Aero) te).isSpheroid()) { immobileMod = new ToHitData(-4, "immobile dropship");
public int getECCMTarget() { return getCrew().getPiloting() + getSensorHits() + getCICHits() + getFCSHits(); }
@Override public boolean isDmgModerate() { if (getArmorRemainingPercent() <= 0.5) { return true; } if (getInternalRemainingPercent() < 0.75) { return true; } if ((getCrew() != null) && (getCrew().getHits() == 2)) { return true; } // If this is not a military unit, we don't care about weapon status. if (!isMilitary()) { return false; } int totalWeapons = getTotalWeaponList().size(); int totalInoperable = 0; for (Mounted weap : getTotalWeaponList()) { if (weap.isCrippled()) { totalInoperable++; } } return ((double) totalInoperable / totalWeapons) >= 0.5; }
/** * Computes and returns the maximum number of turns the given unit could * fly at safe thrust given its fuel payload. Aerospace fighters consume * 1 fuel point per thrust point spent up the the maximum safe thrust, * whereas conventional fighters with turbine engines consume 0.5 fuel * points per thrust point spent up to the maximum safe thrust. * See Strategic Operations pg 34. * * @param aero * @return */ public static float calculateMaxTurnsAtSafe(Aero aero){ int fuelPoints = aero.getFuel(); float fuelPerTurn; if (aero.hasETypeFlag(Entity.ETYPE_CONV_FIGHTER) && aero.hasEngine() && (aero.getEngine().getEngineType() == Engine.COMBUSTION_ENGINE)) { fuelPerTurn = aero.getWalkMP() * 0.5f; } else if (aero.getWalkMP() == 0) { fuelPerTurn = 0.2f; } else { fuelPerTurn = aero.getWalkMP(); } return fuelPoints/fuelPerTurn; }