aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-05-19 18:51:32 -0600
committerFlorian Fischer <florian.fischer@muhq.space>2025-05-19 18:51:32 -0600
commitd1d8e75ea8177b742364054218e12ec3bc3aeb0d (patch)
tree213e448e3ec336540c6250c12d6ea5ce3b197367 /scripts
parent3675ea1acd36d0a27a6868da7d8f07e8ba93b2f6 (diff)
downloadmuhqs-game-d1d8e75ea8177b742364054218e12ec3bc3aeb0d.tar.gz
muhqs-game-d1d8e75ea8177b742364054218e12ec3bc3aeb0d.zip
data.py: support card names containing their set
Diffstat (limited to 'scripts')
-rw-r--r--scripts/data.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/data.py b/scripts/data.py
index fadf9613..2eedb22e 100644
--- a/scripts/data.py
+++ b/scripts/data.py
@@ -16,6 +16,7 @@ def populate_lookup_dicts():
for card in set_dir.iterdir():
SETS_TO_CARDS[set_name].append(card.stem)
CARDS_TO_SETS[card.stem] = set_name
+ CARDS_TO_SETS[f'{set_name}/{card.stem}'] = set_name
def name2set(card: str) -> str:
@@ -62,12 +63,14 @@ def name2cardlisting(card: str) -> str:
The returned target can be used to directly navigate the
card listing to the specific card.
- Card listing targets are all lower case and use '-' instead of
- whitespace.
+ Card listing targets are all lower case and use '-' instead of whitespace.
Ending '!' are stripped from the card names.
+ If a path including the set is given only the card part is considered.
:param card: the english name of a card
:returns: the card listing target
"""
+ if '/' in card:
+ card = card.split('/')[-1]
return card.lower().replace(' ', '-').replace('!', '')