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

Fixed Value Display in Resupplies #5644

Merged
merged 1 commit into from
Jan 5, 2025

Conversation

IllianiCBT
Copy link
Collaborator

Resupplies were incorrectly using sell value for both resupply cost and resupply evaluation. This made it seem like resupplies were a much worse value proposition than they actually are.

Separated buy and sell value calculations for convoy contents to improve clarity and consistency. Updated logic to use appropriate values based on resupply type for better accuracy in determining convoy worth.
@IllianiCBT IllianiCBT added the Bug label Jan 4, 2025
@IllianiCBT IllianiCBT self-assigned this Jan 4, 2025
@@ -222,7 +224,7 @@ private static void calculateConvoyWorth(Resupply resupply) {

// Smugglers always double the cost of the supplies they're offering
if (resupplyType.equals(ResupplyType.RESUPPLY_SMUGGLER)) {
resupply.setConvoyContentsValueCalculated(value.multipliedBy(2));
resupply.setConvoyContentsValueCalculated(sellValue.multipliedBy(2));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We use 'sell value' as that is the lower of the two valuations. We use this to ensure the user will always get a deal from employer resupplies, while (at most) getting buy value from smugglers.

We use buy value for smugglers due to the risk of being scammed. This ensures that in the event the user is scammed they're not also paying out the nose for the privilege.

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.03%. Comparing base (eb3a892) to head (a6cf090).
Report is 67 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5644      +/-   ##
============================================
- Coverage     10.04%   10.03%   -0.01%     
+ Complexity     6079     6073       -6     
============================================
  Files          1074     1074              
  Lines        141598   141600       +2     
  Branches      20645    20645              
============================================
- Hits          14221    14210      -11     
- Misses       126010   126021      +11     
- Partials       1367     1369       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HammerGS HammerGS merged commit fa90f1d into MegaMek:master Jan 5, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants