# Inside the loop that reads pokemon.txt
if 'Abilities' in species:
ability_names = species['Abilities'].split(',')
abilities = set(ability_names)
if 'HiddenAbilities' in species:
abilities.update(species['HiddenAbilities'].split(','))
output_parser.set(internal_name, 'abilities', ",".join(abilities))
# Inside the loop that reads pokemon_forms.txt
if 'Abilities' in fspecies:
ability_names = fspecies['Abilities'].split(',')
abilities = set(output_parser.get(internal_name, 'abilities').split(','))
if 'HiddenAbilities' in fspecies:
abilities.update(fspecies['HiddenAbilities'].split(','))
abilities.update(ability_names)
output_parser.set(internal_name, 'abilities', ",".join(abilities))