From f766f22749b01538f3941dee89aaae74f852d7e4 Mon Sep 17 00:00:00 2001 From: Dawson Matthews Date: Wed, 14 Jan 2026 18:21:38 -0700 Subject: [PATCH] initial commit --- .gitignore | 1 + ZAOUMegaList.txt | 47 +++++++++++++++++++++++++ change_abilities.py | 83 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 .gitignore create mode 100644 ZAOUMegaList.txt create mode 100644 change_abilities.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f23b948 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.jar \ No newline at end of file diff --git a/ZAOUMegaList.txt b/ZAOUMegaList.txt new file mode 100644 index 0000000..599db2c --- /dev/null +++ b/ZAOUMegaList.txt @@ -0,0 +1,47 @@ +Clefable-Mega: Serene Grace +Victreebel-Mega: Triage +Raichu-Mega-X: Levitate +Raichu-Mega-Y: Transistor +Starmie-Mega: Pure Power, -40 Atk +Dragonite-Mega: Soul-Heart +Meganium-Mega: Flower Veil +Feraligatr-Mega: Dragon's Maw +Ampharos-Mega: Fluffy +Absol-Mega-Z: Technician +Chimecho-Mega: Levitate +Skarmory-Mega: Tough Claws +Staraptor-Mega: Tough Claws +Gallade-Mega: Sharpness +Froslass-Mega: Snow Warning +Garchomp-Mega-Z: Rough Skin + Lucario-Mega-Z: Mind's Eye +Heatran-Mega: Earth Eater +Darkrai-Mega: Dark Aura +Emboar-Mega: Supreme Overlord +Excadrill-Mega: Mold Breaker +Golurk-Mega: Adaptability +Audino-Mega: Regenerator +Scolipede-Mega: Tinted Lens +Scrafty-Mega: Shed Skin +Eelektross-Mega: Hadron Engine +Chandelure-Mega: Magic Guard +Chesnaught-Mega: Bulletproof +Delphox-Mega: Levitate +Greninja-Mega: Protean +Meowstic-Mega: Psychic Surge +Pyroar-Mega: Drought +Dragalge-Mega: Regenerator + Floette-Mega: Regenerator +Malamar-Mega: Contrary +Barbaracle-Mega: Tough Claws +Hawlucha-Mega: Stamina +Zygarde-Mega: Aura Break +Crabominable-Mega: Ice Scales +Golisopod-Mega: Regenerator +Drampa-Mega: Drizzle +Magearna-Mega: Soul-Heart +Zeraora-Mega: Volt Absorb +Falinks-Mega: Dauntless Shield +Scovillain-Mega: Contrary +Glimmora-Mega: Rocky Payload +Baxcalibur-Mega: Thermal Exchange \ No newline at end of file diff --git a/change_abilities.py b/change_abilities.py new file mode 100644 index 0000000..f5e9514 --- /dev/null +++ b/change_abilities.py @@ -0,0 +1,83 @@ +''' +Author: Dawson Matthews +Date: 01/14/26 + +Takes as input: + 1. The directory in which all of the json files are listed in their respective + directories seperated by generation from generation1 to generation9 + 2. The file containing all desired mega pokemon and their target abilities in + the format as shown by: Darkrai-Mega: Dark Aura + 3. The name of the new directory to put the changed files in + +Produces as output a new directory with the fixed files in it. +''' + +import sys +import os +import json + +def get_target_abilities(ability_data_path): + ''' + Reads in the data from the path and converts date from the showdown format to the + cobblemon format as a pythyon dictionary i.e. "Darkrai-Mega: Dark Aura" -> {"darkrai": "darkaura"} + ''' + + ability_data = {} + + with open(ability_data_path, "r", encoding="utf-8") as f: + lines = f.readlines() + for line in lines: + line = (line.strip()).split() # Removing new line characters, as well as leading and trailing spaces. Then split it by the middle space + species_name = line[0][:-6].lower() # Removes the "-Mega" suffix and sends the name to lower case + ability = (line[1].replace(" ", "")).lower() # Removes the spaces + ability_data[species_name] = ability + + return ability_data + +def write_augmented_species_data(src_dir, dst_dir, species_data): + ''' + Takes the new species data in dictionary form and creates the new data + ''' + + gen_dirs = os.listdir(species_additions_dir) # Get a list of all directories in the data path, each corresponding to one generation + for gen_dir in gen_dirs: + + dir_path = os.path.join(data_path, gen_dir) + + if os.path.isdir(dir_path) == False: # Make sure it's actually a real file path + return 1 + + species_files = os.listdir(dir_path) + + for species_file_name in species_files: + + species_file_path = os.path.join(dir_path, species_file_name) + with open(species_file_path, "r", encoding="utf-8") as f: + species_data = json.load(f) + + # Edit the ability data (abities is a list of strings, sometimes having an "h:" in front of the name if it's the hidden ability) + forms = species_data["forms"] + for form in forms: + abilities = form["abilities"] + + for ability in abilities: + + +def main(): + program_name = sys.argv[0] + + usage_string = f"Usage: {program_name} " + + num_args = len(sys.argv) + if num_args != 4: + print(usage_string) + + _, src_dir, dst_dir, data_path = sys.argv # Gets the required information from the program arguments + + ability_data = get_target_abilities(data_path) + + write_augmented_species_data(src_dir, dst_dir, ability_data) + + +if __name__ == "__main__": + main() \ No newline at end of file