fix: preserve batter at plate when half-inning ends on caught stealing #11

Merged
cal merged 1 commits from fix/cs-batter-skip-1.9.1 into main 2026-02-11 04:37:54 +00:00
Owner

Summary- When a half-inning ended on a Caught Stealing (or pickoff), the batter at the plate was incorrectly skipped in the next inning- The side-switch code in complete_play() unconditionally advanced the batting order by +1 without checking opponent_play.pa- Now checks whether the last play was a plate appearance before incrementing, matching the existing non-side-switch logic## Changes- command_logic/logic_gameplay.py:756 — check opponent_play.pa == 1 before advancing batting order on side-switch- tests/command_logic/test_logic_gameplay.py — new test_cs_end_of_inning_preserves_batter test simulating a full Top 1 → Bot 1 → Top 2 scenario- VERSION — bumped to 1.9.1## Testing- New test verified to FAIL without the fix (returns batter 5 instead of 4) and PASS with it- All 21 existing tests in test_logic_gameplay.py continue to pass

## Summary- When a half-inning ended on a Caught Stealing (or pickoff), the batter at the plate was incorrectly skipped in the next inning- The side-switch code in `complete_play()` unconditionally advanced the batting order by +1 without checking `opponent_play.pa`- Now checks whether the last play was a plate appearance before incrementing, matching the existing non-side-switch logic## Changes- `command_logic/logic_gameplay.py:756` — check `opponent_play.pa == 1` before advancing batting order on side-switch- `tests/command_logic/test_logic_gameplay.py` — new `test_cs_end_of_inning_preserves_batter` test simulating a full Top 1 → Bot 1 → Top 2 scenario- `VERSION` — bumped to 1.9.1## Testing- New test verified to FAIL without the fix (returns batter 5 instead of 4) and PASS with it- All 21 existing tests in test_logic_gameplay.py continue to pass
cal added 1 commit 2026-02-11 04:26:56 +00:00
fix: preserve batter at plate when half-inning ends on caught stealing
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m5s
046b35e5a5
When a half-inning ended with a CS (or pickoff), the batter who was at
the plate was incorrectly skipped in the next inning. The side-switch
code unconditionally advanced the batting order by 1 without checking
whether the last play was a plate appearance. Now checks opponent_play.pa
before incrementing, matching the existing non-side-switch logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cal force-pushed fix/cs-batter-skip-1.9.1 from 046b35e5a5 to 1eda66a06c 2026-02-11 04:37:49 +00:00 Compare
cal merged commit 128b669b85 into main 2026-02-11 04:37:54 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#11
No description provided.