-
Notifications
You must be signed in to change notification settings - Fork 340
DRAFT PR: Breaching! Infantry vs Infantry Combat Inside TO:AR Buildings #7847
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
base: main
Are you sure you want to change the base?
DRAFT PR: Breaching! Infantry vs Infantry Combat Inside TO:AR Buildings #7847
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7847 +/- ##
============================================
+ Coverage 29.56% 29.61% +0.05%
- Complexity 16275 16597 +322
============================================
Files 3132 3145 +13
Lines 301264 303337 +2073
Branches 52822 53267 +445
============================================
+ Hits 89080 89846 +766
- Misses 202911 204078 +1167
- Partials 9273 9413 +140 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
megamek/unittests/megamek/client/ui/panels/phaseDisplay/DeploymentDisplayTest.java
Fixed
Show fixed
Hide fixed
| } | ||
|
|
||
| List<Integer> entityIds = isAttacker ? combat.attackerIds : combat.defenderIds; | ||
| String sideName = isAttacker ? "Attackers" : "Defenders"; |
Check notice
Code scanning / CodeQL
Unread local variable Note
| /** | ||
| * Report combat ratio. | ||
| */ | ||
| private void reportCombatRatio(megamek.common.units.AbstractBuildingEntity building, |
Check notice
Code scanning / CodeQL
Useless parameter Note
| /** | ||
| * Report combat roll and result. | ||
| */ | ||
| private void reportCombatRoll(megamek.common.units.AbstractBuildingEntity building, |
Check notice
Code scanning / CodeQL
Useless parameter Note
| */ | ||
| private void reportSideEliminated(InfantryBuildingCombatTracker.BuildingCombat combat, | ||
| InfantryBuildingCombatTracker tracker, | ||
| megamek.common.units.AbstractBuildingEntity building, |
Check notice
Code scanning / CodeQL
Useless parameter Note
| */ | ||
| private void reportSideRepulsed(InfantryBuildingCombatTracker.BuildingCombat combat, | ||
| InfantryBuildingCombatTracker tracker, | ||
| megamek.common.units.AbstractBuildingEntity building) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
… pr/buildings/building-entity-test-3-marines
…t just for buildings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements TO:AR page 169 infantry vs. infantry combat inside TO:AR Advanced Buildings, commonly known as "breaching" mechanics. The implementation allows conventional infantry and battle armor to engage in building-to-building combat during the Physical phase.
Key Changes:
- New infantry combat action system with Marine Points Score (MPS) calculation and combat resolution tables
- Building crew participation in defense with crew casualties tracking
- Collateral damage system affecting building structure during combat
- Integration with existing building collapse mechanics
Reviewed changes
Copilot reviewed 81 out of 81 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| InfantryActionTracker.java | New tracker class managing active infantry combat instances with attacker/defender lists |
| TWGameManager.java | Core combat resolution logic including MPS calculation, casualty application, and combat outcome handling |
| MarinePointsScoreCalculator.java | Implements TO:AR Marine Points Score tables for unit strength calculation |
| InfantryCombatTables.java | Combat resolution tables and ratio calculations |
| Entity.java | Added infantry combat state tracking fields and methods |
| BuildingEntity.java | Enhanced building entity with weapon arc support and crew type |
| BuildingCollapseHandler.java | Updated to handle building hex collapse during infantry combat |
| Multiple test files | Comprehensive test coverage for all new systems |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * | ||
| * @return LOS effects between the given positions | ||
| */ | ||
| public static LosEffects calculateLOS(final Game game, final @Nullable Entity attacker, |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method 'calculateLOS' may be confused with calculateLos.
| void beforeEach() { | ||
| coords = new Coords(1, 1); | ||
| entity = new BipedMek(); | ||
| getGame().addEntity(entity); |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A method declared in a superclass is called instead of a method with the same signature in an enclosing class.
| setBoard("BOARD"); | ||
|
|
||
| mockEvent = mock(BoardViewEvent.class); | ||
| when(mockEvent.getBoardId()).thenReturn(getGame().getBoard().getBoardId()); |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A method declared in a superclass is called instead of a method with the same signature in an enclosing class.
| when(mockEvent.getButton()).thenReturn(MouseEvent.BUTTON1); | ||
| when(mockEvent.getModifiers()).thenReturn(0); | ||
| when(mockClient.isMyTurn()).thenReturn(true); | ||
| when(mockClient.getGame()).thenReturn(getGame()); |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A method declared in a superclass is called instead of a method with the same signature in an enclosing class.
| @BeforeEach | ||
| void setUpBoard() { | ||
| player = new Player(0, "Test Player"); | ||
| getGame().addPlayer(0, player); |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A method declared in a superclass is called instead of a method with the same signature in an enclosing class.
| groundEntity.setOwner(player); | ||
| groundBoard = getBoard("GROUND_BOARD"); | ||
| coords = new Coords(0, 0); | ||
| getGame().addEntity(groundEntity); |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A method declared in a superclass is called instead of a method with the same signature in an enclosing class.
| public int locations() { | ||
| if (getInternalBuilding() == null || getInternalBuilding().getCoordsList() == null) { | ||
| // Map can be null during construction | ||
| if (locationToRelativeCoordsMap == null || locationToRelativeCoordsMap.isEmpty()) { |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is useless. locationToRelativeCoordsMap cannot be null at this check, since new HashMap<Integer,CubeCoords>(...) always is non-null.
# Conflicts: # megamek/resources/megamek/common/messages.properties # megamek/src/megamek/common/units/Entity.java
…ry vs Infantry combat
TO:AR p. 169-174 infantry vs. infantry combat inside TO:AR Advanced Buildings.
I can't believe I got tricked into implementing boarding rules.
Breaching!
Future Enhancements
Todo