1.7 KiB
1.7 KiB
Basic Lands Handling
Requirements
- Upon draft room creation, basic lands from the selected sets must be cached and loaded.
- During deck building, players must have access to an infinite number of these basic lands matching the selected sets.
Implementation Details
Server-Side
- Pack Generation: Updated
/api/packs/generateto extract unique basic lands from the processed card pool and return them in the response:{ packs, basicLands }. - Room Management: Updated
RoomManagerandRoominterface to storebasicLandsarray. - Socket Events: Updated
create_roomevent handler to acceptbasicLandsand pass them to the room creation logic.
Client-Side
- State Management: Added
availableLandsstate toApp.tsxwith local storage persistence to persist lands between generation and lobby creation. - Cube Manager: Updated
handleGenerateto parse the new API response and update specific state. - Lobby Manager:
- Enhanced
handleCreateRoomto include basic lands in the server-side image caching request. - Updated
create_roomsocket emission to send the basic lands to the server.
- Enhanced
- Deck Builder:
- Added a "Land Station" UI component.
- If specific basic lands are available, it displays a horizontal scrollable gallery of the unique land arts.
- Clicking a land adds a unique copy (with a specific ID) to the deck, allowing for infinite copies.
- Preserved fallback to generic land counters if no specific lands are available.
Verification
- Verified flow from pack generation -> lobby -> room -> deck builder.
- Validated that lands are deduplicated by Scryfall ID to ensure unique arts are offered.