Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AS Conversion and Cards #4278

Merged
merged 4 commits into from
Apr 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions megamek/src/megamek/common/EquipmentTypeLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,5 @@ public class EquipmentTypeLookup {

@EquipmentName public static final String CL_BA_MORTAR_HEAVY = "CLBAHeavyMortar";
@EquipmentName public static final String CL_BA_MORTAR_LIGHT = "CLBALightMortar";
@EquipmentName public static final String IS_BA_TUBE_ARTY = "ISBATubeArtillery";
}
35 changes: 5 additions & 30 deletions megamek/src/megamek/common/alphaStrike/cardDrawer/ASAeroCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
import megamek.client.ui.swing.util.StringDrawer;
import megamek.common.alphaStrike.ASCardDisplayable;
import megamek.common.alphaStrike.ASDamageVector;
import megamek.common.alphaStrike.AlphaStrikeElement;
import megamek.common.alphaStrike.AlphaStrikeHelper;

import java.awt.*;
import java.awt.geom.Arc2D;
import java.awt.geom.Path2D;

import static java.awt.Color.WHITE;

public class ASAeroCard extends ASHeatTrackingCard {

public ASAeroCard(ASCardDisplayable element) {
Expand Down Expand Up @@ -109,38 +110,12 @@ protected void paintHits(Graphics2D g) {

@Override
protected void paintArmor(Graphics2D g) {
drawBox(g, 36, armorBoxY, armorBoxWidth, armorBoxHeight, BACKGROUND_GRAY, BOX_STROKE);
super.paintArmor(g);
int upperY = armorBoxY + armorBoxHeight / 2 - 18;
new StringDrawer("TH").at(606, upperY).font(headerFont).center().maxWidth(52).draw(g);

if (element != null) {
// Headers A, S
int upperY = armorBoxY + armorBoxHeight / 2 - 18;
int lowerY = armorBoxY + armorBoxHeight / 2 + 18;
g.setFont(headerFont);
int headerWidth = new StringDrawer("A:").at(44, upperY).centerY().draw(g).width + 12;
new StringDrawer("S:").at(44, lowerY).centerY().draw(g);

// Armor Pips
int cx = 44 + headerWidth;
g.setStroke(new BasicStroke(1.5f));
for (int i = 0; i < element.getFullArmor(); i++) {
g.setColor(Color.WHITE);
g.fillOval(cx, upperY - ARMOR_PIP_SIZE / 2, ARMOR_PIP_SIZE, ARMOR_PIP_SIZE);
g.setColor(Color.BLACK);
g.drawOval(cx, upperY - ARMOR_PIP_SIZE / 2, ARMOR_PIP_SIZE, ARMOR_PIP_SIZE);
cx += ARMOR_PIP_SIZE + 1;
}

// Structure Pips
cx = 44 + headerWidth;
for (int i = 0; i < element.getFullStructure(); i++) {
g.setColor(DARKGRAY);
g.fillOval(cx, lowerY - ARMOR_PIP_SIZE / 2, ARMOR_PIP_SIZE, ARMOR_PIP_SIZE);
g.setColor(Color.BLACK);
g.drawOval(cx, lowerY - ARMOR_PIP_SIZE / 2, ARMOR_PIP_SIZE, ARMOR_PIP_SIZE);
cx += ARMOR_PIP_SIZE + 1;
}

new StringDrawer("TH").at(606, upperY).font(headerFont).center().maxWidth(52).draw(g);
new StringDrawer(element.getThreshold() + "").at(606, lowerY).useConfig(valueConfig).center().maxWidth(52).draw(g);
}
}
Expand Down
11 changes: 6 additions & 5 deletions megamek/src/megamek/common/alphaStrike/cardDrawer/ASCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public class ASCard {
protected int armorBoxY = 410;
protected int armorBoxHeight = 94;
protected int armorBoxWidth = BOX_WIDTH_WIDE;
protected int armorPipSpace = 531;
protected int specialBoxX = 36;
protected int specialBoxY = 522;
protected int specialBoxWidth = armorBoxWidth;
Expand Down Expand Up @@ -338,7 +339,6 @@ protected void paintHeat(Graphics2D g) { }
/** Write the armor block. Overridden for some card types. */
protected void paintArmor(Graphics2D g) {
drawBox(g, 36, armorBoxY, armorBoxWidth, armorBoxHeight, BACKGROUND_GRAY, BOX_STROKE);

if (element != null) {
// Headers A, S
int upperY = armorBoxY + armorBoxHeight / 2 - 18;
Expand All @@ -353,11 +353,12 @@ protected void paintArmor(Graphics2D g) {

protected void paintPipLines(Graphics2D g, int leftX, int y, Color fillColor, int pipCount) {
int x = leftX;
int pipsPerLine = (armorBoxWidth - leftX) / ARMOR_PIP_SIZE;
int pipsPerLine = (armorPipSpace - leftX) / ARMOR_PIP_SIZE;
int pipSize = ARMOR_PIP_SIZE;
g.setStroke(new BasicStroke(1.5f));
if (pipCount > pipsPerLine) {
pipSize = ARMOR_PIP_SIZE - 2;
y -= ARMOR_PIP_SIZE / 2;
y -= ARMOR_PIP_SIZE / 3;
}
for (int i = 0; i < Math.min(pipsPerLine, pipCount); i++) {
g.setColor(fillColor);
Expand All @@ -367,8 +368,8 @@ protected void paintPipLines(Graphics2D g, int leftX, int y, Color fillColor, in
x += ARMOR_PIP_SIZE + 1;
}
if (pipCount > pipsPerLine) {
y += ARMOR_PIP_SIZE;
x = leftX;
y += pipSize;
x = leftX + ARMOR_PIP_SIZE / 2;
for (int i = 0; i < pipCount - pipsPerLine; i++) {
g.setColor(fillColor);
g.fillOval(x, y - pipSize / 2, pipSize, pipSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void setHeatTrackingLayout() {
@Override
protected void paintHeat(Graphics2D g) {
int height = 54;
drawBox(g, 36, 372, BOX_WIDTH_WIDE, height, Color.LIGHT_GRAY, BOX_STROKE);
drawBox(g, 36, 372, BOX_WIDTH_WIDE, height, BACKGROUND_GRAY, BOX_STROKE);

g.drawLine(36 + 141, 372 + 12, 36 + 141, 372 + height - 12);
// Heat Scale Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ protected void drawModelChassis(Graphics2D g) {

@Override
protected void paintBaseInfo(Graphics2D g) {
ASCard.drawBox(g, 36, 97, 624, 63, Color.LIGHT_GRAY, BOX_STROKE);
ASCard.drawBox(g, 36, 97, 624, 63, BACKGROUND_GRAY, BOX_STROKE);

int centerY = 129;
new StringDrawer("TP: ").at(44, centerY).centerY().font(headerFont).maxWidth(47).draw(g);
Expand Down Expand Up @@ -304,7 +304,7 @@ protected void paintArmor(Graphics2D g) {
box.closePath();

g.setStroke(new BasicStroke(BOX_STROKE));
g.setColor(Color.LIGHT_GRAY);
g.setColor(BACKGROUND_GRAY);
g.fill(box);
g.setColor(Color.BLACK);
g.draw(box);
Expand Down Expand Up @@ -336,7 +336,7 @@ protected void paintArmor(Graphics2D g) {

@Override
protected void paintSpecial(Graphics2D g) {
ASCard.drawBox(g, 536, 485, 477, 152, Color.LIGHT_GRAY, BOX_STROKE);
ASCard.drawBox(g, 536, 485, 477, 152, BACKGROUND_GRAY, BOX_STROKE);
paintSpecialTextLines(g, element, largeAeroSpecialFont, 551, 484, 447, 44);
}

Expand All @@ -351,7 +351,7 @@ protected void paintPointValue(Graphics2D g) {

@Override
protected void paintHits(Graphics2D g) {
ASCard.drawBox(g, 36, 410, 490, 227, Color.LIGHT_GRAY, BOX_STROKE);
ASCard.drawBox(g, 36, 410, 490, 227, BACKGROUND_GRAY, BOX_STROKE);
if (element.getASUnitType().isAnyOf(WS, SS, JS)) {
new StringDrawer("CRITICAL HITS").at(281, 435).center().font(headerFont).maxWidth(450).draw(g);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected void initialize() {

@Override
protected void paintHits(Graphics2D g) {
drawBox(g, 591, 442, 422, 180, Color.LIGHT_GRAY, BOX_STROKE);
drawBox(g, 591, 442, 422, 180, BACKGROUND_GRAY, BOX_STROKE);

if (element != null) {
new StringDrawer("CRITICAL HITS").at(802, 470).center().font(headerFont).maxWidth(380).draw(g);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ protected void processAMS(Mounted weapon, WeaponType weaponType) {
}

protected void processArtillery(Mounted weapon, WeaponType weaponType) {
if (weaponType.getDamage() == WeaponType.DAMAGE_ARTILLERY) {
if ((weaponType.getDamage() == WeaponType.DAMAGE_ARTILLERY)
|| weaponType.is(EquipmentTypeLookup.IS_BA_TUBE_ARTY)) {
assignToLocations(weapon, getArtilleryType(weaponType), 1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package megamek.common.weapons.battlearmor;

import megamek.common.AmmoType;
import megamek.common.EquipmentTypeLookup;
import megamek.common.options.GameOptions;
import megamek.common.options.OptionsConstants;
import megamek.common.weapons.artillery.ArtilleryWeapon;
Expand All @@ -28,7 +29,7 @@ public class ISBATubeArtillery extends ArtilleryWeapon {
public ISBATubeArtillery() {
super();
name = "Tube Artillery (BA)";
setInternalName("ISBATubeArtillery");
setInternalName(EquipmentTypeLookup.IS_BA_TUBE_ARTY);
rackSize = 3;
ammoType = AmmoType.T_BA_TUBE;
shortRange = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ public int getLongRange() {

@Override
public int getAlphaStrikeHeat() {
return 18;
return 15;
}
}