-
Notifications
You must be signed in to change notification settings - Fork 178
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
Begin work on implementing CamOps Contract Market #4644
Begin work on implementing CamOps Contract Market #4644
Conversation
MekHQ/src/mekhq/campaign/market/contractMarket/AbstractContractMarket.java
Fixed
Show fixed
Hide fixed
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4644 +/- ##
============================================
+ Coverage 10.29% 10.45% +0.15%
- Complexity 5866 5978 +112
============================================
Files 945 953 +8
Lines 131468 132333 +865
Branches 19073 19206 +133
============================================
+ Hits 13533 13833 +300
- Misses 116618 117172 +554
- Partials 1317 1328 +11 ☔ View full report in Codecov by Sentry. |
MHQXMLUtility.writeSimpleXMLCloseTag(pw, --indent, "contractMarket"); | ||
} | ||
|
||
public static AbstractContractMarket generateInstanceFromXML(Node wn, Campaign c, Version version) { |
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.
There are a lot of single or two letter variable names in this method, I'm assuming it was taken from another part of the codebase and then modified to meet your needs, but it makes for really hard to read code. Especially when there are a lot of different variables to track.
c460368
to
1c5f446
Compare
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
20110db
to
1c03c7d
Compare
f22d754
to
f222e11
Compare
f222e11
to
0c7b255
Compare
@@ -2246,6 +2240,18 @@ public Person findBestInRole(PersonnelRole role, String skill) { | |||
return findBestInRole(role, skill, null); | |||
} | |||
|
|||
public @Nullable Person findBestAtSkill(String skill) { |
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.
Just a heads up, we're moving towards having everything JavaDoc'd, obviously not necessary while this is a WIP but something you'll likely need to address before it gets merged. We're aware the majority of our stuff isn't currently JavaDoc'd, so that's something we're trying to address. So if you create a new Class, Method, or edit an existing Class or Method please add JavaDoc's*
*This is going to be added to the automated tests at some point
MekHQ/src/mekhq/campaign/market/contractMarket/AbstractContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/AbstractContractMarket.java
Fixed
Show fixed
Hide fixed
cb38917
to
1d4f06f
Compare
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java
Fixed
Show fixed
Hide fixed
/** | ||
* @return a list of currently active contracts on the market | ||
*/ | ||
public List<Contract> getContracts() { |
Check notice
Code scanning / CodeQL
Exposing internal representation Note
after this call to getContracts
Ok, I'm marking this ready for review. There should be no changes in behavior for the existing AtBMonthly market type, but Camops is now selectable in the options and playable, although it still uses AtB for many of the systems until I can fully implement those. I've added a note to the Market Option dropdown and tooltip saying that the CamOps market is in development and users should not expect it to work properly yet. Future work will revolve around overriding AbstractContractMarket methods, which mostly follow the AtB system, to instead follow CamOps. I've set this up in a way where it should be able to be done piecemeal instead of all at once. |
return findMissionType(getReputationModifier(campaign), employer.isISMajorOrSuperPower()); | ||
} | ||
|
||
private void setContractClauses(AtBContract contract, Campaign campaign) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
return findMissionType(getReputationModifier(campaign), employer.isISMajorOrSuperPower()); | ||
} | ||
|
||
private void setContractClauses(AtBContract contract, Campaign campaign) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
If this is going to be a close implementation of CO contracts I would recommend some toggle options for fine tuning, mainly to avoid some edge cases:
Employer categories can cause issues in some eras, depending upon which nations exist. The combination of straight support and battle compensation in CO is a straight downgrade, rolling high can be a massive disadvantage with 'full fat' peacetime costs. |
@Gribbly1 those are great suggestions, thanks! Would you mind putting them in an RFE? We intend to add configuration options as much as possible but I think a lot of people don't have direct experience with CamOps RAW, so it's hard to guess where the rough edges are sometimes. |
771a422
to
3c15419
Compare
With the size of this PR I'm wanting to get it merged to avoid any major conflicts that might come up while I'm issue report busting. Is it in a stage where it's feature complete enough to be merged, even if feature incomplete, or does it still need time in the oven? |
It's ready to be merged--the player can use this contract market normally, even though the contract parameters won't be 100% correct yet. Nothing should have changed behavior-wise for the current AtB method but I would like to have feedback from the nightly testers to confirm that. Thanks! |
Cool, I'll get dinner out of the way and then do a review. Will get it merged ASAP. |
This has picked up conflicts |
# Conflicts: # MekHQ/src/mekhq/campaign/Campaign.java # MekHQ/src/mekhq/campaign/market/AtbMonthlyContractMarket.java
3c15419
to
dcf55ed
Compare
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.
I'm happy with everything here, but I do think we just need to get this merged so you're not having to deal with conflicts. My stuff is a lot easier to fix than yours, by merit of size.
I have some requests moving forward:
- The ability for 'Mercenary' to be the enemy faction
- Consideration for Kurita's 'Death to Mercenaries' edict, so mercenaries stop getting contracts from the Combine during that period.
You might have implemented some of this, but I didn't spot it while I was reviewing.
Those are good ideas. #4878 also started a list of features someone with a lot of CamOps experience suggested. I'm planning to keep track of those in a "meta" issue so we can tick them off as they're implemented. |
This starts work on refactoring the Contract Market system to support different rulesets such as CamOps. The code was extremely tightly coupled with the AtBContractMarket type and needed to be refactored to properly support other market types. I followed Windchild's suggestions throughout the codebase and extracted much of the logic into an
AbstractContractMarket
class whichAtBContractMarket
,CamOpsContractMarket
, andDisabledContractMarket
all inherit from.Additionally, several areas in
AtBContract
were tightly coupled withAtBContractMarket
, so I've extracted much of that logic into methods in the abstract market class. I think the code is much easier to read now and implementing a new market method later should be a lot easier, although there is still work to do.Any feedback is welcome while I work on this. Thanks!