diff --git a/megamek/docs/ACAR - Abstract Combat Auto Resolve/ACAR-Abstract Combat Auto Resolve documentation.pdf b/megamek/docs/ACAR - Abstract Combat Auto Resolve/ACAR-Abstract Combat Auto Resolve documentation.pdf new file mode 100644 index 00000000000..2d0a9439892 Binary files /dev/null and b/megamek/docs/ACAR - Abstract Combat Auto Resolve/ACAR-Abstract Combat Auto Resolve documentation.pdf differ diff --git a/megamek/i18n/megamek/client/acs-report-messages.properties b/megamek/i18n/megamek/client/acs-report-messages.properties new file mode 100644 index 00000000000..7dcdd4822b5 --- /dev/null +++ b/megamek/i18n/megamek/client/acs-report-messages.properties @@ -0,0 +1,115 @@ +# +# Copyright (c) 2020-2024 - The MegaMek Team. All Rights Reserved. +# +# This file is part of MekHQ. +# +# MekHQ 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 3 of the License, or +# (at your option) any later version. +# +# MekHQ 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. +# +# You should have received a copy of the GNU General Public License +# along with MekHQ. If not, see . +# +# +# Copyright (c) 2020-2024 - The MegaMek Team. All Rights Reserved. +# +# This file is part of MekHQ. +# +# MekHQ 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 3 of the License, or +# (at your option) any later version. +# +# MekHQ 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. +# +# You should have received a copy of the GNU General Public License +# along with MekHQ. If not, see . +# +100=

Abstract Combat Auto Resolution

+ +101=

● Starting Scenario Phase

+102=Team {0} Formations: +103={0} has {1} units. +104={0}, Armor: {1}%, Structure: {2}%, Crew: {3}, Hits: {4} + +999= +1000=

○ Initiative Phase for Round {0}

+1005=

○ Initiative Phase for Start of Game Deployment

+1015=▻ {0} has {1} initiative bonus. +1020=▻ The general turn order is: +1040=

※ The turn order is:

+1045=▻ {0}({1}), rolled {2} +1060=

⁜ Future Deployment

+1065=

▶ Round: #{0}

+1066={0} ({1}), Start: {2} +1067={0}[Team {1}] +1200=
+1230={0} +1231={0} ({1}) {2} +1242=no effect +9999=

● End of the Game

+2020={0} rolls a {1}. + +2201=

◔ Engagement and Control Phase

+2200={0} engages {1} under {2} conditions. +2203=needs {0}+ to control engagement. +2202={0} rolled {1}. +2204={0} gains engagement control! +2205={0} fails to gain engagement control. + + +2002=

◑ Firing Phase

+2001={0} attacks {1}. +3100={0} received {1} damage, {2} armor left +2010=The attack cannot succeed: {0} +2003=Needed {0}+ to hit 〈{1}〉. +2012=The attack misses. +2013=The attack hits! +3090=High Stress episode! +3091=It's crippled! +3092=☠ It's destroyed! +3094={0} took {1} damage to its targeting system. +3095=Rolling for internal damage. +3096={0} took {1} damage to its weapons system. +3097=Took no internal damage. + +3299=

◕ End Phase

+3298=

Destroyed Units

+3330={0} attempts to withdraw under {1} conditions. +3331=Needs {0}+ to successfully withdraw 〈{1}〉. +3332={0} rolled {1} for withdrawal. +3333=The withdrawal is successful! +3334=The withdrawal attempt fails. +3335={0} has has succumbed from his wounds ☠ +3336={0} is still alive ({1} hits) ⛑ + +3337={0} has been devastated, there is nothing left of it. +3338={0} was destroyed by the pilot ejection. +3339={0} was destroyed after being pushed off the combat envelope. +3340={0} was captured by enemy forces. +3341={0} has left the battlefield in full retreat. +3342={0} never joined the battle. +3343={0} was destroyed, it is salvageable. +3344={0} was destroyed by surprise, it is salvageable. + +4500={0} attempts a morale check. Need {1} to succeed. +4501={0} rolled {1}. +4502={0} holds steady and does not lose morale. +4503={0} fails its morale check! Morale worsens from {1} to {2}. + +5000=

● End of Combat

