-
Couldn't load subscription status.
- Fork 198
Updates the dropship acquisition TNs in UnitOrder #7030
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
base: main
Are you sure you want to change the base?
Conversation
…resent the rules in CO 4th p17.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7030 +/- ##
=======================================
Coverage ? 12.03%
Complexity ? 6885
=======================================
Files ? 1102
Lines ? 142253
Branches ? 22002
=======================================
Hits ? 17117
Misses ? 123301
Partials ? 1835 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| //FIXME ? | ||
| /* In theory, these should be the base target numbers of these vehicles. The base TNs in the book are | ||
| * static and don't adjust for Admin skill or anything. This doesn't match our usage of skills such as | ||
| * Administration to find vehicles. Instead, we're going to just kind of assume they 'intended' | ||
| * a base TN of 7 and adjust for windage. | ||
| * | ||
| */ |
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 suggest this be discussed before implemented.
| // Since the actual rules are ambiguous, I'm using the tech level as a stand-in for 'uniqueness' | ||
| // 1 is 'common' and 5 is 'experimental' according to enums | ||
| // However, almost all Dropships are 'D' techlevel, so... a better solution could be found. | ||
|
|
||
| int techLevel = entity.getTechLevel(getCampaign().getGameYear()); | ||
| switch (techLevel) { | ||
| case 1: | ||
| target.addModifier(-1, "Common"); | ||
| break; | ||
| case 2: | ||
| target.addModifier(0, "Average"); | ||
| break; | ||
| case 3: | ||
| target.addModifier(3, "Rare"); | ||
| break; | ||
| case 4: | ||
| target.addModifier(6, "Very Rare"); | ||
| break; | ||
| case 5: | ||
| default: | ||
| target.addModifier(10, "Unique"); | ||
|
|
||
| } |
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.
Another one that needs discussion, coming up with a solution is fine, but any unnoficial value should really be at least talked about with other devs onto why you are thining of adding it this way, and sometimes also it is worth to bring up those as really valid questions on how to most closely to implement the rules as written on MekHQ, alot of contributors can give great advice and sometimes even have access to erratas on how things changed its workings since release/publication
| int year = getCampaign().getGameYear(); | ||
| if (year > 3084) { | ||
| target.addModifier(0, "Era"); | ||
| } else if (year > 3068) { | ||
| target.addModifier(-2, "Era"); | ||
| } else if (year > 3050) { | ||
| target.addModifier(-1, "Era"); | ||
| } else if (year > 2901) { | ||
| target.addModifier(+0, "Era"); | ||
| } else if (year > 2821) { | ||
| target.addModifier(-2, "Era"); | ||
| } else if (year > 2751) { | ||
| target.addModifier(-6, "Era"); | ||
| } else if (year > 2651) { | ||
| target.addModifier(-6, "Era"); | ||
| } else if (year > 2571) { | ||
| target.addModifier(-5, "Era"); | ||
| } else if (year > 2412) { | ||
| target.addModifier(-4, "Era"); | ||
| } else { | ||
| target.addModifier(-3, "Era"); | ||
| } |
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.
int year = getCampaign().getGameYear();
int eraModifier = getTargetModifierForEra(getCampaign().getGameYear());
target.addModifier(eraModifier, I18n.getText("unitOrder.eraModifier"));
return target;
}
private int getTargetModifierForEra(int year) {
if (year > 3084) {
modifier = 0;
} else if (year > 3068) {
modifier = -2;
} else if (year > 3050) {
modifier = -1;
} else if (year > 2901) {
modifier = +0;
} else if (year > 2821) {
modifier = -2;
} else if (year > 2751) {
modifier = -6;
} else if (year > 2651) {
modifier = -6;
} else if (year > 2571) {
modifier = -5;
} else if (year > 2412) {
modifier = -4;
} else {
modifier = -3;
}
return modifier;
}|
Too many decisions on how to implement book rules were made but the comments seen to imply that there were no discussion around the decisions that were taken |
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.
Pull Request Overview
This PR updates the dropship acquisition target numbers (TNs) in UnitOrder to more closely follow the rules in CO 4th p17. Key changes include reordering the XML import statements, reformatting the HTML string concatenations in the find and failToFind methods, and introducing a new block for calculating TN modifiers for Dropship and Jumpship entities.
| //FIXME ? | ||
| /* In theory, these should be the base target numbers of these vehicles. The base TNs in the book are | ||
| * static and don't adjust for Admin skill or anything. This doesn't match our usage of skills such as | ||
| * Administration to find vehicles. Instead, we're going to just kind of assume they 'intended' | ||
| * a base TN of 7 and adjust for windage. | ||
| * | ||
| */ | ||
| if (entity instanceof SpaceStation) { | ||
| target.addModifier((int) Math.ceil(entity.getCost(false) / 50000000) + 5 - 7, "Spacestation Base"); | ||
| } else if (entity instanceof Warship) { | ||
| double collars = ((Warship) entity).getDockingCollars().size(); | ||
| target.addModifier((int) (Math.ceil(Math.sqrt(entity.getWeight() / 5000)) + | ||
| Math.ceil(Math.sqrt(collars))) - 7, "Warship Base"); | ||
| } else if (entity instanceof Dropship) { | ||
| target.addModifier((int) Math.ceil(entity.getCost(false) / 50000000) + 5 - 7, "Dropship Base"); | ||
| } else { | ||
| int collars = ((Jumpship) entity).getDockingCollars().size(); | ||
| target.addModifier((int) Math.ceil(entity.getCost(false) / 100000000) + collars - 7, "Jumpship Base"); | ||
| } |
Copilot
AI
May 17, 2025
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.
[nitpick] Consider refactoring the lengthy acquisition modifiers computation block into helper methods to improve code readability and maintainability.
| //FIXME ? | |
| /* In theory, these should be the base target numbers of these vehicles. The base TNs in the book are | |
| * static and don't adjust for Admin skill or anything. This doesn't match our usage of skills such as | |
| * Administration to find vehicles. Instead, we're going to just kind of assume they 'intended' | |
| * a base TN of 7 and adjust for windage. | |
| * | |
| */ | |
| if (entity instanceof SpaceStation) { | |
| target.addModifier((int) Math.ceil(entity.getCost(false) / 50000000) + 5 - 7, "Spacestation Base"); | |
| } else if (entity instanceof Warship) { | |
| double collars = ((Warship) entity).getDockingCollars().size(); | |
| target.addModifier((int) (Math.ceil(Math.sqrt(entity.getWeight() / 5000)) + | |
| Math.ceil(Math.sqrt(collars))) - 7, "Warship Base"); | |
| } else if (entity instanceof Dropship) { | |
| target.addModifier((int) Math.ceil(entity.getCost(false) / 50000000) + 5 - 7, "Dropship Base"); | |
| } else { | |
| int collars = ((Jumpship) entity).getDockingCollars().size(); | |
| target.addModifier((int) Math.ceil(entity.getCost(false) / 100000000) + collars - 7, "Jumpship Base"); | |
| } | |
| handleAcquisitionModifiersForSpaceEntities(target); |
| // TODO: Fix weight classes | ||
| // TODO: aero large craft | ||
| if (entity instanceof Dropship || entity instanceof Jumpship) { | ||
| //FIXME ? |
Copilot
AI
May 17, 2025
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.
[nitpick] Clarify the 'FIXME' comment with specific details on what needs to be fixed or remove it if it is no longer applicable.
| return "<font color='" + | ||
| MekHQ.getMHQOptions().getFontColorPositiveHexColor() + | ||
| "'><b> unit found</b>.</font> It will be delivered in " + | ||
| transitDays + | ||
| " days."; | ||
| } else { | ||
| return "<font color='" + MekHQ.getMHQOptions().getFontColorNegativeHexColor() | ||
| + "'><b> You cannot afford this unit. Transaction cancelled</b>.</font>"; | ||
| return "<font color='" + | ||
| MekHQ.getMHQOptions().getFontColorNegativeHexColor() + | ||
| "'><b> You cannot afford this unit. Transaction cancelled</b>.</font>"; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String failToFind() { | ||
| return "<font color='" + MekHQ.getMHQOptions().getFontColorNegativeHexColor() | ||
| + "'><b> unit not found</b>.</font>"; | ||
| return "<font color='" + | ||
| MekHQ.getMHQOptions().getFontColorNegativeHexColor() + | ||
| "'><b> unit not found</b>.</font>"; |
Copilot
AI
May 17, 2025
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.
[nitpick] Consider using String.format to construct the HTML message strings instead of manual concatenation for better readability.
This should more closely represent the rules in CO 4th p17.