Search in sources :

Example 1 with SupportVTOL

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

the class PrintVTOL method printVTOLData.

private void printVTOLData(Graphics2D g2d) {
    String VTOLName = vtol.getChassis() + " " + vtol.getModel();
    g2d.setFont(UnitUtil.getNewFont(g2d, VTOLName, true, 180, 10.0f));
    g2d.drawString(VTOLName, 55, 119);
    Font font = UnitUtil.deriveFont(true, 13.5f);
    g2d.setFont(font);
    if (vtol instanceof SupportVTOL) {
        g2d.drawString("SUPPORT", 73, 86.5f);
    }
    font = UnitUtil.deriveFont(8.0f);
    g2d.setFont(font);
    if ((vtol.getCrew() != null) && !vtol.getCrew().getName().equalsIgnoreCase("unnamed")) {
        Crew pilot = vtol.getCrew();
        g2d.drawString(pilot.getName(), 276, 120);
        g2d.drawString(String.valueOf(pilot.getGunnery()), 301, 131);
        g2d.drawString(String.valueOf(pilot.getPiloting()), 371, 132);
    }
    g2d.drawString(Integer.toString(vtol.getWalkMP()), 85, 144);
    if (!vtol.hasWorkingMisc(MiscType.F_MASC, MiscType.S_JETBOOSTER)) {
        g2d.drawString(Integer.toString(vtol.getRunMP()), 85, 154);
    } else {
        int mascMP = vtol.getRunMP();
        g2d.drawString(Integer.toString(vtol.getRunMPwithoutMASC()) + " [" + mascMP + "]", 85, 154);
    }
    String engineName = "Fusion Engine";
    switch(vtol.getEngine().getEngineType()) {
        case Engine.COMBUSTION_ENGINE:
            engineName = "I.C.E.";
            break;
        case Engine.LIGHT_ENGINE:
            engineName = "Light Fusion Engine";
            break;
        case Engine.XL_ENGINE:
            engineName = "XL Fusion Engine";
            break;
        case Engine.XXL_ENGINE:
            engineName = "XXL Fusion Engine";
            break;
        case Engine.COMPACT_ENGINE:
            engineName = "Compact Fusion Engine";
            break;
        case Engine.FUEL_CELL:
            engineName = "Fuel Cell";
            break;
        default:
            break;
    }
    g2d.drawString(engineName, 85, 165);
    if (vtol.getWeight() >= 5) {
        int tonnage = (int) Math.ceil(vtol.getWeight());
        g2d.drawString(Integer.toString(tonnage), 183, 133);
    } else {
        g2d.drawString(String.format("%1$,d", vtol.getWeight()), 183, 133);
    }
    int nextDataLine = 153;
    float startLine = 200;
    int lineFeed = 8;
    String techBase = "Inner Sphere";
    if (vtol.isMixedTech()) {
        if (vtol.isClan()) {
            techBase = "Mixed Tech (Clan)";
        } else {
            techBase = "Mixed Tech (I.S.)";
        }
    } else if (vtol.isClan()) {
        techBase = "Clan";
    }
    font = UnitUtil.getNewFont(g2d, techBase, false, 52, 8);
    g2d.setFont(font);
    g2d.drawString(techBase, 183, 144.5f);
    switch(vtol.getTechLevel()) {
        case TechConstants.T_INTRO_BOXSET:
            ImageHelper.printCenterString(g2d, "(Intro)", font, startLine, nextDataLine);
            nextDataLine += lineFeed;
            break;
        case TechConstants.T_IS_TW_NON_BOX:
        case TechConstants.T_IS_TW_ALL:
        case TechConstants.T_CLAN_TW:
            break;
        case TechConstants.T_IS_ADVANCED:
        case TechConstants.T_CLAN_ADVANCED:
            ImageHelper.printCenterString(g2d, "(Advanced)", font, startLine, nextDataLine);
            nextDataLine += lineFeed;
            break;
        case TechConstants.T_IS_EXPERIMENTAL:
        case TechConstants.T_CLAN_EXPERIMENTAL:
            ImageHelper.printCenterString(g2d, "(Experimental)", font, startLine, nextDataLine);
            nextDataLine += lineFeed;
            break;
        case TechConstants.T_IS_UNOFFICIAL:
        case TechConstants.T_CLAN_UNOFFICIAL:
            ImageHelper.printCenterString(g2d, "(Unofficial)", font, startLine, nextDataLine);
            nextDataLine += lineFeed;
            break;
    }
    font = UnitUtil.deriveFont(8.0f);
    g2d.setFont(font);
    if ((vtol.getSource() != null) && (vtol.getSource().trim().length() > 0)) {
        String sourceFluff = "Era: ";
        font = UnitUtil.deriveFont(true, 8.0f);
        g2d.setFont(font);
        g2d.drawString(sourceFluff, 150, nextDataLine);
        font = UnitUtil.getNewFont(g2d, vtol.getSource(), false, 51, 8.0f);
        g2d.setFont(font);
        g2d.drawString(vtol.getSource(), 183, nextDataLine);
    } else {
        String yearFluff = "Year: ";
        font = UnitUtil.deriveFont(true, 8.0f);
        g2d.setFont(font);
        g2d.drawString(yearFluff, 150, nextDataLine);
        font = UnitUtil.deriveFont(8.0f);
        g2d.setFont(font);
        g2d.drawString(String.format("%1$s", vtol.getYear()), 183, nextDataLine);
    }
    // Cost/BV
    // DecimalFormatSymbols unusualSymbols = new DecimalFormatSymbols();
    // unusualSymbols.setDecimalSeparator('.');
    // unusualSymbols.setGroupingSeparator(',');
    // DecimalFormat myFormatter = new DecimalFormat("#,###",
    // unusualSymbols);
    double bv = vtol.calculateBattleValue(true, true);
    if (bv != -1) {
        font = UnitUtil.deriveFont(true, 8);
        g2d.setFont(font);
        g2d.drawString("BV: ", 35, 365);
        font = UnitUtil.deriveFont(false, 8);
        g2d.setFont(font);
        g2d.drawString(String.format("%1$,d", vtol.calculateBattleValue(true, true)), 50, 365);
    }
    if (UnitUtil.hasBAR(vtol)) {
        font = UnitUtil.deriveFont(true, 9.0f);
        g2d.drawString("BAR: " + UnitUtil.getLowestBARRating(vtol), 400, 55);
    }
    font = UnitUtil.deriveFont(true, 6.5f);
    g2d.setFont(font);
    g2d.drawString(Integer.toString(Calendar.getInstance().get(Calendar.YEAR)), 39.5f, 763.3f);
}
Also used : Crew(megamek.common.Crew) SupportVTOL(megamek.common.SupportVTOL) Font(java.awt.Font)

Aggregations

Font (java.awt.Font)1 Crew (megamek.common.Crew)1 SupportVTOL (megamek.common.SupportVTOL)1