Refactor code such that Card info can be loaded from an external JSON file#21
Merged
apmnt merged 10 commits intoapmnt:mainfrom Oct 24, 2025
Merged
Refactor code such that Card info can be loaded from an external JSON file#21apmnt merged 10 commits intoapmnt:mainfrom
apmnt merged 10 commits intoapmnt:mainfrom
Conversation
…ng into a separate JSON file
apmnt
approved these changes
Oct 24, 2025
Owner
apmnt
left a comment
There was a problem hiding this comment.
Nice, sensible change. Also drives collaboration. Thanks!
| self.test_deck2.add(Card.create_card(Cards.RALTS)) | ||
| self.test_deck2.add(Card.create_card(Cards.RALTS)) | ||
| self.test_deck2.add(Card.create_card(Cards.RALTS)) | ||
| self.test_deck2.add(Card.create_card(Cards.RALTS)) |
Owner
There was a problem hiding this comment.
There could still be an option for an enum just for developer experience when building decks like this
Contributor
Author
There was a problem hiding this comment.
Understandable. Although I'm not sure what is the best way to do it without incurring maintenance effort of populating the enum. Perhaps we need a separate script to parse the json and generate the enum through a build pipeline.
Contributor
Author
|
Thanks for the merge. I hope it didn't result in too much merge conflicts! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moved Card Data to a JSON file
Changes
Moved card definitions from inline Python to
database.json:Enhanced card data parsing:
_parse_card_data()to convert JSON strings to Python types["Colorless", "Colorless"]→2)Code cleanup:
Technical Details
_load_cards(){ "Pokemon": { "id": "A1 129", "name": "Mewtwo EX", "hp": 150, "energy_type": "PSYCHIC", "attacks": ["psydrive", "psychic_sphere"], "retreat_cost": ["Colorless", "Colorless"], ... } }