Fix up forms and hidden ability flag

This commit is contained in:
Petr Viktorin 2012-10-14 13:47:51 +02:00
parent 5250e88929
commit 483ec7cd1a
2 changed files with 9 additions and 6 deletions

View file

@ -242,7 +242,8 @@ class SaveFilePokemon(object):
species=dict(id=self.species.id, name=self.species.name), species=dict(id=self.species.id, name=self.species.name),
) )
if self.form != self.species.default_form: 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, 'ability', id=st.ability_id)
save_object(result, 'held item', id=st.held_item_id) save_object(result, 'held item', id=st.held_item_id)
@ -345,7 +346,7 @@ class SaveFilePokemon(object):
del self.ability del self.ability
reset_form = False reset_form = False
if 'form' in dct: if 'form' in dct:
st.alternate_form = dct['form'] st.alternate_form_id = dct['form']['id']
reset_form = True reset_form = True
if 'species' in dct: if 'species' in dct:
st.national_id = dct['species']['id'] st.national_id = dct['species']['id']
@ -434,6 +435,7 @@ class SaveFilePokemon(object):
if 'moves' in dct: if 'moves' in dct:
pp_reset_indices = [] pp_reset_indices = []
for i, movedict in enumerate(dct['moves']): for i, movedict in enumerate(dct['moves']):
if 'id' in movedict:
st['move{0}_id'.format(i + 1)] = movedict['id'] st['move{0}_id'.format(i + 1)] = movedict['id']
if 'pp' in movedict: if 'pp' in movedict:
st['move{0}_pp'.format(i + 1)] = movedict['pp'] st['move{0}_pp'.format(i + 1)] = movedict['pp']
@ -914,6 +916,7 @@ class SaveFilePokemonGen5(SaveFilePokemon):
if self.nature: if self.nature:
result['nature'] = dict( result['nature'] = dict(
id=self.structure.nature_id, name=self.nature.name) id=self.structure.nature_id, name=self.nature.name)
result['has hidden ability'] = self.hidden_ability
return result return result
def update(self, dct, **kwargs): def update(self, dct, **kwargs):

View file

@ -19,7 +19,7 @@ from construct import *
pokemon_forms = { pokemon_forms = {
# Unown # Unown
201: 'abcdefghijklmnopqrstuvwxyz!?', 201: list('abcdefghijklmnopqrstuvwxyz') + ['exclamation', 'question'],
# Deoxys # Deoxys
386: ['normal', 'attack', 'defense', 'speed'], 386: ['normal', 'attack', 'defense', 'speed'],
@ -33,7 +33,7 @@ pokemon_forms = {
423: ['west', 'east'], 423: ['west', 'east'],
# Rotom # Rotom
479: ['normal', 'heat', 'wash', 'frost', 'fan', 'cut'], 479: ['normal', 'heat', 'wash', 'frost', 'fan', 'mow'],
# Giratina # Giratina
487: ['altered', 'origin'], 487: ['altered', 'origin'],
@ -45,7 +45,7 @@ pokemon_forms = {
493: [ 493: [
'normal', 'fighting', 'flying', 'poison', 'ground', 'rock', 'normal', 'fighting', 'flying', 'poison', 'ground', 'rock',
'bug', 'ghost', 'steel', 'fire', 'water', 'grass', 'bug', 'ghost', 'steel', 'fire', 'water', 'grass',
'thunder', 'psychic', 'ice', 'dragon', 'dark', '???', 'thunder', 'psychic', 'ice', 'dragon', 'dark', 'unknown',
], ],
} }