from pokedex.db import tables
from pokedex.formulae import calculated_hp, calculated_stat
-from pokedex.util import namedtuple, permutations
+from pokedex.compatibility import namedtuple, permutations
from pokedex.struct._pokemon_struct import pokemon_struct
def pokemon_prng(seed):
st = self.structure
self._pokemon = session.query(tables.Pokemon).get(st.national_id)
+ self._pokemon_form = session.query(tables.PokemonForm) \
+ .with_parent(self._pokemon) \
+ .filter_by(name=st.alternate_form) \
+ .one()
self._ability = self._session.query(tables.Ability).get(st.ability_id)
growth_rate = self._pokemon.evolution_chain.growth_rate
self._held_item = None
if st.held_item_id:
- self._held_item = session.query(tables.ItemInternalID) \
- .filter_by(generation_id = 4, internal_id = st.held_item_id).one().item
+ self._held_item = session.query(tables.ItemGameIndex) \
+ .filter_by(generation_id = 4, game_index = st.held_item_id).one().item
self._stats = []
for pokemon_stat in self._pokemon.stats:
pokeball_id = st.hgss_pokeball - 17 + 492
else:
pokeball_id = st.dppt_pokeball
- self._pokeball = session.query(tables.ItemInternalID) \
- .filter_by(generation_id = 4, internal_id = pokeball_id).one().item
+ self._pokeball = session.query(tables.ItemGameIndex) \
+ .filter_by(generation_id = 4, game_index = pokeball_id).one().item
egg_loc_id = st.pt_egg_location_id or st.dp_egg_location_id
met_loc_id = st.pt_met_location_id or st.dp_met_location_id
self._egg_location = None
if egg_loc_id:
- self._egg_location = session.query(tables.LocationInternalID) \
- .filter_by(generation_id = 4, internal_id = egg_loc_id).one().location
+ self._egg_location = session.query(tables.LocationGameIndex) \
+ .filter_by(generation_id = 4, game_index = egg_loc_id).one().location
- self._met_location = session.query(tables.LocationInternalID) \
- .filter_by(generation_id = 4, internal_id = met_loc_id).one().location
+ self._met_location = session.query(tables.LocationGameIndex) \
+ .filter_by(generation_id = 4, game_index = met_loc_id).one().location
@property
def species(self):
return self._pokemon
@property
+ def species_form(self):
+ return self._pokemon_form
+
+ @property
def pokeball(self):
return self._pokeball