Skip to content

Commit

Permalink
Merge branch 'master' into feat/tinkering-princess-ai
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio authored Jan 15, 2025
2 parents b9ea97d + 6d134cf commit 69ea510
Show file tree
Hide file tree
Showing 113 changed files with 17,182 additions and 13,101 deletions.
Binary file added MekHQ/data/images/misc/MekHQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MekHQ/data/images/misc/acar_splash_hd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
5 changes: 3 additions & 2 deletions MekHQ/data/scenariomodifiers/airBattleModifiers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
Need ability to allow player to specifically deploy DropShips
HotDrop.xml
</modifier-->
<modifier>
<!--modifier>
Removed by popular demand
EnemyDropShip.xml
</modifier>
</modifier-->
<modifier>
GoodIntel.xml
</modifier>
Expand Down
10 changes: 6 additions & 4 deletions MekHQ/data/scenariomodifiers/groundBattleModifiers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@
<modifier>
EnemyHotDrop.xml
</modifier>
<modifier>
<!--modifier>
Removed by popular demand
EnemyDropShip.xml
</modifier>
<modifier>
</modifier-->
<!--modifier>
Removed by popular demand
GroundedEnemyDropShip.xml
</modifier>
</modifier-->
<modifier>
GoodIntel.xml
</modifier>
Expand Down
10 changes: 6 additions & 4 deletions MekHQ/data/scenariomodifiers/modifiermanifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@
<modifier>
EnemyHotDrop.xml
</modifier>
<modifier>
<!--modifier>
Removed by popular demand
EnemyDropShip.xml
</modifier>
<modifier>
</modifier-->
<!--modifier>
Removed by popular demand
GroundedEnemyDropShip.xml
</modifier>
</modifier!-->
<modifier>
GoodIntel.xml
</modifier>
Expand Down
25 changes: 24 additions & 1 deletion MekHQ/docs/history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,30 @@ MEKHQ VERSION HISTORY:
+ PR #5709: Added MHQDialogImmersive for Immersive Dialog Functionality that Immersively Improves Immersion
+ Fix #3752: Added Handling for Unsupported Unit Types
+ Fix #5717: Removed End of Contract and Manual Resupplies; Fixed Smuggler Prices; Added Remove SP Button
+ PR #5735: Fix: compilation error due to a function being set as static but acessing instance data
+ PR #5735: Fix: compilation error due to a function being set as static but acessing instance data
+ PR #5781: Feat/ACAR formations reintroduced
+ Fix #5739: Updated 'Clear Units' Button to Correctly Handle StratCon Scenarios
+ Fix #5740,#5580: Fixed Role Eligibility Checks and Ensured Proper Role Assignment
+ Fix #5746: Added Clan and Inner Sphere Resupply Restrictions
+ Fix #5766, #5769: Refactored Education Tag-Along Logic
+ PR #5771: Removed EnemyDropShip and GroundedEnemyDropShip Modifiers
+ Fix #5770: Added null Protection to OutstandingScenariosNagLogic for Outstanding Scenario Nags
+ Fix #5765: Log Prohibited Unit Skips in Resupplies & Prevent Invalid Part Additions
+ Fix #5760: Fixed Combat Team Status Logic for Convoy and Support Force
+ PR #5783: Update Sector Display in Briefing Room to Show Full Grid Reference
+ Fix #5779: Adjust Bounds Calculation in getUnoccupiedAdjacentCoords
+ Fix #5714: Fixed Maternity Leave... yet again
+ Fix #5716: Fixed Force Commander Handling and Improve XML Persistence
+ Fix #5727: Fixed Routed Contracts Resulting in Truncated Payouts
+ Fix #5726: Fix Support Point Acquisition Visual Bug
+ Fix #5736: Preventing Negative Personnel Income
+ PR #5754: Corrected Birthday Generation for Personnel
+ Fix #5753: Added 'null' Protection to AtBDynamicScenarioFactory
+ Fix #5751: Added Exception Handling for Out-of_Bounds Tab Index Selection
+ PR #5731: Remove all the damage applier classes because they currently reside on MegaMek
+ Fix #5713, #5737 Updated & Fixed Required Combat Team Calculations;
Reworked Combat Team Requirement Contract Pay Modifiers; Added Contract Difficulty Modifier
+ PR #4963: Implemented Campaign Options IIC - Full rework of all MekHQ options

