示例#1
0
    def get_level_up_moves(self, form: FormConfig) -> [str]:
        table_names = []
        if form.normal_form:
            table_names.append('Standard Level Up')
        elif form.is_alolan:
            table_names.append('Alola Form Level Up')
        elif form.is_galarian:
            table_names.append('Galarian Form Level Up')
        if form.form_name is not None:
            table_names.append('Level Up - ' + form.form_name)
        assert self.update_table(*table_names)

        attacks = LevelUpMoves()
        for i in range(2, len(self.info_table) - 1, 2):
            level = self.info_table[i][0].text

            if level == 'Evolve':
                level = 0
            elif level == dashy:
                level = 1
            else:
                level = int(level)

            attack = self.info_table[i][1][0].text
            attack = attack_substitution(self.num, namesies(attack))
            if attack == '':
                assert level == 1
                continue

            attacks.add(level, attack)

        level_up_attack_additions(self.num, attacks)

        return attacks.get()
示例#2
0
    def _get_learnable_moves(self, form: FormConfig, table_name: str) -> [str]:
        attacks = []
        if self.update_table(table_name):
            table = self.info_table.xpath('tr')
            if len(table) == 0:
                table = self.info_table.xpath('thead/tr')

            schema = table[1]
            attack_index = get_schema_index(schema, "Attack Name")
            form_index = get_schema_index(schema, "Form")

            for i in range(2, len(table) - 1, 2):
                row = table[i]

                attack = namesies(row[attack_index][0].text)

                if not form.has_form(row, form_index):
                    continue

                # Don't include unimplemented moves
                attack = learnable_attack_substitution(attack)
                if attack == '':
                    continue

                attacks.append(attack)
        return attacks
示例#3
0
    def get_egg_groups(self) -> List[str]:
        # Get them egg groupies
        egg_groups = [
            namesies(egg_group.name) for egg_group in self.species.egg_groups
        ]
        egg_groups = egg_group_substitution(self.num, egg_groups)

        assert len(egg_groups) in [1, 2]
        return egg_groups
示例#4
0
def get_types(type_images):
    assert len(type_images) == 1 or len(type_images) == 2

    types = ["NO_TYPE"] * 2
    for i, type_image in enumerate(type_images):
        # imageName is of the form "...type/<typeName>.gif"
        types[i] = namesies(get_image_name(type_image))

    return types
示例#5
0
def substitute_ability(num: int, ability_name: str) -> str:
    ability_name = namesies(ability_name)
    if ability_name == "COMPOUNDEYES":
        return "COMPOUND_EYES"
    # Basculin -- remove blue-stripe ability
    elif num == 550 and ability_name == "ROCK_HEAD":
        return ""
    # Meowstic -- remove female ability
    elif num == 678 and ability_name == "COMPETITIVE":
        return ""
    else:
        return ability_name
示例#6
0
def substitute_egg_group(egg_group: str) -> str:
    egg_group = namesies(egg_group.replace(' ', ''))
    if egg_group == "AMORPHOUS":
        return "INDETERMINATE"
    elif egg_group == "GRASS":
        return "PLANT"
    elif egg_group == "FIELD":
        return "GROUND"
    elif egg_group == "HUMAN_LIKE":
        return "HUMANSHAPE"
    else:
        return egg_group
