Search in sources :

Example 1 with QuadVee

use of megamek.common.QuadVee in project megameklab by MegaMek.

the class MainUI method createNewUnit.

@Override
public void createNewUnit(long entityType, boolean isPrimitive, boolean isIndustrial, Entity oldEntity) {
    int cockpit = Mech.COCKPIT_STANDARD;
    int at = EquipmentType.T_ARMOR_STANDARD;
    int st = EquipmentType.T_STRUCTURE_STANDARD;
    if (isPrimitive && isIndustrial) {
        cockpit = Mech.COCKPIT_PRIMITIVE_INDUSTRIAL;
        at = EquipmentType.T_ARMOR_PRIMITIVE;
        st = EquipmentType.T_STRUCTURE_INDUSTRIAL;
    } else if (isPrimitive) {
        cockpit = Mech.COCKPIT_PRIMITIVE;
        at = EquipmentType.T_ARMOR_PRIMITIVE;
    } else if (isIndustrial) {
        cockpit = Mech.COCKPIT_INDUSTRIAL;
        at = EquipmentType.T_ARMOR_INDUSTRIAL;
        st = EquipmentType.T_STRUCTURE_INDUSTRIAL;
    }
    if (entityType == Entity.ETYPE_TRIPOD_MECH) {
        setEntity(new TripodMech(Mech.GYRO_STANDARD, Mech.COCKPIT_TRIPOD));
        getEntity().setTechLevel(TechConstants.T_IS_TW_NON_BOX);
    } else if (entityType == Entity.ETYPE_QUAD_MECH) {
        setEntity(new QuadMech(Mech.GYRO_STANDARD, cockpit));
        getEntity().setTechLevel(TechConstants.T_IS_TW_NON_BOX);
    } else if (entityType == Entity.ETYPE_LAND_AIR_MECH) {
        setEntity(new LandAirMech(Mech.GYRO_STANDARD, Mech.COCKPIT_STANDARD, LandAirMech.LAM_STANDARD));
        getEntity().setTechLevel(TechConstants.T_IS_ADVANCED);
        getEntity().setManualBV(-1);
    } else if (entityType == Entity.ETYPE_QUADVEE) {
        setEntity(new QuadVee(Mech.GYRO_STANDARD, QuadVee.MOTIVE_TRACK));
        getEntity().setTechLevel(TechConstants.T_CLAN_ADVANCED);
        UnitUtil.createSpreadMounts((Mech) getEntity(), EquipmentType.get("Tracks"));
        getEntity().setManualBV(-1);
    } else {
        // type == 0
        setEntity(new BipedMech(Mech.GYRO_STANDARD, cockpit));
        getEntity().setTechLevel(TechConstants.T_IS_TW_NON_BOX);
    }
    Mech mech = (Mech) getEntity();
    getEntity().setWeight(25);
    if (entityType == Entity.ETYPE_LAND_AIR_MECH) {
        mech.setEngine(new Engine(75, Engine.NORMAL_ENGINE, 0));
        UnitUtil.updateJumpJets(((Mech) getEntity()), 3, Mech.JUMP_STANDARD);
    } else {
        mech.setEngine(new Engine(25, Engine.NORMAL_ENGINE, 0));
    }
    getEntity().setArmorType(at);
    getEntity().setArmorTechLevel(getEntity().getTechLevel());
    getEntity().setStructureType(st);
    mech.addGyro();
    mech.addEngineCrits();
    if (isPrimitive) {
        mech.addPrimitiveCockpit();
    } else if (isIndustrial) {
        mech.addIndustrialCockpit();
    } else if (Entity.ETYPE_QUADVEE == entityType) {
        mech.addQuadVeeCockpit();
    } else {
        mech.addCockpit();
    }
    UnitUtil.updateHeatSinks(mech, 10, "Single");
    getEntity().autoSetInternal();
    for (int loc = 0; loc < getEntity().locations(); loc++) {
        mech.initializeArmor(0, loc);
        mech.initializeRearArmor(0, loc);
    }
    if (null == oldEntity) {
        mech.setChassis("New");
        mech.setModel("Mek");
        mech.setYear(3145);
    } else {
        mech.setChassis(oldEntity.getChassis());
        mech.setModel(oldEntity.getModel());
        mech.setYear(Math.max(oldEntity.getYear(), mech.getConstructionTechAdvancement().getIntroductionDate()));
        mech.setSource(oldEntity.getSource());
        mech.setManualBV(oldEntity.getManualBV());
        SimpleTechLevel lvl = SimpleTechLevel.max(mech.getStaticTechLevel(), SimpleTechLevel.convertCompoundToSimple(oldEntity.getTechLevel()));
        mech.setTechLevel(lvl.getCompoundTechLevel(oldEntity.isClan()));
        mech.setMixedTech(oldEntity.isMixedTech());
    }
}
Also used : TripodMech(megamek.common.TripodMech) QuadMech(megamek.common.QuadMech) SimpleTechLevel(megamek.common.SimpleTechLevel) BipedMech(megamek.common.BipedMech) Mech(megamek.common.Mech) LandAirMech(megamek.common.LandAirMech) TripodMech(megamek.common.TripodMech) QuadMech(megamek.common.QuadMech) QuadVee(megamek.common.QuadVee) BipedMech(megamek.common.BipedMech) Engine(megamek.common.Engine) LandAirMech(megamek.common.LandAirMech)

Example 2 with QuadVee

use of megamek.common.QuadVee in project megameklab by MegaMek.

the class PrintMech method writeTextFields.

@Override
protected void writeTextFields() {
    super.writeTextFields();
    if (mech.hasUMU()) {
        Element svgEle = getSVGDocument().getElementById("mpJumpLabel");
        if (null != svgEle) {
            svgEle.setTextContent("Underwater:");
        }
    }
    hideElement("warriorDataSingle", mech.getCrew().getSlotCount() != 1);
    hideElement("warriorDataDual", mech.getCrew().getSlotCount() != 2);
    hideElement("warriorDataTriple", mech.getCrew().getSlotCount() != 3);
    setTextField("hsType", formatHeatSinkType());
    setTextField("hsCount", formatHeatSinkCount());
    if (mech instanceof LandAirMech) {
        LandAirMech lam = (LandAirMech) mech;
        if (lam.getLAMType() == LandAirMech.LAM_BIMODAL) {
            // em dash
            setTextField("mpAirMechWalk", "\u2014");
            setTextField("mpAirMechRun", "\u2014");
            setTextField("mpAirMechCruise", "\u2014");
            setTextField("mpAirMechFlank", "\u2014");
        } else {
            setTextField("mpAirMechWalk", Integer.toString(lam.getAirMechWalkMP()));
            setTextField("mpAirMechRun", Integer.toString(lam.getAirMechRunMP()));
            setTextField("mpAirMechCruise", Integer.toString(lam.getAirMechCruiseMP()));
            setTextField("mpAirMechFlank", Integer.toString(lam.getAirMechFlankMP()));
        }
        setTextField("mpSafeThrust", Integer.toString(lam.getJumpMP()));
        setTextField("mpMaxThrust", Integer.toString((int) Math.ceil(lam.getJumpMP() * 1.5)));
        if (!lam.getCrew().getName().equalsIgnoreCase("unnamed") && (lam.getCrew() instanceof LAMPilot)) {
            setTextField("asfGunnerySkill", Integer.toString(((LAMPilot) mech.getCrew()).getGunneryAero()));
            setTextField("asfPilotingSkill", Integer.toString(((LAMPilot) mech.getCrew()).getPilotingAero()));
        } else {
            hideElement("asfGunnerySkill");
            hideElement("asfPilotingSkill");
        }
    } else if (mech instanceof QuadVee) {
        setTextField("mpCruise", Integer.toString(((QuadVee) mech).getCruiseMP(false, false, false)));
        setTextField("mpFlank", formatQuadVeeFlank());
        setTextField("lblVeeMode", ((QuadVee) mech).getMotiveTypeString() + "s");
    }
}
Also used : SVGRectElement(org.w3c.dom.svg.SVGRectElement) Element(org.w3c.dom.Element) QuadVee(megamek.common.QuadVee) LAMPilot(megamek.common.LAMPilot) LandAirMech(megamek.common.LandAirMech)

Aggregations

LandAirMech (megamek.common.LandAirMech)2 QuadVee (megamek.common.QuadVee)2 BipedMech (megamek.common.BipedMech)1 Engine (megamek.common.Engine)1 LAMPilot (megamek.common.LAMPilot)1 Mech (megamek.common.Mech)1 QuadMech (megamek.common.QuadMech)1 SimpleTechLevel (megamek.common.SimpleTechLevel)1 TripodMech (megamek.common.TripodMech)1 Element (org.w3c.dom.Element)1 SVGRectElement (org.w3c.dom.svg.SVGRectElement)1