def attacks(self): a = AttackList() seen = set() for c in self.get_combatants(): for atk in c.attacks: if atk in seen: continue seen.add(atk) atk_copy = Attack.copy(atk) atk_copy.name = f"{atk.name} ({c.name})" a.append(atk_copy) return a
def get_attacks(self): """Returns a list of dicts of all of the character's attacks.""" if self.character_data is None: raise Exception('You must call get_character() first.') character = self.character_data attacks = AttackList() atk_names = set() for attack in character.get('attacks', []): if attack.get('enabled') and not attack.get('removed'): atk = self.parse_attack(attack) # unique naming atk_num = 2 if atk.name in atk_names: while f"{atk.name}{atk_num}" in atk_names: atk_num += 1 atk.name = f"{atk.name}{atk_num}" atk_names.add(atk.name) attacks.append(atk) return attacks
def get_attacks(self): """Returns an attack list.""" if self.character_data is None: raise Exception('You must call get_character() first.') attacks = AttackList() for rownum in range(32, 37): # sht1, R32:R36 a = self.parse_attack(f"R{rownum}", f"Y{rownum}", f"AC{rownum}") if a is not None: attacks.append(a) if self.additional: for rownum in range(3, 14): # sht2, B3:B13; W3:W13 additional = self.parse_attack(f"B{rownum}", f"I{rownum}", f"M{rownum}", self.additional) other = self.parse_attack(f"W{rownum}", f"AD{rownum}", f"AH{rownum}", self.additional) if additional is not None: attacks.append(additional) if other is not None: attacks.append(other) return attacks