Skip to content

feat(adventure): Add deck import/export and inventory management#10813

Open
emirikol1 wants to merge 2 commits into
Card-Forge:masterfrom
emirikol1:feature/adventure-deck-import-export
Open

feat(adventure): Add deck import/export and inventory management#10813
emirikol1 wants to merge 2 commits into
Card-Forge:masterfrom
emirikol1:feature/adventure-deck-import-export

Conversation

@emirikol1
Copy link
Copy Markdown

Summary

Adds multi-format deck import (Arena, MTGO, native .dck), collection export in Arena format, mark-for-sale workflow, and a fix for Veil of Summer crashing the game.

Deck Import/Export (Adventure Mode)

Console Commands:

  • load deck <path> — Import deck, auto-give missing cards free
  • load deck buy <path> — Import deck, purchase missing cards with gold
  • check deck <path> — Report which cards are missing without importing
  • save deck <path> — Export selected deck as native .dck
  • export collection <path> — Export full collection in Arena format
  • mark sell <path> — Mark listed cards for auto-sell

UI (DeckSelectScene):

  • Import Deck button with 3-mode dialog (free give / buy / check-only)
  • Export Deck, Export Collection, Mark for Sale buttons

Technical Details:

  • Cross-platform file path handling (Unix/Mac/Windows) with ~ expansion
  • Uses existing DeckRecognizer for Arena/MTGO format parsing
  • Auto-finds first empty deck slot; expands slots if all full (up to 99)
  • Mark-for-sale respects cards in use by decks and already-marked cards

Bug Fix: Veil of Summer crash

PlayerFactoryUtil.addStaticAbility() crashed with ArrayIndexOutOfBoundsException when processing Hexproof:Black (2-part format) because it expected a 3-part format. Fixed to use instanceof Hexproof pattern matching and access getValidType() directly, consistent with CardFactoryUtil's approach for card hexproof.

Files Changed

  • forge-gui-mobile/.../util/CardUtil.java — Import/export engine
  • forge-gui-mobile/.../player/AdventurePlayer.java — Slot management helpers
  • forge-gui-mobile/.../stage/ConsoleCommandInterpreter.java — 6 new commands
  • forge-gui-mobile/.../scene/DeckSelectScene.java — 4 new UI buttons
  • forge-game/.../player/PlayerFactoryUtil.java — Hexproof keyword fix

Test Plan

  • Export a deck, re-import in Arena format — cards match
  • Import with missing cards in GIVE mode — cards added to collection
  • Import with all slots full — new slot created automatically
  • Mark for sale respects deck usage limits
  • Cross-platform paths (forward slash, backslash, tilde)
  • Veil of Summer resolves without crash (Hexproof:Black and Hexproof:Blue)
  • Build compiles cleanly on current master (rebased May 30 2026)

Made with Cursor

kinke and others added 2 commits May 30, 2026 20:24
…dventure mode

Adds multi-format deck import (Arena, MTGO, native .dck), collection export
in Arena format, and a mark-for-sale workflow. Available via both console
commands and new UI buttons in the deck selection screen.

Console commands:
- load deck <path>       Import deck, auto-give missing cards
- load deck buy <path>   Import deck, purchase missing cards with gold
- check deck <path>      Report which cards are missing
- save deck <path>       Export selected deck as .dck
- export collection <path>  Export full collection in Arena format
- mark sell <path>       Mark listed cards for auto-sell

UI (DeckSelectScene):
- Import Deck button with 3-mode dialog (free/buy/check-only)
- Export Deck, Export Collection, Mark for Sale buttons

Cross-platform file path handling (Unix/Mac/Windows) with ~ expansion.

Co-authored-by: Cursor <cursoragent@cursor.com>
…raw string parsing

PlayerFactoryUtil.addStaticAbility() crashed with ArrayIndexOutOfBoundsException
when processing "Hexproof:Black" (2-part format) because it expected a 3-part
"Hexproof:<validSource>:<description>" format.

Now uses instanceof Hexproof pattern matching to access getValidType() and
getTitle() directly, consistent with CardFactoryUtil's approach for card hexproof.

Fixes crash when Veil of Summer resolves giving player hexproof from black/blue.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tool4ever tool4ever mentioned this pull request May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants