fix: some pokemon have no attack

main
beiyanpiki 1 year ago
parent beec9f0d68
commit 70ee07df4a

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -222,14 +222,19 @@ def get_pokemon_attr(card) -> PokemonAttr:
attacks = [] attacks = []
for attack in card['details']['abilityItemList']: for attack in card['details']['abilityItemList']:
atk_name = attack['abilityName'] atk_name = "" if attack['abilityName'] =='none' else attack['abilityName']
atk_text = "" if attack['abilityText'] == 'none' else attack['abilityText'] atk_text = "" if attack['abilityText'] == 'none' else attack['abilityText']
atk_damage = "" if attack['abilityDamage'] == 'none' else attack['abilityDamage']
if atk_name=="" and atk_text=="" and atk_damage=="":
continue
atk_cost = attack.get('abilityCost', '') atk_cost = attack.get('abilityCost', '')
atk_cost = ['none'] if atk_cost == '' else [elem for elem in atk_cost.split(',') if elem != ""] atk_cost = ['none'] if atk_cost == '' else [elem for elem in atk_cost.split(',') if elem != ""]
for i in range(len(atk_cost)): for i in range(len(atk_cost)):
e = get_energy_by_eid_yorenid(atk_cost[i]) e = get_energy_by_eid_yorenid(atk_cost[i])
atk_cost[i] = e atk_cost[i] = e
atk_damage = None if attack['abilityDamage'] == 'none' else attack['abilityDamage']
atk = Attack(atk_name, atk_text, atk_cost, atk_damage) atk = Attack(atk_name, atk_text, atk_cost, atk_damage)
attacks.append(atk) attacks.append(atk)
return PokemonAttr(energy_type, stage, hp, ability, ancient_trait, weakness, resistance, retreat_cost, pokedex, return PokemonAttr(energy_type, stage, hp, ability, ancient_trait, weakness, resistance, retreat_cost, pokedex,

@ -112,13 +112,13 @@ class Attack:
name: str name: str
text: str text: str
cost: List[Energy] cost: List[Energy]
damage: Optional[str] damage: str
def __init__(self, def __init__(self,
name: str, name: str,
text: str, text: str,
cost: List[Energy], cost: List[Energy],
damage: Optional[str]) -> None: damage: str) -> None:
self.name = name self.name = name
self.text = text self.text = text
self.cost = cost self.cost = cost

Loading…
Cancel
Save