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 #5755: princess no drop bomb no boom boom #5758

Merged

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Jul 20, 2024

Fixes the recent development that Princess will no longer drop bombs (but will use air-launched missiles and rocket pods).

This was caused by two changes for 0.49.20, and was hidden by the fact that Princess couldn't use ammo weapons at all in 0.49.20. The root causes were:

  1. the rework of Mounted<*> types, and subsequent addition of extra checks for linked ammo, which left Princess unable to find ammo to fire from her "Bomb" weapons, and thus unable to plan to use bombs or estimate their impact.
  2. the addition of Enhanced Targeting / Called Shots in Princess.java, which only expects Entity-type targets and was throwing exceptions whenever a Hex or Building target was selected.

This fix returns the ability to use DiveBomb attacks, as well as adding the ability for Princess to estimate crit and kill chances for DiveBomb attacks.

This should also clear up the annoying

megamek.client.bot.princess.Princess.calculateFiringTurn(Princess.java:857) - class megamek.common.HexTarget cannot be cast to class megamek.common.Entity (megamek.common.HexTarget and megamek.common.Entity are in unnamed module of loader 'app')
java.lang.ClassCastException: class megamek.common.HexTarget cannot be cast to class megamek.common.Entity (megamek.common.HexTarget and megamek.common.Entity are in unnamed module of loader 'app')
	at megamek.client.bot.princess.Princess.calculateFiringTurn(Princess.java:720)
	at megamek.client.bot.BotClient.calculateMyTurnWorker(BotClient.java:529)
	at megamek.client.bot.BotClient.calculateMyTurn(BotClient.java:487)
	at megamek.client.bot.BotClient$CalculateBotTurn.run(BotClient.java:65)
	at java.base/java.lang.Thread.run(Thread.java:833)

error messages we've been seeing lately.

Testing:

  • Ran several missions with Princess-controlled bombers and confirmed bombs are working, both through inspection of the game board and via debugging.
  • Ran all three projects' unit tests.

Close #5755

Copy link

codecov bot commented Jul 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.08%. Comparing base (231defd) to head (6cffcc1).
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5758      +/-   ##
============================================
- Coverage     29.08%   29.08%   -0.01%     
- Complexity    13901    13902       +1     
============================================
  Files          2507     2507              
  Lines        266121   266139      +18     
  Branches      47582    47587       +5     
============================================
+ Hits          77404    77409       +5     
- Misses       184797   184808      +11     
- Partials       3920     3922       +2     

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

Copy link
Collaborator

@SuperStucco SuperStucco 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 here.

@HammerGS HammerGS merged commit bcd8888 into MegaMek:master Jul 20, 2024
5 checks passed
@HammerGS
Copy link
Member

Looks like it got merged before that was noticed

@HoneySkull
Copy link
Collaborator

It's fine, it won't effect the functionality, maybe a matter of style / readability only.

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-controlled Aerospace fighters cannot ground-attack or bomb when equipped with bombing ordnance.
4 participants