-
Notifications
You must be signed in to change notification settings - Fork 177
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
Implemented Random Mercenary Company Name Generator #4640
Implemented Random Mercenary Company Name Generator #4640
Conversation
Introduced new enumeration classes for Mercenary company name generation, including `MiddleWordMercenary`, `EndWordCorporate`, and `EndWordMercenary`. Implemented functionality to randomly select names from these enums and added corresponding resource bundles for text values.
Implemented a button in the Campaign Options Pane to generate random company names using the BackgroundsController. The button updates the company name field with a newly generated name, enhancing usability for end-users.
Updated the panInfo's border title to reflect the current campaign's name if the border is an instance of TitledBorder. This enhances the GUI by dynamically displaying the relevant campaign name, improving user experience.
Introduced support for definite articles in random mercenary company names. Updated BackgroundsController to use resources for definite articles and consolidated string construction for name generation.
Enhanced the GUI with a new panel for generating and assigning random mercenary company names. Updated relevant methods and properties to support this functionality.
Added a variety of humorous names to the RandomMercenaryCompanyNameGenerator.properties file. This enhances the variety and entertainment value when generating random mercenary company names.
Added a try-catch block to handle NullPointerException, allowing the method to be tested without needing to mock RandomCallsignGenerator. Returning an empty string if an exception occurs ensures stability during tests.
Introduced the enemyName field to AtBContract to track enemy names. Updated XML read/write methods to include enemyName. Enhanced getEnemyName to ensure enemyName is set and provided a marshallEnemyName method for direct retrieval.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4640 +/- ##
============================================
+ Coverage 9.89% 10.65% +0.76%
- Complexity 5678 5702 +24
============================================
Files 945 950 +5
Lines 129805 131271 +1466
Branches 19119 19134 +15
============================================
+ Hits 12845 13988 +1143
- Misses 115745 116059 +314
- Partials 1215 1224 +9 ☔ View full report in Codecov by Sentry. |
Removed the unnecessary parameter from the createGenerateNameButton method. This simplifies the method signature and aligns its usage with other similar button creation methods in the code.
Added code to clear the old enemy name before updating it with the current year's enemy faction name in AtBContract. This ensures that the enemy name is always refreshed correctly during each contract update.
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and seems to work. Added some of the missing names we see for merc units.
Also can this generated a numbered unit, i.e 21st Stormbringer Legion
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
MekHQ/resources/mekhq/resources/RandomMercenaryCompanyNameGenerator.properties
Show resolved
Hide resolved
Expanded the Mercenary Company Name Generator with additional end words. This enhancement provides more variety and flavor for generated mercenary company names.
Integrated numerical name generation with appropriate suffixes for mercenary company names. Refactored the naming logic to include different prefixes and updated the resource bundle with new suffix entries.
It does now! :D |
Added numerical name prefixes, allowing us to generate names like "The 22nd Beef Brigade" |
Replaced `marshallEnemyName` with a more robust `generateEnemyName` method to ensure the enemy name is set properly. Added proper handling for missing data and fallback mechanisms to avoid null values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and seems to work
This PR does a couple of things: predominately it implements a random name generator to generate a mercenary company name.
When a player starts a new campaign a random name will be generated in place of the previous 'My Campaign'. Additional company names can be generated via button in Campaign Options. New company names can be generated in active campaigns via the GM Tools dialog. This tech was needed for the upcoming Random Backgrounds Module, as we need to known the origin company name for characters with the 'Mercenary' origin.
Finally, whenever players have a contract against the Mercenary faction mhq will generate a random name for that enemy, instead of using faction name. This tech was needed for a future project currently in pre-development.
There are 6 types of random name: Corporate, Mercenary (Vanity type 1 and 2), Mercenary (Generic), and Pre-Fab (type 1 and 2). If a vanity name is generated mhq will use the name of the current campaign commander, if set, otherwise a random Callsign will be generated.
Examples of the kinds of names generated follows: