Skip to content

Commit 5abec82

Browse files
authored
Merge pull request #6553 from IllianiCBT/reasoning
Rebranded "Intelligence" as "Reasoning" to Avoid Confusion with ATOW Intelligence Attribute
2 parents 873c5c1 + de59972 commit 5abec82

20 files changed

+1198
-1113
lines changed

MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties

+5-6
Original file line numberDiff line numberDiff line change
@@ -716,14 +716,14 @@ lblBackgroundsTab.text=Background Options \u270E
716716
lblRandomBackgroundsPanel.text=Random Backgrounds \u2728
717717
lblUseRandomPersonalities.text=Assign Random Personalities \u2318
718718
lblUseRandomPersonalities.tooltip=Personnel are generated with random personality traits, quirks\
719-
\ and intelligence.\
719+
\ and reasoning.\
720720
<br>\
721-
<br>Intelligence affects a character's ability to graduate from education module academies.
721+
<br>Reasoning affects a character's ability to graduate from education module academies.
722722
lblUseRandomPersonalityReputation.text=Personality Influences Reputation
723723
lblUseRandomPersonalityReputation.tooltip=If enabled, the personality of the campaign commander\
724724
\ will impact the unit's Reputation.
725-
lblUseIntelligenceXpMultiplier.text=Intelligence Influences XP Costs
726-
lblUseIntelligenceXpMultiplier.tooltip=If enabled, a character's intelligence will influence all XP\
725+
lblUseReasoningXpMultiplier.text=Reasoning Influences XP Costs
726+
lblUseReasoningXpMultiplier.tooltip=If enabled, a character's reasoning will influence all XP\
727727
\ costs.
728728
lblUseSimulatedRelationships.text=Simulate Background Relationships \u26A0
729729
lblUseSimulatedRelationships.tooltip=Personnel are generated with a random relationship history.\
@@ -808,8 +808,7 @@ lblShowIneligibleAcademies.tooltip=Displays academies a character is ineligible
808808
lblEntranceExamBaseTargetNumber.text=Entrance Exam Target Number \u26A0
809809
lblEntranceExamBaseTargetNumber.tooltip=The base target number for Prestigious Academy entrance exams.\
810810
<br>\
811-
<br>The final TN is this value minus Faculty Skill, opposed by 2d6 + Intelligence/4 or just 2d6\
812-
\ (if personalities are disabled)
811+
<br>The final TN is this value minus Faculty Skill, opposed by 2d6 + Reasoning/4 or just 2d6 (if personalities are disabled)
813812
# createEnableStandardSetsPanel
814813
lblEnableStandardSetsPanel.text=Enable Academy Sets
815814
lblEnableLocalAcademies.text=Local Academies

MekHQ/resources/mekhq/resources/GUI.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ PersonnelTableModelColumn.AGGRESSION.text=Aggression
937937
PersonnelTableModelColumn.AMBITION.text=Ambition
938938
PersonnelTableModelColumn.GREED.text=Greed
939939
PersonnelTableModelColumn.SOCIAL.text=Social
940-
PersonnelTableModelColumn.INTELLIGENCE.text=Intelligence
940+
PersonnelTableModelColumn.REASONING.text=Reasoning
941941
#### PersonnelTabView Enum
942942
PersonnelTabView.GRAPHIC.text=Graphic
943943
PersonnelTabView.GRAPHIC.toolTipText=View the person's portrait, their current unit assignment, and their force, all shown with their graphics.

MekHQ/src/mekhq/campaign/CampaignOptions.java

+459-442
Large diffs are not rendered by default.

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

+202-156
Large diffs are not rendered by default.

MekHQ/src/mekhq/campaign/personnel/education/EducationController.java

+39-40
Large diffs are not rendered by default.

