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

Added Variable Unit Quality to Unit Markets and Updated Unit Market Logic #4160

Merged
merged 23 commits into from
Jun 16, 2024

Conversation

IllianiCBT
Copy link
Collaborator

@IllianiCBT IllianiCBT commented Jun 6, 2024

Requires: #4150 and #4158

This PR enhances the functionality of the AtB Unit Market with the following objectives:

  1. Streamline the process for adding new units for sale. Upon reviewing the code, I noticed numerous dice rolls that lacked clarity regarding their comparison to other market types. I standardized these rolls, introducing human-readable rarity levels to provide maintainers with clear insights into the rarity of units within any given market.

  2. Introduce greater depth to the markets by considering campaign faction and contract state more effectively. Previously, many markets defaulted to the employer faction, potentially leading to difficulties for House Units in maintaining their faction's units between contracts, or problems when no employer is available.

  3. Associate unit quality with market type. While initially, I incorrectly believed this had always been the intent, it seemed too good an idea to abandon. This is applicable for campaigns with and without random unit quality enabled. In the event random unit quality is enabled, the market types will apply different modifiers to the quality roll. In the event this option is disabled, the unit quality will be fixed based on market type.

Additionally, I have provided comprehensive documentation for unit markets and renamed the 'AtB Stuff' folder to 'Against the Bot'. You can access the documentation here.

Update

This now includes a bug fix for the Unit Market that otherwise prevents Artillery from spawning in the unit market. This bug fix was merged into this PR to avoid conflicts.

Closes

Closes #2085

* Revised unit market offers based on market type, unit type, and rarity
* Added quality calculation for units based on the market type
* Included market type description in the GUI
- Adjusted values for market offers in unit market
- Added condition checks for campaign start in contract market
- Introduced modifier for mercenary faction in mercenary market
- Streamlined faction retrieval in PlanetarySystem
- Updated warning message in GUI properties
@IllianiCBT IllianiCBT self-assigned this Jun 6, 2024
@IllianiCBT IllianiCBT added the AtB label Jun 6, 2024
# Conflicts:
#	MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties
@IllianiCBT
Copy link
Collaborator Author

Conflicts resolved

# Conflicts:
#	MekHQ/src/mekhq/campaign/Campaign.java
# Conflicts:
#	MekHQ/src/mekhq/campaign/Quartermaster.java
#	MekHQ/src/mekhq/campaign/mission/AtBContract.java
#	MekHQ/src/mekhq/campaign/storyarc/storytrigger/AddUnitStoryTrigger.java
#	MekHQ/src/mekhq/campaign/universe/generators/companyGenerators/AbstractCompanyGenerator.java
#	MekHQ/src/mekhq/gui/CampaignGUI.java
#	MekHQ/src/mekhq/gui/adapter/ProcurementTableMouseAdapter.java
#	MekHQ/src/mekhq/gui/dialog/GMToolsDialog.java
#	MekHQ/src/mekhq/gui/dialog/MekHQUnitSelectorDialog.java
#	MekHQ/src/mekhq/gui/dialog/PersonnelMarketDialog.java
#	MekHQ/src/mekhq/gui/panes/UnitMarketPane.java
@IllianiCBT
Copy link
Collaborator Author

Resolved conflicts

Copy link
Member

@NickAragua NickAragua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions/maintainability requests.

MekHQ/src/mekhq/campaign/universe/PlanetarySystem.java Outdated Show resolved Hide resolved
* @param market the type of market
* @return the quality of the unit
*/
private int getQuality(UnitMarketType market) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to have this "business logic" code in this UI class, or maybe move it to the UnitMarketType class instead?

- Implemented special vehicle chance setting in market options
- Rolled back `getFactions` and `getFactionSet` methods in `PlanetarySystem.java`
- Adjusted special unit type selection in `AtBMonthlyUnitMarket.java`
- Made related changes in campaign options and campaign options pane files
- Updated CampaignOptions properties and GUI components accordingly
@IllianiCBT IllianiCBT requested a review from NickAragua June 13, 2024 00:01
- The getQuality method is now a static method in UnitMarketType
- These changes allow quality calculations to be done on the market type object instead of in the GUI
- Removed redundant quality calculation code in UnitMarketPane.java
@IllianiCBT
Copy link
Collaborator Author

Updated to include requested revisions.

I also moved the arbitrary 'special vehicle chance' value to campaign options. It's no less arbitrary, but this at least means the user can better adjust it to meet their needs.

Moving getQuality was handled in a second follow-up commit, as I forgot to include it in the initial revision. Apologies for the spam.

# Conflicts:
#	MekHQ/src/mekhq/campaign/market/unitMarket/AtBMonthlyUnitMarket.java
@IllianiCBT IllianiCBT merged commit d941f0a into MegaMek:master Jun 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFE: AtB: Vary unit quality in the Unit Market
2 participants