コード例 #1
0
 @Override
 public ConfiguredComponentStandard[] defaultComponents(ChassisBase aChassis) {
   ChassisStandard chassis = (ChassisStandard) aChassis;
   ConfiguredComponentStandard[] ans = new ConfiguredComponentStandard[Location.values().length];
   for (ComponentStandard component : chassis.getComponents()) {
     ans[component.getLocation().ordinal()] = new ConfiguredComponentStandard(component, true);
   }
   return ans;
 }
コード例 #2
0
  public void updateGraph() {
    DefaultTableXYDataset dataset = new DefaultTableXYDataset();
    for (Entry entry : chassis) {
      XYSeries series = new XYSeries(entry.name, false, false);
      if (entry.representant instanceof ChassisStandard) {
        ChassisStandard chassisStandard = (ChassisStandard) entry.representant;
        for (int rating = chassisStandard.getEngineMin();
            rating <= chassisStandard.getEngineMax();
            rating += 5) {
          if (rating < 100) {
            continue; // TODO: Remove this when they remove the engine limit.
          }
          double speed =
              TopSpeed.calculate(
                  rating,
                  chassisStandard.getMovementProfileBase(),
                  chassisStandard.getMassMax(),
                  efficiencies.getSpeedModifier());
          series.add(speed, payloadStatistics.calculate(chassisStandard, rating));
        }
      } else {
        // Omnimech
        ChassisOmniMech chassisOmniMech = (ChassisOmniMech) entry.representant;
        Engine engine = chassisOmniMech.getFixedEngine();

        double minSpeed =
            TopSpeed.calculate(
                engine.getRating(),
                chassisOmniMech.getMovementProfileMin(),
                chassisOmniMech.getMassMax(),
                efficiencies.getSpeedModifier());
        double stockSpeed =
            TopSpeed.calculate(
                engine.getRating(),
                chassisOmniMech.getMovementProfileStock(),
                chassisOmniMech.getMassMax(),
                efficiencies.getSpeedModifier());
        double maxSpeed =
            TopSpeed.calculate(
                engine.getRating(),
                chassisOmniMech.getMovementProfileMax(),
                chassisOmniMech.getMassMax(),
                efficiencies.getSpeedModifier());

        double payload = payloadStatistics.calculate(chassisOmniMech);
        if (minSpeed != stockSpeed) {
          series.add(minSpeed, payload);
        }
        series.add(stockSpeed, payload);
        if (maxSpeed != stockSpeed) {
          series.add(maxSpeed, payload);
        }
      }
      dataset.addSeries(series);
    }
    setChart(makeChart(dataset));
    XYPlot plot = (XYPlot) getChart().getPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, true);
    renderer.setBaseShapesFilled(false);
    plot.setRenderer(renderer);
  }