0.50.02 (2024-12-30 2130 UTC)
+ Fix #846, #5185: Fix BattleArmor customization/refit overweight check.
Expand Down
5 changes: 3 additions & 2 deletions MekHQ/resources/mekhq/resources/CampaignGUI.properties
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ btnPrintRS.toolTipText=Print record sheets for all currently assigned units.
btnPrintRS.text=Print Sheets
btnGetMul.toolTipText=Get a MUL file of all assigned units that can be loaded into MegaMek
btnGetMul.text=Export MUL File
btnClearAssignedUnits.toolTipText=Clear all assigned units for this scenario
btnClearAssignedUnits.text=Clear Units
btnClearAssignedUnits.toolTipText=Clear all assigned units for this scenario. Restricted to GM Mode\
\ if it is a scenario assigned to the Area of Operations.
btnClearAssignedUnits.text=Reset Deployment
btnResolveScenario.toolTipText=Bring up a wizard that will guide you through the process of resolving this scenario either by MUL files from a MegaMek game or by manually editing for tabletop games.
btnResolveScenario.text=Resolve Manually
btnAutoResolveScenario.toolTipText=<html>Start a game of MegaMek with all the assigned units played by bots.<br>At the game's conclusion, you will be presented with a series of dialogs for resolving the scenario.</html>
Expand Down
3,031 changes: 2,040 additions & 991 deletions MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions MekHQ/resources/mekhq/resources/DateChooser.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ dateField.text=<html><div style='text-align: center;'><b>Campaigns prior to 2470
<br>\
<br>Click on the date to edit it.</div></html>
confirmDate.text=Confirm Date
invalidDate.title=Invalid Date
invalidDate.body=<html>Try: yyyy-MM-dd\
<br>\
<br>Cannot be before %s or after %s.</html>

# createEraButtons
eraAgeOfWar.text=<b>Age of War</b><br>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ col_name.text=Scenario Name
col_status.text=Resolution
col_date.text=Date
col_assign.text=Units Assigned
col_sector.text=Sector
col_sector.text=Grid Reference
col_unknown.text=?
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 - The MegaMek Team. All Rights Reserved.
* Copyright (c) 2021-2024 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MekHQ.
*
Expand All @@ -16,16 +16,17 @@
* You should have received a copy of the GNU General Public License
* along with MekHQ. If not, see <http://www.gnu.org/licenses/>.
*/
package mekhq.campaign;
package mekhq;

