From 8f5d2edfbc9ab9e8076ad1fb2eeace616dc110d3 Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 10:18:54 -0400 Subject: [PATCH 01/18] WIP: implement 02-08-2024 atmospheric control rolls errata --- megamek/src/megamek/common/Aero.java | 10 ++++++++++ megamek/src/megamek/common/IAero.java | 2 ++ .../src/megamek/server/totalwarfare/TWGameManager.java | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/megamek/src/megamek/common/Aero.java b/megamek/src/megamek/common/Aero.java index a27d2b4880c..c50cd4e78e4 100644 --- a/megamek/src/megamek/common/Aero.java +++ b/megamek/src/megamek/common/Aero.java @@ -1609,6 +1609,16 @@ public int getThresh(int loc) { return 0; } + public int getHighestThresh() { + int max = damThresh[0]; + for (int i = 1; i < damThresh.length; i++) { + if (damThresh[i] > max) { + max = damThresh[i]; + } + } + return max; + } + /** * Determine if the unit can be repaired, or only harvested for spares. * diff --git a/megamek/src/megamek/common/IAero.java b/megamek/src/megamek/common/IAero.java index 9060caac715..f69fb6fd0ab 100644 --- a/megamek/src/megamek/common/IAero.java +++ b/megamek/src/megamek/common/IAero.java @@ -133,6 +133,8 @@ default int getClusterMods() { int getThresh(int loc); + int getHighestThresh(); + boolean wasCritThresh(); void setCritThresh(boolean b); diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index 2fc574e6d1d..89a1bc102a1 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -19349,7 +19349,9 @@ void checkForPSRFromDamage() { getGame().addControlRoll(damPRD); } else { // was the damage threshold exceeded this round? - if (((IAero) entity).wasCritThresh()) { + // Note errata: https://bg.battletech.com/forums/index.php?topic=72983.msg2024516#msg2024516 + if ((((IAero) entity).wasCritThresh()) + || entity.damageThisRound > ((IAero) entity).getHighestThresh()) { PilotingRollData damThresh = new PilotingRollData(entity.getId(), 0, "damage threshold exceeded"); if (entity.hasQuirk(OptionsConstants.QUIRK_POS_EASY_PILOT) From 3519d3762c2ab5c59816d5321ea35f5fdc60f74d Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 11:24:45 -0400 Subject: [PATCH 02/18] WIP: stub out highest threshold override for LAMs --- megamek/src/megamek/common/Aero.java | 1 + megamek/src/megamek/common/LandAirMech.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/megamek/src/megamek/common/Aero.java b/megamek/src/megamek/common/Aero.java index c50cd4e78e4..e1525ad97d5 100644 --- a/megamek/src/megamek/common/Aero.java +++ b/megamek/src/megamek/common/Aero.java @@ -1609,6 +1609,7 @@ public int getThresh(int loc) { return 0; } + @Override public int getHighestThresh() { int max = damThresh[0]; for (int i = 1; i < damThresh.length; i++) { diff --git a/megamek/src/megamek/common/LandAirMech.java b/megamek/src/megamek/common/LandAirMech.java index 6545c20e53d..dcdc786ad0e 100644 --- a/megamek/src/megamek/common/LandAirMech.java +++ b/megamek/src/megamek/common/LandAirMech.java @@ -1692,6 +1692,12 @@ public int getThresh(int loc) { return getInternal(loc); } + @Override + public int getHighestThresh() { + // TODO: implement for StratOps Atmospheric Control Roll Errata + return 0; + } + @Override public boolean wasCritThresh() { return critThresh; From ef95e446271a1aee67cef4266c143ab5741cf80b Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 12:01:06 -0400 Subject: [PATCH 03/18] add constant for old/unofficial SO atmospheric control roll rule --- megamek/src/megamek/common/options/OptionsConstants.java | 1 + 1 file changed, 1 insertion(+) diff --git a/megamek/src/megamek/common/options/OptionsConstants.java b/megamek/src/megamek/common/options/OptionsConstants.java index 2b44b7cd0ed..4b52b14062a 100644 --- a/megamek/src/megamek/common/options/OptionsConstants.java +++ b/megamek/src/megamek/common/options/OptionsConstants.java @@ -218,6 +218,7 @@ public class OptionsConstants { public static final String UNOFF_BLIND_FIGHTER = "blind_fighter"; public static final String UNOFF_SENSOR_GEEK = "sensor_geek"; public static final String UNOFF_SMALL_PILOT = "small_pilot"; + public static final String UNOFF_ATMOSPHERIC_CONTROL = "unoff_adv_atmospheric_control"; // EDGE public static final String EDGE = "edge"; From a9bfe23d73fa4d9dede11118a5d900a343778241 Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 12:20:52 -0400 Subject: [PATCH 04/18] add unofficial option for old stratops rule and update current one --- megamek/i18n/megamek/common/options/messages.properties | 4 +++- megamek/src/megamek/common/options/GameOptions.java | 1 + megamek/src/megamek/common/options/OptionsConstants.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/megamek/i18n/megamek/common/options/messages.properties b/megamek/i18n/megamek/common/options/messages.properties index 8014d20732c..602d80c015e 100644 --- a/megamek/i18n/megamek/common/options/messages.properties +++ b/megamek/i18n/megamek/common/options/messages.properties @@ -440,7 +440,7 @@ GameOptionsInfo.option.advanced_movement.description=Newtonian physics-style mov GameOptionsInfo.option.heat_by_bay.displayableName=StratOps Advanced Heat GameOptionsInfo.option.heat_by_bay.description=Heat is produced by individual weapons bays rather than arcs GameOptionsInfo.option.atmospheric_control.displayableName=StratOps Advanced Atmospheric Control Rolls -GameOptionsInfo.option.atmospheric_control.description=atmospheric control rolls only made for damage above the damage threshold +GameOptionsInfo.option.atmospheric_control.description=Atmospheric control rolls occur where the total damage taken by a unit in a turn exceeds its highest damage threshold, or where one damage grouping exceeds the threshold of the target location. GameOptionsInfo.option.ammo_explosions.displayableName=StratOps Ammo explosions GameOptionsInfo.option.ammo_explosions.description=Roll 2D6 on critical hits to ammo-fed weapons. On a roll of 10 or higher, the ammunition explodes. GameOptionsInfo.option.stratops_aa_fire.displayableName=(Unofficial) Advanced Anti-Aircraft @@ -489,6 +489,8 @@ GameOptionsInfo.option.crashed_dropships_survive.displayableName=(Unofficial) Un GameOptionsInfo.option.crashed_dropships_survive.description=If checked, DropShips (and larger) that crash while out of control are not instantly destroyed. GameOptionsInfo.option.expanded_kf_drive_damage.displayableName=(Unofficial) Damage individual K-F Drive components on K-F Drive Critical Hit GameOptionsInfo.option.expanded_kf_drive_damage.description=If a K-F Drive critical hit is taken, a random component is hit (per BattleSpace rules). +GameOptionsInfo.option.unoff_adv_atmospheric_control.displayableName=(Unofficial) Old StratOps Advanced Atmospheric Control Rolls +GameOptionsInfo.option.unoff_adv_atmospheric_control.description=Atmospheric control rolls only apply to hit damage above the damage threshold GameOptionsInfo.group.initiative.displayableName=Initiative Rules diff --git a/megamek/src/megamek/common/options/GameOptions.java b/megamek/src/megamek/common/options/GameOptions.java index ddbd9563a98..fc9740afbe7 100755 --- a/megamek/src/megamek/common/options/GameOptions.java +++ b/megamek/src/megamek/common/options/GameOptions.java @@ -269,6 +269,7 @@ public synchronized void initialize() { addOption(advAeroRules, OptionsConstants.ADVAERORULES_AERO_ARTILLERY_MUNITIONS, false); addOption(advAeroRules, OptionsConstants.ADVAERORULES_CRASHED_DROPSHIPS_SURVIVE, false); addOption(advAeroRules, OptionsConstants.ADVAERORULES_EXPANDED_KF_DRIVE_DAMAGE, false); + addOption(advAeroRules, OptionsConstants.UNOFF_ADV_ATMOSPHERIC_CONTROL, false); IBasicOptionGroup initiative = addGroup("initiative"); addOption(initiative, OptionsConstants.INIT_INF_MOVE_EVEN, false); diff --git a/megamek/src/megamek/common/options/OptionsConstants.java b/megamek/src/megamek/common/options/OptionsConstants.java index 4b52b14062a..ccdd72b4606 100644 --- a/megamek/src/megamek/common/options/OptionsConstants.java +++ b/megamek/src/megamek/common/options/OptionsConstants.java @@ -218,7 +218,7 @@ public class OptionsConstants { public static final String UNOFF_BLIND_FIGHTER = "blind_fighter"; public static final String UNOFF_SENSOR_GEEK = "sensor_geek"; public static final String UNOFF_SMALL_PILOT = "small_pilot"; - public static final String UNOFF_ATMOSPHERIC_CONTROL = "unoff_adv_atmospheric_control"; + public static final String UNOFF_ADV_ATMOSPHERIC_CONTROL = "unoff_adv_atmospheric_control"; // EDGE public static final String EDGE = "edge"; From 474fb4e586b407b8052f999809ef4c7744384702 Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 13:04:55 -0400 Subject: [PATCH 05/18] check both old and new control roll rules --- .../server/totalwarfare/TWGameManager.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index 89a1bc102a1..1060b7f1800 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -19336,9 +19336,10 @@ void checkForPSRFromDamage() { } } if (entity.isAero() && entity.isAirborne() && !game.getBoard().inSpace()) { - // if this aero has any damage, add another roll to the list. + // check if aero unit meets conditions for control rolls and add to the list if (entity.damageThisPhase > 0) { - if (!getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL)) { + if (!getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL) + && !getGame().getOptions().booleanOption(OptionsConstants.UNOFF_ADV_ATMOSPHERIC_CONTROL)) { int damMod = entity.damageThisPhase / 20; PilotingRollData damPRD = new PilotingRollData(entity.getId(), damMod, entity.damageThisPhase + " damage +" + damMod); @@ -19348,15 +19349,23 @@ void checkForPSRFromDamage() { } getGame().addControlRoll(damPRD); } else { - // was the damage threshold exceeded this round? - // Note errata: https://bg.battletech.com/forums/index.php?topic=72983.msg2024516#msg2024516 - if ((((IAero) entity).wasCritThresh()) - || entity.damageThisRound > ((IAero) entity).getHighestThresh()) { + // was the damage threshold in a single location exceeded this round? + if ((((IAero) entity).wasCritThresh())) { PilotingRollData damThresh = new PilotingRollData(entity.getId(), 0, - "damage threshold exceeded"); + "damage threshold exceeded"); if (entity.hasQuirk(OptionsConstants.QUIRK_POS_EASY_PILOT) - && (entity.getCrew().getPiloting() > 3)) { - damThresh.addModifier(-1, "easy to pilot"); + && (entity.getCrew().getPiloting() > 3)) { + damThresh.addModifier(-1, "easy to pilot"); + } + getGame().addControlRoll(damThresh); + } else if (getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL) + && entity.damageThisRound > ((IAero) entity).getHighestThresh()) { + // did the damage exceed the unit's highest threshold? + PilotingRollData damThresh = new PilotingRollData(entity.getId(), 0, + "highest damage threshold exceeded"); + if (entity.hasQuirk(OptionsConstants.QUIRK_POS_EASY_PILOT) + && (entity.getCrew().getPiloting() > 3)) { + damThresh.addModifier(-1, "easy to pilot"); } getGame().addControlRoll(damThresh); } From c6ab462fa04be019bc603161e292beb80f8f2e96 Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 16:37:16 -0400 Subject: [PATCH 06/18] implement getHighestThresh() for LAMs --- megamek/src/megamek/common/LandAirMech.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/megamek/src/megamek/common/LandAirMech.java b/megamek/src/megamek/common/LandAirMech.java index dcdc786ad0e..c9a495b2a31 100644 --- a/megamek/src/megamek/common/LandAirMech.java +++ b/megamek/src/megamek/common/LandAirMech.java @@ -1692,10 +1692,18 @@ public int getThresh(int loc) { return getInternal(loc); } + /** + * @return the highest damage threshold for the LAM unit + */ @Override public int getHighestThresh() { - // TODO: implement for StratOps Atmospheric Control Roll Errata - return 0; + int max = getThresh(0); + for (int i = 1; i < locations(); i++) { + if (getThresh(i) > max) { + max = getThresh(i); + } + } + return max; } @Override From f1f90adecdfa5c812ef9b0fd755dceb557a33f10 Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 17:35:45 -0400 Subject: [PATCH 07/18] track avionics and control system hits per round --- megamek/src/megamek/common/Aero.java | 22 +++++++++++++++++++ megamek/src/megamek/common/IAero.java | 4 ++++ megamek/src/megamek/common/LandAirMech.java | 13 +++++++++++ .../server/totalwarfare/TWGameManager.java | 3 +++ 4 files changed, 42 insertions(+) diff --git a/megamek/src/megamek/common/Aero.java b/megamek/src/megamek/common/Aero.java index e1525ad97d5..3af59370fde 100644 --- a/megamek/src/megamek/common/Aero.java +++ b/megamek/src/megamek/common/Aero.java @@ -143,6 +143,8 @@ public String[] getLocationNames() { * applied before the attack resolves. */ private int altLossThisRound = 0; + private int avionicsHitsThisRound = 0; + private int controlHitsThisRound = 0; private boolean spheroid = false; @@ -759,6 +761,24 @@ public void setAvionicsHits(int hits) { avionicsHits = hits; } + @Override + public int getAvionicsHitsThisRound() { + return avionicsHitsThisRound; + } + + @Override + public void setAvionicsHitsThisRound(int hits) { + avionicsHitsThisRound = hits; + } + + public int getControlHitsThisRound() { + return controlHitsThisRound; + } + + public void setControlHitsThisRound(int hits) { + controlHitsThisRound = hits; + } + public boolean isGearHit() { return gearHit; } @@ -1033,6 +1053,8 @@ public void newRound(int roundNumber) { setWhoFirst(); resetAltLossThisRound(); + setAvionicsHitsThisRound(0); + setControlHitsThisRound(0); // Reset usedInternalBombs setUsedInternalBombs(0); diff --git a/megamek/src/megamek/common/IAero.java b/megamek/src/megamek/common/IAero.java index f69fb6fd0ab..d50a788bddc 100644 --- a/megamek/src/megamek/common/IAero.java +++ b/megamek/src/megamek/common/IAero.java @@ -107,6 +107,10 @@ public interface IAero { int getAvionicsHits(); + int getAvionicsHitsThisRound(); + + void setAvionicsHitsThisRound(int i); + int getSensorHits(); int getFCSHits(); diff --git a/megamek/src/megamek/common/LandAirMech.java b/megamek/src/megamek/common/LandAirMech.java index c9a495b2a31..71850cf3cfd 100644 --- a/megamek/src/megamek/common/LandAirMech.java +++ b/megamek/src/megamek/common/LandAirMech.java @@ -126,6 +126,8 @@ public String[] getLocationAbbrs() { private int straightMoves = 0; private int altLoss = 0; private int altLossThisRound = 0; + private int avionicsHitsThisRound = 0; + //Autoejection private boolean critThresh = false; @@ -880,6 +882,7 @@ public void newRound(int roundNumber) { setWhoFirst(); resetAltLossThisRound(); + setAvionicsHitsThisRound(0); } } @@ -1331,6 +1334,16 @@ public int getAvionicsHits() { return hits; } + @Override + public int getAvionicsHitsThisRound() { + return avionicsHitsThisRound; + } + + @Override + public void setAvionicsHitsThisRound(int hits) { + avionicsHitsThisRound = hits; + } + @Override public int getSensorHits() { return getBadCriticals(CriticalSlot.TYPE_SYSTEM, SYSTEM_SENSORS, LOC_HEAD); diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index 1060b7f1800..ca1389e8a53 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -24045,6 +24045,7 @@ private Vector applyMechSystemCritical(Entity en, int loc, CriticalSlot break; case LandAirMech.LAM_AVIONICS: if (en.getConversionMode() == LandAirMech.CONV_MODE_FIGHTER) { + ((LandAirMech)en).setAvionicsHitsThisRound(((LandAirMech)en).getAvionicsHitsThisRound() + 1); if (en.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( en.getTransportId(), 1, "avionics hit")); @@ -24343,6 +24344,7 @@ private Vector applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in r.subject = aero.getId(); reports.add(r); aero.setAvionicsHits(aero.getAvionicsHits() + 1); + aero.setAvionicsHitsThisRound(aero.getAvionicsHitsThisRound() + 1); if (aero.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( aero.getTransportId(), 1, "avionics hit")); @@ -24359,6 +24361,7 @@ private Vector applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in r = new Report(9115); r.subject = aero.getId(); reports.add(r); + aero.setControlHitsThisRound(aero.getControlHitsThisRound() + 1); if (aero.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( aero.getTransportId(), 1, "critical hit")); From c1fa70c3125dec807c726626518b631b4c539cb6 Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 6 Aug 2024 17:45:28 -0400 Subject: [PATCH 08/18] switch per-round avionics/control hit tracking to boolean --- megamek/src/megamek/common/Aero.java | 24 +++++++++---------- megamek/src/megamek/common/IAero.java | 4 ++-- megamek/src/megamek/common/LandAirMech.java | 12 +++++----- .../server/totalwarfare/TWGameManager.java | 6 ++--- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/megamek/src/megamek/common/Aero.java b/megamek/src/megamek/common/Aero.java index 3af59370fde..7d7f30e0793 100644 --- a/megamek/src/megamek/common/Aero.java +++ b/megamek/src/megamek/common/Aero.java @@ -143,8 +143,8 @@ public String[] getLocationNames() { * applied before the attack resolves. */ private int altLossThisRound = 0; - private int avionicsHitsThisRound = 0; - private int controlHitsThisRound = 0; + private boolean avionicsHitThisRound = false; + private boolean controlHitThisRound = false; private boolean spheroid = false; @@ -762,21 +762,21 @@ public void setAvionicsHits(int hits) { } @Override - public int getAvionicsHitsThisRound() { - return avionicsHitsThisRound; + public boolean isAvionicsHitThisRound() { + return avionicsHitThisRound; } @Override - public void setAvionicsHitsThisRound(int hits) { - avionicsHitsThisRound = hits; + public void setAvionicsHitThisRound(boolean hit) { + avionicsHitThisRound = hit; } - public int getControlHitsThisRound() { - return controlHitsThisRound; + public boolean isControlHitThisRound() { + return controlHitThisRound; } - public void setControlHitsThisRound(int hits) { - controlHitsThisRound = hits; + public void setControlHitThisRound(boolean hit) { + controlHitThisRound = hit; } public boolean isGearHit() { @@ -1053,8 +1053,8 @@ public void newRound(int roundNumber) { setWhoFirst(); resetAltLossThisRound(); - setAvionicsHitsThisRound(0); - setControlHitsThisRound(0); + setAvionicsHitThisRound(false); + setControlHitThisRound(false); // Reset usedInternalBombs setUsedInternalBombs(0); diff --git a/megamek/src/megamek/common/IAero.java b/megamek/src/megamek/common/IAero.java index d50a788bddc..8896d30d431 100644 --- a/megamek/src/megamek/common/IAero.java +++ b/megamek/src/megamek/common/IAero.java @@ -107,9 +107,9 @@ public interface IAero { int getAvionicsHits(); - int getAvionicsHitsThisRound(); + boolean isAvionicsHitThisRound(); - void setAvionicsHitsThisRound(int i); + void setAvionicsHitThisRound(boolean hit); int getSensorHits(); diff --git a/megamek/src/megamek/common/LandAirMech.java b/megamek/src/megamek/common/LandAirMech.java index 71850cf3cfd..569b187bb80 100644 --- a/megamek/src/megamek/common/LandAirMech.java +++ b/megamek/src/megamek/common/LandAirMech.java @@ -126,7 +126,7 @@ public String[] getLocationAbbrs() { private int straightMoves = 0; private int altLoss = 0; private int altLossThisRound = 0; - private int avionicsHitsThisRound = 0; + private boolean avionicsHitThisRound = false; //Autoejection @@ -882,7 +882,7 @@ public void newRound(int roundNumber) { setWhoFirst(); resetAltLossThisRound(); - setAvionicsHitsThisRound(0); + setAvionicsHitThisRound(false); } } @@ -1335,13 +1335,13 @@ public int getAvionicsHits() { } @Override - public int getAvionicsHitsThisRound() { - return avionicsHitsThisRound; + public boolean isAvionicsHitThisRound() { + return avionicsHitThisRound; } @Override - public void setAvionicsHitsThisRound(int hits) { - avionicsHitsThisRound = hits; + public void setAvionicsHitThisRound(boolean hit) { + avionicsHitThisRound = hit; } @Override diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index ca1389e8a53..e2fdcc5f47a 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -24045,7 +24045,7 @@ private Vector applyMechSystemCritical(Entity en, int loc, CriticalSlot break; case LandAirMech.LAM_AVIONICS: if (en.getConversionMode() == LandAirMech.CONV_MODE_FIGHTER) { - ((LandAirMech)en).setAvionicsHitsThisRound(((LandAirMech)en).getAvionicsHitsThisRound() + 1); + ((LandAirMech)en).setAvionicsHitThisRound(true); if (en.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( en.getTransportId(), 1, "avionics hit")); @@ -24344,7 +24344,7 @@ private Vector applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in r.subject = aero.getId(); reports.add(r); aero.setAvionicsHits(aero.getAvionicsHits() + 1); - aero.setAvionicsHitsThisRound(aero.getAvionicsHitsThisRound() + 1); + aero.setAvionicsHitThisRound(true); if (aero.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( aero.getTransportId(), 1, "avionics hit")); @@ -24361,7 +24361,7 @@ private Vector applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in r = new Report(9115); r.subject = aero.getId(); reports.add(r); - aero.setControlHitsThisRound(aero.getControlHitsThisRound() + 1); + aero.setControlHitThisRound(true); if (aero.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( aero.getTransportId(), 1, "critical hit")); From 5879d8b19bc70e0868898cddf11255b39ddc60c9 Mon Sep 17 00:00:00 2001 From: algebro Date: Wed, 7 Aug 2024 14:29:45 -0400 Subject: [PATCH 09/18] remove unnecessary hit tracking and extract adv atmo control rolls to a separate method --- megamek/src/megamek/common/Aero.java | 22 ------ megamek/src/megamek/common/IAero.java | 4 -- megamek/src/megamek/common/LandAirMech.java | 12 ---- .../server/totalwarfare/TWGameManager.java | 70 +++++++++++++++---- 4 files changed, 55 insertions(+), 53 deletions(-) diff --git a/megamek/src/megamek/common/Aero.java b/megamek/src/megamek/common/Aero.java index 7d7f30e0793..e1525ad97d5 100644 --- a/megamek/src/megamek/common/Aero.java +++ b/megamek/src/megamek/common/Aero.java @@ -143,8 +143,6 @@ public String[] getLocationNames() { * applied before the attack resolves. */ private int altLossThisRound = 0; - private boolean avionicsHitThisRound = false; - private boolean controlHitThisRound = false; private boolean spheroid = false; @@ -761,24 +759,6 @@ public void setAvionicsHits(int hits) { avionicsHits = hits; } - @Override - public boolean isAvionicsHitThisRound() { - return avionicsHitThisRound; - } - - @Override - public void setAvionicsHitThisRound(boolean hit) { - avionicsHitThisRound = hit; - } - - public boolean isControlHitThisRound() { - return controlHitThisRound; - } - - public void setControlHitThisRound(boolean hit) { - controlHitThisRound = hit; - } - public boolean isGearHit() { return gearHit; } @@ -1053,8 +1033,6 @@ public void newRound(int roundNumber) { setWhoFirst(); resetAltLossThisRound(); - setAvionicsHitThisRound(false); - setControlHitThisRound(false); // Reset usedInternalBombs setUsedInternalBombs(0); diff --git a/megamek/src/megamek/common/IAero.java b/megamek/src/megamek/common/IAero.java index 8896d30d431..f69fb6fd0ab 100644 --- a/megamek/src/megamek/common/IAero.java +++ b/megamek/src/megamek/common/IAero.java @@ -107,10 +107,6 @@ public interface IAero { int getAvionicsHits(); - boolean isAvionicsHitThisRound(); - - void setAvionicsHitThisRound(boolean hit); - int getSensorHits(); int getFCSHits(); diff --git a/megamek/src/megamek/common/LandAirMech.java b/megamek/src/megamek/common/LandAirMech.java index 569b187bb80..eb794082c07 100644 --- a/megamek/src/megamek/common/LandAirMech.java +++ b/megamek/src/megamek/common/LandAirMech.java @@ -126,7 +126,6 @@ public String[] getLocationAbbrs() { private int straightMoves = 0; private int altLoss = 0; private int altLossThisRound = 0; - private boolean avionicsHitThisRound = false; //Autoejection @@ -882,7 +881,6 @@ public void newRound(int roundNumber) { setWhoFirst(); resetAltLossThisRound(); - setAvionicsHitThisRound(false); } } @@ -1334,16 +1332,6 @@ public int getAvionicsHits() { return hits; } - @Override - public boolean isAvionicsHitThisRound() { - return avionicsHitThisRound; - } - - @Override - public void setAvionicsHitThisRound(boolean hit) { - avionicsHitThisRound = hit; - } - @Override public int getSensorHits() { return getBadCriticals(CriticalSlot.TYPE_SYSTEM, SYSTEM_SENSORS, LOC_HEAD); diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index e2fdcc5f47a..70bd5c275f4 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -58,6 +58,7 @@ import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Manages the Game and processes player actions. @@ -20103,18 +20104,22 @@ private Vector resolveControl(Entity e) { if (e.isUsingManAce()) { target.addModifier(-1, "maneuvering ace"); } - for (Enumeration j = game.getControlRolls(); j.hasMoreElements(); ) { - final PilotingRollData modifier = j.nextElement(); - if (modifier.getEntityId() != e.getId()) { - continue; - } - // found a roll, add it - rolls.addElement(modifier); - if (reasons.length() > 0) { - reasons.append("; "); - } - reasons.append(modifier.getCumulativePlainDesc()); - target.append(modifier); + if (game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL)) { + resolveControlWithAdvAtmospheric(e, target, rolls, reasons); + } else { + for (Enumeration j = game.getControlRolls(); j.hasMoreElements(); ) { + final PilotingRollData modifier = j.nextElement(); + if (modifier.getEntityId() != e.getId()) { + continue; + } + // found a roll, add it + rolls.addElement(modifier); + if (!reasons.isEmpty()) { + reasons.append("; "); + } + reasons.append(modifier.getCumulativePlainDesc()); + target.append(modifier); + } } // any rolls needed? if (!rolls.isEmpty()) { @@ -20280,6 +20285,44 @@ private Vector resolveControl(Entity e) { return vReport; } + void resolveControlWithAdvAtmospheric(Entity e, PilotingRollData target, Vector rolls, StringBuilder reasons) { + // The August 2024 errata changed this rule to only trigger one control roll per + // round regardless of how many crits or thresholds occurred. As a result, the rolls + // need to be combined here at the end phase because not all the information is known + // when the individual rolls are first added throughout the round and previously added + // rolls can't easily be modified. + PilotingRollData atmosphericControlRoll = null; + for (Enumeration j = game.getControlRolls(); j.hasMoreElements(); ) { + final PilotingRollData modifier = j.nextElement(); + if (modifier.getEntityId() != e.getId()) { + continue; + } + if (Stream.of("threshold exceeded", "avionics hit", "critical hit").anyMatch(s -> modifier.getDesc().contains(s))) { + if (atmosphericControlRoll == null) { + atmosphericControlRoll = modifier; + } else { + // Modify the description of the pending atmospheric control roll instead of adding another one + atmosphericControlRoll.addModifier(0, modifier.getDesc(), true); + } + } else { + // Not an atmospheric control roll under the new rules, so treat normally + rolls.addElement(modifier); + if (!reasons.isEmpty()) { + reasons.append("; "); + } + reasons.append(modifier.getCumulativePlainDesc()); + target.append(modifier); + } + } + if (atmosphericControlRoll != null) { + rolls.addElement(atmosphericControlRoll); + if (!reasons.isEmpty()) { + reasons.append("; "); + } + reasons.append(atmosphericControlRoll.getCumulativePlainDesc()); + } + } + /** * Check all aircraft that may have used internal bomb bays for incidental explosions * caused by ground fire. @@ -24045,7 +24088,6 @@ private Vector applyMechSystemCritical(Entity en, int loc, CriticalSlot break; case LandAirMech.LAM_AVIONICS: if (en.getConversionMode() == LandAirMech.CONV_MODE_FIGHTER) { - ((LandAirMech)en).setAvionicsHitThisRound(true); if (en.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( en.getTransportId(), 1, "avionics hit")); @@ -24344,7 +24386,6 @@ private Vector applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in r.subject = aero.getId(); reports.add(r); aero.setAvionicsHits(aero.getAvionicsHits() + 1); - aero.setAvionicsHitThisRound(true); if (aero.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( aero.getTransportId(), 1, "avionics hit")); @@ -24361,7 +24402,6 @@ private Vector applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in r = new Report(9115); r.subject = aero.getId(); reports.add(r); - aero.setControlHitThisRound(true); if (aero.isPartOfFighterSquadron()) { game.addControlRoll(new PilotingRollData( aero.getTransportId(), 1, "critical hit")); From c0ec68ba5ff459643fc82d0c2cb7b72fa9cb21e3 Mon Sep 17 00:00:00 2001 From: algebro Date: Wed, 7 Aug 2024 17:26:57 -0400 Subject: [PATCH 10/18] check highest thresh even if a normal thresh happened; fix bug in stream filter --- .../src/megamek/server/totalwarfare/TWGameManager.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index 70bd5c275f4..f41ccedae1f 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -19359,9 +19359,10 @@ void checkForPSRFromDamage() { damThresh.addModifier(-1, "easy to pilot"); } getGame().addControlRoll(damThresh); - } else if (getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL) - && entity.damageThisRound > ((IAero) entity).getHighestThresh()) { - // did the damage exceed the unit's highest threshold? + } + if (getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL) + && entity.damageThisPhase > ((IAero) entity).getHighestThresh()) { + // did the total damage this round exceed the unit's highest threshold? PilotingRollData damThresh = new PilotingRollData(entity.getId(), 0, "highest damage threshold exceeded"); if (entity.hasQuirk(OptionsConstants.QUIRK_POS_EASY_PILOT) @@ -20297,7 +20298,7 @@ void resolveControlWithAdvAtmospheric(Entity e, PilotingRollData target, Vector< if (modifier.getEntityId() != e.getId()) { continue; } - if (Stream.of("threshold exceeded", "avionics hit", "critical hit").anyMatch(s -> modifier.getDesc().contains(s))) { + if (Stream.of("threshold", "avionics hit", "critical hit").anyMatch(s -> modifier.getDesc().contains(s))) { if (atmosphericControlRoll == null) { atmosphericControlRoll = modifier; } else { From 640d05f5cfda85002495f4f8d13c13790e0516ed Mon Sep 17 00:00:00 2001 From: algebro Date: Thu, 8 Aug 2024 12:49:34 -0400 Subject: [PATCH 11/18] rename method and add docstring --- .../megamek/server/totalwarfare/TWGameManager.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index f41ccedae1f..bfe65b8d6ae 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -20106,7 +20106,7 @@ private Vector resolveControl(Entity e) { target.addModifier(-1, "maneuvering ace"); } if (game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL)) { - resolveControlWithAdvAtmospheric(e, target, rolls, reasons); + addControlWithAdvAtmospheric(e, target, rolls, reasons); } else { for (Enumeration j = game.getControlRolls(); j.hasMoreElements(); ) { final PilotingRollData modifier = j.nextElement(); @@ -20286,7 +20286,16 @@ private Vector resolveControl(Entity e) { return vReport; } - void resolveControlWithAdvAtmospheric(Entity e, PilotingRollData target, Vector rolls, StringBuilder reasons) { + /** + * Processes pending control roll events, merging triggers that would be multiple rolls in standard + * rules but are combined into a single roll under the Advanced Atmospheric Control Rolls rule. + * + * @param e The entity whose pending rolls are being processed + * @param target Target number for the roll + * @param rolls List of rolls to be added to + * @param reasons Text representing the reason for the rolls + */ + void addControlWithAdvAtmospheric(Entity e, PilotingRollData target, Vector rolls, StringBuilder reasons) { // The August 2024 errata changed this rule to only trigger one control roll per // round regardless of how many crits or thresholds occurred. As a result, the rolls // need to be combined here at the end phase because not all the information is known From 6c2ffd2f76f9deba5ecf6539d3a8177c2f24ad13 Mon Sep 17 00:00:00 2001 From: algebro Date: Thu, 8 Aug 2024 14:24:25 -0400 Subject: [PATCH 12/18] show all adv atmo control roll reasons in report --- .../server/totalwarfare/TWGameManager.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index bfe65b8d6ae..2aabed580db 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -20106,7 +20106,7 @@ private Vector resolveControl(Entity e) { target.addModifier(-1, "maneuvering ace"); } if (game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL)) { - addControlWithAdvAtmospheric(e, target, rolls, reasons); + addControlWithAdvAtmospheric(e, rolls, reasons); } else { for (Enumeration j = game.getControlRolls(); j.hasMoreElements(); ) { final PilotingRollData modifier = j.nextElement(); @@ -20291,11 +20291,10 @@ private Vector resolveControl(Entity e) { * rules but are combined into a single roll under the Advanced Atmospheric Control Rolls rule. * * @param e The entity whose pending rolls are being processed - * @param target Target number for the roll * @param rolls List of rolls to be added to * @param reasons Text representing the reason for the rolls */ - void addControlWithAdvAtmospheric(Entity e, PilotingRollData target, Vector rolls, StringBuilder reasons) { + void addControlWithAdvAtmospheric(Entity e, Vector rolls, StringBuilder reasons) { // The August 2024 errata changed this rule to only trigger one control roll per // round regardless of how many crits or thresholds occurred. As a result, the rolls // need to be combined here at the end phase because not all the information is known @@ -20312,7 +20311,10 @@ void addControlWithAdvAtmospheric(Entity e, PilotingRollData target, Vector Date: Thu, 8 Aug 2024 14:24:38 -0400 Subject: [PATCH 13/18] add tests for advanced atmospheric control rolls --- .../megamek/server/GameManagerTest.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 megamek/unittests/megamek/server/GameManagerTest.java diff --git a/megamek/unittests/megamek/server/GameManagerTest.java b/megamek/unittests/megamek/server/GameManagerTest.java new file mode 100644 index 00000000000..9c2b3cd506e --- /dev/null +++ b/megamek/unittests/megamek/server/GameManagerTest.java @@ -0,0 +1,66 @@ +package megamek.server; + +import megamek.common.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.Vector; + +import static org.junit.jupiter.api.Assertions.*; + +class GameManagerTest { + private Player player; + private GameManager gameManager; + private Game game; + + @BeforeAll + static void before() { + EquipmentType.initializeTypes(); + } + + @BeforeEach + void setUp() { + player = new Player(0, "Test"); + gameManager = new GameManager(); + game = gameManager.getGame(); + game.addPlayer(0, player); + } + + @Test + void testAddControlWithAdvAtmosphericMergesIntoOneRoll() { + AeroSpaceFighter aero = new AeroSpaceFighter(); + game.addEntity(aero); + Vector rolls = new Vector<>(); + StringBuilder reasons = new StringBuilder(); + + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "critical hit")); + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "avionics hit")); + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "threshold")); + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "highest damage threshold exceeded")); + gameManager.addControlWithAdvAtmospheric(aero, rolls, reasons); + assertEquals(1, rolls.size()); + assertTrue(reasons.toString().contains("critical hit")); + assertTrue(reasons.toString().contains("avionics hit")); + assertTrue(reasons.toString().contains("threshold")); + assertTrue(reasons.toString().contains("highest damage threshold exceeded")); + } + + @Test + void testAddControlWithAdvAtmosphericIncludesAllReasons() { + AeroSpaceFighter aero = new AeroSpaceFighter(); + game.addEntity(aero); + Vector rolls = new Vector<>(); + StringBuilder reasons = new StringBuilder(); + + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "critical hit")); + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "avionics hit")); + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "threshold")); + game.addControlRoll(new PilotingRollData(aero.getId(), 0, "highest damage threshold exceeded")); + gameManager.addControlWithAdvAtmospheric(aero, rolls, reasons); + assertTrue(reasons.toString().contains("critical hit")); + assertTrue(reasons.toString().contains("avionics hit")); + assertTrue(reasons.toString().contains("threshold")); + assertTrue(reasons.toString().contains("highest damage threshold exceeded")); + } +} \ No newline at end of file From 7c1ef949d8310278311e0e76c5998f4c558f7fda Mon Sep 17 00:00:00 2001 From: algebro Date: Thu, 8 Aug 2024 14:33:29 -0400 Subject: [PATCH 14/18] add LAM tests --- .../megamek/server/GameManagerTest.java | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/megamek/unittests/megamek/server/GameManagerTest.java b/megamek/unittests/megamek/server/GameManagerTest.java index 9c2b3cd506e..6879dbc1a52 100644 --- a/megamek/unittests/megamek/server/GameManagerTest.java +++ b/megamek/unittests/megamek/server/GameManagerTest.java @@ -28,7 +28,7 @@ void setUp() { } @Test - void testAddControlWithAdvAtmosphericMergesIntoOneRoll() { + void testAddControlWithAdvAtmosphericMergesIntoOneRollAero() { AeroSpaceFighter aero = new AeroSpaceFighter(); game.addEntity(aero); Vector rolls = new Vector<>(); @@ -47,7 +47,7 @@ void testAddControlWithAdvAtmosphericMergesIntoOneRoll() { } @Test - void testAddControlWithAdvAtmosphericIncludesAllReasons() { + void testAddControlWithAdvAtmosphericIncludesAllReasonsAero() { AeroSpaceFighter aero = new AeroSpaceFighter(); game.addEntity(aero); Vector rolls = new Vector<>(); @@ -63,4 +63,37 @@ void testAddControlWithAdvAtmosphericIncludesAllReasons() { assertTrue(reasons.toString().contains("threshold")); assertTrue(reasons.toString().contains("highest damage threshold exceeded")); } + + @Test + void testAddControlWithAdvAtmosphericMergesIntoOneRollLAM() { + LandAirMech mech = new LandAirMech(LandAirMech.GYRO_STANDARD, LandAirMech.COCKPIT_STANDARD, LandAirMech.LAM_STANDARD); + game.addEntity(mech); + Vector rolls = new Vector<>(); + StringBuilder reasons = new StringBuilder(); + + game.addControlRoll(new PilotingRollData(mech.getId(), 0, "avionics hit")); + game.addControlRoll(new PilotingRollData(mech.getId(), 0, "threshold")); + game.addControlRoll(new PilotingRollData(mech.getId(), 0, "highest damage threshold exceeded")); + gameManager.addControlWithAdvAtmospheric(mech, rolls, reasons); + assertEquals(1, rolls.size()); + assertTrue(reasons.toString().contains("avionics hit")); + assertTrue(reasons.toString().contains("threshold")); + assertTrue(reasons.toString().contains("highest damage threshold exceeded")); + } + + @Test + void testAddControlWithAdvAtmosphericIncludesAllReasonsLAM() { + LandAirMech mech = new LandAirMech(LandAirMech.GYRO_STANDARD, LandAirMech.COCKPIT_STANDARD, LandAirMech.LAM_STANDARD); + game.addEntity(mech); + Vector rolls = new Vector<>(); + StringBuilder reasons = new StringBuilder(); + + game.addControlRoll(new PilotingRollData(mech.getId(), 0, "avionics hit")); + game.addControlRoll(new PilotingRollData(mech.getId(), 0, "threshold")); + game.addControlRoll(new PilotingRollData(mech.getId(), 0, "highest damage threshold exceeded")); + gameManager.addControlWithAdvAtmospheric(mech, rolls, reasons); + assertTrue(reasons.toString().contains("avionics hit")); + assertTrue(reasons.toString().contains("threshold")); + assertTrue(reasons.toString().contains("highest damage threshold exceeded")); + } } \ No newline at end of file From 4e381b665b1db371a1af7dfaa040ddfba6657bb7 Mon Sep 17 00:00:00 2001 From: algebro Date: Thu, 8 Aug 2024 14:43:05 -0400 Subject: [PATCH 15/18] remove redundant asserts --- megamek/unittests/megamek/server/GameManagerTest.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/megamek/unittests/megamek/server/GameManagerTest.java b/megamek/unittests/megamek/server/GameManagerTest.java index 6879dbc1a52..d51d153369f 100644 --- a/megamek/unittests/megamek/server/GameManagerTest.java +++ b/megamek/unittests/megamek/server/GameManagerTest.java @@ -40,10 +40,6 @@ void testAddControlWithAdvAtmosphericMergesIntoOneRollAero() { game.addControlRoll(new PilotingRollData(aero.getId(), 0, "highest damage threshold exceeded")); gameManager.addControlWithAdvAtmospheric(aero, rolls, reasons); assertEquals(1, rolls.size()); - assertTrue(reasons.toString().contains("critical hit")); - assertTrue(reasons.toString().contains("avionics hit")); - assertTrue(reasons.toString().contains("threshold")); - assertTrue(reasons.toString().contains("highest damage threshold exceeded")); } @Test @@ -76,9 +72,6 @@ void testAddControlWithAdvAtmosphericMergesIntoOneRollLAM() { game.addControlRoll(new PilotingRollData(mech.getId(), 0, "highest damage threshold exceeded")); gameManager.addControlWithAdvAtmospheric(mech, rolls, reasons); assertEquals(1, rolls.size()); - assertTrue(reasons.toString().contains("avionics hit")); - assertTrue(reasons.toString().contains("threshold")); - assertTrue(reasons.toString().contains("highest damage threshold exceeded")); } @Test From d9886d58631294df623aa12e28b8aa15f9d90ada Mon Sep 17 00:00:00 2001 From: algebro Date: Tue, 3 Sep 2024 12:45:02 -0400 Subject: [PATCH 16/18] move Unit Tests into correct TW package --- .../TWGameManagerTest.java} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename megamek/unittests/megamek/server/{GameManagerTest.java => totalwarfare/TWGameManagerTest.java} (96%) diff --git a/megamek/unittests/megamek/server/GameManagerTest.java b/megamek/unittests/megamek/server/totalwarfare/TWGameManagerTest.java similarity index 96% rename from megamek/unittests/megamek/server/GameManagerTest.java rename to megamek/unittests/megamek/server/totalwarfare/TWGameManagerTest.java index d51d153369f..6513334ffa0 100644 --- a/megamek/unittests/megamek/server/GameManagerTest.java +++ b/megamek/unittests/megamek/server/totalwarfare/TWGameManagerTest.java @@ -1,4 +1,4 @@ -package megamek.server; +package megamek.server.totalwarfare; import megamek.common.*; import org.junit.jupiter.api.BeforeAll; @@ -9,9 +9,9 @@ import static org.junit.jupiter.api.Assertions.*; -class GameManagerTest { +class TWGameManagerTest { private Player player; - private GameManager gameManager; + private TWGameManager gameManager; private Game game; @BeforeAll @@ -22,7 +22,7 @@ static void before() { @BeforeEach void setUp() { player = new Player(0, "Test"); - gameManager = new GameManager(); + gameManager = new TWGameManager(); game = gameManager.getGame(); game.addPlayer(0, player); } From c0896908b0f3ed67eba0e25bca44b762b8edb43c Mon Sep 17 00:00:00 2001 From: algebro Date: Wed, 4 Sep 2024 11:34:19 -0400 Subject: [PATCH 17/18] remove erroneous white space --- megamek/src/megamek/common/LandAirMech.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/megamek/src/megamek/common/LandAirMech.java b/megamek/src/megamek/common/LandAirMech.java index eb794082c07..751df64f977 100644 --- a/megamek/src/megamek/common/LandAirMech.java +++ b/megamek/src/megamek/common/LandAirMech.java @@ -126,8 +126,7 @@ public String[] getLocationAbbrs() { private int straightMoves = 0; private int altLoss = 0; private int altLossThisRound = 0; - - + //Autoejection private boolean critThresh = false; From 07bce7759e7be288361b454fab9e18fc990cd6ec Mon Sep 17 00:00:00 2001 From: algebro Date: Wed, 4 Sep 2024 13:02:35 -0400 Subject: [PATCH 18/18] fix whitespace for real this time --- megamek/src/megamek/common/LandAirMech.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megamek/src/megamek/common/LandAirMech.java b/megamek/src/megamek/common/LandAirMech.java index 751df64f977..c9a495b2a31 100644 --- a/megamek/src/megamek/common/LandAirMech.java +++ b/megamek/src/megamek/common/LandAirMech.java @@ -126,7 +126,7 @@ public String[] getLocationAbbrs() { private int straightMoves = 0; private int altLoss = 0; private int altLossThisRound = 0; - + //Autoejection private boolean critThresh = false;