Skip to content

Conversation

@HammerGS
Copy link
Member

@HammerGS HammerGS commented Dec 29, 2025

Summary

Implements Mek abandonment per TacOps: Advanced Rules p.165 and reorganizes ejection/crew game options under Advanced Rules for better discoverability.

Fixes #3716

What's New

Mek Abandonment (TacOps:AR p.165)

  • Meks that are prone AND shutdown can announce abandonment during Movement Phase
  • Crew exits during End Phase of the following turn (two-phase process)
  • Creates MekWarrior entity in same/adjacent hex
  • Mek remains intact on battlefield (unlike ejection which destroys cockpit)
  • Multi-crew Meks create separate MekWarrior for each crew member

Game Options Reorganization

All ejection/crew options moved to Advanced Rules section:

  • TacOps Vehicle Crews
  • Skin of the Teeth Ejection
  • Units Can Be Abandoned (+ note about vehicle requirement)
  • Ejected Crews Flee
  • Auto Eject on Destruction (renamed from "Auto Abandon Unit")
  • Conditional Ejection

Option Improvements

  • "Units Can Be Abandoned" description now notes vehicles require TacOps Vehicle Crews
  • Combined redundant "Ejected Crews Flee" and "Auto Eject on Destruction" via helper method
  • Backwards compatible (option keys unchanged, only display names updated)

Key Differences: Abandonment vs Ejection

Aspect Abandonment Ejection
Unit Status Remains INTACT Cockpit DESTROYED
Timing Two-phase (announce → execute next turn) Immediate
Piloting Roll Not required Required
Result Crewless salvage Destroyed unit

Test Plan

Unit Tests

  • 18 automated tests in AbandonmentTest.java
  • Covers canAbandon(), isAbandoned(), pending state management
  • All tests passing

Manual Testing Scenarios

  • Basic Mek abandonment flow (prone + shutdown → abandon → MekWarrior exits)
  • Abandonment cancellation when Mek stands up or restarts
  • Multi-crew Meks (Command Console creates 2 MekWarriors)
  • Tank abandonment requires both options enabled
  • Stacking limit handling (MekWarrior to adjacent hex)
  • No legal hex available (abandonment fails gracefully)
  • Abandoned Mek can be targeted and destroyed
  • Abandoned Mek not selectable for movement
  • Ejection vs abandonment comparison (cockpit intact vs destroyed)
  • Auto Eject options work identically (combined via helper)

Known Limitations

  • Princess AI: Does not use abandonment strategically

…n Options

  ---
  PR Body

  ## Summary

  Implements Mek abandonment per TacOps: Advanced Rules p.165 and reorganizes ejection/crew game options under Advanced Rules for better discoverability.

  ## What's New

  ### Mek Abandonment (TacOps:AR p.165)
  - Meks that are **prone AND shutdown** can announce abandonment during Movement Phase
  - Crew exits during End Phase of the **following turn** (two-phase process)
  - Creates MekWarrior entity in same/adjacent hex
  - **Mek remains intact** on battlefield (unlike ejection which destroys cockpit)
  - Multi-crew Meks create separate MekWarrior for each crew member

  ### Game Options Reorganization
  All ejection/crew options moved to Advanced Rules section:
  - TacOps Vehicle Crews
  - Skin of the Teeth Ejection
  - Units Can Be Abandoned (+ note about vehicle requirement)
  - Ejected Crews Flee
  - Auto Eject on Destruction (renamed from "Auto Abandon Unit")
  - Conditional Ejection

  ### Option Improvements
  - "Units Can Be Abandoned" description now notes vehicles require TacOps Vehicle Crews
  - Combined redundant "Ejected Crews Flee" and "Auto Eject on Destruction" via helper method
  - Backwards compatible (option keys unchanged, only display names updated)

  ## Key Differences: Abandonment vs Ejection

  | Aspect | Abandonment | Ejection |
  |--------|-------------|----------|
  | Unit Status | Remains INTACT | Cockpit DESTROYED |
  | Timing | Two-phase (announce → execute next turn) | Immediate |
  | Piloting Roll | Not required | Required |
  | Result | Crewless salvage | Destroyed unit |

  ## Test Plan

  ### Unit Tests
  - 18 automated tests in `AbandonmentTest.java`
  - Covers `canAbandon()`, `isAbandoned()`, pending state management
  - All tests passing

  ### Manual Testing Scenarios
  - [ ] Basic Mek abandonment flow (prone + shutdown → abandon → MekWarrior exits)
  - [ ] Abandonment cancellation when Mek stands up or restarts
  - [ ] Multi-crew Meks (Command Console creates 2 MekWarriors)
  - [ ] Tank abandonment requires both options enabled
  - [ ] Stacking limit handling (MekWarrior to adjacent hex)
  - [ ] No legal hex available (abandonment fails gracefully)
  - [ ] Abandoned Mek can be targeted and destroyed
  - [ ] Abandoned Mek not selectable for movement
  - [ ] Ejection vs abandonment comparison (cockpit intact vs destroyed)
  - [ ] Auto Eject options work identically (combined via helper)
  - [ ] Backwards compatibility with saved games

  ## Known Limitations
  - Re-crewing abandoned Meks: Not implemented (future feature)
  - Boarding actions: Cannot board to take control (future feature)
  - Princess AI: Does not use abandonment strategically
Copilot AI review requested due to automatic review settings December 29, 2025 04:56
@HammerGS HammerGS requested a review from a team as a code owner December 29, 2025 04:56
@HammerGS HammerGS added For New Dev Cycle This PR should be merged at the beginning of a dev cycle In Development (Draft) An additional way to mark something as a draft. Make it stand out more. Draft Work in Progress AI Generated Fix AI-generated fix. Requires human testing and review before merging. Needs Player Testing PR lacks actual play testing. labels Dec 29, 2025
Copy link
Contributor

Copilot AI left a 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 Mek abandonment per TacOps: Advanced Rules p.165, introducing a two-phase abandonment process where crews can exit prone and shutdown Meks without destroying the unit. It also reorganizes ejection/crew game options under Advanced Rules for better discoverability.

Key Changes:

  • Implements two-phase Mek abandonment (announce during Movement/End Phase → execute next End Phase)
  • Adds abandonment support for vehicles (requires TacOps Vehicle Crews option)
  • Reorganizes all ejection/crew options from various sections into Advanced Rules
  • Refactors auto-eject logic using helper method shouldAutoEjectOnDestruction()

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
AbandonmentTest.java Comprehensive unit tests for Mek/Tank abandonment state management and eligibility checks
TWPhasePreparationManager.java Adds processUnitAbandonments() call to End Phase processing
TWGameManager.java Core abandonment logic including announce/execute flow, multi-crew reporting, and auto-eject refactoring
TWDamageManagerModular.java Updates auto-eject calls to use new shouldAutoEjectOnDestruction() helper
TWDamageManager.java Updates auto-eject calls to use new shouldAutoEjectOnDestruction() helper
MovePathHandler.java Minor formatting change (blank line removal)
Tank.java Implements canAbandon() and isAbandoned() for vehicle abandonment
Mek.java Implements canAbandon() (prone+shutdown requirement) and isAbandoned() for Meks
Entity.java Adds pending abandonment state fields and prevents actions when abandonment is pending
GameOptions.java Reorganizes ejection/crew options from multiple sections into Advanced Rules
PacketCommand.java Adds ENTITY_ABANDON_ANNOUNCE packet command
MoveStepType.java Adds ABANDON move step type
MoveCommand.java Adds MOVE_ABANDON command for Movement Phase UI
ReportDisplay.java Adds Abandon button and dialog trigger for End Phase
MovementDisplay.java Adds Abandon button handler for Movement Phase Mek abandonment
AbandonUnitDialog.java New dialog for selecting units to abandon during End Phase
Client.java Adds sendUnitAbandonmentAnnouncement() method
report-messages.properties Updates report 2027 and adds new abandonment reports (5325-5330)
options/messages.properties Updates option descriptions for reorganized ejection/crew options
client/messages.properties Adds UI strings for abandonment dialogs and buttons

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gsparks3
Copy link
Collaborator

gsparks3 commented Dec 29, 2025

