public void autoSetMaxBombPoints() { maxBombPoints = (int) Math.round(getWeight() / 5); }
@Override public double getWeightMisc() { // VSTOL equipment weighs extra forr conventional fighters if ((aero.hasETypeFlag(Entity.ETYPE_CONV_FIGHTER)) && aero.isVSTOL()){ // Weight = tonnage * 0.05 rounded up to nearest half ton return Math.ceil(0.05 * aero.getWeight()*2) / 2.0; } return 0.0f; }
/** * @param aero A large craft * @return The maximum number of bay doors. Aerospace units that are not large craft have * a maximum of zero. */ public static int maxBayDoors(Aero aero) { if (aero.hasETypeFlag(Entity.ETYPE_WARSHIP)) { return 8 + (int)Math.ceil(aero.getWeight() / 100000); } else if (aero.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) { return 8 + (int)Math.ceil(aero.getWeight() / 75000); } else if (aero.hasETypeFlag(Entity.ETYPE_JUMPSHIP) || (aero.hasETypeFlag(Entity.ETYPE_DROPSHIP))) { return 7 + (int)Math.ceil(aero.getWeight() / 50000); } else if (aero.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) { return aero.isSpheroid()? 4 : 2; } else { return 0; } }
/** * Calculate the structural integrity weight */ public double getWeightStructure() { double tonnage = 0; if (aero.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) { tonnage = aero.getSI() * aero.getWeight(); if (aero.isSpheroid()) { tonnage /= 500; } else { tonnage /= 200; } } else if (aero.hasETypeFlag(Entity.ETYPE_SPACE_STATION)) { tonnage = aero.getWeight() / 100; } else if (aero.hasETypeFlag(Entity.ETYPE_WARSHIP)) { // SI * weight / 1000, rounded up to half ton tonnage = aero.getSI() * aero.getWeight() / 1000; } else if (aero.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) { tonnage = aero.getWeight() / 150; } else { // Fighters do not allocate weight to structure return 0; } return Math.ceil(tonnage * 2) / 2.0; }
@Override public double getWeightControls() { // Controls for Aerospace Fighters and Conventional Fighters consists // of the cockpit and the fuel double weight; if (aero.hasETypeFlag(Entity.ETYPE_CONV_FIGHTER)) { // Weight = tonnage * 0.1 rounded to nearest half ton weight = Math.round(0.1 * aero.getWeight()*2) / 2.0; } else { weight = 3.0; if (aero.getCockpitType() == Aero.COCKPIT_SMALL) { weight = 2.0; } else if (aero.getCockpitType() == Aero.COCKPIT_COMMAND_CONSOLE){ weight = 6.0; } else if (aero.getCockpitType() == Aero.COCKPIT_PRIMITIVE) { weight = 5.0; } } return weight; }
/** * Checks to see if this unit has valid armor assignment. * * @param buff * @return */ public boolean correctArmor(StringBuffer buff) { boolean correct = true; int maxArmorPoints = maxArmorPoints(aero,aero.getWeight()); int armorTotal = 0; for (int loc = 0; loc < aero.locations(); loc++) { if (aero.getOArmor(loc) > maxArmorPoints) { buff.append(printArmorLocation(loc)) .append(printArmorLocProp(loc, maxArmorPoints)).append("\n"); correct = false; } armorTotal += aero.getOArmor(loc); } if (armorTotal > maxArmorPoints){ buff.append("Total armor," + armorTotal + ", is greater than the maximum: " + maxArmorPoints + "\n"); correct = false; } return correct ; }
cost += 25000 + (10 * getWeight());
int engineRating = (dataFile.getDataAsInt("SafeThrust")[0] - 2) * (int) a.getWeight(); if (a.isPrimitive()) { engineRating *= 1.2;