feat: Add Trainer card legality for reprints + fixing some cards with surnames#996
feat: Add Trainer card legality for reprints + fixing some cards with surnames#996kvacquier wants to merge 4 commits intotcgdex:masterfrom
Conversation
…- Add Trainer card cache to share legality status between cards with the same name - Process cards from newest to oldest sets during compilation (for cache) - Process Trainer cards sequentially, other cards in parallel for performance - Sort final output by release date (oldest first) to maintain original order - Add character name descriptions to Trainer cards (e.g., "Boss's Orders (Giovanni)") This ensures that if a newer Trainer card with the same name is legal, older versions of that Trainer card will also be marked as legal, which aligns with how Trainer cards work in the Pokémon TCG where same-name Trainers share legality.
🃏 10 Cards ChangedDetails: 10 modified Professor's Research (Professor Oak) (cel25-23) (found using en)File: [data/Sword & Shield/Celebrations/23.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Celebrations/23.ts) Professor's Research (Professor Oak) (cel25-24) (found using en)File: [data/Sword & Shield/Celebrations/24.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Celebrations/24.ts) Boss's Orders (Giovanni) (swsh2-154) (found using en)File: [data/Sword & Shield/Rebel Clash/154.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Rebel Clash/154.ts) Boss's Orders (Giovanni) (swsh2-189) (found using en)File: [data/Sword & Shield/Rebel Clash/189.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Rebel Clash/189.ts) Boss's Orders (Giovanni) (swsh2-200) (found using en)File: [data/Sword & Shield/Rebel Clash/200.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Rebel Clash/200.ts) Boss's Orders (Lysandre) (swsh4.5-58) (found using en)File: [data/Sword & Shield/Shining Fates/58.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Shining Fates/58.ts) Professor's Research (Professor Juniper) (swsh4.5-60) (found using en)File: [data/Sword & Shield/Shining Fates/60.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Shining Fates/60.ts) Professor's Research (Professor Magnolia) (swsh1-178) (found using en)File: [data/Sword & Shield/Sword & Shield/178.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Sword & Shield/178.ts) Professor's Research (Professor Magnolia) (swsh1-201) (found using en)File: [data/Sword & Shield/Sword & Shield/201.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Sword & Shield/201.ts) Professor's Research (Professor Magnolia) (swsh1-209) (found using en)File: [data/Sword & Shield/Sword & Shield/209.ts](https://github.com/tcgdex/cards-database/blob/2f21648376e7cd43ffe6f4ed9af11ee485cedfec/data/Sword & Shield/Sword & Shield/209.ts) |
|
Hey, some of this maybe fixed without a big change to the compiler by using this: #1002 |
|
The change is not that big and does not really impact performances, where it's more reliable for the way the card reprint legality works (based on English name only) |
|
It was more that this requires a strict ordering of compilation which might be risky long term as it's possible someone could also change something about the compiler which changes the order unaware that this needed it. Thus getting incorrect legality. Is there a way this can be guaranteed without the strict compilation? |
|
| Thus getting incorrect legality. Is there a way this can be guaranteed without the strict compilation? |
|
Yeah I see what you mean. It's a difficult one. I've not looked at it enough to truly understand the flow. I just know from experience relying on an unchecked order of operations is not a good idea. Could this be computed at run time instead? With a legality endpoint? |
|
I do realise that even the endpoint isn't a good solution |
|
Could we change this to run after compilation. its a bit of a bigger compiler change but i believe it will set a better precedent and also be helpful for future changes. So allow the compile to run normally. before writing to the json add in a step to go through all of the cards for that language and do the legality checks. edit the legality info on the card then pass through to save the json like normal. This should give us the enhanced legality and the safety that we are not relying on a compilation order? Hows that sound? |
e169352 to
0cf2990
Compare
0cf2990 to
401a348
Compare
I've applied your feedback |
|
Looks good, at the moment we are only using the |
AFAIK, in asia, each country as it's own format, legality and rules about reprint (at leasts there's rules for specific, Japan, China and Korea that are different...), so we can not do it the same way |
























































































































Changes
Details
This PR implements a Trainer card legality cache system that ensures all Trainer cards with the same English name share the same legal status. When a newer Trainer card with the same name is legal, older versions of that Trainer card will also be marked as legal, which aligns with how Trainer cards work in the Pokémon TCG where same-name Trainers share legality.
The compilation process has been optimized to:
The cache uses English card names as keys to optimize memory usage, and only stores legality information for Trainer cards.