From 303fba589733bb46fa0e59ab2e9a39a865fa20ec Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Sun, 25 Oct 2020 21:51:43 -0500 Subject: [PATCH 01/12] Hit location table for fighters, small craft, dropships. --- .../reference/AeroHitLocation.properties | 28 ++++ src/megameklab/com/printing/PrintAero.java | 26 +++- .../printing/reference/AeroHitLocation.java | 131 ++++++++++++++++++ 3 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 resources/megameklab/com/printing/reference/AeroHitLocation.properties create mode 100644 src/megameklab/com/printing/reference/AeroHitLocation.java diff --git a/resources/megameklab/com/printing/reference/AeroHitLocation.properties b/resources/megameklab/com/printing/reference/AeroHitLocation.properties new file mode 100644 index 000000000..cf0a5d55e --- /dev/null +++ b/resources/megameklab/com/printing/reference/AeroHitLocation.properties @@ -0,0 +1,28 @@ +title=HIT LOCATION TABLE +dieRoll2d6=Die Roll\n(2D6) +nose=Nose +side=Side +aft=Aft +aboveBelow=Above/Below +wing=Wing +rwing=Right Wing +lwing=Left Wing +rside=Right Side +lside=Left Side +avionics=Avionics +bomb=Bomb +cargo=Cargo +collar=Collar +control=Control +crew=Crew +door=Door +engine=Engine +fcs=FCS +fuel=Fuel +gear=Gear +heatSink=Heat Sink +kfBoom=K-F Boom +lifeSupport=Life Support +sensors=Sensor +thruster=Thruster +weapon=Weapon diff --git a/src/megameklab/com/printing/PrintAero.java b/src/megameklab/com/printing/PrintAero.java index d2b4add28..b35723b5b 100644 --- a/src/megameklab/com/printing/PrintAero.java +++ b/src/megameklab/com/printing/PrintAero.java @@ -18,6 +18,7 @@ package megameklab.com.printing; import megamek.common.*; +import megameklab.com.printing.reference.*; import megameklab.com.util.ImageHelper; import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; @@ -27,10 +28,7 @@ import java.awt.print.PageFormat; import java.io.File; import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; +import java.util.*; import java.util.stream.Collectors; /** @@ -282,4 +280,24 @@ protected String formatWalk() { protected String formatRun() { return Integer.toString(getEntity().getRunMP()); } + + @Override + protected boolean includeReferenceCharts() { + return options.showReferenceCharts(); + } + + @Override + protected List getRightSideReferenceTables() { + List list = new ArrayList<>(); + return list; + } + + @Override + protected void addReferenceCharts(PageFormat pageFormat) { + super.addReferenceCharts(pageFormat); + AeroHitLocation table = new AeroHitLocation(this); + getSVGDocument().getDocumentElement().appendChild(table.createTable(pageFormat.getImageableX(), + pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0, + pageFormat.getImageableWidth() * 0.5, pageFormat.getImageableHeight() * 0.2 - 3.0)); + } } \ No newline at end of file diff --git a/src/megameklab/com/printing/reference/AeroHitLocation.java b/src/megameklab/com/printing/reference/AeroHitLocation.java new file mode 100644 index 000000000..ebf2ee3bd --- /dev/null +++ b/src/megameklab/com/printing/reference/AeroHitLocation.java @@ -0,0 +1,131 @@ +/* + * MegaMekLab - Copyright (C) 2020 - The MegaMek Team + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + */ +package megameklab.com.printing.reference; + +import megamek.common.SmallCraft; +import megameklab.com.printing.PrintAero; + +/** + * + */ +public class AeroHitLocation extends ReferenceTable { + + public AeroHitLocation(PrintAero sheet) { + super(sheet, 0.1, 0.3, 0.5, 0.7, 0.9); + setHeaders(bundle.getString("dieRoll2d6"), bundle.getString("nose"), + bundle.getString("side"), bundle.getString("aft"), + bundle.getString("aboveBelow")); + if (sheet.getEntity() instanceof SmallCraft) { + addSCDSRows(); + } else { + addFighterRows(); + } + } + + private void addSCDSRows() { + addRow("2", bundle.getString("nose") + "/" + bundle.getString("crew"), + bundle.getString("aft") + "/" + bundle.getString("lifeSupport"), + bundle.getString("nose") + "/" + bundle.getString("weapon"), + bundle.getString("nose") + "/" + bundle.getString("weapon")); + addRow("3", bundle.getString("nose") + "/" + bundle.getString("avionics"), + bundle.getString("aft") + "/" + bundle.getString("control"), + bundle.getString("nose") + "/" + bundle.getString("fcs"), + bundle.getString("nose") + "/" + bundle.getString("fcs")); + addRow("4", bundle.getString("rside") + "/" + bundle.getString("weapon"), + bundle.getString("rside") + "/" + bundle.getString("weapon"), + bundle.getString("nose") + "/" + bundle.getString("sensors"), + bundle.getString("nose") + "/" + bundle.getString("sensors")); + addRow("5", bundle.getString("rside") + "/" + bundle.getString("thruster"), + bundle.getString("rside") + "/" + bundle.getString("door"), + bundle.getString("side") + "/" + bundle.getString("thruster"), + bundle.getString("side") + "/" + bundle.getString("thruster")); + addRow("6", bundle.getString("nose") + "/" + bundle.getString("fcs"), + bundle.getString("aft") + "/" + bundle.getString("engine"), + bundle.getString("side") + "/" + bundle.getString("cargo"), + bundle.getString("side") + "/" + bundle.getString("cargo")); + addRow("7", bundle.getString("nose") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("weapon"), + bundle.getString("side") + "/" + bundle.getString("weapon"), + bundle.getString("side") + "/" + bundle.getString("weapon")); + addRow("8", bundle.getString("nose") + "/" + bundle.getString("control"), + bundle.getString("aft") + "/" + bundle.getString("collar"), + bundle.getString("side") + "/" + bundle.getString("door"), + bundle.getString("side") + "/" + bundle.getString("door")); + addRow("9", bundle.getString("lside") + "/" + bundle.getString("thruster"), + bundle.getString("lside") + "/" + bundle.getString("door"), + bundle.getString("side") + "/" + bundle.getString("thruster"), + bundle.getString("side") + "/" + bundle.getString("thruster")); + addRow("10", bundle.getString("lside") + "/" + bundle.getString("weapon"), + bundle.getString("lside") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("avionics"), + bundle.getString("aft") + "/" + bundle.getString("avionics")); + addRow("11", bundle.getString("nose") + "/" + bundle.getString("sensors"), + bundle.getString("aft") + "/" + bundle.getString("gear"), + bundle.getString("aft") + "/" + bundle.getString("engine"), + bundle.getString("aft") + "/" + bundle.getString("engine")); + addRow("12", bundle.getString("nose") + "/" + bundle.getString("kfBoom"), + bundle.getString("aft") + "/" + bundle.getString("fuel"), + bundle.getString("aft") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("weapon")); + } + + private void addFighterRows() { + addRow("2", bundle.getString("nose") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("weapon"), + bundle.getString("nose") + "/" + bundle.getString("weapon"), + bundle.getString("nose") + "/" + bundle.getString("weapon")); + addRow("3", bundle.getString("nose") + "/" + bundle.getString("sensors"), + bundle.getString("aft") + "/" + bundle.getString("heatSink"), + bundle.getString("wing") + "/" + bundle.getString("gear"), + bundle.getString("wing") + "/" + bundle.getString("gear")); + addRow("4", bundle.getString("rwing") + "/" + bundle.getString("heatSink"), + bundle.getString("rwing") + "/" + bundle.getString("fuel"), + bundle.getString("nose") + "/" + bundle.getString("sensors"), + bundle.getString("nose") + "/" + bundle.getString("sensors")); + addRow("5", bundle.getString("rwing") + "/" + bundle.getString("weapon"), + bundle.getString("rwing") + "/" + bundle.getString("weapon"), + bundle.getString("nose") + "/" + bundle.getString("crew"), + bundle.getString("nose") + "/" + bundle.getString("crew")); + addRow("6", bundle.getString("nose") + "/" + bundle.getString("avionics"), + bundle.getString("aft") + "/" + bundle.getString("engine"), + bundle.getString("wing") + "/" + bundle.getString("weapon"), + bundle.getString("wing") + "/" + bundle.getString("weapon")); + addRow("7", bundle.getString("nose") + "/" + bundle.getString("control"), + bundle.getString("aft") + "/" + bundle.getString("control"), + bundle.getString("wing") + "/" + bundle.getString("avionics"), + bundle.getString("nose") + "/" + bundle.getString("avionics")); + addRow("8", bundle.getString("nose") + "/" + bundle.getString("fcs"), + bundle.getString("aft") + "/" + bundle.getString("engine"), + bundle.getString("wing") + "/" + bundle.getString("bomb"), + bundle.getString("wing") + "/" + bundle.getString("weapon")); + addRow("9", bundle.getString("lwing") + "/" + bundle.getString("weapon"), + bundle.getString("lwing") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("control"), + bundle.getString("aft") + "/" + bundle.getString("control")); + addRow("10", bundle.getString("lwing") + "/" + bundle.getString("heatSink"), + bundle.getString("lwing") + "/" + bundle.getString("fuel"), + bundle.getString("aft") + "/" + bundle.getString("engine"), + bundle.getString("aft") + "/" + bundle.getString("engine")); + addRow("11", bundle.getString("nose") + "/" + bundle.getString("gear"), + bundle.getString("aft") + "/" + bundle.getString("heatSink"), + bundle.getString("wing") + "/" + bundle.getString("gear"), + bundle.getString("wing") + "/" + bundle.getString("gear")); + addRow("12", bundle.getString("nose") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("weapon")); + } + + +} From e4a165b3ef1ae5409926207322f3c33432970f0d Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Mon, 26 Oct 2020 21:35:48 -0500 Subject: [PATCH 02/12] Hit location table for advanced aerospace. --- .../reference/AeroHitLocation.properties | 13 ++++ .../printing/reference/AeroHitLocation.java | 59 ++++++++++++++++--- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/resources/megameklab/com/printing/reference/AeroHitLocation.properties b/resources/megameklab/com/printing/reference/AeroHitLocation.properties index cf0a5d55e..87e2e9d0f 100644 --- a/resources/megameklab/com/printing/reference/AeroHitLocation.properties +++ b/resources/megameklab/com/printing/reference/AeroHitLocation.properties @@ -9,20 +9,33 @@ rwing=Right Wing lwing=Left Wing rside=Right Side lside=Left Side +frontSide=Front Side +aftSide=Aft Side +foreRight=Fore-Right +foreLeft=Fore-Left +aftRight=Aft-Right +aftLeft=Aft-Left avionics=Avionics bomb=Bomb cargo=Cargo +cic=CIC collar=Collar control=Control crew=Crew +dockingCollar=Docking Collar door=Door engine=Engine fcs=FCS fuel=Fuel gear=Gear +gravDeck heatSink=Heat Sink kfBoom=K-F Boom +kfDrive=K-F Drive lifeSupport=Life Support sensors=Sensor thruster=Thruster weapon=Weapon +broadsideWeapon=Broadside Weapon +frontSideWeapon=Front Side Weapon +aftSideWeapon=Aft Side Weapon \ No newline at end of file diff --git a/src/megameklab/com/printing/reference/AeroHitLocation.java b/src/megameklab/com/printing/reference/AeroHitLocation.java index ebf2ee3bd..67e4e76fb 100644 --- a/src/megameklab/com/printing/reference/AeroHitLocation.java +++ b/src/megameklab/com/printing/reference/AeroHitLocation.java @@ -13,6 +13,7 @@ */ package megameklab.com.printing.reference; +import megamek.common.Jumpship; import megamek.common.SmallCraft; import megameklab.com.printing.PrintAero; @@ -20,16 +21,24 @@ * */ public class AeroHitLocation extends ReferenceTable { + private final static double[] capitalOffsets = {0.1, 0.3, 0.55, 0.8}; + private final static double[] standardOffsets = {0.1, 0.3, 0.5, 0.7, 0.9}; public AeroHitLocation(PrintAero sheet) { - super(sheet, 0.1, 0.3, 0.5, 0.7, 0.9); - setHeaders(bundle.getString("dieRoll2d6"), bundle.getString("nose"), - bundle.getString("side"), bundle.getString("aft"), - bundle.getString("aboveBelow")); - if (sheet.getEntity() instanceof SmallCraft) { - addSCDSRows(); + super(sheet, (sheet.getEntity() instanceof Jumpship) ? capitalOffsets : standardOffsets); + if (sheet.getEntity() instanceof Jumpship) { + setHeaders(bundle.getString("dieRoll2d6"), bundle.getString("nose"), + bundle.getString("side"), bundle.getString("aft")); + addAdvancedAeroRows(); } else { - addFighterRows(); + setHeaders(bundle.getString("dieRoll2d6"), bundle.getString("nose"), + bundle.getString("side"), bundle.getString("aft"), + bundle.getString("aboveBelow")); + if (sheet.getEntity() instanceof SmallCraft) { + addSCDSRows(); + } else { + addFighterRows(); + } } } @@ -80,6 +89,42 @@ private void addSCDSRows() { bundle.getString("aft") + "/" + bundle.getString("weapon")); } + private void addAdvancedAeroRows() { + addRow("2", bundle.getString("nose") + "/" + bundle.getString("lifeSupport"), + bundle.getString("aft") + "/" + bundle.getString("fuel"), + bundle.getString("nose") + "/" + bundle.getString("avionics")); + addRow("3", bundle.getString("nose") + "/" + bundle.getString("control"), + bundle.getString("aft") + "/" + bundle.getString("avionics"), + bundle.getString("frontSide") + "/" + bundle.getString("sensors")); + addRow("4", bundle.getString("foreRight") + "/" + bundle.getString("weapon"), + bundle.getString("aftRight") + "/" + bundle.getString("weapon"), + bundle.getString("frontSide") + "/" + bundle.getString("frontSideWeapon")); + addRow("5", bundle.getString("foreRight") + "/" + bundle.getString("thruster"), + bundle.getString("aftRight") + "/" + bundle.getString("thruster"), + bundle.getString("frontSide") + "/" + bundle.getString("dockingCollar")); + addRow("6", bundle.getString("nose") + "/" + bundle.getString("cic"), + bundle.getString("aft") + "/" + bundle.getString("engine"), + bundle.getString("frontSide") + "/" + bundle.getString("kfDrive")); + addRow("7", bundle.getString("nose") + "/" + bundle.getString("weapon"), + bundle.getString("aft") + "/" + bundle.getString("weapon"), + bundle.getString("aftSide") + "/" + bundle.getString("broadsideWeapon")); + addRow("8", bundle.getString("nose") + "/" + bundle.getString("sensors"), + bundle.getString("aft") + "/" + bundle.getString("engine"), + bundle.getString("aftSide") + "/" + bundle.getString("gravDeck")); + addRow("9", bundle.getString("foreLeft") + "/" + bundle.getString("thruster"), + bundle.getString("aftLeft") + "/" + bundle.getString("thruster"), + bundle.getString("aftSide") + "/" + bundle.getString("door")); + addRow("10", bundle.getString("foreLeft") + "/" + bundle.getString("weapon"), + bundle.getString("aftLeft") + "/" + bundle.getString("weapon"), + bundle.getString("aftSide") + "/" + bundle.getString("aftSideWeapon")); + addRow("11", bundle.getString("nose") + "/" + bundle.getString("crew"), + bundle.getString("aft") + "/" + bundle.getString("control"), + bundle.getString("aft") + "/" + bundle.getString("cargo")); + addRow("12", bundle.getString("nose") + "/" + bundle.getString("kfDrive"), + bundle.getString("aft") + "/" + bundle.getString("kfDrive"), + bundle.getString("aft") + "/" + bundle.getString("engine")); + } + private void addFighterRows() { addRow("2", bundle.getString("nose") + "/" + bundle.getString("weapon"), bundle.getString("aft") + "/" + bundle.getString("weapon"), From f10ae3f8ae2644da01da182a0b72839c5cb21a94 Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Mon, 26 Oct 2020 22:30:11 -0500 Subject: [PATCH 03/12] Hit mods table for aerospace --- .../reference/AeroToHitMods.properties | 34 +++++++ src/megameklab/com/printing/PrintAero.java | 1 + .../com/printing/reference/AeroToHitMods.java | 92 +++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 resources/megameklab/com/printing/reference/AeroToHitMods.properties create mode 100644 src/megameklab/com/printing/reference/AeroToHitMods.java diff --git a/resources/megameklab/com/printing/reference/AeroToHitMods.properties b/resources/megameklab/com/printing/reference/AeroToHitMods.properties new file mode 100644 index 000000000..061cb2fba --- /dev/null +++ b/resources/megameklab/com/printing/reference/AeroToHitMods.properties @@ -0,0 +1,34 @@ +title=TO-HIT MODIFIERS +range=Range +short=Short +medium=Medium +long=Long +extreme=Extreme +targetInterveningConditions=Target/Intervening conditions +attackAgainstAft=Attack against aft +attackAgainstSide=Attack against side +attackAgainstNose=Attack against nose +flyingAtNOE=Attacker flying at altitude 1\nattacking air target +secondaryTargetForward=Secondary target in fwd arc +secondaryTarget=Secondary target in other arc +targetAirToGround=Target is conducting\nair-to-ground attack +target0velocity=Target is at zero velocity +capitalAgainstSmallTarget=Capital scale weapon vs.\ntarget less than 500 tons +subcapitalAgainstSmallTarget=Sub-capital scale weapon vs.\ntarget less than 500 tons +firingThroughAtmosphere=Firing through atmospheric\nhex on high altitude map +screenHex=Firing into or out of screen hex +targetEvading=Target is evading +attackerConditions=Attacker Conditions +excessThrust=Exceeded safe thrust this turn +outOfControl=Out of control +pilotDamage=Pilot damage +crewDamage=Crew damage +cicDamage=CIC damage +fcsDamage=FCS damage +sensorsHit=Sensor damage +sensorsDestroyed=Sensors destroyed +attackerEvading=Attacker evading + +variable=variable +perHit=/hit +perHex=/hex \ No newline at end of file diff --git a/src/megameklab/com/printing/PrintAero.java b/src/megameklab/com/printing/PrintAero.java index b35723b5b..806e80220 100644 --- a/src/megameklab/com/printing/PrintAero.java +++ b/src/megameklab/com/printing/PrintAero.java @@ -289,6 +289,7 @@ protected boolean includeReferenceCharts() { @Override protected List getRightSideReferenceTables() { List list = new ArrayList<>(); + list.add(new AeroToHitMods(this)); return list; } diff --git a/src/megameklab/com/printing/reference/AeroToHitMods.java b/src/megameklab/com/printing/reference/AeroToHitMods.java new file mode 100644 index 000000000..0f59f57a6 --- /dev/null +++ b/src/megameklab/com/printing/reference/AeroToHitMods.java @@ -0,0 +1,92 @@ +/* + * MegaMekLab - Copyright (C) 2020 - The MegaMek Team + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + */ +package megameklab.com.printing.reference; + +import megamek.common.*; +import megameklab.com.printing.PrintAero; +import org.apache.batik.util.SVGConstants; + +/** + * Table for attack roll mods for aerospace units + */ +public class AeroToHitMods extends ReferenceTable { + private final Entity entity; + private final boolean spaceOnly; + + public AeroToHitMods(PrintAero sheet) { + super(sheet, 0.02, 0.08, 0.8); + this.entity = sheet.getEntity(); + spaceOnly = (entity instanceof Jumpship) + || entity.getMovementMode().equals(EntityMovementMode.STATION_KEEPING); + setColumnAnchor(0, SVGConstants.SVG_START_VALUE); + setColumnAnchor(1, SVGConstants.SVG_START_VALUE); + + addMods(); + } + + private void addMods() { + addRow(bundle.getString("range"), "", ""); + addRow("", bundle.getString("short"), "+0"); + addRow("", bundle.getString("medium"), "+2"); + addRow("", bundle.getString("long"), "+4"); + addRow("", bundle.getString("extreme"), "+6"); + + addRow(bundle.getString("targetInterveningConditions"), "", ""); + addRow("", bundle.getString("attackAgainstAft"), "+0"); + addRow("", bundle.getString("attackAgainstSide"), "+1"); + addRow("", bundle.getString("attackAgainstNose"), "+2"); + if (!spaceOnly) { + addRow("", bundle.getString("flyingAtNOE"), + (entity.isOmni() && !entity.isSupportVehicle()) ? "+1" : "+2"); + } + addRow("", bundle.getString("secondaryTargetForward"), "+1"); + addRow("", bundle.getString("secondaryTarget"), "+2"); + if (!spaceOnly) { + addRow("", bundle.getString("targetAirToGround"), "-3"); + } + addRow("", bundle.getString("target0velocity"), "-2"); + if (entity.getWeaponList().stream().map(m -> (WeaponType) m.getType()) + .filter(w -> w.getAtClass() != WeaponType.CLASS_CAPITAL_MISSILE) + .anyMatch(WeaponType::isCapital)) { + addRow("", bundle.getString("capitalAgainstSmallTarget"), "+5"); + } + if (entity.getWeaponList().stream().map(m -> (WeaponType) m.getType()) + .filter(w -> w.getAtClass() != WeaponType.CLASS_CAPITAL_MISSILE) + .anyMatch(WeaponType::isSubCapital)) { + addRow("", bundle.getString("subcapitalAgainstSmallTarget"), "+3"); + } + if (!(entity instanceof ConvFighter)) { + addRow("", bundle.getString("firingThroughAtmosphere"), "+2" + bundle.getString("perHex")); + addRow("", bundle.getString("screenHex"), "+2"); + } + addRow("", bundle.getString("targetEvading"), bundle.getString("variable")); + + addRow(bundle.getString("attackerConditions"), "", ""); + addRow("", bundle.getString("excessThrust"), "+2"); + addRow("", bundle.getString("outOfControl"), "+2"); + if (entity.isFighter() && !entity.isSupportVehicle()) { + addRow("", bundle.getString("pilotDamage"), "+2"); + } else { + addRow("", bundle.getString("crewDamage"), "+2"); + } + if (entity instanceof Jumpship) { + addRow("", bundle.getString("cicDamage"), "+2" + bundle.getString("perHit")); + } else { + addRow("", bundle.getString("fcsDamage"), "+2" + bundle.getString("perHit")); + } + addRow("", bundle.getString("sensorsHit"), "+1" + bundle.getString("perHit")); + addRow("", bundle.getString("sensorsDestroyed"), "+5"); + addRow("", bundle.getString("attackerEvading"), bundle.getString("variable")); + } +} From 6067126a0f533706ad6b1f472a1a5ee5708588f7 Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Tue, 27 Oct 2020 14:38:18 -0500 Subject: [PATCH 04/12] Remove secondary target mods for large craft. --- src/megameklab/com/printing/reference/AeroToHitMods.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/megameklab/com/printing/reference/AeroToHitMods.java b/src/megameklab/com/printing/reference/AeroToHitMods.java index 0f59f57a6..2f55addc1 100644 --- a/src/megameklab/com/printing/reference/AeroToHitMods.java +++ b/src/megameklab/com/printing/reference/AeroToHitMods.java @@ -50,8 +50,10 @@ private void addMods() { addRow("", bundle.getString("flyingAtNOE"), (entity.isOmni() && !entity.isSupportVehicle()) ? "+1" : "+2"); } - addRow("", bundle.getString("secondaryTargetForward"), "+1"); - addRow("", bundle.getString("secondaryTarget"), "+2"); + if (!entity.isLargeCraft()) { + addRow("", bundle.getString("secondaryTargetForward"), "+1"); + addRow("", bundle.getString("secondaryTarget"), "+2"); + } if (!spaceOnly) { addRow("", bundle.getString("targetAirToGround"), "-3"); } From 99cc29ce1922d9c91f9d1bec1fc7172218b67411 Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Tue, 27 Oct 2020 14:52:44 -0500 Subject: [PATCH 05/12] Only add tables to first page of multi-page sheet. --- src/megameklab/com/printing/PrintEntity.java | 2 +- src/megameklab/com/printing/PrintRecordSheet.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/megameklab/com/printing/PrintEntity.java b/src/megameklab/com/printing/PrintEntity.java index ac83ac57c..c3f478457 100644 --- a/src/megameklab/com/printing/PrintEntity.java +++ b/src/megameklab/com/printing/PrintEntity.java @@ -190,7 +190,7 @@ protected void processImage(int pageNum, PageFormat pageFormat) { drawEraIcon(); } drawFluffImage(); - if (includeReferenceCharts()) { + if ((pageNum == 0) && includeReferenceCharts()) { addReferenceCharts(pageFormat); } } diff --git a/src/megameklab/com/printing/PrintRecordSheet.java b/src/megameklab/com/printing/PrintRecordSheet.java index 789356bfa..9b003afed 100644 --- a/src/megameklab/com/printing/PrintRecordSheet.java +++ b/src/megameklab/com/printing/PrintRecordSheet.java @@ -292,7 +292,7 @@ void createDocument(int pageIndex, PageFormat pageFormat, boolean addMargin) { svgGenerator = new SVGGraphics2D(context, false); double ratio = Math.min(pageFormat.getImageableWidth() / (options.getPaperSize().pxWidth - 36), pageFormat.getPaper().getImageableHeight() / (options.getPaperSize().pxHeight - 36)); - if (includeReferenceCharts()) { + if ((pageIndex == firstPage) && includeReferenceCharts()) { ratio *= TABLE_RATIO; } Element svgRoot = svgDocument.getDocumentElement(); From fe282dde3755414f755d881c436e51e7cbafd2fa Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Tue, 27 Oct 2020 21:12:25 -0500 Subject: [PATCH 06/12] Control roll table --- .../reference/ControlRollTable.properties | 23 +++++ src/megameklab/com/printing/PrintAero.java | 1 + .../printing/reference/ControlRollTable.java | 85 +++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 resources/megameklab/com/printing/reference/ControlRollTable.properties create mode 100644 src/megameklab/com/printing/reference/ControlRollTable.java diff --git a/resources/megameklab/com/printing/reference/ControlRollTable.properties b/resources/megameklab/com/printing/reference/ControlRollTable.properties new file mode 100644 index 000000000..b9e747f6e --- /dev/null +++ b/resources/megameklab/com/printing/reference/ControlRollTable.properties @@ -0,0 +1,23 @@ +title=CONTROL ROLL TABLE +situation=Situation +movement=Movement +exceedCeiling=Exceed normal operating ceiling +rollMoreThanOnce=Roll more than once in a turn +thrustExceedsSI=Use thrust > current SI +velocityOver2xThrust=Velocity > 2x safe thrust\nin atmosphere +stalling=Stalling +descending3plus=Descending 3+ altitudes in a turn +damage=Damage +avionicsCritical=Avionics critical +controlCritical=Control critical +damagedInAtmosphere=Damaged in atmosphere +modifiers=Modifiers +pilotDamage=Pilot damage +crewDamage=Crew damage +avionicsDamage=Avionics damage +lifeSupportDamage=Life support damage +atmosphericOperations=Atmospheric operations +aboveSafeThrust=Above safe thrust +above2xSafeThrust=Velocity above 2x safe thrust +perHit=/hit +perPoint=/point diff --git a/src/megameklab/com/printing/PrintAero.java b/src/megameklab/com/printing/PrintAero.java index 806e80220..bc0e8bbfc 100644 --- a/src/megameklab/com/printing/PrintAero.java +++ b/src/megameklab/com/printing/PrintAero.java @@ -290,6 +290,7 @@ protected boolean includeReferenceCharts() { protected List getRightSideReferenceTables() { List list = new ArrayList<>(); list.add(new AeroToHitMods(this)); + list.add(new ControlRollTable(this)); return list; } diff --git a/src/megameklab/com/printing/reference/ControlRollTable.java b/src/megameklab/com/printing/reference/ControlRollTable.java new file mode 100644 index 000000000..1060f4170 --- /dev/null +++ b/src/megameklab/com/printing/reference/ControlRollTable.java @@ -0,0 +1,85 @@ +/* + * MegaMekLab - Copyright (C) 2020 - The MegaMek Team + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + */ +package megameklab.com.printing.reference; + +import megamek.common.*; +import megameklab.com.printing.PrintAero; +import org.apache.batik.util.SVGConstants; + +/** + * Control roll situations and modifiers for aerospace units + */ +public class ControlRollTable extends ReferenceTable { + + private final Entity entity; + private final boolean spaceOnly; + private final boolean atmosphereOnly; + + public ControlRollTable(PrintAero sheet) { + super(sheet, 0.02, 0.08, 0.14, 0.8); + setColumnAnchor(0, SVGConstants.SVG_START_VALUE); + setColumnAnchor(1, SVGConstants.SVG_START_VALUE); + setColumnAnchor(2, SVGConstants.SVG_START_VALUE); + entity = sheet.getEntity(); + // Capital ships and satellite SVs + spaceOnly = (entity instanceof Jumpship) || entity.getMovementMode().equals(EntityMovementMode.STATION_KEEPING); + // Conventional fighters, fixed wing support, and airships + atmosphereOnly = (entity instanceof ConvFighter) && !spaceOnly; + addMods(); + } + + private void addMods() { + addRow(bundle.getString("situation"), "", "", ""); + if (entity.getWalkMP() > 0) { + addRow("", bundle.getString("movement"), "", ""); + if (atmosphereOnly) { + addRow("", "", bundle.getString("exceedCeiling"), ""); + } + addRow("", "", bundle.getString("rollMoreThanOnce") + "", ""); + if (entity.getWalkMP() > 0) { + addRow("", "", bundle.getString("thrustExceedsSI") + "", ""); + } + if (!spaceOnly) { + addRow("", "", bundle.getString("velocityOver2xThrust") + "", ""); + addRow("", "", bundle.getString("stalling") + "", ""); + addRow("", "", bundle.getString("descending3plus") + "", ""); + } + } + addRow("", bundle.getString("damage"), "", ""); + addRow("", "", bundle.getString("avionicsCritical"), ""); + addRow("", "", bundle.getString("controlCritical"), ""); + if (!spaceOnly) { + addRow("", "", bundle.getString("damagedInAtmosphere"), ""); + } + + addRow(bundle.getString("modifiers"), "", "", ""); + if ((entity instanceof SmallCraft) || (entity instanceof Jumpship) + || entity.isSupportVehicle()) { + addRow("", bundle.getString("crewDamage"), "", "+1" + bundle.getString("perHit")); + } else { + addRow("", bundle.getString("pilotDamage"), "", "+1" + bundle.getString("perHit")); + } + addRow("", bundle.getString("avionicsDamage"), "", "+1" + bundle.getString("perHit")); + addRow("", bundle.getString("lifeSupportDamage"), "", "+1" + bundle.getString("perHit")); + if (!spaceOnly) { + addRow("", bundle.getString("atmosphericOperations"), "", "+2"); + } + if (entity.getWalkMP() > 0) { + addRow("", bundle.getString("aboveSafeThrust"), "", "+1"); + if (!spaceOnly) { + addRow("", bundle.getString("above2xSafeThrust"), "", "+1" + bundle.getString("perPoint")); + } + } + } +} From 483e5e8d7c8c4bc8ca71762a9f4b72b96d8a279b Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Tue, 27 Oct 2020 21:24:36 -0500 Subject: [PATCH 07/12] Fill in attacker evasion mod. --- .../com/printing/reference/AeroToHitMods.properties | 1 + src/megameklab/com/printing/reference/AeroToHitMods.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/megameklab/com/printing/reference/AeroToHitMods.properties b/resources/megameklab/com/printing/reference/AeroToHitMods.properties index 061cb2fba..ac7c3e4e2 100644 --- a/resources/megameklab/com/printing/reference/AeroToHitMods.properties +++ b/resources/megameklab/com/printing/reference/AeroToHitMods.properties @@ -28,6 +28,7 @@ fcsDamage=FCS damage sensorsHit=Sensor damage sensorsDestroyed=Sensors destroyed attackerEvading=Attacker evading +prohibited=Prohibited variable=variable perHit=/hit diff --git a/src/megameklab/com/printing/reference/AeroToHitMods.java b/src/megameklab/com/printing/reference/AeroToHitMods.java index 2f55addc1..ce5665a6f 100644 --- a/src/megameklab/com/printing/reference/AeroToHitMods.java +++ b/src/megameklab/com/printing/reference/AeroToHitMods.java @@ -89,6 +89,10 @@ private void addMods() { } addRow("", bundle.getString("sensorsHit"), "+1" + bundle.getString("perHit")); addRow("", bundle.getString("sensorsDestroyed"), "+5"); - addRow("", bundle.getString("attackerEvading"), bundle.getString("variable")); + if (entity.isLargeCraft()) { + addRow("", bundle.getString("attackerEvading"), "+2"); + } else if (!entity.getMovementMode().equals(EntityMovementMode.AIRSHIP)) { + addRow("", bundle.getString("attackerEvading"), bundle.getString("prohibited")); + } } } From f6efb3cae24be32a817300d6cd557febdf67a3bf Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Tue, 27 Oct 2020 21:38:57 -0500 Subject: [PATCH 08/12] Added atmospheric operations control roll mods. --- .../printing/reference/ControlRollTable.properties | 5 +++-- .../com/printing/reference/ControlRollTable.java | 14 +++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/resources/megameklab/com/printing/reference/ControlRollTable.properties b/resources/megameklab/com/printing/reference/ControlRollTable.properties index b9e747f6e..84d03731c 100644 --- a/resources/megameklab/com/printing/reference/ControlRollTable.properties +++ b/resources/megameklab/com/printing/reference/ControlRollTable.properties @@ -16,8 +16,9 @@ pilotDamage=Pilot damage crewDamage=Crew damage avionicsDamage=Avionics damage lifeSupportDamage=Life support damage -atmosphericOperations=Atmospheric operations aboveSafeThrust=Above safe thrust -above2xSafeThrust=Velocity above 2x safe thrust +atmosphericOperations=Atmospheric operations +per20points=Per 20 points of damage +above2xSafeThrust=Velocity above 2x\nsafe thrust perHit=/hit perPoint=/point diff --git a/src/megameklab/com/printing/reference/ControlRollTable.java b/src/megameklab/com/printing/reference/ControlRollTable.java index 1060f4170..00fd3a490 100644 --- a/src/megameklab/com/printing/reference/ControlRollTable.java +++ b/src/megameklab/com/printing/reference/ControlRollTable.java @@ -72,14 +72,18 @@ private void addMods() { } addRow("", bundle.getString("avionicsDamage"), "", "+1" + bundle.getString("perHit")); addRow("", bundle.getString("lifeSupportDamage"), "", "+1" + bundle.getString("perHit")); - if (!spaceOnly) { - addRow("", bundle.getString("atmosphericOperations"), "", "+2"); - } if (entity.getWalkMP() > 0) { addRow("", bundle.getString("aboveSafeThrust"), "", "+1"); - if (!spaceOnly) { - addRow("", bundle.getString("above2xSafeThrust"), "", "+1" + bundle.getString("perPoint")); + } + if (!spaceOnly) { + // Combining +2 atmospheric mod with the unit type adjustment + if (entity instanceof Dropship) { + addRow("", bundle.getString("atmosphericOperations"), "", ((Dropship) entity).isSpheroid() ? "+3" : "+2"); + } else { + addRow("", bundle.getString("atmosphericOperations"), "", "+1"); } + addRow("", "", bundle.getString("per20points"), "+1"); + addRow("", "", bundle.getString("above2xSafeThrust"), "+1" + bundle.getString("perPoint")); } } } From 0aa7cea9c18b3179a41266ef5eccb5db91d38744 Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Wed, 28 Oct 2020 10:42:07 -0500 Subject: [PATCH 09/12] Straight movement table --- .../StraightMovementTable.properties | 4 + src/megameklab/com/printing/PrintAero.java | 3 + .../reference/StraightMovementTable.java | 129 ++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 resources/megameklab/com/printing/reference/StraightMovementTable.properties create mode 100644 src/megameklab/com/printing/reference/StraightMovementTable.java diff --git a/resources/megameklab/com/printing/reference/StraightMovementTable.properties b/resources/megameklab/com/printing/reference/StraightMovementTable.properties new file mode 100644 index 000000000..3318fdd8d --- /dev/null +++ b/resources/megameklab/com/printing/reference/StraightMovementTable.properties @@ -0,0 +1,4 @@ +title=STRAIGHT MOVEMENT +velocity=Velocity +lowAltitude=Low Altitude\nMap +ground=Ground Map \ No newline at end of file diff --git a/src/megameklab/com/printing/PrintAero.java b/src/megameklab/com/printing/PrintAero.java index bc0e8bbfc..276be102b 100644 --- a/src/megameklab/com/printing/PrintAero.java +++ b/src/megameklab/com/printing/PrintAero.java @@ -291,6 +291,9 @@ protected List getRightSideReferenceTables() { List list = new ArrayList<>(); list.add(new AeroToHitMods(this)); list.add(new ControlRollTable(this)); + if (aero.isFighter() || ((aero instanceof SmallCraft) && !aero.isSpheroid())) { + list.add(new StraightMovementTable(this)); + } return list; } diff --git a/src/megameklab/com/printing/reference/StraightMovementTable.java b/src/megameklab/com/printing/reference/StraightMovementTable.java new file mode 100644 index 000000000..9a8bbbf50 --- /dev/null +++ b/src/megameklab/com/printing/reference/StraightMovementTable.java @@ -0,0 +1,129 @@ +/* + * MegaMekLab - Copyright (C) 2020 - The MegaMek Team + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + */ +package megameklab.com.printing.reference; + +import megamek.common.ConvFighter; +import megamek.common.Dropship; +import megamek.common.EntityMovementMode; +import megamek.common.SmallCraft; +import megameklab.com.printing.PrintAero; + +/** + * For aerodyne units + */ +public class StraightMovementTable extends ReferenceTable { + + public StraightMovementTable(PrintAero sheet) { + super(sheet, 0.1, 0.45, 0.8); + setHeaders(bundle.getString("velocity"), bundle.getString("lowAltitude"), + bundle.getString("ground")); + if ((sheet.getEntity() instanceof Dropship) + || sheet.getEntity().getMovementMode().equals(EntityMovementMode.AIRSHIP)) { + addDropshipRows(); + } else if (sheet.getEntity() instanceof SmallCraft) { + addSmallCraftRows(); + } else if (sheet.getEntity().isSupportVehicle()) { + addFixedWingRows(); + } else if (sheet.getEntity() instanceof ConvFighter) { + addCFRows(); + } else { + addASFRows(); + } + } + + private void addDropshipRows() { + addRow("1", "1", "8"); + addRow("2", "1", "16"); + addRow("3", "1", "24"); + addRow("4", "2", "32"); + addRow("5", "2", "40"); + addRow("6", "2", "48"); + addRow("7", "3", "56"); + addRow("8", "3", "64"); + addRow("9", "3", "72"); + addRow("10", "4", "80"); + addRow("11", "4", "88"); + addRow("12", "4", "96"); + addRow("13-15", "5", "-"); + addRow("16+", "6", "-"); + } + + private void addSmallCraftRows() { + addRow("1", "1", "8"); + addRow("2", "1", "14"); + addRow("3", "1", "20"); + addRow("4", "1", "26"); + addRow("5", "1", "32"); + addRow("6", "1", "38"); + addRow("7", "2", "44"); + addRow("8", "2", "50"); + addRow("9", "2", "56"); + addRow("10", "3", "62"); + addRow("11", "3", "68"); + addRow("12", "3", "74"); + addRow("13-15", "4", "-"); + addRow("16+", "5", "-"); + } + + private void addCFRows() { + addRow("1", "1", "8"); + addRow("2", "1", "12"); + addRow("3", "1", "16"); + addRow("4", "1", "20"); + addRow("5", "1", "24"); + addRow("6", "1", "28"); + addRow("7", "1", "32"); + addRow("8", "1", "36"); + addRow("9", "1", "40"); + addRow("10", "2", "44"); + addRow("11", "2", "48"); + addRow("12", "2", "52"); + addRow("13-15", "3", "-"); + addRow("16+", "4", "-"); + } + + private void addFixedWingRows() { + addRow("1", "2", "8"); + addRow("2", "2", "14"); + addRow("3", "2", "20"); + addRow("4", "2", "26"); + addRow("5", "2", "32"); + addRow("6", "2", "38"); + addRow("7", "2", "44"); + addRow("8", "2", "50"); + addRow("9", "2", "56"); + addRow("10", "4", "62"); + addRow("11", "4", "68"); + addRow("12", "4", "74"); + addRow("13-15", "6", "-"); + addRow("16+", "8", "-"); + } + + private void addASFRows() { + addRow("1", "1", "8"); + addRow("2", "1", "12"); + addRow("3", "1", "16"); + addRow("4", "1", "20"); + addRow("5", "1", "24"); + addRow("6", "1", "28"); + addRow("7", "2", "32"); + addRow("8", "2", "36"); + addRow("9", "2", "40"); + addRow("10", "3", "44"); + addRow("11", "3", "48"); + addRow("12", "3", "52"); + addRow("13-15", "4", "-"); + addRow("16+", "5", "-"); + } +} From 7c31609135b80352a825c0b15a5dd00d317c506b Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Wed, 28 Oct 2020 11:03:52 -0500 Subject: [PATCH 10/12] Space map facing change cost table. --- .../ChangingFacingCostTable.properties | 4 ++ src/megameklab/com/printing/PrintAero.java | 3 ++ .../reference/ChangingFacingCostTable.java | 37 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 resources/megameklab/com/printing/reference/ChangingFacingCostTable.properties create mode 100644 src/megameklab/com/printing/reference/ChangingFacingCostTable.java diff --git a/resources/megameklab/com/printing/reference/ChangingFacingCostTable.properties b/resources/megameklab/com/printing/reference/ChangingFacingCostTable.properties new file mode 100644 index 000000000..131e78fd0 --- /dev/null +++ b/resources/megameklab/com/printing/reference/ChangingFacingCostTable.properties @@ -0,0 +1,4 @@ +title=CHANGING FACING COST +velocity=Velocity +thrustPoints=Thrust\npoints +plus1perPoint=+1/point \ No newline at end of file diff --git a/src/megameklab/com/printing/PrintAero.java b/src/megameklab/com/printing/PrintAero.java index 276be102b..f362ecb8a 100644 --- a/src/megameklab/com/printing/PrintAero.java +++ b/src/megameklab/com/printing/PrintAero.java @@ -294,6 +294,9 @@ protected List getRightSideReferenceTables() { if (aero.isFighter() || ((aero instanceof SmallCraft) && !aero.isSpheroid())) { list.add(new StraightMovementTable(this)); } + if (!(aero instanceof ConvFighter) && !(aero instanceof SpaceStation)) { + list.add(new ChangingFacingCostTable(this)); + } return list; } diff --git a/src/megameklab/com/printing/reference/ChangingFacingCostTable.java b/src/megameklab/com/printing/reference/ChangingFacingCostTable.java new file mode 100644 index 000000000..eba16c317 --- /dev/null +++ b/src/megameklab/com/printing/reference/ChangingFacingCostTable.java @@ -0,0 +1,37 @@ +/* + * MegaMekLab - Copyright (C) 2020 - The MegaMek Team + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + */ +package megameklab.com.printing.reference; + +import megameklab.com.printing.PrintAero; +import org.apache.batik.util.SVGConstants; + +/** + * Thrust point cost to change facing on a space or high-altitude map + */ +public class ChangingFacingCostTable extends ReferenceTable { + + public ChangingFacingCostTable(PrintAero sheet) { + super(sheet, 0.1, 0.35, 0.6, 0.85); + setHeaders(bundle.getString("velocity"), bundle.getString("thrustPoints"), + bundle.getString("velocity"), bundle.getString("thrustPoints")); + addRows(); + } + + private void addRows() { + addRow("0-2", "1", "10", "5"); + addRow("3-5", "2", "11", "6"); + addRow("6-7", "3", "12", bundle.getString("plus1perPoint")); + addRow("8-9", "4", "", ""); + } +} From d8723c463424c4d6318974c15cc0622a417cb2f6 Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Wed, 28 Oct 2020 11:42:08 -0500 Subject: [PATCH 11/12] Air-to-ground attack table. --- .../AirToGroundAttackTable.properties | 9 +++ src/megameklab/com/printing/PrintAero.java | 22 ++++-- .../reference/AirToGroundAttackTable.java | 68 +++++++++++++++++++ 3 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 resources/megameklab/com/printing/reference/AirToGroundAttackTable.properties create mode 100644 src/megameklab/com/printing/reference/AirToGroundAttackTable.java diff --git a/resources/megameklab/com/printing/reference/AirToGroundAttackTable.properties b/resources/megameklab/com/printing/reference/AirToGroundAttackTable.properties new file mode 100644 index 000000000..3dc910d56 --- /dev/null +++ b/resources/megameklab/com/printing/reference/AirToGroundAttackTable.properties @@ -0,0 +1,9 @@ +title=AIR-TO-GROUND ATTACKS +attackType=Attack Type +modifier=Modifier +altitude=Altitude +strafing=Strafing +striking=Striking +diveBombing=Dive bombing +altitudeBombing=Altitude bombing +plusAltitude=+altitude \ No newline at end of file diff --git a/src/megameklab/com/printing/PrintAero.java b/src/megameklab/com/printing/PrintAero.java index f362ecb8a..718e7f69d 100644 --- a/src/megameklab/com/printing/PrintAero.java +++ b/src/megameklab/com/printing/PrintAero.java @@ -303,9 +303,23 @@ protected List getRightSideReferenceTables() { @Override protected void addReferenceCharts(PageFormat pageFormat) { super.addReferenceCharts(pageFormat); - AeroHitLocation table = new AeroHitLocation(this); - getSVGDocument().getDocumentElement().appendChild(table.createTable(pageFormat.getImageableX(), - pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0, - pageFormat.getImageableWidth() * 0.5, pageFormat.getImageableHeight() * 0.2 - 3.0)); + ReferenceTable table = new AeroHitLocation(this); + if ((getEntity() instanceof Jumpship) + || (getEntity().getMovementMode().equals(EntityMovementMode.STATION_KEEPING))) { + getSVGDocument().getDocumentElement().appendChild(table.createTable(pageFormat.getImageableX(), + pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0, + pageFormat.getImageableWidth() * TABLE_RATIO, pageFormat.getImageableHeight() * 0.2 - 3.0)); + } else { + double x = pageFormat.getImageableX(); + getSVGDocument().getDocumentElement().appendChild(table.createTable(x, + pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0, + pageFormat.getImageableWidth() * 0.5 - 3.0, pageFormat.getImageableHeight() * 0.2 - 3.0)); + x += pageFormat.getImageableWidth() * 0.5; + table = new AirToGroundAttackTable(this); + getSVGDocument().getDocumentElement().appendChild(table.createTable(x, + pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0, + pageFormat.getImageableWidth() * (TABLE_RATIO - 0.5), + pageFormat.getImageableHeight() * 0.2 - 3.0)); + } } } \ No newline at end of file diff --git a/src/megameklab/com/printing/reference/AirToGroundAttackTable.java b/src/megameklab/com/printing/reference/AirToGroundAttackTable.java new file mode 100644 index 000000000..90cf71bd0 --- /dev/null +++ b/src/megameklab/com/printing/reference/AirToGroundAttackTable.java @@ -0,0 +1,68 @@ +/* + * MegaMekLab - Copyright (C) 2020 - The MegaMek Team + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + */ +package megameklab.com.printing.reference; + +import megamek.common.*; +import megameklab.com.printing.PrintAero; +import org.apache.batik.util.SVGConstants; + +/** + * Hit mods and altitude requirements for air-to-ground attacks + */ +public class AirToGroundAttackTable extends ReferenceTable { + + private final Aero aero; + + public AirToGroundAttackTable(PrintAero sheet) { + super(sheet, 0.02, 0.5, 0.8); + this.aero = (Aero) sheet.getEntity(); + setHeaders(bundle.getString("attackType"), bundle.getString("modifier"), + bundle.getString("altitude")); + setColumnAnchor(0, SVGConstants.SVG_START_VALUE); + addRows(); + } + + private void addRows() { + if (canStrafe()) { + addRow(bundle.getString("strafing"), "+4", "1-3"); + } + addRow(bundle.getString("striking"), "+2", "2-5"); + if (canBomb()) { + addRow(bundle.getString("diveBombing"), "+2", "3-5"); + addRow(bundle.getString("altitudeBombing"), "+2", "1+"); + addRow("", bundle.getString("plusAltitude"), ""); + } + } + + private boolean canStrafe() { + if (aero.isSpheroid()) { + return false; + } + for (Mounted mounted : aero.getIndividualWeaponList()) { + if (mounted.getType().hasFlag(WeaponType.F_ENERGY) + && ((WeaponType) mounted.getType()).getAmmoType() == AmmoType.F_NONE) { + return true; + } + } + return false; + } + + private boolean canBomb() { + if (aero.isSupportVehicle()) { + return aero.hasWorkingMisc(MiscType.F_EXTERNAL_STORES_HARDPOINT); + } else { + return aero.isFighter(); + } + } +} From c2c5063155962c92cb076f7f1c02dcfa49dbf153 Mon Sep 17 00:00:00 2001 From: Carl Spain Date: Sat, 31 Oct 2020 14:02:47 -0500 Subject: [PATCH 12/12] Random movement table. --- .../reference/RandomMovementTable.properties | 8 +++ src/megameklab/com/printing/PrintAero.java | 14 ++++- .../reference/RandomMovementTable.java | 55 +++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 resources/megameklab/com/printing/reference/RandomMovementTable.properties create mode 100644 src/megameklab/com/printing/reference/RandomMovementTable.java diff --git a/resources/megameklab/com/printing/reference/RandomMovementTable.properties b/resources/megameklab/com/printing/reference/RandomMovementTable.properties new file mode 100644 index 000000000..46a687222 --- /dev/null +++ b/resources/megameklab/com/printing/reference/RandomMovementTable.properties @@ -0,0 +1,8 @@ +title=RANDOM MOVEMENT TABLE +d6result=1D6\nResult +effect=Effect +fwd1l2=Forward 1 hex, left 2 hexsides +fwd1l1=Forward 1 hex, left 1 hexside +fwd1=Forward 1 hex +fwd1r1=Forward 1 hex, right 1 hexside +fwd1r2=Forward 1 hex, right 2 hexsides diff --git a/src/megameklab/com/printing/PrintAero.java b/src/megameklab/com/printing/PrintAero.java index 718e7f69d..2a3833c7f 100644 --- a/src/megameklab/com/printing/PrintAero.java +++ b/src/megameklab/com/printing/PrintAero.java @@ -297,6 +297,10 @@ protected List getRightSideReferenceTables() { if (!(aero instanceof ConvFighter) && !(aero instanceof SpaceStation)) { list.add(new ChangingFacingCostTable(this)); } + // This goes at the bottom for other units + if (aero instanceof Warship) { + list.add(new RandomMovementTable(this, true)); + } return list; } @@ -311,15 +315,21 @@ protected void addReferenceCharts(PageFormat pageFormat) { pageFormat.getImageableWidth() * TABLE_RATIO, pageFormat.getImageableHeight() * 0.2 - 3.0)); } else { double x = pageFormat.getImageableX(); + double height = pageFormat.getImageableHeight() * (1 - TABLE_RATIO); getSVGDocument().getDocumentElement().appendChild(table.createTable(x, pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0, - pageFormat.getImageableWidth() * 0.5 - 3.0, pageFormat.getImageableHeight() * 0.2 - 3.0)); + pageFormat.getImageableWidth() * 0.5 - 3.0, height - 3.0)); x += pageFormat.getImageableWidth() * 0.5; table = new AirToGroundAttackTable(this); getSVGDocument().getDocumentElement().appendChild(table.createTable(x, pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0, pageFormat.getImageableWidth() * (TABLE_RATIO - 0.5), - pageFormat.getImageableHeight() * 0.2 - 3.0)); + height * 0.5 - 3.0)); + table = new RandomMovementTable(this, false); + getSVGDocument().getDocumentElement().appendChild(table.createTable(x, + pageFormat.getImageableY() + pageFormat.getImageableHeight() * TABLE_RATIO + 3.0 + height * 0.5, + pageFormat.getImageableWidth() * (TABLE_RATIO - 0.5), + height * 0.5 - 3.0)); } } } \ No newline at end of file diff --git a/src/megameklab/com/printing/reference/RandomMovementTable.java b/src/megameklab/com/printing/reference/RandomMovementTable.java new file mode 100644 index 000000000..101b27a20 --- /dev/null +++ b/src/megameklab/com/printing/reference/RandomMovementTable.java @@ -0,0 +1,55 @@ +/* + * MegaMekLab - Copyright (C) 2020 - The MegaMek Team + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + */ +package megameklab.com.printing.reference; + +import megameklab.com.printing.PrintAero; +import org.apache.batik.util.SVGConstants; + +/** + * Aerospace random movement due to heat or failed control roll by 5+ + */ +public class RandomMovementTable extends ReferenceTable { + + private final boolean breakLines; + + /** + * @param sheet The record sheet + * @param breakLines If true, long lines will be spit at the comma. This permits + * the same table to be used in multiple places that have different + * width requirements. + */ + public RandomMovementTable(PrintAero sheet, boolean breakLines) { + super(sheet, 0.1, 0.35); + this.breakLines = breakLines; + setHeaders(bundle.getString("d6result"), bundle.getString("effect")); + setColumnAnchor(1, SVGConstants.SVG_START_VALUE); + addRows(); + } + + private String handleLine(String str) { + if (breakLines) { + return str.replace(", ", "\n"); + } else { + return str; + } + } + + private void addRows() { + addRow("1", handleLine(bundle.getString("fwd1l2"))); + addRow("2", handleLine(bundle.getString("fwd1l1"))); + addRow("3-4", handleLine(bundle.getString("fwd1"))); + addRow("5", handleLine(bundle.getString("fwd1r1"))); + addRow("6", handleLine(bundle.getString("fwd1r2"))); + } +}