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

Facility implementation #2788

Merged
merged 12 commits into from
Aug 15, 2021
Merged

Conversation

NickAragua
Copy link
Member

This implements supply depots, data centers and early warning systems for StratCon.

Supply depot - allied: +1 support point/week
Supply depot - hostile: +5% to opfor BV budget
Data Center - allied: reveals entire track
Data Center - hostile: increases chances of scenario to spawn by 5% on either the "once a week" roll or the "when you deploy your lance" roll
Early Warning System - reduces arrival delay for reinforcements by 1 turn

I started work on the "Orbital Defense" facility, but I think I have a much cooler idea for it than what I was originally thinking of (think "facility in orbit" rather than "ground based guns"), but that's for a different pull request.

@codecov
Copy link

codecov bot commented Aug 4, 2021

Codecov Report

Merging #2788 (a4e9daf) into master (3b202c4) will increase coverage by 0.02%.
The diff coverage is 2.85%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2788      +/-   ##
============================================
+ Coverage     10.62%   10.64%   +0.02%     
- Complexity     3869     3890      +21     
============================================
  Files           717      717              
  Lines        100134   100246     +112     
  Branches      16409    16417       +8     
============================================
+ Hits          10635    10668      +33     
- Misses        88111    88207      +96     
+ Partials       1388     1371      -17     
Impacted Files Coverage Δ
...src/mekhq/campaign/mission/AtBDynamicScenario.java 0.00% <0.00%> (ø)
...hq/campaign/mission/AtBDynamicScenarioFactory.java 1.59% <0.00%> (-0.01%) ⬇️
...ign/mission/atb/AtBScenarioModifierApplicator.java 0.00% <0.00%> (ø)
.../src/mekhq/campaign/stratcon/StratconFacility.java 0.00% <0.00%> (ø)
...khq/campaign/stratcon/StratconFacilityFactory.java 0.00% <0.00%> (ø)
.../mekhq/campaign/stratcon/StratconRulesManager.java 0.00% <0.00%> (ø)
...rc/mekhq/campaign/stratcon/StratconTrackState.java 0.00% <0.00%> (ø)
MekHQ/src/mekhq/gui/StratconPanel.java 0.00% <0.00%> (ø)
...c/mekhq/gui/stratcon/CampaignManagementDialog.java 0.00% <0.00%> (ø)
...ekhq/campaign/mission/atb/AtBScenarioModifier.java 51.11% <25.00%> (-1.45%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb33d90...a4e9daf. Read the comment docs.

@lgtm-com
Copy link

lgtm-com bot commented Aug 4, 2021

This pull request introduces 2 alerts when merging fcfdca1 into df5e785 - view on LGTM.com

new alerts:

  • 1 for Spurious Javadoc @param tags
  • 1 for Implicit narrowing conversion in compound assignment

Copy link
Contributor

@Windchild292 Windchild292 left a comment

Choose a reason for hiding this comment

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

Looks good in general, just a few code improvement ideas

MekHQ/data/scenariomodifiers/HostileBVBudgetIncrease.xml Outdated Show resolved Hide resolved
@@ -1604,6 +1604,9 @@ public static int calculateEffectiveBV(AtBDynamicScenario scenario, Campaign cam
bvBudget += forceBVBudget;
}
}

bvBudget += bvBudget * scenario.getEffectivePlayerBVMultiplier();
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs a Math.round, Math.floor, or Math.ceil

Copy link
Member Author

Choose a reason for hiding this comment

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

Why? It always produces a whole number.

Copy link
Contributor

@Windchild292 Windchild292 Aug 11, 2021

Choose a reason for hiding this comment

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

It is also an unrounded double to integer cast, and thus may not in future... and causes another CI issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really sure why we care if the bv budget drifts one way or the other by 1 point - we're usually talking thousands or tens of thousands of point.

Copy link
Member Author

Choose a reason for hiding this comment

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

And honestly, how often does java change the behavior of their "double to integer" cast? It's not like we're directly executing CPU instructions here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Rarely, and I know it is minor... but it's still a code scanning alert both in LGTM and in GitHub Actions, and I'm trying to keep the first low while reducing the latter.

MekHQ/src/mekhq/campaign/stratcon/StratconTrackState.java Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Aug 13, 2021

This pull request introduces 1 alert when merging a4e9daf into eb33d90 - view on LGTM.com

new alerts:

  • 1 for Implicit narrowing conversion in compound assignment

Copy link
Contributor

@Windchild292 Windchild292 left a comment

Choose a reason for hiding this comment

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

For merging into 0.49.3. Will open a PR with suggest code improvements shortly.

@Windchild292 Windchild292 merged commit 715d834 into MegaMek:master Aug 15, 2021
@NickAragua NickAragua deleted the facility_implementation branch August 15, 2021 03:22
@HammerGS HammerGS added the StratCon Bugs relating strictly to StratCon label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
StratCon Bugs relating strictly to StratCon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants