Skip to content

Fixed duplicates in commander generated decks#10000

Open
kojotak wants to merge 2 commits intoCard-Forge:masterfrom
kojotak:9985_toothy
Open

Fixed duplicates in commander generated decks#10000
kojotak wants to merge 2 commits intoCard-Forge:masterfrom
kojotak:9985_toothy

Conversation

@kojotak
Copy link
Copy Markdown
Contributor

@kojotak kojotak commented Mar 6, 2026

Possible fix for #9985

I don't know why, but Pir, Imaginative Rascal loaded from CardRelationMatrixGenerator.cardPools has collectorNumner N.A.. That is not the case if loading from StaticData.instance().getCommonCards() (this returns 11 and 1050). The N.A. collectorNumber results in equals method returning false in an attempt to remove this card from the deck, causing Pir, Imaginative Rascal beeing duplicated (in main deck and as a commander partner).

With this change, the card generated deck for Toothy, Imaginary Friend can be loaded:

image

@kojotak kojotak changed the title Add preSelectedCards from commonCards instead of CardRelationMatrixGenerator.cardPool Fixed duplicates in commander generated decks Mar 16, 2026
@Hanmac Hanmac requested review from Agetian and tehdiplomat March 16, 2026 12:12
@Hanmac Hanmac requested a review from tool4ever March 18, 2026 15:32
@Hanmac
Copy link
Copy Markdown
Contributor

Hanmac commented Mar 18, 2026

@Agetian might need to look into why it got the wrong CN?

@Agetian
Copy link
Copy Markdown
Contributor

Agetian commented Mar 20, 2026

Yeah, not sure why it doesn't return the proper CN :/ A deeper look into this might be needed but not sure who would be best suited for the job?

@kojotak
Copy link
Copy Markdown
Contributor Author

kojotak commented Mar 25, 2026

I went a little bit deeper. PaperCard without the CN is loaded from the deckgendecks/Commander.dat file, not from the res/editions/*.txt files. You can check that using breakpoint in CardThemedMatrixIO#loadMatrix inspecting the matrix hashMap. Don't know, yet, why the serialized card is without CN nor how to repair (rebuild) the dat file.

@Agetian
Copy link
Copy Markdown
Contributor

Agetian commented Mar 26, 2026

Oh, hmm, I'll see if I can find an opportunity to regenerate that LDA file , along with the two other ones that desperately need updating.

@kojotak
Copy link
Copy Markdown
Contributor Author

kojotak commented Mar 27, 2026

Shouldn't the Commander.dat file contain just card names? The problem will arise again when some card will have different name/edition/collector number/flags/foil/artIndex (according to equals method). The PaperCard instance (stored in CardRelationMateixGenerator.cardPools ) is used only for DeckFormat.isLegalCard() check, but this can be delayed after loading the whole card from StaticData . The generateRandomCommanderDeck() method would be a little bit slower in exchange for smaller memory footprint of cardPools (and dat files).

@Agetian
Copy link
Copy Markdown
Contributor

Agetian commented Mar 27, 2026

It's a LDA model for building Commander decks based on training data, it should be regularly updated, ideally, but I'm not sure how and who did it before (I do know how the other LDA models were generated and I update those from time to time). The card information should be a separate thing, yes, and I don't understand why CN is inferred specifically from Commander.dat and not just from the card DB :/

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.

3 participants