Beispiel #1
0
 @Override
 public float getWeightControls() {
   if (tank.hasNoControlSystems()) {
     return 0;
   } else {
     return TestEntity.ceilMaxHalf(tank.getWeight() / 20.0f, getWeightCeilingControls());
   }
 }
Beispiel #2
0
 public float getTankWeightLifting() {
   switch (tank.getMovementMode()) {
     case HOVER:
     case VTOL:
     case HYDROFOIL:
     case SUBMARINE:
     case WIGE:
       return TestEntity.ceilMaxHalf(tank.getWeight() / 10.0f, getWeightCeilingLifting());
     default:
       return 0f;
   }
 }
Beispiel #3
0
  @Override
  public boolean correctEntity(StringBuffer buff, int ammoTechLvl) {
    boolean correct = true;
    if (skip()) {
      return true;
    }
    if (!correctWeight(buff)) {
      buff.insert(0, printTechLevel() + printShortMovement());
      buff.append(printWeightCalculation()).append("\n");
      correct = false;
    }
    if (!engine.engineValid) {
      buff.append(engine.problem.toString()).append("\n\n");
      correct = false;
    }
    if (tank.hasWorkingMisc(MiscType.F_ARMORED_MOTIVE_SYSTEM)
        && !((tank.getMovementMode() == EntityMovementMode.WHEELED)
            || (tank.getMovementMode() == EntityMovementMode.TRACKED)
            || (tank.getMovementMode() == EntityMovementMode.HOVER)
            || (tank.getMovementMode() == EntityMovementMode.HYDROFOIL)
            || (tank.getMovementMode() == EntityMovementMode.NAVAL)
            || (tank.getMovementMode() == EntityMovementMode.SUBMARINE)
            || (tank.getMovementMode() == EntityMovementMode.WIGE))) {
      buff.append("Armored Motive system and incompatible movemement mode!\n\n");
      correct = false;
    }
    if (tank.getFreeSlots() < 0) {
      buff.append("Not enough item slots available! Using ");
      buff.append(Math.abs(tank.getFreeSlots()));
      buff.append(" slot(s) too many.\n\n");
      correct = false;
    }
    int armorLimit = (int) (((tank.getWeight() * 7) / 2) + 40);
    if (tank.getTotalOArmor() > armorLimit) {
      buff.append("Armor exceeds point limit for ");
      buff.append(tank.getWeight());
      buff.append("-ton vehicle: ");
      buff.append(tank.getTotalOArmor());
      buff.append(" points > ");
      buff.append(armorLimit);
      buff.append(".\n\n");
      correct = false;
    }
    if (tank instanceof VTOL) {
      if (!tank.hasWorkingMisc(MiscType.F_MAST_MOUNT)) {
        for (Mounted m : tank.getEquipment()) {
          if (m.getLocation() == VTOL.LOC_ROTOR) {
            buff.append("rotor equipment must be placed in mast mount");
            correct = false;
          }
        }
      }
      if (tank.getOArmor(VTOL.LOC_ROTOR) > VTOL_MAX_ROTOR_ARMOR) {
        buff.append(tank.getOArmor(VTOL.LOC_ROTOR));
        buff.append(
            " points of VTOL rotor armor exceed " + VTOL_MAX_ROTOR_ARMOR + "-point limit.\n\n");
        correct = false;
      }
    }
    for (Mounted m : tank.getMisc()) {
      if (m.getType().hasFlag(MiscType.F_COMBAT_VEHICLE_ESCAPE_POD)) {
        if (m.getLocation()
            != (tank instanceof SuperHeavyTank ? SuperHeavyTank.LOC_REAR : Tank.LOC_REAR)) {
          buff.append("combat vehicle escape pod must be placed in rear");
          correct = false;
        }
      }
    }
    for (int loc = 0; loc < tank.locations(); loc++) {
      int count = 0;
      for (Mounted misc : tank.getMisc()) {
        if ((misc.getLocation() == loc) && misc.getType().hasFlag(MiscType.F_MANIPULATOR)) {
          count++;
        }
      }
      if (count > 2) {
        buff.append("max of 2 manipulators per location");
        correct = false;
        break;
      }
    }

    if (showFailedEquip() && hasFailedEquipment(buff)) {
      correct = false;
    }
    if (hasIllegalTechLevels(buff, ammoTechLvl)) {
      correct = false;
    }
    if (hasIllegalEquipmentCombinations(buff)) {
      correct = false;
    }
    // only tanks with fusion engine can be vacuum protected
    if (!(tank.getEngine().isFusion()
            || (tank.getEngine().getEngineType() == Engine.FUEL_CELL)
            || (tank.getEngine().getEngineType() == Engine.SOLAR)
            || (tank.getEngine().getEngineType() == Engine.BATTERY)
            || (tank.getEngine().getEngineType() == Engine.FISSION)
            || (tank.getEngine().getEngineType() == Engine.NONE))
        && !tank.doomedInVacuum()) {
      buff.append("Vacuum protection requires fusion engine.\n");
      correct = false;
    }

    if (!correctCriticals(buff)) {
      correct = false;
    }
    return correct;
  }