8000 Fix: Fixed Default Attribute Scores; Fixed Attribute Score Randomness; Reworked Attribute Score Randomness Option; Added Starting Attribute Score Documentation by IllianiBird · Pull Request #6843 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: Fixed Default Attribute Scores; Fixed Attribute Score Randomness; Reworked Attribute Score Randomness Option; Added Starting Attribute Score Documentation #6843

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

Merged
merged 3 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1825,14 +1825,11 @@ lblUseAttributes.tooltip=If checked, characters will be generated with <i>A Time
<br>\
<br><b>Warning:</b> If enabled (or disabled) mid-campaign, you need to navigate to the personnel tab, and (while in\
\ GM Mode) you should use the right-click menu to reset attribute scores for all personnel.
lblRandomizeAttributes.text=Extra Random Attributes \u2728
lblRandomizeAttributes.tooltip=If checked, an extra d6 is rolled for each of the character's ATOW Attributes.\
lblRandomizeAttributes.text=Random Attributes \uD83C\uDF1F
lblRandomizeAttributes.tooltip=If checked, a d6 is rolled for each of the character's ATOW Attributes.\
<br>\
<br>On a roll of a 6 the Attribute is increased by 1, and a second d6 is rolled. If that is also a 6, the Attribute is\
\ increased by 1 again; and so on, until 6s stop being rolled.\
<br>\
<br>On a roll of a 6 the Attribute is decreased by 1, and a second d6 is rolled. If that is also a 1, the Attribute is\
\ decreased by 1 again; and so on, until 1s stop being rolled.
<br>On a roll of a 6 the Attribute is increased by 1. On a roll of a 6 the Attribute is decreased\
\ by 1.
lblRandomizeTraits.text=Randomize Traits \u2728
lblRandomizeTraits.tooltip=If checked, a newly created character's Connections, Wealth, Reputation, and Unlucky scores\
\ are randomized.\
Expand Down
14 changes: 7 additions & 7 deletions MekHQ/src/mekhq/campaign/personnel/enums/PersonnelRole.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum PersonnelRole {
MEKWARRIOR(true, KeyEvent.VK_M, 4, 5, 6, 6, 4, 4, 4),

// I used an average of the modifiers from the MekWarrior, and Aerospace Pilot ATOW Archetypes
LAM_PILOT(true, KeyEvent.VK_UNDEFINED, 4, 4, 6, 6, 4, 4, 41),
LAM_PILOT(true, KeyEvent.VK_UNDEFINED, 3, 4, 6, 6, 4, 4, 5),

// ATOW: Tanker Archetype
GROUND_VEHICLE_DRIVER(true, KeyEvent.VK_V, 4, 5, 5, 6, 4, 4, 4),
Expand All @@ -76,16 +76,16 @@ public enum PersonnelRole {
VEHICLE_CREW(true, KeyEvent.VK_UNDEFINED, 5, 4, 5, 3, 5, 4, 3),

// ATOW: Aerospace Pilot Archetype
AEROSPACE_PILOT(true, KeyEvent.VK_A, 2, 3, 5, 5, 4, 4, 0),
AEROSPACE_PILOT(true, KeyEvent.VK_A, 2, 3, 5, 5, 4, 4, 5),

// ATOW: Aerospace Pilot Archetype
CONVENTIONAL_AIRCRAFT_PILOT(true, KeyEvent.VK_C, 2, 3, 5, 5, 4, 4, 0),
CONVENTIONAL_AIRCRAFT_PILOT(true, KeyEvent.VK_C, 2, 3, 5, 5, 4, 4, 5),

// ATOW: Aerospace Pilot Archetype (most ProtoMek pilots are Aerospace Sibkbo washouts, so this made the most sense)
PROTOMEK_PILOT(true, KeyEvent.VK_P, 2, 3, 5, 5, 4, 4, 0),
PROTOMEK_PILOT(true, KeyEvent.VK_P, 2, 3, 5, 5, 4, 4, 5),

// ATOW: Elemental Archetype
BATTLE_ARMOUR(true, true, KeyEvent.VK_B, 7, 6, 4, 0, 3, 4, 3),
BATTLE_ARMOUR(true, true, KeyEvent.VK_B, 7, 6, 4, 5, 3, 4, 3),

// ATOW: Renegade Warrior Archetype
SOLDIER(true, KeyEvent.VK_S, 5, 5, 4, 5, 4, 6, 3),
Expand Down Expand Up @@ -124,8 +124,8 @@ public enum PersonnelRole {
ASTECH(false, KeyEvent.VK_UNDEFINED, 5, 4, 5, 3, 5, 4, 3),

// ATOW: Communications Specialist Archetype (this might seem like an odd choice, but the Attributes for this Archetype
// work really well for this profession
DOCTOR(false, KeyEvent.VK_D, 3, 4, 4, 5, 6, 4, 4),
// work really well for this profession). However, we have switched Dexterity and Reflexes.
DOCTOR(false, KeyEvent.VK_D, 3, 4, 5, 4, 6, 4, 4),

// ATOW: Communications Specialist Archetype (this might seem like an odd choice, but the Attributes for this Archetype
// work really well for this profession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@
*
* Catalyst Game Labs and the Catalyst Game Labs logo are trademarks of
* InMediaRes Productions, LLC.
*
* MechWarrior Copyright Microsoft Corporation. MekHQ was created under
* Microsoft's "Game Content Usage Rules"
* <https://www.xbox.com/en-US/developers/rules> and it is not endorsed by or
* affiliated with Microsoft.
*/
package mekhq.campaign.personnel.generator;

import static megamek.common.Compute.d6;
import static megamek.common.Compute.randomInt;
import static mekhq.campaign.personnel.skills.Attributes.DEFAULT_ATTRIBUTE_SCORE;
import static mekhq.campaign.personnel.skills.Attributes.MINIMUM_ATTRIBUTE_SCORE;
import static mekhq.campaign.personnel.skills.SkillDeprecationTool.DEPRECATED_SKILLS;
import static mekhq.campaign.personnel.skills.enums.SkillSubType.SUPPORT_COMMAND;

Expand Down Expand Up @@ -161,19 +165,21 @@ public void generateSkills(final Campaign campaign, final Person person, final i
public void generateAttributes(Person person) {
RandomSkillPreferences skillPreferences = getSkillPreferences();

if (!skillPreferences.isUseAttributes()) {
for (SkillAttribute attribute : SkillAttribute.values()) {
if (attribute.isNone()) {
continue;
}

person.setAttributeScore(attribute, DEFAULT_ATTRIBUTE_SCORE);
// Reset Attribute Scores to default
for (SkillAttribute attribute : SkillAttribute.values()) {
if (attribute.isNone()) {
continue;
}

person.setAttributeScore(attribute, DEFAULT_ATTRIBUTE_SCORE);
}

// If we're not using attributes, early exit
if (!skillPreferences.isUseAttributes()) {
return;
}

boolean extraRandomAttributes = skillPreferences.isRandomizeAttributes();
boolean randomizeAttributes = skillPreferences.isRandomizeAttributes();

PersonnelRole profession = person.getPrimaryRole();
Phenotype phenotype = person.getPhenotype();
Expand All @@ -189,23 +195,11 @@ public void generateAttributes(Person person) {

// Attribute randomization
int roll = d6();

if (roll == 1) {
person.changeAttributeScore(attribute, -1);

if (extraRandomAttributes) {
while ((d6() == 1) && (person.getAttributeScore(attribute) > MINIMUM_ATTRIBUTE_SCORE)) {
person.changeAttributeScore(attribute, -1);
}
}
} else if (roll == 6) {
person.changeAttributeScore(attribute, 1);

if (extraRandomAttributes) {
int attributeCap = person.getPhenotype().getAttributeCap(attribute);
while ((d6() == 6) && (person.getAttributeScore(attribute) < attributeCap)) {
person.changeAttributeScore(attribute, 1);
}
if (randomizeAttributes) {
if (roll == 1) {
person.changeAttributeScore(attribute, -1);
} else if (roll == 6) {
person.changeAttributeScore(attribute, 1);
}
}
}
Expand Down
Loading
0