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

Fix 1552 rfe add ada air defense arrow iv munition #4762

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Sep 9, 2023

This PR adds two new features:

  1. EnumSet of Munitions (replaces int bit array); we can now add infinite new Munitions and let Java handle the math.
  2. Air-Defense Arrow IV missiles.

Also includes:

  • Princess will avoid using AIV artillery indirectly while ADA missiles are available and enemy aircraft are around.
  • Princess will preferentially select ADA missiles for Arrow IV AAA shots while available.
  • Princess will better estimate the utility of AA artillery shots and Flak shots (both to-hit and expected damage).
  • SerialKiller will now allow serializing EnumSets and Enums backed by Longs.
  • Land dead ASF/VTOL/WiGEs so that they no longer count as "airborne".

close #1552

In cases where Princess has ADA missiles and is fighting forces with
airborne units, prefer ADA over all else, including artillery attacks.

Updated estimation of damage and to-hit chances when using Flak or ADA
missiles.

Added some extra belt-and-suspenders checks to damage application, in
case ADA missiles get handled as Artillery (they should not, but still).

Updated some tests to be disabled under Java 17 or later, due to issues
with spying classes containing certain classes or list types.

Close MegaMek#1152
megamek/src/megamek/common/Compute.java Fixed Show fixed Hide fixed
megamek/src/megamek/common/Compute.java Fixed Show fixed Hide fixed
@@ -4496,7 +4508,7 @@
*/
private static ToHitData compileTerrainAndLosToHitMods(Game game, Entity ae, Targetable target, int ttype, int aElev, int tElev,
int targEl, int distance, LosEffects los, ToHitData toHit, ToHitData losMods, int toSubtract, int eistatus,
WeaponType wtype, Mounted weapon, int weaponId, AmmoType atype, long munition, boolean isAttackerInfantry,
WeaponType wtype, Mounted weapon, int weaponId, AmmoType atype, EnumSet<AmmoType.Munitions> munition, boolean isAttackerInfantry,

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'munition' is never used.
@@ -3192,7 +3204,7 @@
* @param isINarcGuided flag that indicates whether the target is broadcasting an iNarc beacon
*/
private static ToHitData compileAmmoToHitMods(Game game, Entity ae, Targetable target, int ttype, ToHitData toHit,
WeaponType wtype, Mounted weapon, AmmoType atype, long munition, boolean bApollo, boolean bArtemisV,
WeaponType wtype, Mounted weapon, AmmoType atype, EnumSet<AmmoType.Munitions> munition, boolean bApollo, boolean bArtemisV,

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'wtype' is never used.
@@ -3192,7 +3204,7 @@
* @param isINarcGuided flag that indicates whether the target is broadcasting an iNarc beacon
*/
private static ToHitData compileAmmoToHitMods(Game game, Entity ae, Targetable target, int ttype, ToHitData toHit,
WeaponType wtype, Mounted weapon, AmmoType atype, long munition, boolean bApollo, boolean bArtemisV,
WeaponType wtype, Mounted weapon, AmmoType atype, EnumSet<AmmoType.Munitions> munition, boolean bApollo, boolean bArtemisV,

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'weapon' is never used.
@HammerGS
Copy link
Member

I'll test this later this week. Exciting to see.

@Saklad5
Copy link
Contributor

Saklad5 commented Sep 10, 2023

I'm very excited, both for ADAs specifically and the capacity for adding more munition types.

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.

Looks good. Needs a little cleanup and I've got a couple of minor suggestions.

Also, and this is a requirement, please check that MekHQ and MML at least compile with these changes.

megamek/src/megamek/common/Compute.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/Entity.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/actions/WeaponAttackAction.java Outdated Show resolved Hide resolved
@Sleet01
Copy link
Collaborator Author

Sleet01 commented Sep 12, 2023

Also, and this is a requirement, please check that MekHQ and MML at least compile with these changes.

Shit. I added a PR for MML's lone usage of Munitions but missed MekHQ's somehow. I'll put up a dependent PR.

Edit: PR for MekHQ fix is #4762

@Sleet01
Copy link
Collaborator Author

Sleet01 commented Sep 15, 2023

Not to rush anyone, but the dependent PR for MML already went in, so it's broken until this gets pulled.
Should I put up a PR to back the MML update out until this goes in?

@HammerGS
Copy link
Member

I think all the requested changes are done right?

@Sleet01
Copy link
Collaborator Author

Sleet01 commented Sep 15, 2023

I think all the requested changes are done right?

I think I got everything. I asked Nick to check it over one more time.

@NickAragua NickAragua merged commit 99ac2dd into MegaMek:master Sep 16, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: AD Arrow IV ammunition
4 participants