Search in sources :

Example 1 with SuperHeavyTank

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

the class PrintLargeSupportVehicle method printImage.

public void printImage(Graphics2D g2d, PageFormat pageFormat) {
    if (g2d == null) {
        return;
    }
    System.gc();
    try {
        if (largesupporttank instanceof SuperHeavyTank) {
            try {
                ImageHelper.loadSVGImage(new File("data/images/recordsheets/SuperHeavyTankCritTable.svg")).render(g2d);
            } catch (SVGException e) {
                e.printStackTrace();
            }
        } else {
            ImageHelper.loadSVGImage(new File("data/images/recordsheets/LargeSupportTankCritTable.svg")).render(g2d);
            ImageHelper.loadSVGImage(new File("data/images/recordsheets/LargeSupportTankHitTable.svg")).render(g2d);
        }
        ImageHelper.loadSVGImage(new File("data/images/recordsheets/TankMotiveDmgTable.svg")).render(g2d);
        ImageHelper.loadSVGImage(new File("data/images/recordsheets/TankSheetCopyrightInfo.svg")).render(g2d);
        ImageHelper.loadSVGImage(new File("data/images/recordsheets/SuperHeavyBaseTemplate.svg")).render(g2d);
        if (largesupporttank.hasNoTurret()) {
            ImageHelper.loadSVGImage(new File("data/images/recordsheets/SuperHeavyNoTurretTemplate.svg")).render(g2d);
        } else if (largesupporttank.hasNoDualTurret()) {
            ImageHelper.loadSVGImage(new File("data/images/recordsheets/SuperHeavySingleTurretTemplate.svg")).render(g2d);
        } else {
            ImageHelper.loadSVGImage(new File("data/images/recordsheets/SuperHeavyDualTurretTemplate.svg")).render(g2d);
        }
    } catch (SVGException e) {
        e.printStackTrace();
    }
    printLargeSupportTankData(g2d);
    printArmor(g2d);
    printWeaponsNEquipment(g2d);
    // Armor Pips
    printFrontArmor(g2d, largesupporttank.getOArmor(Tank.LOC_FRONT), false);
    printFrontLeftArmor(g2d, largesupporttank.getOArmor(LargeSupportTank.LOC_FRONTLEFT), false);
    printFrontRightArmor(g2d, largesupporttank.getOArmor(LargeSupportTank.LOC_FRONTRIGHT), false);
    printRearLeftArmor(g2d, largesupporttank.getOArmor(LargeSupportTank.LOC_REARLEFT), false);
    printRearRightArmor(g2d, largesupporttank.getOArmor(LargeSupportTank.LOC_REARRIGHT), false);
    printRearArmor(g2d, largesupporttank.getOArmor(LargeSupportTank.LOC_REAR), false);
    if (!largesupporttank.hasNoTurret()) {
        printTurretArmor(g2d, largesupporttank.getOArmor(LargeSupportTank.LOC_TURRET), false);
    }
    if (!largesupporttank.hasNoDualTurret()) {
        printFrontTurretArmor(g2d, largesupporttank.getOArmor(LargeSupportTank.LOC_TURRET_2));
    }
    // Internal Pips
    printFrontStruct(g2d, largesupporttank.getOInternal(Tank.LOC_FRONT), false);
    printLeftFrontStruct(g2d, largesupporttank.getOInternal(LargeSupportTank.LOC_FRONTLEFT), false);
    printRightFrontStruct(g2d, largesupporttank.getOInternal(LargeSupportTank.LOC_REARRIGHT), false);
    printLeftRearStruct(g2d, largesupporttank.getOInternal(LargeSupportTank.LOC_REARLEFT), false);
    printRightRearStruct(g2d, largesupporttank.getOInternal(LargeSupportTank.LOC_REARRIGHT), false);
    printRearStruct(g2d, largesupporttank.getOInternal(LargeSupportTank.LOC_REAR), false);
    if (!largesupporttank.hasNoTurret()) {
        printTurretStruct(g2d, largesupporttank.getOInternal(LargeSupportTank.LOC_TURRET), false);
    }
    if (!largesupporttank.hasNoDualTurret()) {
        printFrontTurretStruct(g2d, largesupporttank.getOInternal(LargeSupportTank.LOC_TURRET_2));
    }
    printLargeSupportTankImage(g2d);
    g2d.scale(pageFormat.getImageableWidth(), pageFormat.getImageableHeight());
}
Also used : SuperHeavyTank(megamek.common.SuperHeavyTank) SVGException(com.kitfox.svg.SVGException) File(java.io.File)

Example 2 with SuperHeavyTank

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

the class MainUI method createNewUnit.

@Override
public void createNewUnit(long entityType, boolean isPrimitive, boolean isIndustrial, Entity oldEntity) {
    if (entityType == Entity.ETYPE_VTOL) {
        setEntity(new VTOL());
        getEntity().setTechLevel(TechConstants.T_INTRO_BOXSET);
        getEntity().setWeight(20);
        getEntity().setMovementMode(EntityMovementMode.VTOL);
    } else {
        if (entityType == Entity.ETYPE_SUPER_HEAVY_TANK) {
            setEntity(new SuperHeavyTank());
            getEntity().setTechLevel(TechConstants.T_IS_ADVANCED);
            getEntity().setWeight(51);
        } else {
            setEntity(new Tank());
            getEntity().setTechLevel(TechConstants.T_INTRO_BOXSET);
            getEntity().setWeight(20);
        }
        getEntity().setMovementMode(EntityMovementMode.HOVER);
    }
    Tank tank = (Tank) getEntity();
    tank.setYear(3145);
    tank.setEngine(new Engine(Math.max(10, (int) getEntity().getWeight() - tank.getSuspensionFactor()), Engine.NORMAL_ENGINE, Engine.TANK_ENGINE));
    tank.autoSetInternal();
    for (int loc = 0; loc < getEntity().locations(); loc++) {
        tank.initializeArmor(0, loc);
    }
    getEntity().setArmorType(EquipmentType.T_ARMOR_STANDARD);
    getEntity().setArmorTechLevel(TechConstants.T_INTRO_BOXSET);
    getEntity().setStructureType(EquipmentType.T_STRUCTURE_STANDARD);
    tank.setHasNoDualTurret(true);
    if (Entity.ETYPE_VTOL == entityType) {
        tank.setHasNoTurret(true);
    }
    if (null == oldEntity) {
        tank.setChassis("New");
        tank.setModel("Tank");
        tank.setYear(3145);
    } else {
        tank.setChassis(oldEntity.getChassis());
        tank.setModel(oldEntity.getModel());
        tank.setYear(Math.max(oldEntity.getYear(), tank.getConstructionTechAdvancement().getIntroductionDate()));
        tank.setSource(oldEntity.getSource());
        tank.setManualBV(oldEntity.getManualBV());
        SimpleTechLevel lvl = SimpleTechLevel.max(tank.getStaticTechLevel(), SimpleTechLevel.convertCompoundToSimple(oldEntity.getTechLevel()));
        tank.setTechLevel(lvl.getCompoundTechLevel(oldEntity.isClan()));
        tank.setMixedTech(oldEntity.isMixedTech());
        tank.setMovementMode(oldEntity.getMovementMode());
    }
    tank.setOriginalWalkMP((tank.getEngine().getRating() + tank.getSuspensionFactor()) / (int) tank.getWeight());
}
Also used : SimpleTechLevel(megamek.common.SimpleTechLevel) VTOL(megamek.common.VTOL) SuperHeavyTank(megamek.common.SuperHeavyTank) SuperHeavyTank(megamek.common.SuperHeavyTank) Tank(megamek.common.Tank) Engine(megamek.common.Engine)

Aggregations

SuperHeavyTank (megamek.common.SuperHeavyTank)2 SVGException (com.kitfox.svg.SVGException)1 File (java.io.File)1 Engine (megamek.common.Engine)1 SimpleTechLevel (megamek.common.SimpleTechLevel)1 Tank (megamek.common.Tank)1 VTOL (megamek.common.VTOL)1