import megamek.Version;
import megamek.common.annotations.Nullable;
import megamek.common.options.GameOptions;
import megamek.common.util.sorter.NaturalOrderComparator;
import megamek.logging.MMLogger;
import megamek.utilities.xml.MMXMLUtility;
import mekhq.MHQConstants;
import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.CampaignOptions;
import mekhq.campaign.RandomSkillPreferences;
import mekhq.campaign.event.OptionsChangedEvent;
import mekhq.campaign.personnel.PersonnelOptions;
import mekhq.campaign.personnel.SkillType;
Expand Down Expand Up @@ -64,6 +65,8 @@
* @author Justin "Windchild" Bowen
*/
public class CampaignPreset {
static final private Version LAST_COMPATIBLE_VERSION = new Version("0.50.03-SNAPSHOT");

private static final MMLogger logger = MMLogger.create(CampaignPreset.class);

// region Variable Declarations
Expand Down Expand Up @@ -439,6 +442,14 @@ public static List<CampaignPreset> loadCampaignPresetsFromDirectory(final @Nulla
return null;
}

if (LAST_COMPATIBLE_VERSION.isLowerThan(version)) {
String message = String.format(
"Cannot parse Campaign Preset from %s in newer version %s.",
version.toString(), MHQConstants.VERSION);
logger.error(message);
return null;
}

final CampaignPreset preset = new CampaignPreset();
try {
for (int x = 0; x < nl.getLength(); x++) {
Expand Down
19 changes: 11 additions & 8 deletions MekHQ/src/mekhq/MekHQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import megamek.SuiteConstants;
import megamek.client.Client;
import megamek.client.bot.princess.BehaviorSettings;
import megamek.client.ui.dialogs.AutoResolveChanceDialog;
import megamek.client.ui.dialogs.AutoResolveProgressDialog;
import megamek.client.ui.dialogs.AutoResolveSimulationLogDialog;
import megamek.client.ui.preferences.PreferencesNode;
import megamek.client.ui.preferences.SuitePreferences;
Expand All @@ -37,6 +39,7 @@
import megamek.common.Board;
import megamek.common.annotations.Nullable;
import megamek.common.autoresolve.acar.SimulatedClient;
import megamek.common.autoresolve.converter.SingletonForces;
import megamek.common.autoresolve.event.AutoResolveConcludedEvent;
import megamek.common.event.*;
import megamek.common.net.marshalling.SanityInputFilter;
Expand Down Expand Up @@ -645,25 +648,25 @@ public void startAutoResolve(AtBScenario scenario, List<Unit> units) {
this.autosaveService.requestBeforeMissionAutosave(getCampaign());

if (getCampaign().getCampaignOptions().isAutoResolveVictoryChanceEnabled()) {
var proceed = megamek.client.ui.dialogs.AutoResolveChanceDialog
var proceed = AutoResolveChanceDialog
.showDialog(
getCampaigngui().getFrame(),
campaignGUI.getFrame(),
getCampaign().getCampaignOptions().getAutoResolveNumberOfScenarios(),
Runtime.getRuntime().availableProcessors(),
getCampaign().getPlayer().getTeam(),
new AtBSetupForces(getCampaign(), units, scenario),
1,
new AtBSetupForces(getCampaign(), units, scenario, new SingletonForces()),
new Board(scenario.getBaseMapX(), scenario.getBaseMapY())) == JOptionPane.YES_OPTION;
if (!proceed) {
return;
}
}

var event = megamek.client.ui.dialogs.AutoResolveProgressDialog.showDialog(
getCampaigngui().getFrame(),
new AtBSetupForces(getCampaign(), units, scenario),
var event = AutoResolveProgressDialog.showDialog(
campaignGUI.getFrame(),
new AtBSetupForces(getCampaign(), units, scenario, new SingletonForces()),
new Board(scenario.getBaseMapX(), scenario.getBaseMapY()));

var autoResolveBattleReport = new AutoResolveSimulationLogDialog(getCampaigngui().getFrame(), event.getLogFile());
var autoResolveBattleReport = new AutoResolveSimulationLogDialog(campaignGUI.getFrame(), event.getLogFile());
autoResolveBattleReport.setModal(true);
autoResolveBattleReport.setVisible(true);

Expand Down
78 changes: 35 additions & 43 deletions MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -3833,8 +3833,8 @@ public int getDeploymentDeficit(AtBContract contract) {
return 0;
}

int total = -contract.getRequiredLances();
int role = -max(1, contract.getRequiredLances() / 2);
int total = -contract.getRequiredCombatTeams();
int role = -max(1, contract.getRequiredCombatTeams() / 2);
int minimumUnitCount = (int) ((double) getStandardForceSize(faction) / 2);

final CombatRole requiredLanceRole = contract.getContractType().getRequiredLanceRole();
Expand Down Expand Up @@ -4291,27 +4291,6 @@ private void processWeeklyRelationshipEvents(Person person) {
getDivorce().processNewWeek(this, getLocalDate(), person, false);
getMarriage().processNewWeek(this, getLocalDate(), person, false);
getProcreation().processNewWeek(this, getLocalDate(), person);

if (person.getGender().isFemale()) {
if (campaignOptions.isUseMaternityLeave()) {
if ((person.isPregnant())
&& (person.getStatus().isActive())
&& (person.getDueDate().minusWeeks(20).isAfter(currentDay.minusDays(1)))) {

person.changeStatus(this, currentDay, PersonnelStatus.ON_MATERNITY_LEAVE);
}

List<Person> children = person.getGenealogy().getChildren();

if ((person.getStatus().isOnMaternityLeave()) && (!children.isEmpty())) {
LocalDate lastChildBirthDate = getYoungestChildDateOfBirth(children);

if (currentDay.isAfter(lastChildBirthDate)) {
person.changeStatus(this, getLocalDate(), PersonnelStatus.ACTIVE);
}
}
}
}
}
}

Expand Down Expand Up @@ -5605,6 +5584,24 @@ public void removeFunds(final TransactionType type, final Money quantity,
addReport("Funds removed : " + quantityString + " (" + description + ')');
}


/**
* Generic method for paying Personnel (Person) in the company.
* Debits money from the campaign and if the campaign tracks
* total earnings it will account for that.
* @param type TransactionType being debited
* @param quantity total money - it's usually displayed outside of this method
* @param description String displayed in the ledger and report
* @param individualPayouts Map of Person to the Money they're owed
*/
public void payPersonnel(TransactionType type, Money quantity, String description, Map<Person, Money> individualPayouts) {
getFinances().debit(type, getLocalDate(), quantity, description,
individualPayouts, getCampaignOptions().isTrackTotalEarnings());
String quantityString = quantity.toAmountAndSymbolString();
addReport("Funds removed : " + quantityString + " (" + description + ')');

}

public CampaignOptions getCampaignOptions() {
return campaignOptions;
}
Expand Down Expand Up @@ -7802,10 +7799,15 @@ public void completeMission(@Nullable Mission mission, MissionStatus status) {
// check for money in escrow
// According to FMM(r) pg 179, both failure and breach lead to no
// further payment even though this seems foolish
if ((contract.getStatus().isSuccess())
&& (contract.getMonthsLeft(getLocalDate()) > 0)) {
if (contract.getStatus().isSuccess()) {
remainingMoney = contract.getMonthlyPayOut()
.multipliedBy(contract.getMonthsLeft(getLocalDate()));
.multipliedBy(contract.getMonthsLeft(getLocalDate()));

if (contract instanceof AtBContract) {
Money routedPayout = ((AtBContract) contract).getRoutedPayout();

remainingMoney = routedPayout == null ? remainingMoney : routedPayout;
}
}

// If overage repayment is enabled, we first need to check if the salvage
Expand All @@ -7828,27 +7830,17 @@ public void completeMission(@Nullable Mission mission, MissionStatus status) {

if (getCampaignOptions().isUseShareSystem()) {
ResourceBundle financeResources = ResourceBundle.getBundle("mekhq.resources.Finances",
MekHQ.getMHQOptions().getLocale());
MekHQ.getMHQOptions().getLocale());

Money shares = remainingMoney.multipliedBy(contract.getSharesPercent()).dividedBy(100);
remainingMoney = remainingMoney.minus(shares);
if (remainingMoney.isGreaterThan(Money.zero())) {
Money shares = remainingMoney.multipliedBy(contract.getSharesPercent()).dividedBy(100);
remainingMoney = remainingMoney.minus(shares);

if (getFinances().debit(TransactionType.SALARIES, getLocalDate(), shares,
if (getFinances().debit(TransactionType.SALARIES, getLocalDate(), shares,
String.format(financeResources.getString("ContractSharePayment.text"), contract.getName()))) {
addReport(financeResources.getString("DistributedShares.text"), shares.toAmountAndSymbolString());

if (getCampaignOptions().isTrackTotalEarnings()) {
boolean sharesForAll = getCampaignOptions().isSharesForAll();
addReport(financeResources.getString("DistributedShares.text"), shares.toAmountAndSymbolString());

int numberOfShares = getActivePersonnel().stream()
.mapToInt(person -> person.getNumShares(this, sharesForAll))
.sum();

Money singleShare = shares.dividedBy(numberOfShares);

for (Person person : getActivePersonnel()) {
person.payPersonShares(this, singleShare, sharesForAll);
}
getFinances().payOutSharesToPersonnel(this, shares);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/campaign/CampaignFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public Campaign createCampaign(InputStream is)
// ...otherwise, assume we're an XML file.

CampaignXmlParser parser = new CampaignXmlParser(is, this.app);

return parser.parse();
}

Expand All @@ -91,4 +90,5 @@ private byte[] readHeader(InputStream is) throws IOException {

return header;
}

}
Loading

0 comments on commit 69ea510

Please sign in to comment.