DRAFT PR: Breaching! Infantry vs Infantry Combat Inside TO:AR Buildings#7847
DRAFT PR: Breaching! Infantry vs Infantry Combat Inside TO:AR Buildings#7847psikomonkie wants to merge 14 commits intoMegaMek:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7847 +/- ##
===========================================
Coverage 29.66% 29.66%
- Complexity 16556 16705 +149
===========================================
Files 3136 3147 +11
Lines 302538 303993 +1455
Branches 53085 53367 +282
===========================================
+ Hits 89741 90193 +452
- Misses 203390 204355 +965
- Partials 9407 9445 +38 ☔ 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.
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, |
There was a problem hiding this comment.
The method 'calculateLOS' may be confused with calculateLos.
| void beforeEach() { | ||
| coords = new Coords(1, 1); | ||
| entity = new BipedMek(); | ||
| getGame().addEntity(entity); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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
Closes #3551
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