1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 15:02:59 +00:00
fftcgtool/fftcg/opus.py
2021-08-09 14:03:45 +02:00

60 lines
1.5 KiB
Python

import logging
import roman
from .cards import Cards
class Opus(Cards):
def __init__(self, opus_id: str):
logger = logging.getLogger(__name__)
if opus_id.isnumeric():
self.__name = f"Opus {roman.toRoman(int(opus_id)).upper()}"
self.__number = opus_id
self.__filename = f"opus_{opus_id}"
params = {"set": [self.__name]}
elif opus_id == "chaos":
self.__name = "Boss Deck Chaos"
self.__number = "B"
self.__filename = "boss_deck_chaos"
params = {"set": [self.__name]}
elif opus_id == "promo":
self.__name = "Promo"
self.__number = "PR"
self.__filename = "promo"
params = {"rarity": ["pr"]}
else:
self.__name = "?"
self.__number = "?"
self.__filename = "?"
params = {"set": "?"}
super().__init__(params)
# remove reprints
for card in self:
if not card.code.startswith(self.__number + "-"):
self.remove(card)
# sort cards by opus, then serial
self.sort(key=lambda x: x.serial)
self.sort(key=lambda x: x.opus)
for card in self:
logger.info(f"imported card {card}")
@property
def name(self) -> str:
return self.__name
@property
def number(self) -> str:
return self.__number
@property
def filename(self) -> str:
return self.__filename