feat: Enhance draft system with 4-player 'pick 2' rules, minimum player count, and fix pack duplication by ensuring unique pack instances.
All checks were successful
Build and Deploy / build (push) Successful in 1m25s

This commit is contained in:
2025-12-16 18:41:43 +01:00
parent 58641b34a5
commit 6163869a17
6 changed files with 90 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
# 2025-12-16 - Draft Rules and Logic Implementation
## Draft Minimum Players
- Added backend check in `index.ts` to prevent drafting with fewer than 4 players.
- Emit `draft_error` to room if condition is not met.
- Added `draft_error` listener in `GameRoom.tsx` to notify users.
## 4-Player Draft Rules (Pick 2)
- Modified `DraftManager.ts`:
- Added `pickedInCurrentStep` to track picks within a single pack pass cycle.
- Implemented logic in `pickCard`:
- If 4 players: Require 2 picks before passing pack.
- Else: Require 1 pick.
- Logic handles pack exhaustion (if pack runs out before picks completed, it passes).
## Robustness
- Updated `rejoin_room` handler in `index.ts` to send the current `draft` state if the room is in `drafting` status. This allows users to refresh and stay in the draft flow (critical for multi-pick scenarios).