From 483ec7cd1a068965a25a5873ff33ef8312674b10 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Sun, 14 Oct 2012 13:47:51 +0200 Subject: [PATCH] Fix up forms and hidden ability flag --- pokedex/struct/__init__.py | 9 ++++++--- pokedex/struct/_pokemon_struct.py | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pokedex/struct/__init__.py b/pokedex/struct/__init__.py index ed012d3..1a8bfb5 100644 --- a/pokedex/struct/__init__.py +++ b/pokedex/struct/__init__.py @@ -242,7 +242,8 @@ class SaveFilePokemon(object): species=dict(id=self.species.id, name=self.species.name), ) if self.form != self.species.default_form: - result['form'] = dict(id=st.form_id, name=self.form.form_name) + result['form'] = dict( + id=st.alternate_form_id, name=self.form.form_name) save_object(result, 'ability', id=st.ability_id) save_object(result, 'held item', id=st.held_item_id) @@ -345,7 +346,7 @@ class SaveFilePokemon(object): del self.ability reset_form = False if 'form' in dct: - st.alternate_form = dct['form'] + st.alternate_form_id = dct['form']['id'] reset_form = True if 'species' in dct: st.national_id = dct['species']['id'] @@ -434,7 +435,8 @@ class SaveFilePokemon(object): if 'moves' in dct: pp_reset_indices = [] for i, movedict in enumerate(dct['moves']): - st['move{0}_id'.format(i + 1)] = movedict['id'] + if 'id' in movedict: + st['move{0}_id'.format(i + 1)] = movedict['id'] if 'pp' in movedict: st['move{0}_pp'.format(i + 1)] = movedict['pp'] else: @@ -914,6 +916,7 @@ class SaveFilePokemonGen5(SaveFilePokemon): if self.nature: result['nature'] = dict( id=self.structure.nature_id, name=self.nature.name) + result['has hidden ability'] = self.hidden_ability return result def update(self, dct, **kwargs): diff --git a/pokedex/struct/_pokemon_struct.py b/pokedex/struct/_pokemon_struct.py index 2c7a81e..ece59e2 100644 --- a/pokedex/struct/_pokemon_struct.py +++ b/pokedex/struct/_pokemon_struct.py @@ -19,7 +19,7 @@ from construct import * pokemon_forms = { # Unown - 201: 'abcdefghijklmnopqrstuvwxyz!?', + 201: list('abcdefghijklmnopqrstuvwxyz') + ['exclamation', 'question'], # Deoxys 386: ['normal', 'attack', 'defense', 'speed'], @@ -33,7 +33,7 @@ pokemon_forms = { 423: ['west', 'east'], # Rotom - 479: ['normal', 'heat', 'wash', 'frost', 'fan', 'cut'], + 479: ['normal', 'heat', 'wash', 'frost', 'fan', 'mow'], # Giratina 487: ['altered', 'origin'], @@ -45,7 +45,7 @@ pokemon_forms = { 493: [ 'normal', 'fighting', 'flying', 'poison', 'ground', 'rock', 'bug', 'ghost', 'steel', 'fire', 'water', 'grass', - 'thunder', 'psychic', 'ice', 'dragon', 'dark', '???', + 'thunder', 'psychic', 'ice', 'dragon', 'dark', 'unknown', ], }