Skip to content

Commit 47c5762

Browse files
authored
Merge pull request #3931 from AaronGullickson/update-scenario-dialog
Add new Scenario features to CustomizeScenarioDialog
2 parents 9bdf79f + a5030a1 commit 47c5762

26 files changed

+4030
-236
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
title=Customize BotForce
2+
lblName.text=Name:
3+
lblTeam.text=Team:
4+
panBehavior.title=Behavior
5+
panRandomUnits.title=Random Units
6+
scrollFixedUnits.title=Fixed Units
7+
choiceTeam.text=Team
8+
choiceAllied.text=Allied
9+
lblCowardice.text=Cowardice:
10+
lblSelfPreservation.text=Self-Preservation:
11+
lblAggression.text=Aggression:
12+
lblHerdMentality.text=Herd Mentality:
13+
lblPilotingRisk.text=Piloting Risk:
14+
lblForcedWithdrawal.text=Forced Withdrawal:
15+
lblAutoFlee.text=Auto Flee:
16+
lblBalancingMethod.text=Balancing Method:
17+
lblBalancingMethod.tooltip=<html>What characteristic to balance force multiplier on<br>(e.g. BV, weight)</html>
18+
lblFaction.text=Faction:
19+
lblFaction.tooltip=<html>Faction for selecting units</html>
20+
lblUnitType.text=Unit Type:
21+
lblUnitType.tooltip=<html>Which unit type to generate. For mixed unit types<br>use different forces on the same team or use percent<br>conventional and/or integrated BA chance.</html>
22+
lblSkillLevel.text=Skill Level:
23+
lblSkillLevel.tooltip=<html>Base skill level for random skill generation of the units.</html>
24+
lblQuality.text=Rating:
25+
lblQuality.tooltip=<html>Determines the tech quality of generated units.</html>
26+
lblFocalWeightClass.text=Focal Weight Class:
27+
lblFocalWeightClass.tooltip=<html>The targeted weight class of the generated units. If not specified,<br>the targeted weight class will be chosen to match the player's force.</html>
28+
lblForceMultiplier.text=Force Multiplier:
29+
lblForceMultiplier.tooltip=<html>How big/tough is this force relative to the player's force?<br>The final calculation will include fixed units as well.</html>
30+
lblPercentConventional.text=Percent Conventional:
31+
lblPercentConventional.tooltip=<html>Replace a certain percent of a Mek or Aero force<br>with vehicles or conventional fighters, respectively.</html>
32+
lblBaChance.text=Integrated BA Chance:
33+
lblBaChance.tooltip=<html>Probability that this force includes<br>integrated Battle Armor units.</html>
34+
lblLanceSize.text=Formation Size:
35+
lblLanceSize.tooltip=<html>The minimum group size that units should be added in.<br>Larger values can lead to more approximate<br>results with force multiplier matching.</html>
36+
btnOK.text=Done
37+
btnClose.text=Cancel
38+
btnBehavior.text=Edit Behavior Settings
39+
btnLoadUnits.text=Load Fixed Units
40+
btnLoadUnits.tooltip=<html>Load fixed units from a .mul file,<br>overwriting existing units</html>
41+
btnSaveUnits.text=Save Fixed Units
42+
btnSaveUnits.tooltip=<html>Save fixed units to a .mul file</html>
43+
btnDeleteUnits.text=Delete Fixed Units
44+
btnDeleteUnits.tooltip=<html>Delete all fixed units</html>
45+
chkUseRandomUnits.text=Use randomly generated units
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,49 @@
11
btnCancel.text=Cancel
2-
btnOkay.text=OK
3-
lblName.text=Scenario Name:
4-
lblStatus.text=Status:
2+
btnOkay.text=Done
3+
lblName.text=<html><b><nobr>Scenario Name:</nobr></b></html>
4+
lblDate.text=<html><b><nobr>Scenario Date:</nobr></b></html>
5+
lblDeployment.text=<html><b><nobr>Deployment:</nobr></b></html>
6+
lblStatus.text=<html><b><nobr>Status:</nobr></b></html>
57
title=Customize Scenario
68
title.new=New Scenario
7-
lblDate.text=Date:
9+
btnAddLoot.text=Add Loot
10+
btnEditLoot.text=Edit Loot
11+
btnDeleteLoot.text=Delete Loot
12+
btnAddObjective.text=Add Objective
13+
btnEditObjective.text=Edit Objective
14+
btnDeleteObjective.text=Delete Objective
15+
btnPlanetaryConditions.text=Edit Planetary Conditions...
16+
btnMapSettings.text=Edit Map Settings...
17+
panPlanetaryConditions.title=Planetary Conditions
18+
panDeploymentLimits.title=Deployment Limits
19+
panMap.title=Map Settings
20+
lblAllowedUnits.text=<html><b><nobr>Allowed Unit Types:</nobr></b></html>
21+
lblQuantityLimit.text=<html><b><nobr>Quantity Limit:</nobr></b></html>
22+
lblRequiredPersonnel.text=<html><b><nobr>Required Personnel:</nobr></b></html>
23+
lblRequiredUnits.text=<html><b><nobr>Required Units:</nobr></b></html>
24+
lblLight.text=<html><b>Light:</b></html>
25+
lblWeather.text=<html><b>Weather:</b></html>
26+
lblWind.text=<html><b>Wind:</b></html>
27+
lblFog.text=<html><b>Fog:</b></html>
28+
lblBlowingSand.text=<html><b><nobr>Blowing Sand:</nobr></b></html>
29+
lblEMI.text=<html><b>EMI:</b></html>
30+
lblAtmosphere.text=<html><b>Atmosphere:</b></html>
31+
lblGravity.text=<html><b>Gravity:</b></html>
32+
lblTemperature.text=<html><b>Temperature:</b></html>
33+
lblOtherConditions.text=<html><b>Other:</b></html>
34+
lblBoardType.text=<html><b><nobr>Board Type:<nobr></b></html>
35+
lblMap.text=<html><b>Map:<nobr></b></html>
36+
lblMapSize.text=<html><b><nobr>Map Size:<nobr></b></html>
37+
emi.text=Electromagnetic interference
38+
sand.text=Blowing sand
39+
panOtherForces.title=Other Forces
40+
btnAddForce.text=Add Force
41+
btnEditForce.text=Edit Force
42+
btnDeleteForce.text=Delete Force
43+
panObjectives.title=Scenario Objectives
44+
panLoot.title=Scenario Costs & Payouts
45+
addEventButton.text=Apply Modifier
46+
txtDesc.title=Description
47+
txtReport.title=After-Action Report
48+
btnEditLimits.text=Edit Limits
49+
btnRemoveLimits.text=Remove Limits
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
dialog.title=Customize Scenario Objective
2+
panObjectiveEffect.title=Objective Effects
3+
lblDescription.text=Description:
4+
lblDetails.text=Details:
5+
lblObjectiveType.text=Objective Type:
6+
lblForceNames.text=Force Names:
7+
lblTimeLimit.text=Time Limit:
8+
lblMagnitude.text=Amount:
9+
lblEffectType.text=Effect Type:
10+
lblEffectScaling.text=Effect Scaling:
11+
lblEffectCondition.text=Effect Condition:
12+
lblSuccessEffects.text=Effects on Success
13+
lblFailureEffects.text=Effects on Failure
14+
btnAdd.text=Add
15+
btnRemove.text=Remove
16+
btnCancel.text=Cancel
17+
btnOK.text=Done
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
labDeploymentOffset.text=Deployment Zone Offset
2+
labDeploymentOffset.tip=Deployment Zone Offset, in hexes from corresponding map edge
3+
labDeploymentWidth.text=Deployment Zone Width
4+
labDeploymentWidth.tip=Deployment Zone width, in hexes
5+
labDeploymentAnyNW.text=Deployment Zone NW corner
6+
labDeploymentAnySE.text=Deployment Zone SE corner
7+
btnOK.text=Done
8+
btnCancel.text=Cancel
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dialog.title=Select Map
2+
checkFixed.text=Use Fixed Map
3+
listMapGenerators.none=None
4+
lblBoardType.text=Board Type:
5+
lblMapSize.text=Map Size:
6+
btnOK.text=Done
7+
btnCancel.text=Cancel
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dialog.title=Edit Scenario Deployment Limits
2+
panAllowedUnits.title=Allowed Units
3+
checkAllUnits.text=Allow all units
4+
lblQuantityType.text=Quantity Type:
5+
lblCountType.text=Maximum Type:
6+
lblQuantity.text=Maximum Quantity:
7+
btnOK.text=Done
8+
btnCancel.text=Cancel

MekHQ/src/mekhq/GameThread.java

+1-16
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,7 @@ public void run() {
174174
client.sendMapSettings(mapSettings);
175175
Thread.sleep(MekHQ.getMHQOptions().getStartGameDelay());
176176

177-
PlanetaryConditions planetaryConditions = new PlanetaryConditions();
178-
planetaryConditions.setLight(scenario.getLight());
179-
planetaryConditions.setWeather(scenario.getWeather());
180-
planetaryConditions.setWind(scenario.getWind());
181-
planetaryConditions.setFog(scenario.getFog());
182-
planetaryConditions.setAtmosphere(scenario.getAtmosphere());
183-
planetaryConditions.setTemperature(scenario.getTemperature());
184-
planetaryConditions.setGravity(scenario.getGravity());
185-
planetaryConditions.setEMI(scenario.getEMI());
186-
planetaryConditions.setBlowingSand(scenario.getBlowingSand());
187-
planetaryConditions.setShiftingWindDirection(scenario.canWindShiftDirection());
188-
planetaryConditions.setShiftingWindStrength(scenario.canWindShiftStrength());
189-
planetaryConditions.setWindMax(scenario.getMaxWindStrength());
190-
planetaryConditions.setWindMin(scenario.getMinWindStrength());
191-
192-
client.sendPlanetaryConditions(planetaryConditions);
177+
client.sendPlanetaryConditions(scenario.createPlanetaryConditions());
193178
Thread.sleep(MekHQ.getMHQOptions().getStartGameDelay());
194179

195180
// set player deployment

MekHQ/src/mekhq/Utilities.java

+87
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import mekhq.campaign.Campaign;
3333
import mekhq.campaign.CampaignOptions;
3434
import mekhq.campaign.finances.Money;
35+
import mekhq.campaign.mission.IPlayerSettings;
3536
import mekhq.campaign.personnel.Person;
3637
import mekhq.campaign.personnel.SkillType;
3738
import mekhq.campaign.personnel.enums.PersonnelRole;
@@ -1285,4 +1286,90 @@ public static MechSummary retrieveOriginalUnit(Entity newE) throws EntityLoading
12851286

12861287
return summary;
12871288
}
1289+
1290+
public static List<String> generateEntityStub(List<Entity> entities) {
1291+
List<String> stub = new ArrayList<>();
1292+
for (Entity en : entities) {
1293+
if (null == en) {
1294+
stub.add("<html><font color='red'>No random assignment table found for faction</font></html>");
1295+
} else {
1296+
stub.add("<html>" + en.getCrew().getName() + " (" +
1297+
en.getCrew().getGunnery() + "/" +
1298+
en.getCrew().getPiloting() + "), " +
1299+
"<i>" + en.getShortName() + "</i>" +
1300+
"</html>");
1301+
}
1302+
}
1303+
return stub;
1304+
}
1305+
1306+
/**
1307+
* Display a descriptive character string for the deployment parameters in an object that implements IPlayerSettings
1308+
* @param player object that implements IPlayerSettings
1309+
* @return A character string
1310+
*/
1311+
public static String getDeploymentString(Player player) {
1312+
StringBuilder result = new StringBuilder("");
1313+
1314+
if(player.getStartingPos() >=0
1315+
&& player.getStartingPos() <= IStartingPositions.START_LOCATION_NAMES.length) {
1316+
result.append(IStartingPositions.START_LOCATION_NAMES[player.getStartingPos()]);
1317+
}
1318+
1319+
if (player.getStartingPos() == 0) {
1320+
int NWx = player.getStartingAnyNWx() + 1;
1321+
int NWy = player.getStartingAnyNWy() + 1;
1322+
int SEx = player.getStartingAnySEx() + 1;
1323+
int SEy = player.getStartingAnySEy() + 1;
1324+
if ((NWx + NWy + SEx + SEy) > 0) {
1325+
result.append(" (" + NWx + ", " + NWy + ")-(" + SEx + ", " + SEy + ")");
1326+
}
1327+
}
1328+
int so = player.getStartOffset();
1329+
int sw = player.getStartWidth();
1330+
if ((so != 0) || (sw != 3)) {
1331+
result.append(", " + so);
1332+
result.append(", " + sw);
1333+
}
1334+
1335+
return result.toString();
1336+
}
1337+
1338+
public static String getDeploymentString(IPlayerSettings settings) {
1339+
return getDeploymentString(createPlayer(settings));
1340+
}
1341+
1342+
/**
1343+
* Create a Player object from IPlayerSettings parameters. Useful for tracking these variables in dialogs.
1344+
* @param settings an object that implements IPlayerSettings
1345+
* @return A Player object
1346+
*/
1347+
public static Player createPlayer(IPlayerSettings settings) {
1348+
Player p = new Player(1, "fake");
1349+
p.setStartingPos(settings.getStartingPos());
1350+
p.setStartWidth(settings.getStartWidth());
1351+
p.setStartOffset(settings.getStartOffset());
1352+
p.setStartingAnyNWx(settings.getStartingAnyNWx());
1353+
p.setStartingAnyNWy(settings.getStartingAnyNWy());
1354+
p.setStartingAnySEx(settings.getStartingAnySEx());
1355+
p.setStartingAnySEy(settings.getStartingAnySEy());
1356+
1357+
return p;
1358+
}
1359+
1360+
/**
1361+
* Update values of an object that implements IPlayerSettings from a player object
1362+
* @param settings An object that implements IPlayerSettings
1363+
* @param player A Player object from which to read values
1364+
*/
1365+
public static void updatePlayerSettings(IPlayerSettings settings, Player player) {
1366+
settings.setStartingPos(player.getStartingPos());
1367+
settings.setStartWidth(player.getStartWidth());
1368+
settings.setStartOffset(player.getStartOffset());
1369+
settings.setStartingAnyNWx(player.getStartingAnyNWx());
1370+
settings.setStartingAnyNWy(player.getStartingAnyNWy());
1371+
settings.setStartingAnySEx(player.getStartingAnySEx());
1372+
settings.setStartingAnySEy(player.getStartingAnySEy());
1373+
1374+
}
12881375
}

MekHQ/src/mekhq/campaign/mission/AtBScenario.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import megamek.common.planetaryconditions.Atmosphere;
3434
import mekhq.MHQConstants;
3535
import mekhq.MekHQ;
36+
import mekhq.Utilities;
3637
import mekhq.campaign.Campaign;
3738
import mekhq.campaign.againstTheBot.AtBConfiguration;
3839
import mekhq.campaign.againstTheBot.AtBStaticWeightGenerator;
@@ -1501,7 +1502,7 @@ protected BotForce getEnemyBotForce(AtBContract c, int start, int home, List<Ent
15011502
@Override
15021503
public void generateStub(Campaign c) {
15031504
super.generateStub(c);
1504-
alliesPlayerStub = generateEntityStub(alliesPlayer);
1505+
alliesPlayerStub = Utilities.generateEntityStub(alliesPlayer);
15051506

15061507
alliesPlayer.clear();
15071508
if (null != bigBattleAllies) {

0 commit comments

Comments
 (0)