+5002=Team {0} Report: +5003={0} has {1} units remaining. +5004={0}, Armor remaining: {1}%, Structure remaining: {2}%, Crew: {3}, Hits: {4} +5005={0} - Armor remaining: {1}%, Structure remaining: {2}% +5006={0} has {1} units destroyed. +5007={0} has {1} units retreating. diff --git a/megamek/i18n/megamek/client/acs-report-messages_en.properties b/megamek/i18n/megamek/client/acs-report-messages_en.properties new file mode 100644 index 00000000000..e69de29bb2d diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index b71c76573e6..49932600ee3 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -4828,3 +4828,5 @@ Bot.commands.caution=Piloting Caution #### TacOps movement and damage descriptions TacOps.leaping.leg_damage=leaping (leg damage) TacOps.leaping.fall_damage=leaping (fall) + +#### diff --git a/megamek/i18n/megamek/common/messages.properties b/megamek/i18n/megamek/common/messages.properties index b7f0baac68d..20b7bcdf6dd 100644 --- a/megamek/i18n/megamek/common/messages.properties +++ b/megamek/i18n/megamek/common/messages.properties @@ -600,3 +600,51 @@ BeastSize.monstrous=Monstrous ArtilleryMessage.drifted=Artillery drifted here from BombMessage.drifted=Bomb drifted here from + + + +acar.invalid_attack=Invalid attack +acar.invalid_skill=Invalid skill +acar.skill=Skill +acar.critical_target_damage=Critical Target Damage +acar.skill_7=Wet behind the ears (skill) +acar.skill_6=Really Green (skill) +acar.skill_5=Green (skill) +acar.skill_4=Regular (skill) +acar.skill_3=Veteran (skill) +acar.skill_2=Elite (skill) +acar.skill_1=Heroic (skill) +acar.skill_0=Legendary (skill) +acar.short_range=Short range +acar.medium_range=Medium range +acar.long_range=Long range +acar.extreme_range=Extreme range +acar.TMM=TMM +acar.attacker_JUMP=Attacker JUMP +acar.target_JUMP=Target JUMP +acar.shaken=Shaken (morale) +acar.unsteady=Unsteady (morale) +acar.broken=Broken (morale) +acar.routed=Routed (morale) +acar.more_than_two_targets=Too many targets +acar.two_targets=Two targets +acar.invalid_engagement_control=Invalid engagement and control +acar.invalid_attacking_formation=Invalid attacking formation +acar.formation_tactics=Tactics +acar.force_engagement=Force engagement +acar.evade=Evade +acar.formation_is_infantry_only=Formation is infantry only +acar.formation_is_vehicle_only=Formation is vehicle only +acar.size_difference=Formation size difference +acar.shaken_morale=Shaken morale +acar.unsteady_morale=Unsteady morale +acar.broken_morale=Broken morale +acar.routed_morale=Routed morale +acar.forced_engagement=Forced Engagement +acar.aerospace_formation=Aerospace Formation +acar.invalid_nerve_recovering=Invalid nerve recovering +acar.formation_morale=Morale +acar.jump_modifier=Movement modifier +acar.withdraw.crippled=Crippled + +AutoResolveSimulationLogDialog.title=Auto Resolve Report \ No newline at end of file diff --git a/megamek/src/megamek/client/ui/advancedSearchMap/BoardTableModel.java b/megamek/src/megamek/client/ui/advancedSearchMap/BoardTableModel.java index fb74f8ef95b..d704a79091a 100644 --- a/megamek/src/megamek/client/ui/advancedSearchMap/BoardTableModel.java +++ b/megamek/src/megamek/client/ui/advancedSearchMap/BoardTableModel.java @@ -113,7 +113,7 @@ public int getPreferredWidth(int col) { } public void setData(BoardClassifier bc) { - data = bc.getBoardPaths().values().stream().toList();; + data = bc.getBoardPaths().values().stream().toList(); tags = new ArrayList<>(); width = new ArrayList<>(); height = new ArrayList<>(); diff --git a/megamek/src/megamek/client/ui/dialogs/AutoResolveSimulationLogDialog.java b/megamek/src/megamek/client/ui/dialogs/AutoResolveSimulationLogDialog.java new file mode 100644 index 00000000000..f796b364689 --- /dev/null +++ b/megamek/src/megamek/client/ui/dialogs/AutoResolveSimulationLogDialog.java @@ -0,0 +1,20 @@ +package megamek.client.ui.dialogs; + +import megamek.client.ui.dialogs.helpDialogs.AbstractHelpDialog; +import megamek.common.internationalization.Internationalization; + +import javax.swing.*; +import java.awt.*; +import java.io.File; + +public class AutoResolveSimulationLogDialog extends AbstractHelpDialog { + + public AutoResolveSimulationLogDialog(final JFrame frame, File logFile) { + super(frame, Internationalization.getText("AutoResolveSimulationLogDialog.title"), + logFile.getAbsolutePath()); + + setMinimumSize(new Dimension(800, 400)); + setModalExclusionType(ModalExclusionType.TOOLKIT_EXCLUDE); + } + +} diff --git a/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java b/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java index e7977ff8998..25d670d5440 100644 --- a/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java +++ b/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java @@ -296,7 +296,7 @@ private void moveElement(DefaultListModel srcModel, int srcIndex, int trg private ColourSelectorButton csbBoardTextColor; private ColourSelectorButton csbBoardSpaceTextColor; private ColourSelectorButton csbMapsheetColor; - private JSpinner attackArrowTransparency;; + private JSpinner attackArrowTransparency; private JSpinner ecmTransparency; private JTextField buttonsPerRow; private JTextField playersRemainingToShow; diff --git a/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java b/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java index d23be02e5b7..0a72608d49e 100644 --- a/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java +++ b/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java @@ -1888,7 +1888,7 @@ private static StringBuilder inGameValues(Entity entity, Player localPlayer, boo // Seen by if (showSeenBy) { - String seenByInfo = getSeenByInfo(game, gameOptions, entity);; + String seenByInfo = getSeenByInfo(game, gameOptions, entity); if (!seenByInfo.isEmpty()) { attr = String.format("FACE=Dialog COLOR=%s", UIUtil.toColorHexString((GUIP.getUnitToolTipHighlightColor()))); seenByInfo = UIUtil.tag("FONT", attr, seenByInfo); diff --git a/megamek/src/megamek/common/autoresolve/AutoResolveMethod.java b/megamek/src/megamek/common/autoresolve/AutoResolveMethod.java deleted file mode 100644 index d65fe3f3d15..00000000000 --- a/megamek/src/megamek/common/autoresolve/AutoResolveMethod.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. - * - * This file is part of MekHQ. - * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . - */ -package megamek.common.autoresolve; - - -import mekhq.utilities.Internationalization; - -import java.util.Optional; - -/** - * @author Luana Coppio - */ -public enum AutoResolveMethod { - PRINCESS("AutoResolveMethod.PRINCESS.text", "AutoResolveMethod.PRINCESS.toolTipText"), - ABSTRACT_COMBAT("AutoResolveMethod.ABSTRACT_COMBAT.text", "AutoResolveMethod.ABSTRACT_COMBAT.toolTipText"); - - private final String name; - private final String toolTipText; - - AutoResolveMethod(final String name, final String toolTipText) { - this.name = Internationalization.getTextAt("AutoResolveMethod", name); - this.toolTipText = Internationalization.getTextAt("AutoResolveMethod", toolTipText); - } - - public String getToolTipText() { - return toolTipText; - } - - public String getName() { - return name; - } - - public static Optional fromIntSafe(int index) { - if (index < 0 || index >= values().length) { - return Optional.empty(); - } - return Optional.of(values()[index]); - } - - public static Optional fromStringSafe(String method) { - return switch (method.toUpperCase()) { - case "PRINCESS" -> Optional.of(PRINCESS); - case "ABSTRACT_COMBAT" -> Optional.of(ABSTRACT_COMBAT); - default -> Optional.empty(); - }; - } - - @Override - public String toString() { - return name; - } -} diff --git a/megamek/src/megamek/common/autoresolve/Resolver.java b/megamek/src/megamek/common/autoresolve/Resolver.java index 97e6fbb6ff5..6b8865bf1b9 100644 --- a/megamek/src/megamek/common/autoresolve/Resolver.java +++ b/megamek/src/megamek/common/autoresolve/Resolver.java @@ -1,38 +1,25 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve; -import megamek.common.Entity; -import megamek.common.Player; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; import megamek.common.autoresolve.acar.SimulationOptions; +import megamek.common.autoresolve.acar.phase.*; import megamek.common.autoresolve.converter.SetupForces; +import megamek.common.autoresolve.event.AutoResolveConcludedEvent; import megamek.common.options.AbstractOptions; -import mekhq.campaign.Campaign; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.SimulationOptions; -import mekhq.campaign.autoresolve.converter.SetupForces; -import mekhq.campaign.autoresolve.event.AutoResolveConcludedEvent; -import mekhq.campaign.mission.AtBScenario; -import mekhq.campaign.unit.Unit; - -import java.util.List; /** @@ -43,20 +30,10 @@ public class Resolver { private final SimulationOptions options; private final SetupForces setupForces; - public Resolver(List playes, - List units, + public Resolver(SetupForces setupForces, AbstractOptions gameOptions) { - this.options = new SimulationOptions(gameOptions); - this.setupForces = new SetupForces(campaign, units, scenario); - } - - public AutoResolveConcludedEvent resolveSimulation() { - SimulationContext context = new SimulationContext(scenario, options, setupForces); - SimulationManager simulationManager = new SimulationManager(context); - initializeGameManager(simulationManager); - simulationManager.execute(); - return simulationManager.getConclusionEvent(); + this.setupForces = setupForces; } private void initializeGameManager(SimulationManager simulationManager) { @@ -68,4 +45,13 @@ private void initializeGameManager(SimulationManager simulationManager) { simulationManager.addPhaseHandler(new EndPhase(simulationManager)); simulationManager.addPhaseHandler(new VictoryPhase(simulationManager)); } + + public AutoResolveConcludedEvent resolveSimulation() { + SimulationContext context = new SimulationContext(options, setupForces); + SimulationManager simulationManager = new SimulationManager(context); + initializeGameManager(simulationManager); + simulationManager.execute(); + return simulationManager.getConclusionEvent(); + } + } diff --git a/megamek/src/megamek/common/autoresolve/acar/SimulatedClient.java b/megamek/src/megamek/common/autoresolve/acar/SimulatedClient.java index 0a0f65a1b55..f58fd812cb4 100644 --- a/megamek/src/megamek/common/autoresolve/acar/SimulatedClient.java +++ b/megamek/src/megamek/common/autoresolve/acar/SimulatedClient.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar; import megamek.client.AbstractClient; diff --git a/megamek/src/megamek/common/autoresolve/acar/SimulationContext.java b/megamek/src/megamek/common/autoresolve/acar/SimulationContext.java index c4398a1ef81..4ad9626f76f 100644 --- a/megamek/src/megamek/common/autoresolve/acar/SimulationContext.java +++ b/megamek/src/megamek/common/autoresolve/acar/SimulationContext.java @@ -1,20 +1,15 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar; @@ -22,6 +17,13 @@ import megamek.common.*; import megamek.common.actions.EntityAction; import megamek.common.annotations.Nullable; +import megamek.common.autoresolve.acar.action.Action; +import megamek.common.autoresolve.acar.action.ActionHandler; +import megamek.common.autoresolve.acar.report.PublicReportEntry; +import megamek.common.autoresolve.component.AcTurn; +import megamek.common.autoresolve.component.Formation; +import megamek.common.autoresolve.component.FormationTurn; +import megamek.common.autoresolve.converter.SetupForces; import megamek.common.enums.GamePhase; import megamek.common.enums.SkillLevel; import megamek.common.event.GameEvent; @@ -29,15 +31,6 @@ import megamek.common.force.Forces; import megamek.logging.MMLogger; import megamek.server.scriptedevent.TriggeredEvent; -import mekhq.campaign.autoresolve.acar.SimulationOptions; -import mekhq.campaign.autoresolve.acar.action.Action; -import mekhq.campaign.autoresolve.acar.action.ActionHandler; -import mekhq.campaign.autoresolve.acar.report.PublicReportEntry; -import mekhq.campaign.autoresolve.component.AcTurn; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.campaign.autoresolve.component.FormationTurn; -import mekhq.campaign.autoresolve.converter.SetupForces; -import mekhq.campaign.mission.AtBScenario; import org.apache.commons.lang3.NotImplementedException; import java.util.*; @@ -52,7 +45,6 @@ public class SimulationContext implements IGame { private static final MMLogger logger = MMLogger.create(SimulationContext.class); private final SimulationOptions options; - private final AtBScenario scenario; /** * Objectives that must be considered during the game @@ -91,15 +83,10 @@ public class SimulationContext implements IGame { */ private final Vector graveyard = new Vector<>(); - public SimulationContext(AtBScenario scenario, SimulationOptions gameOptions, SetupForces setupForces) { + public SimulationContext(SimulationOptions gameOptions, SetupForces setupForces) { this.options = gameOptions; - this.scenario = scenario; setBoard(0, new Board()); - setupForces.createForcesOnGame(this); - } - - public AtBScenario getScenario() { - return scenario; + setupForces.createForcesOnSimulation(this); } public void addUnit(InGameObject unit) { diff --git a/megamek/src/megamek/common/autoresolve/acar/SimulationManager.java b/megamek/src/megamek/common/autoresolve/acar/SimulationManager.java index d9aed0a920d..96391296e7e 100644 --- a/megamek/src/megamek/common/autoresolve/acar/SimulationManager.java +++ b/megamek/src/megamek/common/autoresolve/acar/SimulationManager.java @@ -1,28 +1,30 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar; import megamek.common.IGame; import megamek.common.Player; import megamek.common.ReportEntry; import megamek.common.TurnOrdered; +import megamek.common.autoresolve.acar.action.*; +import megamek.common.autoresolve.acar.manager.*; +import megamek.common.autoresolve.acar.phase.*; +import megamek.common.autoresolve.acar.report.HtmlGameLogger; +import megamek.common.autoresolve.acar.report.PublicReportEntry; +import megamek.common.autoresolve.component.Formation; + +import megamek.common.autoresolve.event.AutoResolveConcludedEvent; import megamek.common.enums.GamePhase; import megamek.common.net.packets.Packet; import megamek.common.preference.PreferenceManager; @@ -31,11 +33,6 @@ import megamek.server.Server; import megamek.server.commands.ServerCommand; import megamek.server.victory.VictoryResult; -import mekhq.campaign.autoresolve.acar.phase.PhaseHandler; -import mekhq.campaign.autoresolve.acar.report.HtmlGameLogger; -import mekhq.campaign.autoresolve.acar.report.PublicReportEntry; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.campaign.autoresolve.event.AutoResolveConcludedEvent; import java.util.ArrayList; import java.util.Collections; diff --git a/megamek/src/megamek/common/autoresolve/acar/SimulationOptions.java b/megamek/src/megamek/common/autoresolve/acar/SimulationOptions.java index 86d72966d84..d6cde18f092 100644 --- a/megamek/src/megamek/common/autoresolve/acar/SimulationOptions.java +++ b/megamek/src/megamek/common/autoresolve/acar/SimulationOptions.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar; import megamek.common.options.AbstractOptions; diff --git a/megamek/src/megamek/common/autoresolve/acar/action/AbstractAttackAction.java b/megamek/src/megamek/common/autoresolve/acar/action/AbstractAttackAction.java index 5d427a37e74..872e2e6c8c6 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/AbstractAttackAction.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/AbstractAttackAction.java @@ -1,26 +1,18 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; -import mekhq.campaign.autoresolve.acar.action.AttackAction; - public abstract class AbstractAttackAction implements AttackAction { private final int entityId; diff --git a/megamek/src/megamek/common/autoresolve/acar/action/Action.java b/megamek/src/megamek/common/autoresolve/acar/action/Action.java index 6154a9d4950..c28846a290a 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/Action.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/Action.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; import megamek.common.actions.EntityAction; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; /** * @author Luana Coppio diff --git a/megamek/src/megamek/common/autoresolve/acar/action/ActionHandler.java b/megamek/src/megamek/common/autoresolve/acar/action/ActionHandler.java index 544ccd228bf..060adafe4b5 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/ActionHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/ActionHandler.java @@ -1,26 +1,19 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; -import mekhq.campaign.autoresolve.acar.action.Action; -import mekhq.campaign.autoresolve.acar.manager.SimulationManagerHelper; +import megamek.common.autoresolve.acar.manager.SimulationManagerHelper; public interface ActionHandler extends SimulationManagerHelper { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/AttackAction.java b/megamek/src/megamek/common/autoresolve/acar/action/AttackAction.java index d2b73c6e1ab..f7f006324a6 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/AttackAction.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/AttackAction.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; public interface AttackAction extends Action { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/AttackToHitData.java b/megamek/src/megamek/common/autoresolve/acar/action/AttackToHitData.java index 14b7ec937d6..5d7e166e063 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/AttackToHitData.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/AttackToHitData.java @@ -1,31 +1,24 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; import megamek.common.InGameObject; import megamek.common.TargetRoll; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.component.Formation; import megamek.common.strategicBattleSystems.SBFUnit; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.action.StandardUnitAttack; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.utilities.Internationalization; +import megamek.common.internationalization.Internationalization; import java.util.List; diff --git a/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlAction.java b/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlAction.java index bb665b42e63..c445e2b9005 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlAction.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlAction.java @@ -1,30 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.Action; -import mekhq.campaign.autoresolve.acar.action.ActionHandler; -import mekhq.campaign.autoresolve.acar.handler.EngagementAndControlActionHandler; -import mekhq.campaign.autoresolve.component.EngagementControl; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.handler.EngagementAndControlActionHandler; +import megamek.common.autoresolve.component.EngagementControl; public class EngagementControlAction implements Action { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlToHitData.java b/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlToHitData.java index 88189b3126e..72f9a858660 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlToHitData.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/EngagementControlToHitData.java @@ -1,29 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; import megamek.common.TargetRoll; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.action.EngagementControlAction; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.utilities.Internationalization; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.component.Formation; +import megamek.common.internationalization.Internationalization; public class EngagementControlToHitData extends TargetRoll { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/ManeuverToHitData.java b/megamek/src/megamek/common/autoresolve/acar/action/ManeuverToHitData.java index 4a57b9dbaec..da0fc0cf183 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/ManeuverToHitData.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/ManeuverToHitData.java @@ -1,28 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; import megamek.common.TargetRoll; -import mekhq.campaign.autoresolve.component.EngagementControl; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.utilities.Internationalization; +import megamek.common.autoresolve.component.EngagementControl; +import megamek.common.autoresolve.component.Formation; +import megamek.common.internationalization.Internationalization; public class ManeuverToHitData extends TargetRoll { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/MoraleCheckAction.java b/megamek/src/megamek/common/autoresolve/acar/action/MoraleCheckAction.java index 25174f7703b..4f3f4df69c4 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/MoraleCheckAction.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/MoraleCheckAction.java @@ -1,28 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.Action; -import mekhq.campaign.autoresolve.acar.handler.MoraleCheckActionHandler; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.handler.MoraleCheckActionHandler; public class MoraleCheckAction implements Action { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveAction.java b/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveAction.java index d9d37909957..2debaf44186 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveAction.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveAction.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.handler.RecoveringNerveActionHandler; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.handler.RecoveringNerveActionHandler; public class RecoveringNerveAction implements Action { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveActionToHitData.java b/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveActionToHitData.java index e71a09b4490..6907622f79b 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveActionToHitData.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/RecoveringNerveActionToHitData.java @@ -1,29 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; import megamek.common.TargetRoll; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.action.RecoveringNerveAction; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.utilities.Internationalization; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.component.Formation; +import megamek.common.internationalization.Internationalization; public class RecoveringNerveActionToHitData extends TargetRoll { diff --git a/megamek/src/megamek/common/autoresolve/acar/action/StandardUnitAttack.java b/megamek/src/megamek/common/autoresolve/acar/action/StandardUnitAttack.java index 87d51bee103..8d3c7a33b35 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/StandardUnitAttack.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/StandardUnitAttack.java @@ -1,30 +1,24 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; import megamek.common.alphaStrike.ASRange; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.handler.StandardUnitAttackHandler; +import megamek.common.autoresolve.component.Formation; import megamek.logging.MMLogger; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.handler.StandardUnitAttackHandler; -import mekhq.campaign.autoresolve.component.Formation; import java.util.Optional; diff --git a/megamek/src/megamek/common/autoresolve/acar/action/WithdrawAction.java b/megamek/src/megamek/common/autoresolve/acar/action/WithdrawAction.java index 85563095d40..b7c94f19bab 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/WithdrawAction.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/WithdrawAction.java @@ -1,28 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.Action; -import mekhq.campaign.autoresolve.acar.handler.WithdrawActionHandler; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.handler.WithdrawActionHandler; public class WithdrawAction implements Action { private final int formationId; diff --git a/megamek/src/megamek/common/autoresolve/acar/action/WithdrawToHitData.java b/megamek/src/megamek/common/autoresolve/acar/action/WithdrawToHitData.java index af9c0896ced..23e6ab939e0 100644 --- a/megamek/src/megamek/common/autoresolve/acar/action/WithdrawToHitData.java +++ b/megamek/src/megamek/common/autoresolve/acar/action/WithdrawToHitData.java @@ -1,28 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.action; import megamek.common.TargetRoll; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.utilities.Internationalization; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.component.Formation; +import megamek.common.internationalization.Internationalization; public class WithdrawToHitData extends TargetRoll { diff --git a/megamek/src/megamek/common/autoresolve/acar/handler/AbstractActionHandler.java b/megamek/src/megamek/common/autoresolve/acar/handler/AbstractActionHandler.java index 2806f265584..72485129516 100644 --- a/megamek/src/megamek/common/autoresolve/acar/handler/AbstractActionHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/handler/AbstractActionHandler.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.handler; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.Action; -import mekhq.campaign.autoresolve.acar.action.ActionHandler; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.Action; +import megamek.common.autoresolve.acar.action.ActionHandler; public abstract class AbstractActionHandler implements ActionHandler { diff --git a/megamek/src/megamek/common/autoresolve/acar/handler/EngagementAndControlActionHandler.java b/megamek/src/megamek/common/autoresolve/acar/handler/EngagementAndControlActionHandler.java index c247e90f457..a86af715753 100644 --- a/megamek/src/megamek/common/autoresolve/acar/handler/EngagementAndControlActionHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/handler/EngagementAndControlActionHandler.java @@ -1,32 +1,25 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.handler; import megamek.common.Compute; import megamek.common.Roll; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.EngagementControlAction; -import mekhq.campaign.autoresolve.acar.action.EngagementControlToHitData; -import mekhq.campaign.autoresolve.acar.handler.AbstractActionHandler; -import mekhq.campaign.autoresolve.acar.report.EngagementAndControlReporter; -import mekhq.campaign.autoresolve.component.EngagementControl; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.EngagementControlAction; +import megamek.common.autoresolve.acar.action.EngagementControlToHitData; +import megamek.common.autoresolve.acar.report.EngagementAndControlReporter; +import megamek.common.autoresolve.component.EngagementControl; import java.util.Map; diff --git a/megamek/src/megamek/common/autoresolve/acar/handler/MoraleCheckActionHandler.java b/megamek/src/megamek/common/autoresolve/acar/handler/MoraleCheckActionHandler.java index 310bb75c778..69f50f8e411 100644 --- a/megamek/src/megamek/common/autoresolve/acar/handler/MoraleCheckActionHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/handler/MoraleCheckActionHandler.java @@ -1,32 +1,26 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.handler; import megamek.common.Compute; import megamek.common.Roll; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.MoraleCheckAction; -import mekhq.campaign.autoresolve.acar.action.RecoveringNerveAction; -import mekhq.campaign.autoresolve.acar.action.RecoveringNerveActionToHitData; -import mekhq.campaign.autoresolve.acar.report.MoraleReporter; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.MoraleCheckAction; +import megamek.common.autoresolve.acar.action.RecoveringNerveAction; +import megamek.common.autoresolve.acar.action.RecoveringNerveActionToHitData; +import megamek.common.autoresolve.acar.report.MoraleReporter; +import megamek.common.autoresolve.component.Formation; public class MoraleCheckActionHandler extends AbstractActionHandler { diff --git a/megamek/src/megamek/common/autoresolve/acar/handler/RecoveringNerveActionHandler.java b/megamek/src/megamek/common/autoresolve/acar/handler/RecoveringNerveActionHandler.java index 74796f7bc10..7f5346a9587 100644 --- a/megamek/src/megamek/common/autoresolve/acar/handler/RecoveringNerveActionHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/handler/RecoveringNerveActionHandler.java @@ -1,31 +1,24 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.handler; import megamek.common.Compute; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.RecoveringNerveAction; -import mekhq.campaign.autoresolve.acar.action.RecoveringNerveActionToHitData; -import mekhq.campaign.autoresolve.acar.handler.AbstractActionHandler; -import mekhq.campaign.autoresolve.acar.report.RecoveringNerveActionReporter; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.RecoveringNerveAction; +import megamek.common.autoresolve.acar.action.RecoveringNerveActionToHitData; +import megamek.common.autoresolve.acar.report.RecoveringNerveActionReporter; +import megamek.common.autoresolve.component.Formation; public class RecoveringNerveActionHandler extends AbstractActionHandler { diff --git a/megamek/src/megamek/common/autoresolve/acar/handler/StandardUnitAttackHandler.java b/megamek/src/megamek/common/autoresolve/acar/handler/StandardUnitAttackHandler.java index 464d2b4cb95..fa5e603dc28 100644 --- a/megamek/src/megamek/common/autoresolve/acar/handler/StandardUnitAttackHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/handler/StandardUnitAttackHandler.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.handler; import megamek.codeUtilities.ObjectUtility; @@ -24,14 +18,13 @@ import megamek.common.Entity; import megamek.common.Roll; import megamek.common.alphaStrike.AlphaStrikeElement; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.AttackToHitData; +import megamek.common.autoresolve.acar.action.StandardUnitAttack; +import megamek.common.autoresolve.acar.report.AttackReporter; +import megamek.common.autoresolve.component.EngagementControl; +import megamek.common.autoresolve.component.Formation; import megamek.common.strategicBattleSystems.SBFUnit; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.AttackToHitData; -import mekhq.campaign.autoresolve.acar.action.StandardUnitAttack; -import mekhq.campaign.autoresolve.acar.handler.AbstractActionHandler; -import mekhq.campaign.autoresolve.acar.report.AttackReporter; -import mekhq.campaign.autoresolve.component.EngagementControl; -import mekhq.campaign.autoresolve.component.Formation; import java.util.ArrayList; import java.util.Collections; diff --git a/megamek/src/megamek/common/autoresolve/acar/handler/WithdrawActionHandler.java b/megamek/src/megamek/common/autoresolve/acar/handler/WithdrawActionHandler.java index 23d9de7b826..0b322e82e17 100644 --- a/megamek/src/megamek/common/autoresolve/acar/handler/WithdrawActionHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/handler/WithdrawActionHandler.java @@ -1,31 +1,24 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.handler; import megamek.common.Compute; import megamek.common.IEntityRemovalConditions; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.WithdrawAction; -import mekhq.campaign.autoresolve.acar.action.WithdrawToHitData; -import mekhq.campaign.autoresolve.acar.handler.AbstractActionHandler; -import mekhq.campaign.autoresolve.acar.report.WithdrawReporter; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.WithdrawAction; +import megamek.common.autoresolve.acar.action.WithdrawToHitData; +import megamek.common.autoresolve.acar.report.WithdrawReporter; import java.util.concurrent.atomic.AtomicInteger; diff --git a/megamek/src/megamek/common/autoresolve/acar/manager/ActionsProcessor.java b/megamek/src/megamek/common/autoresolve/acar/manager/ActionsProcessor.java index 48e5077f773..266fd0a2675 100644 --- a/megamek/src/megamek/common/autoresolve/acar/manager/ActionsProcessor.java +++ b/megamek/src/megamek/common/autoresolve/acar/manager/ActionsProcessor.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.manager; import megamek.common.actions.EntityAction; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.manager.SimulationManagerHelper; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.*; public record ActionsProcessor(SimulationManager simulationManager) implements SimulationManagerHelper { diff --git a/megamek/src/megamek/common/autoresolve/acar/manager/InitiativeHelper.java b/megamek/src/megamek/common/autoresolve/acar/manager/InitiativeHelper.java index 030a1d6f1dc..781570696de 100644 --- a/megamek/src/megamek/common/autoresolve/acar/manager/InitiativeHelper.java +++ b/megamek/src/megamek/common/autoresolve/acar/manager/InitiativeHelper.java @@ -1,35 +1,29 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.manager; import megamek.common.*; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.report.FormationReportEntry; +import megamek.common.autoresolve.acar.report.PlayerNameReportEntry; +import megamek.common.autoresolve.acar.report.PublicReportEntry; +import megamek.common.autoresolve.acar.report.ReportHeader; +import megamek.common.autoresolve.component.AcTurn; +import megamek.common.autoresolve.component.Formation; +import megamek.common.autoresolve.component.FormationTurn; import megamek.common.enums.GamePhase; import megamek.common.strategicBattleSystems.SBFFormation; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.report.FormationReportEntry; -import mekhq.campaign.autoresolve.acar.report.PlayerNameReportEntry; -import mekhq.campaign.autoresolve.acar.report.PublicReportEntry; -import mekhq.campaign.autoresolve.acar.report.ReportHeader; -import mekhq.campaign.autoresolve.component.AcTurn; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.campaign.autoresolve.component.FormationTurn; import java.util.*; import java.util.stream.Collectors; diff --git a/megamek/src/megamek/common/autoresolve/acar/manager/PhaseEndManager.java b/megamek/src/megamek/common/autoresolve/acar/manager/PhaseEndManager.java index 0e6882fb860..4a438ec296f 100644 --- a/megamek/src/megamek/common/autoresolve/acar/manager/PhaseEndManager.java +++ b/megamek/src/megamek/common/autoresolve/acar/manager/PhaseEndManager.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.manager; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.report.PublicReportEntry; import megamek.common.enums.GamePhase; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.report.PublicReportEntry; public record PhaseEndManager(SimulationManager simulationManager) implements SimulationManagerHelper { diff --git a/megamek/src/megamek/common/autoresolve/acar/manager/PhasePreparationManager.java b/megamek/src/megamek/common/autoresolve/acar/manager/PhasePreparationManager.java index 954ebb56f36..9102af8347e 100644 --- a/megamek/src/megamek/common/autoresolve/acar/manager/PhasePreparationManager.java +++ b/megamek/src/megamek/common/autoresolve/acar/manager/PhasePreparationManager.java @@ -1,25 +1,19 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.manager; -import mekhq.campaign.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.SimulationManager; public record PhasePreparationManager(SimulationManager simulationManager) implements SimulationManagerHelper { diff --git a/megamek/src/megamek/common/autoresolve/acar/manager/SimulationManagerHelper.java b/megamek/src/megamek/common/autoresolve/acar/manager/SimulationManagerHelper.java index 6d434f6c391..b088a7705bf 100644 --- a/megamek/src/megamek/common/autoresolve/acar/manager/SimulationManagerHelper.java +++ b/megamek/src/megamek/common/autoresolve/acar/manager/SimulationManagerHelper.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.manager; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.report.PublicReportEntry; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.report.PublicReportEntry; /** * Helper interface for classes that need to interact with the {@link SimulationManager}. diff --git a/megamek/src/megamek/common/autoresolve/acar/manager/VictoryHelper.java b/megamek/src/megamek/common/autoresolve/acar/manager/VictoryHelper.java index 2906956d493..e96343ff7d1 100644 --- a/megamek/src/megamek/common/autoresolve/acar/manager/VictoryHelper.java +++ b/megamek/src/megamek/common/autoresolve/acar/manager/VictoryHelper.java @@ -1,28 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.manager; import megamek.common.Player; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; import megamek.server.victory.VictoryResult; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; public class VictoryHelper { diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/DeploymentPhase.java b/megamek/src/megamek/common/autoresolve/acar/phase/DeploymentPhase.java index 3bc34e64023..add09159813 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/DeploymentPhase.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/DeploymentPhase.java @@ -1,26 +1,20 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; +import megamek.common.autoresolve.acar.SimulationManager; import megamek.common.enums.GamePhase; -import mekhq.campaign.autoresolve.acar.SimulationManager; public class DeploymentPhase extends PhaseHandler { diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/EndPhase.java b/megamek/src/megamek/common/autoresolve/acar/phase/EndPhase.java index e41171297cb..e4a55b41b67 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/EndPhase.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/EndPhase.java @@ -1,35 +1,29 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; import megamek.ai.utility.Memory; import megamek.common.IEntityRemovalConditions; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.MoraleCheckAction; +import megamek.common.autoresolve.acar.action.RecoveringNerveAction; +import megamek.common.autoresolve.acar.action.WithdrawAction; +import megamek.common.autoresolve.acar.report.EndPhaseReporter; +import megamek.common.autoresolve.component.Formation; import megamek.common.enums.GamePhase; import megamek.common.strategicBattleSystems.SBFUnit; import megamek.common.util.weightedMaps.WeightedDoubleMap; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.MoraleCheckAction; -import mekhq.campaign.autoresolve.acar.action.RecoveringNerveAction; -import mekhq.campaign.autoresolve.acar.action.WithdrawAction; -import mekhq.campaign.autoresolve.acar.report.EndPhaseReporter; -import mekhq.campaign.autoresolve.component.Formation; import java.util.List; diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/FiringPhase.java b/megamek/src/megamek/common/autoresolve/acar/phase/FiringPhase.java index cd9b7877df2..ef7f9166d62 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/FiringPhase.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/FiringPhase.java @@ -1,36 +1,30 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; import megamek.common.Compute; import megamek.common.Entity; import megamek.common.alphaStrike.ASRange; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.Action; +import megamek.common.autoresolve.acar.action.ManeuverToHitData; +import megamek.common.autoresolve.acar.action.StandardUnitAttack; +import megamek.common.autoresolve.component.EngagementControl; +import megamek.common.autoresolve.component.Formation; +import megamek.common.autoresolve.component.FormationTurn; import megamek.common.enums.GamePhase; import megamek.common.util.weightedMaps.WeightedDoubleMap; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.Action; -import mekhq.campaign.autoresolve.acar.action.ManeuverToHitData; -import mekhq.campaign.autoresolve.acar.action.StandardUnitAttack; -import mekhq.campaign.autoresolve.component.EngagementControl; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.campaign.autoresolve.component.FormationTurn; import java.util.ArrayList; import java.util.Collection; diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/InitiativePhase.java b/megamek/src/megamek/common/autoresolve/acar/phase/InitiativePhase.java index c3d74f31fed..db2e85c6fad 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/InitiativePhase.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/InitiativePhase.java @@ -1,27 +1,20 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; +import megamek.common.autoresolve.acar.SimulationManager; import megamek.common.enums.GamePhase; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.phase.PhaseHandler; public class InitiativePhase extends PhaseHandler { diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/MovementPhase.java b/megamek/src/megamek/common/autoresolve/acar/phase/MovementPhase.java index 15005d4469f..6b440aea534 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/MovementPhase.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/MovementPhase.java @@ -1,34 +1,28 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; import megamek.common.Entity; import megamek.common.alphaStrike.ASRange; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.action.EngagementControlAction; +import megamek.common.autoresolve.component.EngagementControl; +import megamek.common.autoresolve.component.Formation; +import megamek.common.autoresolve.component.FormationTurn; import megamek.common.enums.GamePhase; import megamek.common.strategicBattleSystems.SBFFormation; import megamek.common.util.weightedMaps.WeightedDoubleMap; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.action.EngagementControlAction; -import mekhq.campaign.autoresolve.component.EngagementControl; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.campaign.autoresolve.component.FormationTurn; import java.util.Collections; import java.util.Map; diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/PhaseHandler.java b/megamek/src/megamek/common/autoresolve/acar/phase/PhaseHandler.java index 98deddf75f1..2ec5036a56c 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/PhaseHandler.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/PhaseHandler.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; import megamek.common.enums.GamePhase; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; /** * @author Luana Coppio diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/StartingScenarioPhase.java b/megamek/src/megamek/common/autoresolve/acar/phase/StartingScenarioPhase.java index 9bf1723936a..a4092998ae8 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/StartingScenarioPhase.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/StartingScenarioPhase.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.report.StartingScenarioPhaseReporter; import megamek.common.enums.GamePhase; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.report.StartingScenarioPhaseReporter; public class StartingScenarioPhase extends PhaseHandler { diff --git a/megamek/src/megamek/common/autoresolve/acar/phase/VictoryPhase.java b/megamek/src/megamek/common/autoresolve/acar/phase/VictoryPhase.java index 1711a4e44b6..94c9e2f93a6 100644 --- a/megamek/src/megamek/common/autoresolve/acar/phase/VictoryPhase.java +++ b/megamek/src/megamek/common/autoresolve/acar/phase/VictoryPhase.java @@ -1,33 +1,27 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.phase; import megamek.common.Entity; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.report.VictoryPhaseReporter; +import megamek.common.autoresolve.component.Formation; +import megamek.common.autoresolve.damage.DamageApplierChooser; +import megamek.common.autoresolve.damage.EntityFinalState; import megamek.common.enums.GamePhase; import megamek.common.strategicBattleSystems.SBFUnit; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; -import mekhq.campaign.autoresolve.acar.report.VictoryPhaseReporter; -import mekhq.campaign.autoresolve.component.Formation; -import mekhq.campaign.unit.damage.DamageApplierChooser; -import mekhq.campaign.unit.damage.EntityFinalState; public class VictoryPhase extends PhaseHandler { diff --git a/megamek/src/megamek/common/autoresolve/acar/report/AttackReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/AttackReporter.java index 7f511df245f..4bb1dbbc639 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/AttackReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/AttackReporter.java @@ -1,29 +1,23 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.IGame; import megamek.common.Roll; import megamek.common.TargetRoll; +import megamek.common.autoresolve.component.Formation; import megamek.common.strategicBattleSystems.SBFUnit; -import mekhq.campaign.autoresolve.component.Formation; import java.util.function.Consumer; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/EndPhaseReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/EndPhaseReporter.java index 62b3ed86ecc..8cf86fe47a1 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/EndPhaseReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/EndPhaseReporter.java @@ -1,28 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.Entity; import megamek.common.IEntityRemovalConditions; import megamek.common.IGame; -import mekhq.campaign.autoresolve.acar.report.EntityNameReportEntry; import java.util.Map; import java.util.function.Consumer; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/EngagementAndControlReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/EngagementAndControlReporter.java index 60fa489f13c..1cf2d89188c 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/EngagementAndControlReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/EngagementAndControlReporter.java @@ -1,30 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.IGame; import megamek.common.Roll; -import mekhq.campaign.autoresolve.acar.report.PlayerNameReportEntry; -import mekhq.campaign.autoresolve.acar.report.RollReportEntry; -import mekhq.campaign.autoresolve.component.EngagementControl; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.component.EngagementControl; +import megamek.common.autoresolve.component.Formation; import java.util.function.Consumer; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/EntityNameReportEntry.java b/megamek/src/megamek/common/autoresolve/acar/report/EntityNameReportEntry.java index cb67a447e3d..acab9f3cf1c 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/EntityNameReportEntry.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/EntityNameReportEntry.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.util.PlayerColour; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/FormationReportEntry.java b/megamek/src/megamek/common/autoresolve/acar/report/FormationReportEntry.java index 17c67a75aab..c0a0df2b38f 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/FormationReportEntry.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/FormationReportEntry.java @@ -1,28 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.tooltip.SBFInGameObjectTooltip; import megamek.client.ui.swing.util.UIUtil; import megamek.common.IGame; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.component.Formation; public class FormationReportEntry extends PublicReportEntry { diff --git a/megamek/src/megamek/common/autoresolve/acar/report/HtmlGameLogger.java b/megamek/src/megamek/common/autoresolve/acar/report/HtmlGameLogger.java index e15031936c6..4073f246867 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/HtmlGameLogger.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/HtmlGameLogger.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.GameLog; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/MoraleReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/MoraleReporter.java index d7df46e1487..0b4064d5d34 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/MoraleReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/MoraleReporter.java @@ -1,28 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.IGame; import megamek.common.Roll; -import mekhq.campaign.autoresolve.acar.report.RollReportEntry; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.component.Formation; import java.util.function.Consumer; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/PlayerNameReportEntry.java b/megamek/src/megamek/common/autoresolve/acar/report/PlayerNameReportEntry.java index 9992e61787d..e006cad2122 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/PlayerNameReportEntry.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/PlayerNameReportEntry.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.util.PlayerColour; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/PublicReportEntry.java b/megamek/src/megamek/common/autoresolve/acar/report/PublicReportEntry.java index fb777f07b9c..bb235ee4ec5 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/PublicReportEntry.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/PublicReportEntry.java @@ -1,28 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.Report; import megamek.common.ReportEntry; import megamek.common.Roll; -import mekhq.campaign.autoresolve.acar.report.ReportMessages; import java.io.Serializable; import java.util.ArrayList; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/RecoveringNerveActionReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/RecoveringNerveActionReporter.java index 39f75f3df8a..7dad53032e3 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/RecoveringNerveActionReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/RecoveringNerveActionReporter.java @@ -1,29 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.util.UIUtil; import megamek.common.IGame; import megamek.common.Roll; -import mekhq.campaign.autoresolve.acar.report.RollReportEntry; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.component.Formation; import java.util.function.Consumer; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/ReportHeader.java b/megamek/src/megamek/common/autoresolve/acar/report/ReportHeader.java index a7e461801f6..05381954f34 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/ReportHeader.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/ReportHeader.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.util.UIUtil; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/ReportMessages.java b/megamek/src/megamek/common/autoresolve/acar/report/ReportMessages.java index f1c45a0cece..e4656133c9b 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/ReportMessages.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/ReportMessages.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.MegaMek; @@ -30,23 +24,23 @@ public class ReportMessages { private static final ResourceBundle RESOURCE_BUNDLE = - ResourceBundle.getBundle("mekhq.resources.acs-report-messages", MegaMek.getMMOptions().getLocale()); + ResourceBundle.getBundle("megamek.client.acs-report-messages", MegaMek.getMMOptions().getLocale()); private static final ResourceBundle EN_RESOURCE_BUNDLE = - ResourceBundle.getBundle("mekhq.resources.acs-report-messages", Locale.ENGLISH); + ResourceBundle.getBundle("megamek.client.acs-report-messages", Locale.ENGLISH); private static String getEnString(String key) { - try { + if (EN_RESOURCE_BUNDLE.containsKey(key)) { return EN_RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { + } else { return null; } } public static String getString(String key) { - try { + if (RESOURCE_BUNDLE.containsKey(key)) { return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { + } else { return getEnString(key); } } diff --git a/megamek/src/megamek/common/autoresolve/acar/report/RollReportEntry.java b/megamek/src/megamek/common/autoresolve/acar/report/RollReportEntry.java index 041556690c7..7dd26385d21 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/RollReportEntry.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/RollReportEntry.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.util.UIUtil; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/StartingScenarioPhaseReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/StartingScenarioPhaseReporter.java index c114f98acde..043f44124ae 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/StartingScenarioPhaseReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/StartingScenarioPhaseReporter.java @@ -1,28 +1,22 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.Entity; import megamek.common.IGame; import megamek.common.Player; -import mekhq.campaign.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.SimulationManager; import java.util.ArrayList; import java.util.HashMap; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/UnitReportEntry.java b/megamek/src/megamek/common/autoresolve/acar/report/UnitReportEntry.java index d755da6356f..201eaaec6bb 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/UnitReportEntry.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/UnitReportEntry.java @@ -1,26 +1,20 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.util.UIUtil; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.component.Formation; import java.awt.*; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/VictoryPhaseReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/VictoryPhaseReporter.java index c390b069b59..3518da34827 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/VictoryPhaseReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/VictoryPhaseReporter.java @@ -1,29 +1,23 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.common.Entity; import megamek.common.IGame; import megamek.common.Player; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.acar.SimulationManager; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationManager; import java.util.ArrayList; import java.util.HashMap; diff --git a/megamek/src/megamek/common/autoresolve/acar/report/WithdrawReporter.java b/megamek/src/megamek/common/autoresolve/acar/report/WithdrawReporter.java index dadb1348bd8..4c4cfdc1051 100644 --- a/megamek/src/megamek/common/autoresolve/acar/report/WithdrawReporter.java +++ b/megamek/src/megamek/common/autoresolve/acar/report/WithdrawReporter.java @@ -1,31 +1,23 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.acar.report; import megamek.client.ui.swing.util.UIUtil; import megamek.common.IGame; import megamek.common.Roll; import megamek.common.TargetRoll; -import mekhq.campaign.autoresolve.acar.report.PlayerNameReportEntry; -import mekhq.campaign.autoresolve.acar.report.RollReportEntry; -import mekhq.campaign.autoresolve.component.Formation; +import megamek.common.autoresolve.component.Formation; import java.util.function.Consumer; diff --git a/megamek/src/megamek/common/autoresolve/component/AcTurn.java b/megamek/src/megamek/common/autoresolve/component/AcTurn.java index 89da4ca7935..e06bbdd0dcb 100644 --- a/megamek/src/megamek/common/autoresolve/component/AcTurn.java +++ b/megamek/src/megamek/common/autoresolve/component/AcTurn.java @@ -1,26 +1,20 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.component; import megamek.common.AbstractPlayerTurn; -import mekhq.campaign.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationContext; public abstract class AcTurn extends AbstractPlayerTurn { diff --git a/megamek/src/megamek/common/autoresolve/component/EngagementControl.java b/megamek/src/megamek/common/autoresolve/component/EngagementControl.java index a69164b9204..ce67bd81579 100644 --- a/megamek/src/megamek/common/autoresolve/component/EngagementControl.java +++ b/megamek/src/megamek/common/autoresolve/component/EngagementControl.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.component; public enum EngagementControl { diff --git a/megamek/src/megamek/common/autoresolve/component/Formation.java b/megamek/src/megamek/common/autoresolve/component/Formation.java index 2320b869ff1..40fbef41e8c 100644 --- a/megamek/src/megamek/common/autoresolve/component/Formation.java +++ b/megamek/src/megamek/common/autoresolve/component/Formation.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.component; import megamek.ai.utility.Memory; @@ -26,7 +20,6 @@ import megamek.common.alphaStrike.ASRange; import megamek.common.strategicBattleSystems.SBFFormation; import megamek.common.strategicBattleSystems.SBFUnit; -import mekhq.campaign.autoresolve.component.EngagementControl; public class Formation extends SBFFormation { diff --git a/megamek/src/megamek/common/autoresolve/component/FormationTurn.java b/megamek/src/megamek/common/autoresolve/component/FormationTurn.java index 6be4381c029..a6403ffcd8f 100644 --- a/megamek/src/megamek/common/autoresolve/component/FormationTurn.java +++ b/megamek/src/megamek/common/autoresolve/component/FormationTurn.java @@ -1,27 +1,21 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.component; import megamek.common.IGame; import megamek.common.InGameObject; -import mekhq.campaign.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.acar.SimulationContext; public class FormationTurn extends AcTurn { diff --git a/megamek/src/megamek/common/autoresolve/converter/BalancedConsolidateForces.java b/megamek/src/megamek/common/autoresolve/converter/BalancedConsolidateForces.java index 7e637b7f470..7d198a3ad55 100644 --- a/megamek/src/megamek/common/autoresolve/converter/BalancedConsolidateForces.java +++ b/megamek/src/megamek/common/autoresolve/converter/BalancedConsolidateForces.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.converter; import java.util.*; diff --git a/megamek/src/megamek/common/autoresolve/converter/ConsolidateForces.java b/megamek/src/megamek/common/autoresolve/converter/ConsolidateForces.java index fecb040024c..caef1224262 100644 --- a/megamek/src/megamek/common/autoresolve/converter/ConsolidateForces.java +++ b/megamek/src/megamek/common/autoresolve/converter/ConsolidateForces.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.converter; import megamek.common.Entity; diff --git a/megamek/src/megamek/common/autoresolve/converter/ForceToFormationConverter.java b/megamek/src/megamek/common/autoresolve/converter/ForceToFormationConverter.java index 85b6f0d8d1e..264e3c94972 100644 --- a/megamek/src/megamek/common/autoresolve/converter/ForceToFormationConverter.java +++ b/megamek/src/megamek/common/autoresolve/converter/ForceToFormationConverter.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.autoresolve.converter; import megamek.common.Entity; @@ -26,14 +20,14 @@ import megamek.common.alphaStrike.ASRange; import megamek.common.alphaStrike.AlphaStrikeElement; import megamek.common.alphaStrike.conversion.ASConverter; +import megamek.common.autoresolve.acar.SimulationContext; +import megamek.common.autoresolve.component.Formation; import megamek.common.force.Force; import megamek.common.force.Forces; import megamek.common.strategicBattleSystems.BaseFormationConverter; import megamek.common.strategicBattleSystems.SBFUnit; import megamek.common.strategicBattleSystems.SBFUnitConverter; import megamek.logging.MMLogger; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.autoresolve.component.Formation; import java.util.ArrayList; diff --git a/megamek/src/megamek/common/autoresolve/converter/SetupForces.java b/megamek/src/megamek/common/autoresolve/converter/SetupForces.java index 645fef19cae..15259318d95 100644 --- a/megamek/src/megamek/common/autoresolve/converter/SetupForces.java +++ b/megamek/src/megamek/common/autoresolve/converter/SetupForces.java @@ -1,466 +1,24 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 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. * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . */ package megamek.common.autoresolve.converter; -import io.sentry.Sentry; -import megamek.common.*; -import megamek.common.alphaStrike.conversion.ASConverter; import megamek.common.autoresolve.acar.SimulationContext; -import megamek.common.enums.SkillLevel; -import megamek.common.force.Forces; -import megamek.common.options.OptionsConstants; -import megamek.common.planetaryconditions.PlanetaryConditions; -import megamek.logging.MMLogger; -import mekhq.campaign.Campaign; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.copy.CrewRefBreak; -import mekhq.campaign.mission.AtBDynamicScenario; -import mekhq.campaign.mission.AtBScenario; -import mekhq.campaign.mission.BotForce; -import mekhq.campaign.mission.Scenario; -import mekhq.campaign.unit.Unit; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; - -/** - * @author Luana Coppio - */ -public class SetupForces { - private static final MMLogger logger = MMLogger.create(SetupForces.class); - - private final List units; - private final List players; - private final Forces forces; - - public SetupForces(List players, List units, Forces forces) { - this.units = units; - this.forces = forces; - this.players = players; - } - - /** - * Create the forces for the game object, using the campaign, units and scenario - * @param game The game object to setup the forces in - */ - public void createForcesOnGame(SimulationContext game) { - setupPlayer(game); - setupBots(game); - ConsolidateForces.consolidateForces(game); - convertForcesIntoFormations(game); - } - - private static class FailedToConvertForceToFormationException extends RuntimeException { - public FailedToConvertForceToFormationException(Throwable cause) { - super(cause); - } - } - - /** - * Convert the forces in the game to formations, this is the most important step in the setup of the game, - * it converts every top level force into a single formation, and those formations are then added to the game - * and used in the auto resolve in place of the original entities - * @param game The game object to convert the forces in - */ - private static void convertForcesIntoFormations(SimulationContext game) { - for(var force : game.getForces().getTopLevelForces()) { - try { - var formation = new ForceToFormationConverter(force, game).convert(); - formation.setTargetFormationId(Entity.NONE); - formation.setOwnerId(force.getOwnerId()); - game.addUnit(formation); - game.getForces().addEntity(formation, force.getId()); - } catch (Exception e) { - Sentry.captureException(e); - var entities = game.getForces().getFullEntities(force).stream().filter(Entity.class::isInstance) - .map(Entity.class::cast).toList(); - logger.error("Error converting force to formation {} - {}", force, entities, e); - throw new FailedToConvertForceToFormationException(e); - } - } - } - - /** - * Setup the player, its forces and entities in the game, it also sets the player skill level. - * @param game The game object to setup the player in - */ - private void setupPlayer(SimulationContext game, SkillLevel playerSkillLevel) { - var player = getCleanPlayer(); - game.addPlayer(player.getId(), player); - var entities = setupPlayerForces(player); - game.setPlayerSkillLevel(player.getId(), playerSkillLevel); - sendEntities(entities, game); - } - - /** - * Setup the bots, their forces and entities in the game, it also sets the player skill level. - * @param game The game object to setup the bots in - */ - private void setupBot(SimulationContext game, SkillLevel botSkillLevel) { - var localBots = new HashMap(); - for (int i = 0; i < scenario.getNumBots(); i++) { - BotForce bf = scenario.getBotForce(i); - String name = bf.getName(); - if (localBots.containsKey(name)) { - int append = 2; - while (localBots.containsKey(name + append)) { - append++; - } - name += append; - } - var highestPlayerId = game.getPlayersList().stream().mapToInt(Player::getId).max().orElse(0); - Player bot = new Player(highestPlayerId + 1, name); - bot.setTeam(bf.getTeam()); - localBots.put(name, bot); - configureBot(bot, bf); - game.addPlayer(bot.getId(), bot); - if (bot.isEnemyOf(campaign.getPlayer())) { - game.setPlayerSkillLevel(bot.getId(), enemySkill); - } else { - game.setPlayerSkillLevel(bot.getId(), allySkill); - } - bf.generateRandomForces(units, campaign); - var entities = bf.getFullEntityList(campaign); - var botEntities = setupBotEntities(bot, entities, bf.getDeployRound()); - sendEntities(botEntities, game); - } - } - - /** - * Create a player object from the campaign and scenario wichi doesnt have a reference to the original player - * @return The clean player object - */ - private Player getCleanPlayer() { - var campaignPlayer = campaign.getPlayer(); - var player = new Player(campaignPlayer.getId(), campaign.getName()); - player.setCamouflage(campaign.getCamouflage().clone()); - player.setColour(campaign.getColour()); - player.setStartingPos(scenario.getStartingPos()); - player.setStartOffset(scenario.getStartOffset()); - player.setStartWidth(scenario.getStartWidth()); - player.setStartingAnyNWx(scenario.getStartingAnyNWx()); - player.setStartingAnyNWy(scenario.getStartingAnyNWy()); - player.setStartingAnySEx(scenario.getStartingAnySEx()); - player.setStartingAnySEy(scenario.getStartingAnySEy()); - player.setTeam(1); - player.setNbrMFActive(scenario.getNumPlayerMinefields(Minefield.TYPE_ACTIVE)); - player.setNbrMFConventional(scenario.getNumPlayerMinefields(Minefield.TYPE_CONVENTIONAL)); - player.setNbrMFInferno(scenario.getNumPlayerMinefields(Minefield.TYPE_INFERNO)); - player.setNbrMFVibra(scenario.getNumPlayerMinefields(Minefield.TYPE_VIBRABOMB)); - player.getTurnInitBonus(); - return player; - } - - /** - * Setup the player forces and entities for the game - * @param player The player object to setup the forces for - * @return A list of entities for the player - */ - private List setupPlayerForces(Player player) { - boolean useDropship = false; - if (scenario.getCombatRole().isPatrol()) { - for (Entity en : scenario.getAlliesPlayer()) { - if (en.getUnitType() == UnitType.DROPSHIP) { - useDropship = true; - break; - } - } - if (!useDropship) { - for (Unit unit : units) { - if (unit.getEntity().getUnitType() == UnitType.DROPSHIP) { - useDropship = true; - break; - } - } - } - } - var entities = new ArrayList(); - - for (Unit unit : units) { - // Get the Entity - var entity = ASConverter.getUndamagedEntity(unit.getEntity()); - // Set the TempID for auto reporting - if (Objects.isNull(entity)) { - continue; - } - - entity.setExternalIdAsString(unit.getId().toString()); - // Set the owner - entity.setOwner(player); - - // If this unit is a spacecraft, set the crew size and marine size values - if (entity.isLargeCraft() || (entity.getUnitType() == UnitType.SMALL_CRAFT)) { - entity.setNCrew(unit.getActiveCrew().size()); - entity.setNMarines(unit.getMarineCount()); - } - // Calculate deployment round - int deploymentRound = entity.getDeployRound(); - if (!(scenario instanceof AtBDynamicScenario)) { - int speed = entity.getWalkMP(); - if (entity.getJumpMP() > 0) { - if (entity instanceof Infantry) { - speed = entity.getJumpMP(); - } else { - speed++; - } - } - // Set scenario type-specific delay - deploymentRound = Math.max(entity.getDeployRound(), scenario.getDeploymentDelay() - speed); - // Lances deployed in scout roles always deploy units in 6-walking speed turns - if (scenario.getCombatRole().isPatrol() - && (scenario.getCombatTeamById(campaign) != null) - && (scenario.getCombatTeamById(campaign).getForceId() == scenario.getCombatTeamId()) - && !useDropship) { - deploymentRound = Math.max(deploymentRound, 6 - speed); - } - } - entity.setDeployRound(deploymentRound); - var force = campaign.getForceFor(unit); - if (force != null) { - entity.setForceString(force.getFullMMName()); - } else if (!unit.getEntity().getForceString().isBlank()) { - // this was added mostly to make it easier to run tests - entity.setForceString(unit.getEntity().getForceString()); - } - var newCrewRef = new CrewRefBreak(unit.getEntity().getCrew()).copy(); - entity.setCrew(newCrewRef); - entities.add(entity); - } - - for (Entity entity : scenario.getAlliesPlayer()) { - if (null == entity) { - continue; - } - entity.setOwner(player); - - int deploymentRound = entity.getDeployRound(); - if (!(scenario instanceof AtBDynamicScenario)) { - int speed = entity.getWalkMP(); - if (entity.getJumpMP() > 0) { - if (entity instanceof Infantry) { - speed = entity.getJumpMP(); - } else { - speed++; - } - } - deploymentRound = Math.max(entity.getDeployRound(), scenario.getDeploymentDelay() - speed); - if (!useDropship - && scenario.getCombatRole().isPatrol() - && (scenario.getCombatTeamById(campaign) != null) - && (scenario.getCombatTeamById(campaign).getForceId() == scenario.getCombatTeamId())) { - deploymentRound = Math.max(deploymentRound, 6 - speed); - } - } - - entity.setDeployRound(deploymentRound); - entities.add(entity); - } - - return entities; - } - - /** - * Setup the map settings for the game, not relevant at the moment, as the map settings are not used in the autoresolve currently - * @return The map settings object - */ - private MapSettings setupMapSettings() { - MapSettings mapSettings = MapSettings.getInstance(); - mapSettings.setBoardSize(scenario.getMapX(), scenario.getMapY()); - mapSettings.setMapSize(1, 1); - mapSettings.getBoardsSelectedVector().clear(); - - // if the scenario is taking place in space, do space settings instead - if (scenario.getBoardType() == Scenario.T_SPACE - || scenario.getTerrainType().equals("Space")) { - mapSettings.setMedium(MapSettings.MEDIUM_SPACE); - mapSettings.getBoardsSelectedVector().add(MapSettings.BOARD_GENERATED); - } else if (scenario.isUsingFixedMap()) { - String board = scenario.getMap().replace(".board", ""); - board = board.replace("\\", "/"); - mapSettings.getBoardsSelectedVector().add(board); - - if (scenario.getBoardType() == Scenario.T_ATMOSPHERE) { - mapSettings.setMedium(MapSettings.MEDIUM_ATMOSPHERE); - } - } else { - File mapgenFile = new File("data/mapgen/" + scenario.getMap() + ".xml"); - try (InputStream is = new FileInputStream(mapgenFile)) { - mapSettings = MapSettings.getInstance(is); - } catch (IOException ex) { - Sentry.captureException(ex); - logger.error( - String.format("Could not load map file data/mapgen/%s.xml", scenario.getMap()), - ex); - } - - if (scenario.getBoardType() == Scenario.T_ATMOSPHERE) { - mapSettings.setMedium(MapSettings.MEDIUM_ATMOSPHERE); - } - - // duplicate code, but getting a new instance of map settings resets the size - // parameters - mapSettings.setBoardSize(scenario.getMapX(), scenario.getMapY()); - mapSettings.setMapSize(1, 1); - mapSettings.getBoardsSelectedVector().add(MapSettings.BOARD_GENERATED); - } - return mapSettings; - } - - /** - * Configure the bot player object with the bot force data - * @param bot The bot player object - * @param botForce The bot force data - */ - private void configureBot(Player bot, BotForce botForce) { - bot.setTeam(botForce.getTeam()); - // set deployment - bot.setStartingPos(botForce.getStartingPos()); - bot.setStartOffset(botForce.getStartOffset()); - bot.setStartWidth(botForce.getStartWidth()); - bot.setStartingAnyNWx(botForce.getStartingAnyNWx()); - bot.setStartingAnyNWy(botForce.getStartingAnyNWy()); - bot.setStartingAnySEx(botForce.getStartingAnySEx()); - bot.setStartingAnySEy(botForce.getStartingAnySEy()); - - // set camo - bot.setCamouflage(botForce.getCamouflage().clone()); - bot.setColour(botForce.getColour()); - } - - /** - * Setup the bot entities for the game - * @param bot The bot player object - * @param originalEntities The original entities for the bot - * @param deployRound The deployment round for the bot - * @return A list of entities for the bot - */ - private List setupBotEntities(Player bot, List originalEntities, int deployRound) { - String forceName = bot.getName() + "|1"; - var entities = new ArrayList(); - - for (Entity originalBotEntity : originalEntities) { - var entity = ASConverter.getUndamagedEntity(originalBotEntity); - if (entity == null) { - logger.warn("Could not convert entity for bot {} - {}", bot.getName(), originalBotEntity); - continue; - } - - entity.setOwner(bot); - entity.setForceString(forceName); - entity.setCrew(new CrewRefBreak(entity.getCrew()).copy()); - entity.setId(originalBotEntity.getId()); - entity.setExternalIdAsString(originalBotEntity.getExternalIdAsString()); - entity.setCommander(originalBotEntity.isCommander()); - - if (entity.getDeployRound() == 0) { - entity.setDeployRound(deployRound); - } - entities.add(entity); - } - return entities; - } - - /** - * Get the planetary conditions for the game, not used at the moment in the auto resolve, but planed for the future - * @return The planetary conditions object - */ - private PlanetaryConditions getPlanetaryConditions() { - PlanetaryConditions planetaryConditions = new PlanetaryConditions(); - if (campaign.getCampaignOptions().isUseLightConditions()) { - planetaryConditions.setLight(scenario.getLight()); - } - if (campaign.getCampaignOptions().isUseWeatherConditions()) { - planetaryConditions.setWeather(scenario.getWeather()); - planetaryConditions.setWind(scenario.getWind()); - planetaryConditions.setFog(scenario.getFog()); - planetaryConditions.setEMI(scenario.getEMI()); - planetaryConditions.setBlowingSand(scenario.getBlowingSand()); - planetaryConditions.setTemperature(scenario.getModifiedTemperature()); - } - if (campaign.getCampaignOptions().isUsePlanetaryConditions()) { - planetaryConditions.setAtmosphere(scenario.getAtmosphere()); - planetaryConditions.setGravity(scenario.getGravity()); - } - return planetaryConditions; - } - - /** - * Send the entities to the game object - * @param entities The entities to send - * @param game the game object to send the entities to - */ - private void sendEntities(List entities, SimulationContext game) { - Map forceMapping = new HashMap<>(); - for (final Entity entity : new ArrayList<>(entities)) { - if (entity instanceof ProtoMek) { - int numPlayerProtos = game.getSelectedEntityCount(new EntitySelector() { - private final int ownerId = entity.getOwnerId(); - @Override - public boolean accept(Entity entity) { - return (entity instanceof ProtoMek) && (ownerId == entity.getOwnerId()); - } - }); - - entity.setUnitNumber((short) (numPlayerProtos / 5)); - } - - if (Entity.NONE == entity.getId()) { - entity.setId(game.getNextEntityId()); - } - - // Give the unit a spotlight, if it has the spotlight quirk - entity.setExternalSearchlight(entity.hasExternalSearchlight() - || entity.hasQuirk(OptionsConstants.QUIRK_POS_SEARCHLIGHT)); - game.getPlayer(entity.getOwnerId()).changeInitialEntityCount(1); - game.getPlayer(entity.getOwnerId()).changeInitialBV(entity.calculateBattleValue()); +public abstract class SetupForces { - // Restore forces from MULs or other external sources from the forceString, if - // any - if (!entity.getForceString().isBlank()) { - List forceList = Forces.parseForceString(entity); - int realId = megamek.common.force.Force.NO_FORCE; - boolean topLevel = true; + public abstract void createForcesOnSimulation(SimulationContext context); - for (megamek.common.force.Force force : forceList) { - if (!forceMapping.containsKey(force.getId())) { - if (topLevel) { - realId = game.getForces().addTopLevelForce(force, entity.getOwner()); - } else { - megamek.common.force.Force parent = game.getForces().getForce(realId); - realId = game.getForces().addSubForce(force, parent); - } - forceMapping.put(force.getId(), realId); - } else { - realId = forceMapping.get(force.getId()); - } - topLevel = false; - } - entity.setForceString(""); - entity.setIGame(game); - game.addEntity(entity); - game.getForces().addEntity(entity, realId); - } - } - } } diff --git a/megamek/src/megamek/common/autoresolve/damage/AeroDamageApplier.java b/megamek/src/megamek/common/autoresolve/damage/AeroDamageApplier.java new file mode 100644 index 00000000000..aafdc26542d --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/AeroDamageApplier.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + +import megamek.common.Aero; +import megamek.common.HitData; +import megamek.common.IEntityRemovalConditions; + +import java.util.ArrayList; +import java.util.List; + +import static megamek.common.Compute.randomInt; + +/** + * Applies damage to an Aero entity. + * @param entity Aero entity + * @param crewMustSurvive Whether the crew must survive + * @param entityMustSurvive Whether the entity must survive + * @author Luana Coppio + */ +public record AeroDamageApplier(Aero entity, boolean crewMustSurvive, boolean entityMustSurvive) implements DamageApplier { + + @Override + public int getRandomHitLocation() { + var entity = entity(); + List validLocations = new ArrayList<>(); + for (int i = 0; i < entity.locations(); i++) { + if (entity.getOArmor(i) <= 0) { + continue; + } + if (!entity.isLocationBlownOff(i) && entity.getSI() > 0) { + validLocations.add(i); + } + } + + return validLocations.isEmpty() ? -1 : validLocations.get(randomInt(validLocations.size())); + } + + @Override + public void destroyLocationAfterEjection() { + entity().setDestroyed(true); + entity().setRemovalCondition(IEntityRemovalConditions.REMOVE_DEVASTATED); + } + + @Override + public HitDetails damageInternals(HitDetails hitDetails) { + HitData hit = hitDetails.hit(); + var entity = entity(); + int currentInternalValue = entity.getSI(); + int newInternalValue = Math.max(currentInternalValue + hitDetails.setArmorValueTo(), 0); + entity.setArmor(0, hit); + entity.setSI(newInternalValue); + applyDamageToEquipments(hit); + if (newInternalValue == 0) { + hitDetails = destroyLocation(hitDetails); + } + return hitDetails; + } +} diff --git a/megamek/src/megamek/common/autoresolve/damage/DamageApplier.java b/megamek/src/megamek/common/autoresolve/damage/DamageApplier.java new file mode 100644 index 00000000000..71103e78a1f --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/DamageApplier.java @@ -0,0 +1,317 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + +import megamek.common.*; +import megamek.logging.MMLogger; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @author Luana Coppio + */ +public interface DamageApplier { + MMLogger logger = MMLogger.create(DamageApplier.class); + + record HitDetails(HitData hit, int damageToApply, int setArmorValueTo, boolean hitInternal, int hitCrew) { + public HitDetails withCrewDamage(int crewDamage) { + return new HitDetails(hit, damageToApply, setArmorValueTo, hitInternal, crewDamage); + } + public HitDetails killsCrew() { + return new HitDetails(hit, damageToApply, setArmorValueTo, hitInternal, Crew.DEATH); + } + } + + E entity(); + + boolean crewMustSurvive(); + + boolean entityMustSurvive(); + + /** + * Applies damage to the entity in clusters of a given size. + * This is USUALLY the function you will want to use. + * + * @param dmg the total damage to apply + * @param clusterSize the size of the clusters + */ + default int applyDamageInClusters(int dmg, int clusterSize) { + int totalDamage = dmg; + int damageApplied = 0; + while (totalDamage > 0) { + if (entity().isCrippled() && entity().getRemovalCondition() == IEntityRemovalConditions.REMOVE_DEVASTATED) { + // devastated units don't need to take any damage anymore + break; + } + var clusterDamage = Math.min(totalDamage, clusterSize); + applyDamage(clusterDamage); + totalDamage -= clusterDamage; + damageApplied += clusterDamage; + } + return damageApplied; + } + + /** + * Applies damage to the entity. + * + * @param dmg the total damage to apply + */ + default void applyDamage(int dmg) { + int hitLocation = getRandomHitLocation(); + if (hitLocation == -1) { + entity().setDestroyed(true); + return; + } + HitData hit = getHitData(hitLocation); + HitDetails hitDetails = setupHitDetails(hit, dmg); + applyDamage(hitDetails); + } + + /** + * Returns the location to hit. + * + * @return returns a valid random location to be hit. + */ + default int getRandomHitLocation() { + var entity = entity(); + List validLocations = new ArrayList<>(); + for (int i = 0; i < entity.locations(); i++) { + if (entity.getOArmor(i) <= 0) { + continue; + } + var locationIsNotBlownOff = !entity.isLocationBlownOff(i); + var locationIsNotDestroyed = entity.getInternal(i) > 0; + if (locationIsNotBlownOff && locationIsNotDestroyed) { + validLocations.add(i); + } + } + Collections.shuffle(validLocations); + return validLocations.isEmpty() ? -1 : validLocations.get(0); + } + + /** + * Hits the entity with the given hit details. + * + * @param hitDetails the hit details + */ + default void applyDamage(HitDetails hitDetails) { + hitDetails = damageArmor(hitDetails); + if (hitDetails.hitInternal()) { + hitDetails = damageInternals(hitDetails); + } + tryToDamageCrew(hitDetails.hitCrew()); + } + + /** + * Destroys the location after the crew has been ejected. + */ + default void destroyLocationAfterEjection() { + // default implementation does nothing + } + + /** + * Applies damage to the internals of the entity. + * + * @param hitDetails the hit details + */ + default HitDetails damageInternals(HitDetails hitDetails) { + HitData hit = hitDetails.hit(); + var entity = entity(); + int currentInternalValue = entity.getInternal(hit); + int newInternalValue = Math.max(currentInternalValue + hitDetails.setArmorValueTo(), entityMustSurvive() ? 1 : 0); + entity.setArmor(0, hit); + logger.trace("[{}] Damage: {} - Internal at: {}", entity.getDisplayName(), hitDetails.damageToApply(), newInternalValue); + entity.setInternal(newInternalValue, hit); + applyDamageToEquipments(hit); + if (newInternalValue == 0) { + hitDetails = destroyLocation(hitDetails); + } + return hitDetails; + } + + /** + * Destroys the location of the entity. This one is used when you have the HitData. + * + * @param hitDetails the hit details with information about the location + */ + default HitDetails destroyLocation(HitDetails hitDetails) { + destroyLocation(hitDetails.hit().getLocation()); + return hitDetails.killsCrew(); + } + + /** + * Destroys the location of the entity. This one is used when the location is already known. + * + * @param location the location index in the entity + */ + default void destroyLocation(int location) { + var entity = entity(); + logger.trace("[{}] Destroying location {}", entity.getDisplayName(), location); + entity.destroyLocation(location); + entity.setDestroyed(true); + setEntityDestroyed(entity); + } + + /** + * Tries to damage the crew of the entity. If the crew is dead, the entity is marked as destroyed. + * The crew won't be damaged if they are already ejected or already dead. + * This function also does try to not outright kill the crew, as it has proven to be a bit too deadly. + * @param hitCrew the amount of hits to apply to ALL crew + */ + default void tryToDamageCrew(int hitCrew) { + if (hitCrew == 0) { + return; + } + + var entity = entity(); + Crew crew = entity.getCrew(); + if (crew == null || crew.isEjected() || crew.isDead()) { + return; + } + var hits = tryToNotKillTheCrew(hitCrew, crew); + + crew.setHits(hits, 0); + logger.trace("[{}] Crew hit ({} hits)", entity().getDisplayName(), crew.getHits()); + if (crew.isDead()) { + logger.trace("[{}] Crew died", entity().getDisplayName()); + entity.setDestroyed(true); + setEntityDestroyed(entity); + } + } + + /** + * Tries to not kill the crew. This function will set the amount of hits the crew will take. + * If the crew must survive, the crew will try to eject instead, and if they can't be + * ejected, it will set the total hits to DEATH - 1 (so... 5). + * @param hitCrew the amount of hits to apply to ALL crew + * @param crew the crew to apply the hits to + * @return the amount of hits to apply to the crew + */ + private Integer tryToNotKillTheCrew(int hitCrew, Crew crew) { + var hits = Math.min(crew.getHits() + hitCrew, Crew.DEATH); + + if (hits == Crew.DEATH) { + if (crewMustSurvive()) { + hits = Compute.randomIntInclusive(4) + 1; + } + if (tryToEjectCrew()) { + destroyLocationAfterEjection(); + } + } + return hits; + } + + /** + * Sets the entity as destroyed. + * @param entity entity to be set as destroyed + * @param the type of the entity + */ + static void setEntityDestroyed(E entity) { + if (entity.getRemovalCondition() != IEntityRemovalConditions.REMOVE_DEVASTATED) { + entity.setRemovalCondition(IEntityRemovalConditions.REMOVE_SALVAGEABLE); + entity.setSalvage(true); + logger.trace("[{}] Entity destroyed", entity.getDisplayName()); + } + } + + /** + * Sets the entity as destroyed by ejection if possible. + * @param entity entity to be set as destroyed + * @param the type of the entity + */ + static void setEntityDestroyedByEjection(E entity) { + if (entity.getRemovalCondition() != IEntityRemovalConditions.REMOVE_DEVASTATED) { + entity.setRemovalCondition(IEntityRemovalConditions.REMOVE_EJECTED); + entity.setSalvage(true); + logger.trace("[{}] Entity destroyed by ejection", entity.getDisplayName()); + } + } + + /** + * Tries to eject the crew of the entity if possible. + * + * @return true if the crew was ejected + */ + default boolean tryToEjectCrew() { + var entity = entity(); + var crew = entity.getCrew(); + if (crew == null || crew.isEjected() || !entity().isEjectionPossible() || entityMustSurvive()) { + return false; + } + crew.setEjected(true); + entity.setDestroyed(true); + setEntityDestroyedByEjection(entity); + logger.trace("[{}] Crew ejected", entity().getDisplayName()); + return true; + } + + /** + * Applies damage to the equipments of the entity. + * + * @param hit the hit data with information about the location + */ + default void applyDamageToEquipments(HitData hit) { + var entity = entity(); + var criticalSlots = entity.getCriticalSlots(hit.getLocation()); + Collections.shuffle(criticalSlots); + for (CriticalSlot slot : criticalSlots) { + if (slot != null && slot.isHittable() && !slot.isHit() && !slot.isDestroyed()) { + slot.setHit(true); + slot.setDestroyed(true); + logger.trace("[{}] Equipment destroyed: {}", entity.getDisplayName(), slot); + break; + } + } + } + + /** + * Applies damage only to the armor of the entity. + * + * @param hitDetails the hit details + */ + default HitDetails damageArmor(HitDetails hitDetails) { + var currentArmorValue = Math.max(hitDetails.setArmorValueTo(), 0); + entity().setArmor(currentArmorValue, hitDetails.hit()); + logger.trace("[{}] Damage: {} - Armor at: {}", entity().getDisplayName(), hitDetails.damageToApply(), currentArmorValue); + return hitDetails; + } + + /** + * Returns the hit data for the given hit location. + * + * @param hitLocation the hit location + * @return the hit data + */ + default HitData getHitData(int hitLocation) { + return new HitData(hitLocation, false, HitData.EFFECT_NONE); + } + + /** + * Sets up the hit details for the given hit and damage. + * + * @param hit the hit data + * @param damageToApply the damage to apply + * @return the hit details + */ + default HitDetails setupHitDetails(HitData hit, int damageToApply) { + int currentArmorValue = entity().getArmor(hit); + int setArmorValueTo = currentArmorValue - damageToApply; + boolean hitInternal = setArmorValueTo < 0; + int hitCrew = hitInternal ? 1 : 0; + + return new HitDetails(hit, damageToApply, setArmorValueTo, hitInternal, hitCrew); + } +} diff --git a/megamek/src/megamek/common/autoresolve/damage/DamageApplierChooser.java b/megamek/src/megamek/common/autoresolve/damage/DamageApplierChooser.java new file mode 100644 index 00000000000..66519b3888e --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/DamageApplierChooser.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + +import megamek.common.*; + +/** + * @author Luana Coppio + */ +public class DamageApplierChooser { + + + /** + * Choose the correct DamageHandler for the given entity. + * A damage handler is a class that handles applying damage on an entity, be it a Mek, Infantry, etc. + * It can damage internal, armor, cause criticals, kill crew, set limbs as blown-off, can even destroy the entity, + * @param entity the entity to choose the handler for + * @return the correct DamageHandler for the given entity + */ + public static DamageApplier choose(Entity entity) { + return choose(entity, EntityFinalState.ANY); + } + + /** + * Choose the correct DamageHandler for the given entity. + * A damage handler is a class that handles applying damage on an entity, be it a Mek, Infantry, etc. + * It can damage internal, armor, cause criticals, kill crew, set limbs as blown-off, can even destroy the entity, + * This one also accepts parameters to indicate if the crew must survive and if the entity must survive. + * @param entity the entity to choose the handler for + * @param entityFinalState if the crew must survive and/or entity must survive + * @return the correct DamageHandler for the given entity + */ + public static DamageApplier choose( + Entity entity, EntityFinalState entityFinalState) { + return choose(entity, entityFinalState.crewMustSurvive, entityFinalState.entityMustSurvive); + } + + /** + * Choose the correct DamageHandler for the given entity. + * A damage handler is a class that handles applying damage on an entity, be it a Mek, Infantry, etc. + * It can damage internal, armor, cause critical, kill crew, set limbs as blown-off, can even destroy the entity, + * This one also accepts parameters to indicate if the crew must survive and if the entity must survive. + * @param entity the entity to choose the handler for + * @param crewMustSurvive if the crew must survive + * @param entityMustSurvive if the entity must survive + * @return the correct DamageHandler for the given entity + */ + public static DamageApplier choose( + Entity entity, boolean crewMustSurvive, boolean entityMustSurvive) { + + if (entity instanceof Infantry) { + return new InfantryDamageApplier((Infantry) entity); + } else if (entity instanceof Mek) { + return new MekDamageApplier((Mek) entity, crewMustSurvive, entityMustSurvive); + } else if (entity instanceof GunEmplacement) { + return new GunEmplacementDamageApplier((GunEmplacement) entity, crewMustSurvive, entityMustSurvive); + } else if (entity instanceof Aero) { + return new AeroDamageApplier((Aero) entity, crewMustSurvive, entityMustSurvive); + } + return new SimpleDamageApplier(entity, crewMustSurvive, entityMustSurvive); + } + + /** + * Automatically applies damage to the entity based on the "removal condition" provided. + * The damage is calculated as being a percentage of the total armor of the unit, then it is transformed in a roll of dices + * which the average roll is that amount, then the total damage is calculated and applied in clusters of 5 damage. It rolls a minimum of + * 1 dice of damage. + * The removal condition is a code that indicates why the entity is being removed from the game. + * It will decide if the unit or entity must survive based on the type of removal condition. + * The removal conditions are: + * * RETREAT: crew must survive, entity must survive, 80% of the total armor is applied as damage + * * SALVAGEABLE: crew may die, entity must be destroyed, 75% of the total armor is applied as damage + * * CAPTURED: crew must survive, entity must be destroyed, 33% of the total armor is applied as damage + * * EJECTED: crew must survive, entity must be destroyed, 33% of the total armor is applied as damage + * * DEVASTATED: crew may survive, entity must be destroyed, 500% of the total armor is applied as damage + * * OTHER: crew may die, entity may be destroyed, 33% of the total armor applied as damage + * The amount of damage applied present right now was decided arbitrarily and can be changed later, maybe even make it follow + * a config file, client settings, etc. + * + * @param entity the entity to choose the handler for + * @param removalCondition the reason why the entity is being removed + */ + public static void damageRemovedEntity(Entity entity, int removalCondition) { + var numberOfDices = getNumberOfDices(entity, removalCondition); + var damage = Compute.d6(numberOfDices); + var clusterSize = 5; + + var retreating = removalCondition == IEntityRemovalConditions.REMOVE_IN_RETREAT; + var captured = removalCondition == IEntityRemovalConditions.REMOVE_CAPTURED; + var ejected = removalCondition == IEntityRemovalConditions.REMOVE_EJECTED; + var devastated = removalCondition == IEntityRemovalConditions.REMOVE_DEVASTATED; + var salvageable = removalCondition == IEntityRemovalConditions.REMOVE_SALVAGEABLE; + + var crewMustSurvive = retreating || captured || ejected; + var entityMustSurvive = !devastated && !salvageable && !ejected; + + DamageApplierChooser.choose(entity, crewMustSurvive, entityMustSurvive) + .applyDamageInClusters(damage, clusterSize); + } + + private static int getNumberOfDices(Entity entity, int removalCondition) { + double targetDamage = switch (removalCondition) { + case IEntityRemovalConditions.REMOVE_CAPTURED, IEntityRemovalConditions.REMOVE_EJECTED -> entity.getTotalOArmor() * 1.2; + case IEntityRemovalConditions.REMOVE_DEVASTATED -> entity.getTotalOArmor() * 5; // no damage is actually applied + case IEntityRemovalConditions.REMOVE_IN_RETREAT -> entity.getTotalOArmor() * 0.8; + case IEntityRemovalConditions.REMOVE_SALVAGEABLE -> entity.getTotalOArmor() * 0.75; + default -> entity.getTotalOArmor() * 0.33; + }; + + return Math.max(1, (int) (targetDamage / 6 / 0.6)); + } + +} diff --git a/megamek/src/megamek/common/autoresolve/damage/EntityFinalState.java b/megamek/src/megamek/common/autoresolve/damage/EntityFinalState.java new file mode 100644 index 00000000000..2affacd308d --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/EntityFinalState.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + + +public enum EntityFinalState { + ANY(false, false), + CREW_MUST_SURVIVE(true, false), + ENTITY_MUST_SURVIVE(false, true), + CREW_AND_ENTITY_MUST_SURVIVE(true, true); + + final boolean crewMustSurvive; + final boolean entityMustSurvive; + + EntityFinalState(boolean crewMustSurvive, boolean entityMustSurvive) { + this.crewMustSurvive = crewMustSurvive; + this.entityMustSurvive = entityMustSurvive; + } +} diff --git a/megamek/src/megamek/common/autoresolve/damage/GunEmplacementDamageApplier.java b/megamek/src/megamek/common/autoresolve/damage/GunEmplacementDamageApplier.java new file mode 100644 index 00000000000..d481c60a7fb --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/GunEmplacementDamageApplier.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + + +import megamek.common.GunEmplacement; + +public record GunEmplacementDamageApplier(GunEmplacement entity, boolean crewMustSurvive, boolean entityMustSurvive) + implements DamageApplier { + + @Override + public int getRandomHitLocation() { + if (entity.isDestroyed()) { + return -1; + } + return 0; + } + +} diff --git a/megamek/src/megamek/common/autoresolve/damage/InfantryDamageApplier.java b/megamek/src/megamek/common/autoresolve/damage/InfantryDamageApplier.java new file mode 100644 index 00000000000..10674a88365 --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/InfantryDamageApplier.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + +import megamek.common.BattleArmor; +import megamek.common.Infantry; + +/** + * @author Luana Coppio + */ +public record InfantryDamageApplier(Infantry entity) implements DamageApplier { + + @Override + public boolean crewMustSurvive() { + return false; + } + + @Override + public boolean entityMustSurvive() { + return false; + } + + @Override + public HitDetails damageArmor(HitDetails hitDetails) { + if (entity() instanceof BattleArmor te) { + for (int i = 0; i < te.getTroopers(); i++) { + var currentValueArmor = te.getArmor(BattleArmor.LOC_SQUAD); + var newArmorValue = Math.max(currentValueArmor - 1, 0); + if (te.getArmor(BattleArmor.LOC_TROOPER_1 + i) > 0) { + te.setArmor(newArmorValue, BattleArmor.LOC_TROOPER_1 + i); + } + } + } + if (entity().isCrippled()) { + entity().setDestroyed(true); + } + return hitDetails; + } + + @Override + public HitDetails damageInternals(HitDetails hitDetails) { + if (entity() instanceof BattleArmor te) { + for (int i = 0; i < te.getTroopers(); i++) { + var currentValue = te.getInternal(BattleArmor.LOC_SQUAD); + var newValue = Math.max(currentValue - 1, 0); + if (te.getInternal(BattleArmor.LOC_TROOPER_1 + i) > 0) { + te.setInternal(newValue, BattleArmor.LOC_TROOPER_1 + i); + } + } + } else { + var currentValue = entity().getInternal(Infantry.LOC_INFANTRY); + var newValue = Math.max(currentValue - 1, 0); + entity().setInternal(newValue, Infantry.LOC_INFANTRY); + } + + if (entity().isCrippled()) { + entity().setDestroyed(true); + } + return hitDetails; + } +} diff --git a/megamek/src/megamek/common/autoresolve/damage/MekDamageApplier.java b/megamek/src/megamek/common/autoresolve/damage/MekDamageApplier.java new file mode 100644 index 00000000000..2a7b6a5a817 --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/MekDamageApplier.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + + +import megamek.common.*; +import megamek.common.util.weightedMaps.WeightedDoubleMap; + +import java.util.Collections; +import java.util.Objects; +import java.util.Set; + +import static megamek.common.Compute.rollD6; +import static megamek.common.CriticalSlot.TYPE_SYSTEM; + +/** + * @author Luana Coppio + */ +public record MekDamageApplier(Mek entity, boolean crewMustSurvive, boolean entityMustSurvive) implements DamageApplier { + + // Target roll to hit the rear arc of the mek randomly + private static final int REAR_ARC_HIT_CHANCE = 11; + private static final Set criticalSystems = Set.of(Mek.SYSTEM_ENGINE, Mek.SYSTEM_GYRO, Mek.SYSTEM_LIFE_SUPPORT, + Mek.SYSTEM_SENSORS, Mek.SYSTEM_COCKPIT); + private static final Set criticalLocations = Set.of(Mek.LOC_CT, Mek.LOC_HEAD, Mek.LOC_LT, Mek.LOC_RT); + + @Override + public int getRandomHitLocation() { + var entity = entity(); + WeightedDoubleMap weightedDoubleMap = new WeightedDoubleMap<>(); + for (int i = 0; i < entity.locations(); i++) { + if (entity.getOArmor(i) <= 0) { + continue; + } + var locationIsNotBlownOff = !entity.isLocationBlownOff(i); + var locationIsNotDestroyed = entity.getInternal(i) > 0; + var locationIsNotHead = Mek.LOC_HEAD != i; + var weight = locationIsNotHead ? 6.0 : 1.0; + if (locationIsNotBlownOff && locationIsNotDestroyed) { + weightedDoubleMap.add(weight, i); + } + } + return weightedDoubleMap.randomOptionalItem().orElse(-1); + } + + @Override + public HitDetails setupHitDetails(HitData hit, int dmg) { + int currentArmorValue = entity.getArmor(hit); + int setArmorValueTo = currentArmorValue - dmg; + boolean hitInternal = setArmorValueTo < 0; + boolean isHeadHit = (entity.getCockpitType() != Mek.COCKPIT_TORSO_MOUNTED) && (hit.getLocation() == Mek.LOC_HEAD); + int hitCrew = isHeadHit || hitInternal ? 1 : 0; + + return new HitDetails(hit, dmg, setArmorValueTo, hitInternal, hitCrew); + } + + @Override + public HitData getHitData(int hitLocation) { + boolean hitRearArc = Compute.rollD6(2).isTargetRollSuccess(REAR_ARC_HIT_CHANCE); + return getHitData(hitLocation, hitRearArc); + } + + /** + * Returns the hit data for the given location, considering if the hit is on the rear arc or not. + * @param hitLocation the location of the hit + * @param hitRearArc if the hit is on the rear arc + * @return the hit data + */ + public HitData getHitData(int hitLocation, boolean hitRearArc) { + return new HitData(hitLocation, hitRearArc && hitLocationHasRear(hitLocation), HitData.EFFECT_NONE); + } + + private boolean hitLocationHasRear(int hitLocation) { + return switch(hitLocation) { + case Mek.LOC_CT, Mek.LOC_LT, Mek.LOC_RT -> true; + default -> false; + }; + } + + + @Override + public HitDetails destroyLocation(HitDetails hitDetails) { + var entity = entity(); + var hit = hitDetails.hit(); + entity.destroyLocation(hit.getLocation()); + if (hit.getLocation() == Mek.LOC_CT || hit.getLocation() == Mek.LOC_HEAD) { + entity.setDestroyed(true); + if (hit.getLocation() == Mek.LOC_HEAD) { + if (entity.isEjectionPossible()) { + var toHit = new ToHitData(); + toHit.addModifier(4, "Ejection"); + if (rollD6(2).isTargetRollSuccess(toHit)) { + hitDetails = hitDetails.withCrewDamage(2); + } else { + hitDetails = hitDetails.killsCrew(); + } + } else { + hitDetails = hitDetails.killsCrew(); + } + DamageApplier.setEntityDestroyed(entity); + } else { + entity.setSalvage(false); + entity.setRemovalCondition(IEntityRemovalConditions.REMOVE_DEVASTATED); + logger.trace("[{}] Mek devastated!", entity.getDisplayName()); + } + } + if (hit.getLocation() == Mek.LOC_RLEG || hit.getLocation() == Mek.LOC_LLEG) { + // leg destroyed causes a fall which damages the pilot + hitDetails.withCrewDamage(1); + } + return hitDetails; + } + + @Override + public void applyDamageToEquipments(HitData hit) { + var entity = entity(); + var criticalSlots = entity.getCriticalSlots(hit.getLocation()); + Collections.shuffle(criticalSlots); + if (entityMustSurvive() && criticalLocations.contains(hit.getLocation())) { + criticalSlots = criticalSlots.stream().filter(Objects::nonNull) + .filter(slot -> !(slot.getType() == TYPE_SYSTEM && criticalSystems.contains(slot.getIndex()))) + .toList(); + } + for (CriticalSlot slot : criticalSlots) { + if (slot != null && slot.isHittable() && !slot.isHit() && !slot.isDestroyed()) { + slot.setHit(true); + slot.setDestroyed(true); + logger.trace("[{}] Slot {} destroyed", entity.getDisplayName(), slot.getIndex()); + break; + } + } + // TODO: check if damage on ammo + // TODO: check if damage on life support + // TODO: check if damage on cockpit + } + + @Override + public void destroyLocationAfterEjection(){ + var entity = entity(); + entity.destroyLocation(Mek.LOC_HEAD); + } + + @Override + public HitDetails damageInternals(HitDetails hitDetails) { + HitData hit = hitDetails.hit(); + var entity = entity(); + int currentInternalValue = entity.getInternal(hit); + int newInternalValue = Math.max(currentInternalValue + hitDetails.setArmorValueTo(), 0); + entity.setArmor(0, hit); + if (entityMustSurvive() && !canLoseLocation(hit)) { + newInternalValue = Math.max(newInternalValue, Compute.d6()); + } + entity.setInternal(newInternalValue, hit); + applyDamageToEquipments(hit); + if (newInternalValue == 0) { + hitDetails = destroyLocation(hitDetails); + } + return hitDetails; + } + + private boolean canLoseLocation(HitData hitData) { + var location = hitData.getLocation(); + if (!entityMustSurvive()) { + return true; + } + + if (location == Mek.LOC_CT || location == Mek.LOC_HEAD) { + return false; + } + if (location == Mek.LOC_LT || location == Mek.LOC_RT) { + if (entity.getCritical(location, Mek.SYSTEM_ENGINE) == null) { + return true; + } + } + if (location == Mek.LOC_LLEG || location == Mek.LOC_RLEG) { + return !entity.isLocationBlownOff(Mek.LOC_LLEG) && !entity.isLocationBlownOff(Mek.LOC_RLEG); + } + + return true; + } +} diff --git a/megamek/src/megamek/common/autoresolve/damage/SimpleDamageApplier.java b/megamek/src/megamek/common/autoresolve/damage/SimpleDamageApplier.java new file mode 100644 index 00000000000..aad07012667 --- /dev/null +++ b/megamek/src/megamek/common/autoresolve/damage/SimpleDamageApplier.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.damage; + +import megamek.common.Entity; + +/** + * @author Luana Coppio + */ +public record SimpleDamageApplier(Entity entity, boolean crewMustSurvive, boolean entityMustSurvive) + implements DamageApplier {} diff --git a/megamek/src/megamek/common/autoresolve/event/AutoResolveConcludedEvent.java b/megamek/src/megamek/common/autoresolve/event/AutoResolveConcludedEvent.java index 47ea24aab58..03aa2b8cf58 100644 --- a/megamek/src/megamek/common/autoresolve/event/AutoResolveConcludedEvent.java +++ b/megamek/src/megamek/common/autoresolve/event/AutoResolveConcludedEvent.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. + * + * 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 megamek.common.autoresolve.event; /* * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * @@ -17,16 +33,13 @@ * along with MekHQ. If not, see . */ -package megamek.common.autoresolve.event; - import megamek.common.Entity; import megamek.common.IEntityRemovalConditions; import megamek.common.IGame; import megamek.common.annotations.Nullable; +import megamek.common.autoresolve.acar.SimulationContext; import megamek.common.event.PostGameResolution; import megamek.server.victory.VictoryResult; -import mekhq.campaign.autoresolve.acar.SimulationContext; -import mekhq.campaign.mission.AtBScenario; import org.apache.commons.lang3.builder.ToStringBuilder; import java.io.File; @@ -40,7 +53,6 @@ public class AutoResolveConcludedEvent implements PostGameResolution { private final IGame game; private final boolean controlledScenario; - private final AtBScenario scenario; private final Vector survived = new Vector<>(); private final Vector retreated = new Vector<>(); private final Vector graveyard = new Vector<>(); @@ -57,7 +69,6 @@ public AutoResolveConcludedEvent(SimulationContext game, VictoryResult victoryRe this.controlledScenario = (game.getLocalPlayer().getTeam() == victoryResult.getWinningTeam()); this.victoryResult = victoryResult; this.game = game; - this.scenario = game.getScenario(); this.logFile = logFile; game.getInGameObjects().stream() @@ -106,10 +117,6 @@ public AutoResolveConcludedEvent(SimulationContext game, VictoryResult victoryRe .forEach(wrecked::addElement); } - public AtBScenario getScenario() { - return scenario; - } - public VictoryResult getVictoryResult() { return victoryResult; } diff --git a/megamek/src/megamek/common/internationalization/Internationalization.java b/megamek/src/megamek/common/internationalization/Internationalization.java index 1ba61d4b8f0..1aa5b806dbe 100644 --- a/megamek/src/megamek/common/internationalization/Internationalization.java +++ b/megamek/src/megamek/common/internationalization/Internationalization.java @@ -1,22 +1,16 @@ /* - * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2025 - The MegaMek Team. All Rights Reserved. * - * This file is part of MekHQ. + * 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. * - * MekHQ 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 3 of the License, or - * (at your option) any later version. - * - * MekHQ 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. - * - * You should have received a copy of the GNU General Public License - * along with MekHQ. If not, see . + * 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 megamek.common.internationalization; import megamek.MegaMek; @@ -37,21 +31,16 @@ */ public class Internationalization { - private final String prefix; - protected static final String DEFAULT = "messages"; + private final String defaultBundle; private final ConcurrentHashMap resourceBundles = new ConcurrentHashMap<>(); - private static Internationalization instance; - - { - instance = new Internationalization(); - } + protected static Internationalization instance; - protected Internationalization() { - prefix = "megamek.client."; + static { + instance = new Internationalization("megamek.client.messages"); } - protected Internationalization(String prefix) { - this.prefix = prefix; + protected Internationalization(String defaultBundle) { + this.defaultBundle = defaultBundle; } public static Internationalization getInstance() { @@ -73,7 +62,7 @@ public ResourceBundle newBundle(String baseName, Locale locale, String format, C ResourceBundle getResourceBundle(String bundleName) { return resourceBundles.computeIfAbsent(bundleName, k -> - ResourceBundle.getBundle(prefix + bundleName, MegaMek.getMMOptions().getLocale(), new UTF8Control())); + ResourceBundle.getBundle(bundleName, MegaMek.getMMOptions().getLocale(), new UTF8Control())); } /** @@ -95,7 +84,7 @@ public static String getTextAt(String bundleName, String key) { * @return the localized string */ public static String getText(String key) { - return getTextAt(DEFAULT, key); + return getTextAt(getInstance().defaultBundle, key); } /** @@ -105,7 +94,7 @@ public static String getText(String key) { * @return the localized string */ public static String getFormattedText(String key, Object... args) { - return MessageFormat.format(getFormattedTextAt(DEFAULT, key), args); + return MessageFormat.format(getFormattedTextAt(getInstance().defaultBundle, key), args); } /** diff --git a/megamek/src/megamek/common/weapons/capitalweapons/NLWeapon.java b/megamek/src/megamek/common/weapons/capitalweapons/NLWeapon.java index 8102e42e9f0..64bca10aa43 100644 --- a/megamek/src/megamek/common/weapons/capitalweapons/NLWeapon.java +++ b/megamek/src/megamek/common/weapons/capitalweapons/NLWeapon.java @@ -34,7 +34,7 @@ public NLWeapon() { super(); atClass = CLASS_CAPITAL_LASER; capital = true; - flags = flags.andNot(F_PROTO_WEAPON).andNot(F_MEK_WEAPON).andNot(F_TANK_WEAPON);; + flags = flags.andNot(F_PROTO_WEAPON).andNot(F_MEK_WEAPON).andNot(F_TANK_WEAPON); } @Override diff --git a/megamek/src/megamek/common/weapons/capitalweapons/NavalACWeapon.java b/megamek/src/megamek/common/weapons/capitalweapons/NavalACWeapon.java index 5f66e21e6f1..8bfd674db03 100644 --- a/megamek/src/megamek/common/weapons/capitalweapons/NavalACWeapon.java +++ b/megamek/src/megamek/common/weapons/capitalweapons/NavalACWeapon.java @@ -35,7 +35,7 @@ public NavalACWeapon() { super(); ammoType = AmmoType.T_NAC; atClass = CLASS_CAPITAL_AC; - flags = flags.or(F_DIRECT_FIRE).or(F_BALLISTIC).andNot(F_MEK_WEAPON).andNot(F_TANK_WEAPON);; + flags = flags.or(F_DIRECT_FIRE).or(F_BALLISTIC).andNot(F_MEK_WEAPON).andNot(F_TANK_WEAPON); capital = true; } diff --git a/megamek/src/megamek/common/weapons/capitalweapons/SubCapCannonWeapon.java b/megamek/src/megamek/common/weapons/capitalweapons/SubCapCannonWeapon.java index c68149b370a..e8dedfe0183 100644 --- a/megamek/src/megamek/common/weapons/capitalweapons/SubCapCannonWeapon.java +++ b/megamek/src/megamek/common/weapons/capitalweapons/SubCapCannonWeapon.java @@ -35,7 +35,7 @@ public SubCapCannonWeapon() { super(); ammoType = AmmoType.T_SCC; atClass = CLASS_CAPITAL_AC; - flags = flags.or(F_DIRECT_FIRE).or(F_BALLISTIC).andNot(F_PROTO_WEAPON).andNot(F_MEK_WEAPON).andNot(F_TANK_WEAPON);; + flags = flags.or(F_DIRECT_FIRE).or(F_BALLISTIC).andNot(F_PROTO_WEAPON).andNot(F_MEK_WEAPON).andNot(F_TANK_WEAPON); capital = true; subCapital = true; } diff --git a/megamek/src/megamek/common/weapons/lasers/ISXPulseLaserSmall.java b/megamek/src/megamek/common/weapons/lasers/ISXPulseLaserSmall.java index 40e9e3b48ae..c9fb21b3d34 100644 --- a/megamek/src/megamek/common/weapons/lasers/ISXPulseLaserSmall.java +++ b/megamek/src/megamek/common/weapons/lasers/ISXPulseLaserSmall.java @@ -54,7 +54,7 @@ public ISXPulseLaserSmall() { maxRange = RANGE_SHORT; shortAV = 3; cost = 31000; - flags = flags.or(F_BURST_FIRE).andNot(F_PROTO_WEAPON);; + flags = flags.or(F_BURST_FIRE).andNot(F_PROTO_WEAPON); rulesRefs = "321, TO"; //Tech Progression tweaked to combine IntOps with TRO Prototypes/3145 NTNU RS techAdvancement.setTechBase(TECH_BASE_IS).setTechRating(RATING_E) @@ -63,7 +63,7 @@ public ISXPulseLaserSmall() { .setProductionFactions(F_LC) .setStaticTechLevel(SimpleTechLevel.STANDARD); } - + @Override public boolean isAlphaStrikePointDefense() { return true;