Skip to content

Commit

Permalink
Merge pull request #818 from MegaMek/aero_tables
Browse files Browse the repository at this point in the history
Optional reference tables for aerospace record sheets
  • Loading branch information
neoancient authored Nov 1, 2020
2 parents 1a9222f + 71f6936 commit 01ecedf
Show file tree
Hide file tree
Showing 17 changed files with 833 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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
prohibited=Prohibited

variable=variable
perHit=/hit
perHex=/hex
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title=CHANGING FACING COST
velocity=Velocity
thrustPoints=Thrust\npoints
plus1perPoint=+1/point
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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
aboveSafeThrust=Above safe thrust
atmosphericOperations=Atmospheric operations
per20points=Per 20 points of damage
above2xSafeThrust=Velocity above 2x\nsafe thrust
perHit=/hit
perPoint=/point
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title=STRAIGHT MOVEMENT
velocity=Velocity
lowAltitude=Low Altitude\nMap
ground=Ground Map
58 changes: 54 additions & 4 deletions src/megameklab/com/printing/PrintAero.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/**
Expand Down Expand Up @@ -282,4 +280,56 @@ protected String formatWalk() {
protected String formatRun() {
return Integer.toString(getEntity().getRunMP());
}

@Override
protected boolean includeReferenceCharts() {
return options.showReferenceCharts();
}

@Override
protected List<ReferenceTable> getRightSideReferenceTables() {
List<ReferenceTable> 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));
}
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;
}

@Override
protected void addReferenceCharts(PageFormat pageFormat) {
super.addReferenceCharts(pageFormat);
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();
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, 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),
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));
}
}
}
2 changes: 1 addition & 1 deletion src/megameklab/com/printing/PrintEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected void processImage(int pageNum, PageFormat pageFormat) {
drawEraIcon();
}
drawFluffImage();
if (includeReferenceCharts()) {
if ((pageNum == 0) && includeReferenceCharts()) {
addReferenceCharts(pageFormat);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/megameklab/com/printing/PrintRecordSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,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();
Expand Down
Loading

0 comments on commit 01ecedf

Please sign in to comment.