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 4520 princess only fires aero tag #5020

Merged
merged 10 commits into from
Jan 13, 2024

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Jan 7, 2024

This change updates a few things:

  1. don't allow Aerospace units to fire TAG if there's no utility in it.
  2. let Princess calculate incoming guided fire for the turn, and use this to calculate Aero TAG utility.
  3. move part of the "has usable weapons" check out into compute as a generic computeTotalDamage function, and include bombs in the computation.

Since the implementation of step 2 is pretty simplistic, that part can be excised for a later patch without affecting the fix to this issue.

In short, for each Aerospace with TAG that Princess controls, Princess will now calculate and cache a list of
A) all incoming guided artillery impacting this turn;
B) all Laser-Guided Bombs on other units on the board;
C) all Indirect Fire-capable weapons on all other (non-Aerospace) units on the board;

these lists will be used to compute the maximum possible damage deriving from using a given Aerospace unit's TAG rather than firing its weapons normally. The Aero unit will attempt to TAG if its expected damage is equal to or less than the potential damage from incoming guided munitions this turn. Otherwise, TAG will not be used.

NOTE: This calculation does not take into account the distance from a given TAG target to each incoming munition's target point (needed for precise assessment of e.g. Homing Arrow IV or Copperhead rounds). It also does not take into account whether prospective targets are even within firing range of Indirect-Fire-capable friendly ground units. However, adding these checks to computeGuidedWeapons would not cause much additional computation time overall because each list is calculated once and then cached for later re-use by the turn-planning code.

tl;dr: fix works, and Princess will be slightly smarter about using TAG.

Testing:

  • Tested with Princess-controlled Bomber ASFs mounting normal weapons, guided bomb munitions, and TAG (both as weapons and as "bomb" pods).
    -- Also included off-board Copperhead and Homing Arrow IV units.
  • Ran all MegaMek unit tests.

close #4520

@Sleet01
Copy link
Collaborator Author

Sleet01 commented Jan 7, 2024

I'll have another commit tomorrow with fixes for the above, and hopefully filtering out homing attacks by distance.

@Sleet01
Copy link
Collaborator Author

Sleet01 commented Jan 8, 2024

A fun turn testing with this code:

image
image

Teammate, a friendly Princess, detected two previously-fired Homing AIVs and a bunch of LG bombs nearby, so used the relatively poorly-armed Centurions to TAG for the Homing rounds and the Sabutai's dive bomb attack, as well spotting for indirect Thunderbolt fire (not shown).

@HammerGS
Copy link
Member

HammerGS commented Jan 8, 2024

Awesome to see.

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.

Some thoughts/feedback.

@SJuliez SJuliez merged commit cdf8a99 into MegaMek:master Jan 13, 2024
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.

Princess never uses other weapons if TAG pod is loaded or present on aircraft
6 participants