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),
)
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,6 +435,7 @@ class SaveFilePokemon(object):
if 'moves' in dct:
pp_reset_indices = []
for i, movedict in enumerate(dct['moves']):
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']
@ -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):

View file

@ -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',
],
}