I'm pretty sure that the TO Vehicle Crews option should not be required here for anything vehicle-abandonment-related. That optional rule generates certain effects in gameplay based on the size of the vehicle crew, but the actual crew size is tracked for abandonment purposes regardless of whether it is active or not. The only relevant portion - that vehicle crews have one member per 15 tons, round up - is also present in TechManual page 103, specifically for combat vehicles (support vehicles have different crew requirements, detailed in TM page 131).

@HammerGS HammerGS marked this pull request as draft December 29, 2025 19:12
@HammerGS HammerGS removed the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Jan 2, 2026
@HammerGS
Copy link
Member Author

HammerGS commented Jan 2, 2026

I'm pretty sure that the TO Vehicle Crews option should not be required here for anything vehicle-abandonment-related. That optional rule generates certain effects in gameplay based on the size of the vehicle crew, but the actual crew size is tracked for abandonment purposes regardless of whether it is active or not. The only relevant portion - that vehicle crews have one member per 15 tons, round up - is also present in TechManual page 103, specifically for combat vehicles (support vehicles have different crew requirements, detailed in TM page 131).

Yeah, I misread the rules on this, will fix.

HammerGS and others added 7 commits January 2, 2026 16:54
…ment()

     - Mek abandonment during Movement Phase now properly calls
       announceUnitAbandonment() and generates game reports
     - Previously the ABANDON step was added but never processed

  2. Removed ADVANCED_TAC_OPS_TANK_CREWS requirement from Tank.canAbandon()
     - Vehicle crew size (1 per 15 tons) is defined in TM p.103 as a base rule
     - TacOps Vehicle Crews option adds crew specialization mechanics,
       not crew size itself
     - Vehicle abandonment now only requires the eject/abandon option
  Fixes #7842

  1. Added missing ABANDON step handler in MovePathHandler.processMovement()
     - Mek abandonment during Movement Phase now properly calls
       announceUnitAbandonment() and generates game reports
     - Previously the ABANDON step was added but never processed

  2. Removed ADVANCED_TAC_OPS_TANK_CREWS requirement from Tank.canAbandon()
     - Vehicle crew size (1 per 15 tons) is defined in TM p.103 as a base rule
     - TacOps Vehicle Crews option adds crew specialization mechanics,
       not crew size itself
     - Vehicle abandonment now only requires the eject/abandon option

  3. Updated AbandonmentTest to match corrected behavior
     - Removed obsolete test for TacOps option requirement
     - Updated test names and removed unnecessary mock setups
…ment()

     - Mek abandonment during Movement Phase now properly calls
       announceUnitAbandonment() and generates game reports

  2. Removed ADVANCED_TAC_OPS_TANK_CREWS requirement from Tank.canAbandon()
     - Vehicle crew size (1 per 15 tons) is defined in TM p.103 as a base rule
     - Vehicle abandonment now only requires the eject/abandon option

  3. Updated AbandonmentTest to match corrected behavior

  4. Added warning dialog when starting up a Mek with pending abandonment
     - User is now warned that startup will cancel the pending abandonment

  5. Fixed units with pending abandonment being skipped in Movement Phase
     - Units now get their turn so they can startup (cancel abandonment)
       or skip their turn
@HammerGS HammerGS requested a review from Copilot January 3, 2026 00:59
@HammerGS HammerGS marked this pull request as ready for review January 3, 2026 00:59
@HammerGS HammerGS removed In Development (Draft) An additional way to mark something as a draft. Make it stand out more. Draft Work in Progress Needs Player Testing PR lacks actual play testing. labels Jan 3, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HammerGS
Copy link
Member Author

HammerGS commented Jan 3, 2026

Tested and i can't find anything not working.

@HammerGS HammerGS added the AI ready for Review Indicates that is has been in game tested and is ready for review as it can be label Jan 3, 2026
Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HammerGS HammerGS merged commit b14e466 into main Jan 6, 2026
6 checks passed
@HammerGS HammerGS deleted the Implement-Abandonment branch January 6, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Fix AI-generated fix. Requires human testing and review before merging. AI ready for Review Indicates that is has been in game tested and is ready for review as it can be

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFE: Implement official mech abandonment rules

4 participants