Closed april closed 6 years ago
Hm, that's not good. I'll take a look at that in a few hours once I'm off work.
Pretty sure it's somewhere in list_add()
and list_merge()
, but the code is pretty opaque.
There has probably got to be a more immutable way to do the decklist parsing, maybe a refactoring job someday. :)
I disagree, Decklist.parse('1 mountain', '1 mountain')
correctly reports that there's one mountain in the maindeck and sideboard. I'm starting to debug this now, so I should hopefully spot the issue soon.
Found it... validateDecklist
's combineDecks
internal function ended up modifying the maindeck because it did not deep-copy cards as it added them to the "combined list", thus holding pointers to it when it incremented its quantity when sideboard copies were found later.
If you have a mainboard of
4 Mountain
and a sideboard of4 Mountain
, it will create a decklist with 8 Mountains in the main and 4 in the sideboard.I think this is related to @Nightfirecat's recent changes.