Skip to content

Commit 68f1b68

Browse files
authored
Merge pull request #7344 from IllianiBird/atowCitizenshipSPA
Improvement: Added Citizenship/Trueborn SPA
2 parents 24b7d2a + 1cb1577 commit 68f1b68

File tree

7 files changed

+38
-4
lines changed

7 files changed

+38
-4
lines changed

MekHQ/data/universe/defaultspa.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,18 @@ They can make one additional procurement attempt per day.]]></desc>
553553
This SPA reduces the penalty from low Reputation by 2 and reduces the chance of an assassination attempt occurring by half.
554554
555555
While this SPA does exist in ATOW (and that's where you'll find its description), these effects are unique to MekHQ.]]></desc>
556+
<xpCost>200</xpCost>
557+
<weight>1</weight>
558+
<skillPrereq />
559+
</ability>
560+
<ability>
561+
<lookupName>atow_citizenship</lookupName>
562+
<displayName>Citizenship/Trueborn (ATOW)</displayName>
563+
<desc><![CDATA[Unlocks additional options during character creation.
564+
565+
Increases Connections by 1.
566+
567+
While this SPA does exist in ATOW, the Connections modifier is unique to MekHQ. We use that to abstract the kinds of bonuses this SPA would incur in a tabletop game.]]></desc>
556568
<xpCost>200</xpCost>
557569
<weight>1</weight>
558570
<skillPrereq/>

MekHQ/src/mekhq/campaign/market/contractMarket/AtbMonthlyContractMarket.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ private void checkForSubcontracts(Campaign campaign, AtBContract contract, int u
361361
int connections = 0;
362362
Person commander = campaign.getCommander();
363363
if (commander != null) {
364-
connections = commander.getConnections();
364+
connections = commander.getAdjustedConnections();
365365
}
366366
int roll = d6(2) + connections;
367367
if (roll < 6) {

MekHQ/src/mekhq/campaign/personnel/Person.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5475,6 +5475,26 @@ public int getConnections() {
54755475
return connections;
54765476
}
54775477

5478+
/**
5479+
* Calculates and returns the character's adjusted Connections value.
5480+
*
5481+
* <p>If the character has the {@link PersonnelOptions#ATOW_CITIZENSHIP} SPA their Connections value is
5482+
* increased by 1.</p>
5483+
*
5484+
* <p>The connections value is clamped within the allowed minimum and maximum range before being returned.</p>
5485+
*
5486+
* @return the character's Connections value, clamped within the minimum and maximum limits
5487+
*
5488+
* @author Illiani
5489+
* @since 0.50.07
5490+
*/
5491+
public int getAdjustedConnections() {
5492+
boolean hasCitizenship = options.booleanOption(ATOW_CITIZENSHIP);
5493+
5494+
int modifiers = (hasCitizenship ? 1 : 0);
5495+
return clamp(connections + modifiers, MINIMUM_CONNECTIONS, MAXIMUM_CONNECTIONS);
5496+
}
5497+
54785498
public void setConnections(final int connections) {
54795499
this.connections = clamp(connections, MINIMUM_CONNECTIONS, MAXIMUM_CONNECTIONS);
54805500
}

MekHQ/src/mekhq/campaign/personnel/PersonnelOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class PersonnelOptions extends PilotOptions {
6767
public static final String FLAW_SLOW_LEARNER = "flaw_slow_learner";
6868
public static final String ATOW_FAST_LEARNER = "atow_fast_learner";
6969
public static final String ATOW_ALTERNATE_ID = "atow_alternate_id";
70+
public static final String ATOW_CITIZENSHIP = "atow_citizenship";
7071
public static final String FLAW_ANIMAL_ANTIPATHY = "flaw_animal_antipathy";
7172
public static final String ATOW_ANIMAL_EMPATHY = "atow_animal_empathy";
7273
public static final String ATOW_AMBIDEXTROUS = "atow_ambidextrous";
@@ -186,6 +187,7 @@ public void initialize() {
186187
addOption(l3a, FLAW_SLOW_LEARNER, false);
187188
addOption(l3a, ATOW_FAST_LEARNER, false);
188189
addOption(l3a, ATOW_ALTERNATE_ID, false);
190+
addOption(l3a, ATOW_CITIZENSHIP, false);
189191
addOption(l3a, FLAW_ANIMAL_ANTIPATHY, false);
190192
addOption(l3a, ATOW_ANIMAL_EMPATHY, false);
191193
addOption(l3a, ATOW_AMBIDEXTROUS, false);

MekHQ/src/mekhq/campaign/rating/CamOpsReputation/CommandRating.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private static int getATOWTraitValues(Person commander, boolean isUseAgingEffect
136136
PersonnelOptions options = commander.getOptions();
137137

138138
// Connections
139-
traitScore += commander.getConnections();
139+
traitScore += commander.getAdjustedConnections();
140140

141141
// Wealth
142142
traitScore += commander.getWealth() >= 7 ? 1 : 0;

MekHQ/src/mekhq/gui/enums/PersonnelTableModelColumn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ public String getCellValue(final Campaign campaign, final PersonnelMarket person
934934
case TOUGHNESS:
935935
return Integer.toString(person.getToughness());
936936
case CONNECTIONS:
937-
return Integer.toString(person.getConnections());
937+
return Integer.toString(person.getAdjustedConnections());
938938
case WEALTH:
939939
return Integer.toString(person.getWealth());
940940
case REPUTATION:

MekHQ/src/mekhq/gui/view/PersonViewPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ private JPanel fillOther() {
20742074
pnlOther.setBorder(RoundedLineBorder.createRoundedLineBorder(resourceMap.getString("pnlSkills.traits")));
20752075

20762076
JLabel lblConnections = null;
2077-
int connections = person.getConnections();
2077+
int connections = person.getAdjustedConnections();
20782078
if (connections != 0) {
20792079
String connectionsLabel = String.format(resourceMap.getString("format.traitValue"),
20802080
resourceMap.getString("lblConnections.text"),

0 commit comments

Comments
 (0)