示例#7
0
    def get_moves(self) -> Tuple[List[str], List[str]]:
        # Maps from version name to list of Moves in that version
        version_to_moves = {}  # type: Dict[str, List[Move]]
        for entry in self.pokemon.moves:
            for version_entry in entry.version_group_details:
                version_name = version_entry['version_group']['name']
                version_to_moves.setdefault(version_name, []).append(
                    _get_move(entry, version_entry))

        # Get the moves of the most relevant version
        version = next(version for version in PAIRED_VERSIONS
                       if version in version_to_moves)
        moves = version_to_moves[version]

        # Create move lists from version's moves
        level_up_moves = LevelUpMoves()
        learnable_moves = []  # type: List[str]
        for move in moves:
            attack_name = namesies(move.name)

            # Level-up moves
            if move.learn_method == 'level-up':
                # Potentially replace this move with another one
                attack_name = attack_substitution(self.num, attack_name)
                if attack_name == '':
                    # Should only be removing default moves
                    assert move.level_learned == 1
                    continue

                level_up_moves.add(move.level_learned, attack_name)
            # All other learnable moves
            # Did you know that if you bred Pikachu holding Light Ball the Pichu will know Volt Tackle??
            elif move.learn_method in [
                    'machine', 'egg', 'tutor', 'light-ball-egg'
            ]:
                # Don't include unimplemented moves
                attack_name = learnable_attack_substitution(attack_name)
                if attack_name == '':
                    continue

                learnable_moves.append(attack_name)
            # Form change is for Rotom
            elif not (self.num == 479 and move.learn_method == 'form-change'):
                raise Exception('Unknown move learn method ' +
                                move.learn_method + ' for ' + move.name)

        level_up_attack_additions(self.num, level_up_moves)

        # Add any manually added learnable moves
        learnable_moves.extend(learnable_attack_additions(self.num))

        return level_up_moves.get(), learnable_moves
示例#8
0
    def get_types(self) -> List[str]:
        types = ['', 'NO_TYPE']
        for poke_type in self.pokemon.types:
            types[poke_type.slot - 1] = namesies(poke_type.type.name)

        # Replace types if applicable
        types = type_substitution(self.num, types)

        assert len(types) == 2
        assert types[0] != ''
        assert types[0] != 'NO_TYPE'

        return types
示例#9
0
    def get_abilities(self) -> List[str]:
        abilities = [''] * 3

        # Add each ability in the corresponding slot in the list
        pokemon = self._get_pokemon(self.form_config.use_base_abilities)
        for ability in pokemon.abilities:
            ability_name = namesies(ability.ability.name)

            # Replace/remove the ability if applicable
            abilities[ability.slot - 1] = ability_substitution(
                self.num, ability_name)

            # Hidden abilities must be in the third slot
            if ability.is_hidden:
                assert ability.slot == 3

        # Remove empty slots
        abilities = [ability for ability in abilities if ability != '']

        assert len(abilities) in [1, 2, 3]
        return abilities
示例#10
0
 def get_growth_rate(self) -> str:
     growth_rate = _get_growth_rate(self.species.growth_rate.name)
     return namesies(growth_rate)
示例#11
0
        evs = base.evs
        effort_substitution(num, base.evs)
        print("Effort Values:", evs)

        base_exp = base.base_exp
        print("Base EXP:", base_exp)

        f.write(str(num) + '\n')
        f.write(str(name) + '\n')

        stats = [str(stat) for stat in stats]
        f.write(' '.join(stats) + '\n')

        f.write(str(base_exp) + '\n')
        f.write(namesies(growth_rate) + '\n')
        f.write(namesies(types[0]) + ' ')
        f.write(namesies(types[1]) + '\n')

        f.write(str(catch_rate) + '\n')

        evs = [str(ev) for ev in evs]
        f.write(' '.join(evs) + '\n')

        # TODO: Evolutions
        f.write('NONE\n')

        # TODO: Wild Hold Items
        f.write('0\n')

        f.write(str(female_ratio) + '\n')
示例#12
0
                'Sun/Moon Level Up' + suffix, 'Sun / Moon Level Up' + suffix,
                form_config.form_name + " Form Level Up"
            ]

        assert parser.update_table(*level_up_tables)
        attacks = []
        for i in range(2, len(parser.info_table) - 1, 2):
            level = parser.info_table[i][0].text

            if level == 'Evolve':
                level = 0
            elif level == dashy:
                level = 1

            attack = parser.info_table[i][1][0].text
            attack = attack_substitution(num, namesies(attack))
            if attack == '':
                assert level == 1
                continue

            attacks.append(str(level) + " " + attack)
            print(str(int(level)) + " " + attack)

        print("TMS:")
        tms = []
        if parser.update_table('TM & HM Attacks'):
            schema = parser.info_table[1]
            attack_index = get_schema_index(schema, "Attack Name")
            form_index = get_schema_index(schema, "Form")

            for i in range(2, len(parser.info_table) - 1, 2):