Package megamek.common

Examples of megamek.common.SmallCraft


      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) {
          //add in thrusters
          SmallCraft sc = (SmallCraft)t;
          vLabels[9].setValue(getCriticalHitTally(sc.getLeftThrustHits(),3));
          vLabels[10].setValue(getCriticalHitTally(sc.getRightThrustHits(),3));
      } else {
          vLabels[9].setValue("-");
          vLabels[10].setValue("-");
      }
     
View Full Code Here


        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) {
            //add in thrusters
            SmallCraft sc = (SmallCraft)t;
            vLabels[9].setValue(getCriticalHitTally(sc.getLeftThrustHits(),3));
            vLabels[10].setValue(getCriticalHitTally(sc.getRightThrustHits(),3));
        } else {
            vLabels[9].setValue("-");
            vLabels[10].setValue("-");
        }
View Full Code Here

        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) {
            //add in thrusters
            SmallCraft sc = (SmallCraft)t;
            vLabels[9].setValue(getCriticalHitTally(sc.getLeftThrustHits(),3));
            vLabels[10].setValue(getCriticalHitTally(sc.getRightThrustHits(),3));
        } else {
            vLabels[9].setValue("-");
            vLabels[10].setValue("-");
        }
View Full Code Here

        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) {
            //add in thrusters
            SmallCraft sc = (SmallCraft)t;
            vLabels[9].setValue(getCriticalHitTally(sc.getLeftThrustHits(),3));
            vLabels[10].setValue(getCriticalHitTally(sc.getRightThrustHits(),3));
        } else {
            vLabels[9].setValue("-");
            vLabels[10].setValue("-");
        }
View Full Code Here

            if (entity instanceof FighterSquadron) {
                return default_fighter_squadron;
            }

            if (entity instanceof SmallCraft) {
                SmallCraft sc = (SmallCraft) entity;
                if (sc.isSpheroid()) {
                    return default_small_craft_sphere;
                } else {
                    return default_small_craft_aero;
                }
            }
View Full Code Here

           
            if(entity instanceof FighterSquadron)
                return default_fighter_squadron;
           
            if(entity instanceof SmallCraft) {
                SmallCraft sc = (SmallCraft)entity;
                if(sc.isSpheroid())
                    return default_small_craft_sphere;
                else
                    return default_small_craft_aero;
            }
           