MekHQ/src/mekhq/campaign/personnel/education/TrainingCombatTeams.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ private static void processEducationTime(Campaign campaign, Person commander, Pe
255255

256256
int perExperienceLevelMultiplier = EDUCATION_TIME_MULTIPLIER;
257257
double experienceMultiplier = campaignOptions.getXpCostMultiplier();
258-
double intelligenceCostMultiplier = trainee.getIntelligenceXpCostMultiplier(campaignOptions.isUseIntelligenceXpMultiplier());
258+
double reasoningCostMultiplier = trainee.getReasoningXpCostMultiplier(campaignOptions.isUseReasoningXpMultiplier());
259259

260-
// Intelligence cost changes should always take place before global changes
260+
// Reasoning cost changes should always take place before global changes
261261
perExperienceLevelMultiplier = (int) round(perExperienceLevelMultiplier * experienceMultiplier);
262-
perExperienceLevelMultiplier = (int) round(perExperienceLevelMultiplier * intelligenceCostMultiplier);
262+
perExperienceLevelMultiplier = (int) round(perExperienceLevelMultiplier * reasoningCostMultiplier);
263263

264264
int educationTimeReduction = currentExperienceLevel * perExperienceLevelMultiplier;
265265
if (newEducationTime >= educationTimeReduction) {

MekHQ/src/mekhq/campaign/personnel/skills/Skill.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@
3737
import java.io.PrintWriter;
3838
import java.util.Objects;
3939

40+
import megamek.codeUtilities.MathUtility;
4041
import megamek.common.Compute;
4142
import megamek.common.enums.SkillLevel;
4243
import megamek.logging.MMLogger;
4344
import mekhq.campaign.personnel.Person;
4445
import mekhq.campaign.personnel.PersonnelOptions;
45-
import mekhq.campaign.randomEvents.personalities.enums.Intelligence;
46+
import mekhq.campaign.randomEvents.personalities.enums.Reasoning;
4647
import mekhq.utilities.MHQXMLUtility;
4748
import org.w3c.dom.Node;
4849
import org.w3c.dom.NodeList;
@@ -342,7 +343,7 @@ public void improve() {
342343
* the cost for the next valid level if it exists.</p>
343344
*
344345
* <p><b>Usage:</b> For most use cases you probably want to call {@code getCostToImprove(String)} from a
345-
* {@link Person} object, as that will factor in things like {@link Intelligence}.</p>
346+
* {@link Person} object, as that will factor in things like {@link Reasoning}.</p>
346347
*
347348
* @return the cost to improve the skill, or 0 if no valid level with a positive cost is found.
348349
*/
@@ -433,11 +434,11 @@ public static Skill generateInstanceFromXML(final Node wn) {
433434
String text = wn2.getTextContent();
434435
retVal.type = SkillType.getType(text);
435436
} else if (wn2.getNodeName().equalsIgnoreCase("level")) {
436-
retVal.level = Integer.parseInt(wn2.getTextContent());
437+
retVal.level = MathUtility.parseInt(wn2.getTextContent());
437438
} else if (wn2.getNodeName().equalsIgnoreCase("bonus")) {
438-
retVal.bonus = Integer.parseInt(wn2.getTextContent());
439+
retVal.bonus = MathUtility.parseInt(wn2.getTextContent());
439440
} else if (wn2.getNodeName().equalsIgnoreCase("agingModifier")) {
440-
retVal.agingModifier = Integer.parseInt(wn2.getTextContent());
441+
retVal.agingModifier = MathUtility.parseInt(wn2.getTextContent());
441442
}
442443
}
443444
} catch (Exception ex) {

MekHQ/src/mekhq/campaign/personnel/skills/SkillDeprecationTool.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
* <p>It identifies deprecated skills from the person's current skill set and allows the user to remove them while
4444
* refunding the appropriate amount of XP. This process involves calculating XP refunds using the skill's cost and
45-
* intelligence multiplier, and providing a dialog for managing the refund.
45+
* reasoning multiplier, and providing a dialog for managing the refund.
4646
*
4747
* <p>The class is initialized with a {@link Campaign} and a {@link Person}, and directly modifies the person's
4848
* skills and XP as necessary.
@@ -110,7 +110,7 @@ public boolean isRefundAll() {
110110
* Checks the specified person's skills for any deprecated skills.
111111
*
112112
* <p>If a deprecated skill is found, calculates the XP refund based on the skill's level and the person's
113-
* intelligence multiplier. It then triggers a dialog to allow the user to refund or retain the skill.
113+
* reasoning multiplier. It then triggers a dialog to allow the user to refund or retain the skill.
114114
*
115115
* @param person the {@link Person} to check for deprecated skills
116116
*/
@@ -119,17 +119,17 @@ private void checkForDeprecatedSkills(Person person) {
119119

120120
final double xpCostMultiplier = campaignOptions.getXpCostMultiplier();
121121

122-
final boolean isUseIntelligenceMultiplier = campaignOptions.isUseIntelligenceXpMultiplier();
123-
final double intelligenceMultiplier = person.getIntelligenceXpCostMultiplier(isUseIntelligenceMultiplier);
122+
final boolean isUseReasoningMultiplier = campaignOptions.isUseReasoningXpMultiplier();
123+
final double reasoningXpMultiplier = person.getReasoningXpCostMultiplier(isUseReasoningMultiplier);
124124

125125
final Skills skills = person.getSkills();
126126
for (SkillType skillType : DEPRECATED_SKILLS) {
127127
final String skillName = skillType.getName();
128128
if (skills.hasSkill(skillName)) {
129129
int refundValue = getRefundValue(skills, skillType, skillName);
130130

131-
// Intelligence cost changes should always take place before global changes
132-
refundValue = (int) round(refundValue * intelligenceMultiplier);
131+
// Reasoning cost changes should always take place before global changes
132+
refundValue = (int) round(refundValue * reasoningXpMultiplier);
133133
refundValue = (int) round(refundValue * xpCostMultiplier);
134134

135135
triggerDialog(skills, skillName, refundValue);

MekHQ/src/mekhq/campaign/randomEvents/personalities/PersonalityController.java

+42-40
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import static mekhq.campaign.personnel.enums.GenderDescriptors.HE_SHE_THEY;
3535
import static mekhq.campaign.personnel.enums.GenderDescriptors.HIM_HER_THEM;
3636
import static mekhq.campaign.personnel.enums.GenderDescriptors.HIS_HER_THEIR;
37-
import static mekhq.campaign.randomEvents.personalities.enums.Intelligence.*;
37+
import static mekhq.campaign.randomEvents.personalities.enums.Reasoning.*;
3838

3939
import java.util.ArrayList;
4040
import java.util.Arrays;
@@ -46,13 +46,13 @@
4646
import mekhq.campaign.randomEvents.personalities.enums.Aggression;
4747
import mekhq.campaign.randomEvents.personalities.enums.Ambition;
4848
import mekhq.campaign.randomEvents.personalities.enums.Greed;
49-
import mekhq.campaign.randomEvents.personalities.enums.Intelligence;
5049
import mekhq.campaign.randomEvents.personalities.enums.PersonalityQuirk;
50+
import mekhq.campaign.randomEvents.personalities.enums.Reasoning;
5151
import mekhq.campaign.randomEvents.personalities.enums.Social;
5252

5353
/**
5454
* This class is responsible for generating and managing personalities for characters. It assigns traits such as
55-
* aggression, ambition, greed, social behavior, intelligence, and personality quirks to a person, and generates a
55+
* aggression, ambition, greed, social behavior, reasoning, and personality quirks to a person, and generates a
5656
* descriptive personality summary.
5757
*
5858
* <p>Additionally, this class includes methods for handling fallback personality logic, generating
@@ -76,12 +76,12 @@ public class PersonalityController {
7676
* </ul>
7777
*/
7878
public enum PersonalityTraitType {
79-
AGGRESSION, AMBITION, GREED, SOCIAL, INTELLIGENCE, PERSONALITY_QUIRK;
79+
AGGRESSION, AMBITION, GREED, SOCIAL, REASONING, PERSONALITY_QUIRK;
8080
}
8181

8282
/**
8383
* Generates a personality for the given person by assigning various personality characteristics such as aggression,
84-
* ambition, greed, social behavior, intelligence, and optional quirks.
84+
* ambition, greed, social behavior, reasoning, and optional quirks.
8585
*
8686
* <p>The method ensures that each personality characteristic is generated with a specified
8787
* probability (1 in 6 by default). If no characteristic is assigned, a fallback mechanism generates at least one
@@ -132,8 +132,8 @@ public static void generatePersonality(Person person) {
132132
person.setPersonalityQuirk(PersonalityQuirk.NONE);
133133
}
134134

135-
// INTELLIGENCE
136-
person.setIntelligence(generateIntelligence(randomInt(8346)));
135+
// REASONING
136+
person.setReasoning(generateReasoning(randomInt(8346)));
137137

138138
// finally, write the description
139139
writePersonalityDescription(person);
@@ -150,15 +150,15 @@ public static void generatePersonality(Person person) {
150150
* Generates an expansive "big" personality for a major character, Ronin, or hero.
151151
*
152152
* <p>This method creates a detailed set of personality traits for the given person,
153-
* selecting and assigning a combination of major traits, a quirk, and intelligence. It ensures the generated
153+
* selecting and assigning a combination of major traits, a quirk, and reasoning. It ensures the generated
154154
* personality reflects a high degree of uniqueness and depth.</p>
155155
*
156156
* <p>The method proceeds as follows:
157157
* <ul>
158158
* <li>Randomly selects up to four major traits (Aggression, Ambition, Greed, Social).</li>
159159
* <li>Assigns the selected traits to the person's corresponding personality attributes.</li>
160160
* <li>Generates and applies a unique personality quirk to the person.</li>
161-
* <li>Generates an intelligence score using the maximum of two random values.</li>
161+
* <li>Generates a reasoning score using the maximum of two random values.</li>
162162
* <li>Writes a personality description based on the generated traits and attributes.</li>
163163
* </ul>
164164
*
@@ -225,10 +225,10 @@ public static void generateBigPersonality(Person person) {
225225
// PERSONALITY QUIRK
226226
generateAndApplyPersonalityQuirk(person);
227227

228-
// INTELLIGENCE
229-
int firstIntelligence = randomInt(8346);
230-
int secondIntelligence = randomInt(8346);
231-
person.setIntelligence(generateIntelligence(max(firstIntelligence, secondIntelligence)));
228+
// REASONING
229+
int firstReasoning = randomInt(8346);
230+
int secondReasoning = randomInt(8346);
231+
person.setReasoning(generateReasoning(max(firstReasoning, secondReasoning)));
232232

233233
// finally, write the description
234234
writePersonalityDescription(person);
@@ -324,14 +324,12 @@ public static void writePersonalityDescription(Person person) {
324324
person.getSocial(),
325325
person.getSocialDescriptionIndex());
326326

327-
// Intelligence and personality quirk are handled differently to general personality traits.
328-
// INTELLIGENCE
329-
Intelligence intelligence = person.getIntelligence();
330-
String intelligenceDescription = "";
331-
if (!intelligence.isAverageType()) {
332-
intelligenceDescription = intelligence.getDescription(person.getIntelligenceDescriptionIndex(),
333-
gender,
334-
givenName);
327+
// Reasoning and personality quirk are handled differently to general personality traits.
328+
// REASONING
329+
Reasoning reasoning = person.getReasoning();
330+
String reasoningDescription = "";
331+
if (!reasoning.isAverageType()) {
332+
reasoningDescription = reasoning.getDescription(person.getReasoningDescriptionIndex(), gender, givenName);
335333
}
336334

337335
// PERSONALITY QUIRK
@@ -369,11 +367,11 @@ public static void writePersonalityDescription(Person person) {
369367
}
370368
}
371369

372-
if (!intelligenceDescription.isBlank()) {
370+
if (!reasoningDescription.isBlank()) {
373371
if (!personalityDescription.toString().isBlank()) {
374-
personalityDescription.append("<p>").append(intelligenceDescription).append("</p>");
372+
personalityDescription.append("<p>").append(reasoningDescription).append("</p>");
375373
} else {
376-
personalityDescription.append(intelligenceDescription);
374+
personalityDescription.append(reasoningDescription);
377375
}
378376
}
379377

@@ -389,9 +387,9 @@ public static void writePersonalityDescription(Person person) {
389387
}
390388

391389
/**
392-
* Retrieves the descriptions of all personality traits (other than Intelligence and Quirks) for the given person.
393-
* This method processes various personality traits such as aggression, ambition, greed, and social behavior,
394-
* generating descriptions based on the specified indices, gender, and given name of the person.
390+
* Retrieves the descriptions of all personality traits (other than Reasoning and Quirks) for the given person. This
391+
* method processes various personality traits such as aggression, ambition, greed, and social behavior, generating
392+
* descriptions based on the specified indices, gender, and given name of the person.
395393
*
396394
* <p>Descriptions for traits that are not assigned or are empty will be excluded from the
397395
* returned list. This ensures only meaningful and applicable descriptions are included.
@@ -416,10 +414,8 @@ public static void writePersonalityDescription(Person person) {
416414
* the given person; traits without meaningful descriptions are excluded
417415
*/
418416
private static List<String> getTraitDescriptions(Gender gender, String givenName, Aggression aggression,
419-
int aggressionDescriptionIndex, Ambition ambition,
420-
int ambitionDescriptionIndex, Greed greed,
421-
int greedDescriptionIndex, Social social,
422-
int socialDescriptionIndex) {
417+
int aggressionDescriptionIndex, Ambition ambition, int ambitionDescriptionIndex, Greed greed,
418+
int greedDescriptionIndex, Social social, int socialDescriptionIndex) {
423419
List<String> traitDescriptions = new ArrayList<>();
424420

425421
// AGGRESSION
@@ -461,18 +457,24 @@ private static List<String> getTraitDescriptions(Gender gender, String givenName
461457
return traitDescriptions;
462458
}
463459

460+
461+
/**
462+
* @deprecated replaced by {@link #getReasoning()}
463+
*/
464+
@Deprecated(since = "0.50.05", forRemoval = true)
465+
466+
464467
/**
465-
* Generates an Intelligence enum value for a person based on a randomly rolled value. Each intelligence level is
466-
* mapped to a specific range of values, with lower rolls producing less intelligent results and higher rolls
467-
* producing more intelligent results.
468+
* Generates an {@link Reasoning} enum value for a person based on a randomly rolled value. Each reasoning
469+
* level is mapped to a specific range of values, with lower rolls producing less intelligent results and higher
470+
* rolls producing more intelligent results.
468471
*
469-
* @param roll the random roll value used to determine the Intelligence enum value
472+
* @param roll the random roll value used to determine the {@link Reasoning} enum value
470473
*
471-
* @return the Intelligence enum value corresponding to the rolled range
474+
* @return the {@link Reasoning} enum value corresponding to the rolled range
472475
*
473476
* @throws IllegalStateException if the roll exceeds the expected value range
474-
*/
475-
private static Intelligence generateIntelligence(int roll) {
477+
*/ private static Reasoning generateReasoning(int roll) {
476478
if (roll < 1) {
477479
return BRAIN_DEAD;
478480
} else if (roll < 2) {
@@ -525,7 +527,7 @@ private static Intelligence generateIntelligence(int roll) {
525527
return GENIUS;
526528
} else {
527529
throw new IllegalStateException(
528-
"Unexpected value in mekhq/campaign/personnel/randomEvents/PersonalityController.java/generateIntelligence: " +
530+
"Unexpected value in mekhq/campaign/personnel/randomEvents/PersonalityController.java/generateReasoning: " +
529531
roll);
530532
}
531533
}
@@ -549,7 +551,7 @@ private static Intelligence generateIntelligence(int roll) {
549551
* are not enabled
550552
*/
551553
public static int getPersonalityValue(final boolean isUseRandomPersonalities, final Aggression aggression,
552-
final Ambition ambition, final Greed greed, final Social social) {
554+
final Ambition ambition, final Greed greed, final Social social) {
553555
if (!isUseRandomPersonalities) {
554556
return 0;
555557
}

0 commit comments

Comments
 (0)