Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Personality Revamp #5998

Merged
merged 35 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ebf5ea8
Refactored personality-related package structure
IllianiCBT Feb 3, 2025
73d9b77
Refactored personality and greed handling for enhanced clarity
IllianiCBT Feb 3, 2025
7bc4a16
Add randomized personality description indices to Person
IllianiCBT Feb 3, 2025
6ea3362
Improve gender-neutral language in character descriptions
IllianiCBT Feb 3, 2025
518d8e2
Update resource keys to include ".regexp" suffix
IllianiCBT Feb 3, 2025
9f0282b
Refactor Aggression.properties to use .regexp keys
IllianiCBT Feb 3, 2025
4f6e12e
Update intelligence and greed descriptions with regex and fixes
IllianiCBT Feb 3, 2025
45d7cff
Refactored personality description generation and fixed property lite…
IllianiCBT Feb 3, 2025
733456b
Refactored character descriptions to use placeholders
IllianiCBT Feb 3, 2025
d894710
Replace .regexp keys with simpler keys in properties files
IllianiCBT Feb 3, 2025
d6e16d7
Add detailed descriptions for Personality Quirk properties
IllianiCBT Feb 4, 2025
dfdd109
Refactored personality traits to include combatant/civilian-specific …
IllianiCBT Feb 5, 2025
aaf96c7
Add detailed descriptions for Personality Quirks
IllianiCBT Feb 6, 2025
62c6f3d
Refactored personality quirks and revised civilian references.
IllianiCBT Feb 7, 2025
e8b1fea
Refactored personality handling to include campaign context
IllianiCBT Feb 7, 2025
b1f9bfe
Merge branch 'master' into personality_revamp
IllianiCBT Feb 7, 2025
ba00885
Refactored personality value logic to use PersonalityController
IllianiCBT Feb 7, 2025
6d73144
Add unit tests for personality-related enums
IllianiCBT Feb 7, 2025
66c4a9a
Improve handling of personnel description updates
IllianiCBT Feb 7, 2025
cde0655
Update PersonalityQuirk keys for Inner Sphere terminology
IllianiCBT Feb 7, 2025
d1c87ee
Merge branch 'refs/heads/master' into personality_revamp
IllianiCBT Feb 21, 2025
7b2a57c
Remove unused Personalities.properties resource file
IllianiCBT Feb 21, 2025
3d79f02
Refactor intelligence levels and descriptions.
IllianiCBT Feb 23, 2025
db77ef1
Update copyright year range in MHQInternationalization.java
IllianiCBT Feb 23, 2025
df7c382
Remove campaign parameter from personality handling methods
IllianiCBT Feb 23, 2025
5104b59
Updated documentation
IllianiCBT Feb 23, 2025
94c31c0
Merge branch 'refs/heads/master' into personality_revamp
IllianiCBT Feb 23, 2025
978ef30
Add personality quirks for re-educated personnel
IllianiCBT Feb 23, 2025
5243e0c
Refactor personality description formatting logic.
IllianiCBT Feb 23, 2025
6b17048
Make PERSONALITY_QUIRK_CHANCE a constant
IllianiCBT Feb 23, 2025
91b0c42
Fix placeholder inconsistency in Social.properties
IllianiCBT Feb 23, 2025
a80566d
Merge branch 'refs/heads/master' into personality_revamp
IllianiCBT Feb 24, 2025
a0058c6
Refactor personality generation and description logic
IllianiCBT Feb 24, 2025
6aabe3f
Refactor personality value retrieval in prisoner events.
IllianiCBT Feb 24, 2025
537c20f
Refactor personality description methods for clarity
IllianiCBT Feb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add personality quirks for re-educated personnel
Introduced a chance for re-educated personnel to gain personality quirks. Made personality quirk generation configurable via the static `PERSONALITY_QUIRK_CHANCE` field for better control. Also exposed `generatePersonalityQuirk` for broader use within the campaign logic.
  • Loading branch information
IllianiCBT committed Feb 23, 2025
commit 978ef30c626bcb28cb2d558b846593c6dc7f8caa
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
import java.util.*;

import static megamek.common.Compute.d6;
import static megamek.common.Compute.randomInt;
import static mekhq.campaign.personnel.SkillType.EXP_REGULAR;
import static mekhq.campaign.personnel.SkillType.EXP_VETERAN;
import static mekhq.campaign.randomEvents.personalities.PersonalityController.PERSONALITY_QUIRK_CHANCE;
import static mekhq.campaign.randomEvents.personalities.PersonalityController.generatePersonalityQuirk;
import static mekhq.campaign.randomEvents.personalities.PersonalityController.writeDescription;

/**
* The EducationController class is responsible for managing the education
Expand Down Expand Up @@ -1488,6 +1492,14 @@ private static void processGraduation(Campaign campaign, Person person, Academy
person.setOriginFaction(campaign.getFaction());
}

// People coming out of re-education camps have a chance to become a little weird
if (person.getPersonalityQuirk().isNone()) {
if (randomInt(PERSONALITY_QUIRK_CHANCE / 2) == 0) {
person.setPersonalityQuirk(generatePersonalityQuirk());
writeDescription(person);
}
}

// brainwashed personnel should have higher than average loyalty, so they roll
// 4d6 and drop the lowest roll
List<Integer> rolls = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
import java.util.Objects;
import java.util.Random;

import static megamek.common.Compute.d6;
import static megamek.common.Compute.randomInt;
import static mekhq.campaign.randomEvents.personalities.enums.Intelligence.*;

public class PersonalityController {
public static int PERSONALITY_QUIRK_CHANCE = 10;

/**
* Generates a personality for the given person. The method assigns various personality traits,
* intelligence, and potential quirks to the person.
Expand All @@ -52,14 +55,14 @@ public static void generatePersonality(Person person) {
for (int table = 0; table < 4; table++) {
// we only want a 1 in 6 chance of getting a personality trait, per table
// this prevents trait bloat and helps reduce repetitiveness
if (randomInt(6) == 0) {
if (d6() == 1) {
setPersonalityTrait(person, table, randomInt(26));
}
}

// we only want 1 in 10 persons to have a quirk,
// as these helps reduce repetitiveness and keeps them unique
if (randomInt(10) == 0) {
if (randomInt(PERSONALITY_QUIRK_CHANCE) == 0) {
person.setPersonalityQuirk(generatePersonalityQuirk());
}

Expand Down Expand Up @@ -178,7 +181,7 @@ private static List<String> getTraitDescriptions(Person person) {
/**
* @return a random personality quirk for a person.
*/
private static PersonalityQuirk generatePersonalityQuirk() {
public static PersonalityQuirk generatePersonalityQuirk() {
Random random = new Random();
PersonalityQuirk[] values = PersonalityQuirk.values();

Expand Down