View Full Code Here

                minBottomMargin = minAeroTopMargin;
                minRightMargin = minAeroLeftMargin;
            } else if (en instanceof Aero) {
                ams = aero;
                if (en instanceof SmallCraft) {
                    SmallCraft sc = (SmallCraft) en;
                    if (sc.isSpheroid()) {
                        ams = sphere;
                    }
                }
                if (en.isCapitalFighter()) {
                    ams = capFighter;
View Full Code Here

                minBottomMargin = minAeroTopMargin;
                minRightMargin = minAeroLeftMargin;
            } else if (en instanceof Aero) {
                ams = aero;
                if (en instanceof SmallCraft) {
                    SmallCraft sc = (SmallCraft) en;
                    if (sc.isSpheroid()) {
                        ams = sphere;
                    }
                }
                if (en.isCapitalFighter()) {
                    ams = capFighter;
View Full Code Here

        dataFile = bb;
    }

    public Entity getEntity() throws EntityLoadingException {

        SmallCraft a = new SmallCraft();

        if (!dataFile.exists("Name")) {
            throw new EntityLoadingException("Could not find name block.");
        }
        a.setChassis(dataFile.getDataAsString("Name")[0]);
        if (dataFile.exists("Model") && dataFile.getDataAsString("Model")[0] != null) {
            a.setModel(dataFile.getDataAsString("Model")[0]);
        } else {
            a.setModel("");
        }

        if (dataFile.exists("source")) {
            a.setSource(dataFile.getDataAsString("source")[0]);
        }

        setTechLevel(a);

        if (!dataFile.exists("tonnage")) {
            throw new EntityLoadingException("Could not find weight block.");
        }
        a.setWeight(dataFile.getDataAsFloat("tonnage")[0]);

        if (!dataFile.exists("crew")) {
            throw new EntityLoadingException("Could not find crew block.");
        }
        a.setNCrew(dataFile.getDataAsInt("crew")[0]);

        if (!dataFile.exists("passengers")) {
            throw new EntityLoadingException("Could not find passenger block.");
        }
        a.setNPassenger(dataFile.getDataAsInt("passengers")[0]);

        if (!dataFile.exists("motion_type")) {
            throw new EntityLoadingException("Could not find movement block.");
        }
        String sMotion = dataFile.getDataAsString("motion_type")[0];
        int nMotion = 16;
        if (sMotion.equals("spheroid")) {
            nMotion = 17;
            a.setSpheroid(true);
        }
        a.setMovementMode(nMotion);

        // figure out structural integrity
        if (!dataFile.exists("structural_integrity")) {
            throw new EntityLoadingException("Could not find structual integrity block.");
        }
        a.set0SI(dataFile.getDataAsInt("structural_integrity")[0]);

        // figure out heat
        if (!dataFile.exists("heatsinks")) {
            throw new EntityLoadingException("Could not find weight block.");
        }
        a.setHeatSinks(dataFile.getDataAsInt("heatsinks")[0]);
        if (!dataFile.exists("sink_type")) {
            throw new EntityLoadingException("Could not find weight block.");
        }
        a.setHeatType(dataFile.getDataAsInt("sink_type")[0]);

        // figure out fuel
        if (!dataFile.exists("fuel")) {
            throw new EntityLoadingException("Could not find fuel block.");
        }
        a.setFuel(dataFile.getDataAsInt("fuel")[0]);

        // figure out engine stuff
        // not done for small craft and up
        if (!dataFile.exists("SafeThrust")) {
            throw new EntityLoadingException("Could not find Safe Thrust block.");
        }
        a.setOriginalWalkMP(dataFile.getDataAsInt("SafeThrust")[0]);

        a.setEngine(new Engine(400, 0, 0));

        if (dataFile.exists("armor_type")) {
            a.setArmorType(dataFile.getDataAsInt("armor_type")[0]);
        }
        if (dataFile.exists("armor_tech")) {
            a.setArmorTechLevel(dataFile.getDataAsInt("armor_tech")[0]);
        }
        if (dataFile.exists("internal_type")) {
            a.setStructureType(dataFile.getDataAsInt("internal_type")[0]);
        }

        if (!dataFile.exists("armor")) {
            throw new EntityLoadingException("Could not find armor block.");
        }

        int[] armor = dataFile.getDataAsInt("armor");

        if (armor.length != 4) {
            throw new EntityLoadingException("Incorrect armor array length");
        }

        a.initializeArmor(armor[BLKAeroFile.NOSE], Aero.LOC_NOSE);
        a.initializeArmor(armor[BLKAeroFile.RW], Aero.LOC_RWING);
        a.initializeArmor(armor[BLKAeroFile.LW], Aero.LOC_LWING);
        a.initializeArmor(armor[BLKAeroFile.AFT], Aero.LOC_AFT);

        a.autoSetInternal();
        // This is not working right for arrays for some reason
        a.autoSetThresh();

        loadEquipment(a, "Nose", Aero.LOC_NOSE);
        loadEquipment(a, "Right Side", Aero.LOC_RWING);
        loadEquipment(a, "Left Side", Aero.LOC_LWING);
        loadEquipment(a, "Aft", Aero.LOC_AFT);

        // get the bays on this dropship
        // should be of format name:units:doors
        if (dataFile.exists("transporters")) {
            String[] transporters = dataFile.getDataAsString("transporters");
            // Walk the array of transporters.
            for (String transporter : transporters) {
                if (transporter.startsWith("InfantryBay:", 0)) {
                    String numbers = transporter.substring(12);
                    String temp[] = numbers.split(":");
                    int size = Integer.parseInt(temp[0]);
                    int doors = Integer.parseInt(temp[1]);
                    a.addTransporter(new InfantryBay(size, doors));
                } else if (transporter.startsWith("BattleArmorBay:", 0)) {
                    String numbers = transporter.substring(15);
                    String temp[] = numbers.split(":");
                    int size = Integer.parseInt(temp[0]);
                    int doors = Integer.parseInt(temp[1]);
                    a.addTransporter(new BattleArmorBay(size, doors));
                } else if (transporter.startsWith("CargoBay:", 0)) {
                    String numbers = transporter.substring(9);
                    String temp[] = numbers.split(":");
                    int size = Integer.parseInt(temp[0]);
                    int doors = Integer.parseInt(temp[1]);
                    a.addTransporter(new CargoBay(size, doors));
                }
            }
        }

        return a;
View Full Code Here

TOP

Related Classes of megamek.common.SmallCraft

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.