mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Misc.
This commit is contained in:
parent
add72ef5da
commit
88b9a216c7
2 changed files with 8 additions and 8 deletions
|
@ -30,12 +30,10 @@ def test_cases():
|
||||||
OK gyarados flail thrash iron-head outrage
|
OK gyarados flail thrash iron-head outrage
|
||||||
OK drifblim memento gust thunderbolt pain-split
|
OK drifblim memento gust thunderbolt pain-split
|
||||||
OK crobat nasty-plot brave-bird
|
OK crobat nasty-plot brave-bird
|
||||||
OK crobat brave-bird hypnosis
|
|
||||||
NO crobat nasty-plot hypnosis
|
NO crobat nasty-plot hypnosis
|
||||||
OK garchomp double-edge thrash outrage
|
OK garchomp double-edge thrash outrage
|
||||||
OK nidoking counter disable amnesia head-smash
|
OK nidoking counter disable amnesia head-smash
|
||||||
OK aggron stomp smellingsalt screech fire-punch
|
OK aggron stomp smellingsalt screech fire-punch
|
||||||
NO aggron endeavor body-slam
|
|
||||||
OK tyranitar dragon-dance outrage thunder-wave surf
|
OK tyranitar dragon-dance outrage thunder-wave surf
|
||||||
NO butterfree morning-sun harden
|
NO butterfree morning-sun harden
|
||||||
OK pikachu reversal bide nasty-plot discharge
|
OK pikachu reversal bide nasty-plot discharge
|
||||||
|
|
|
@ -259,11 +259,11 @@ class MovesetSearch(object):
|
||||||
print 'Smeargle families:', sorted(self.smeargle_families)
|
print 'Smeargle families:', sorted(self.smeargle_families)
|
||||||
return easy_moves, non_egg_moves
|
return easy_moves, non_egg_moves
|
||||||
|
|
||||||
def trade_cost(self, version_group_from, version_group_to, *thing_generations):
|
def trade_cost(self, version_group_from, version_group_to, max_generation=None):
|
||||||
"""Return cost of trading between versions, None if impossibble
|
"""Return cost of trading between versions, None if impossibble
|
||||||
|
|
||||||
`thing_generations` should be the generation IDs of the pokemon and
|
`max_generation` should be the maximum generation of the moves traded.
|
||||||
moves being traded.
|
(also of pokemon, if those aren't checked another way)
|
||||||
"""
|
"""
|
||||||
# XXX: this ignores HM transfer restrictions
|
# XXX: this ignores HM transfer restrictions
|
||||||
gen_from = self.generation_id_by_version_group[version_group_from]
|
gen_from = self.generation_id_by_version_group[version_group_from]
|
||||||
|
@ -271,7 +271,7 @@ class MovesetSearch(object):
|
||||||
if gen_from == gen_to:
|
if gen_from == gen_to:
|
||||||
return self.costs['trade']
|
return self.costs['trade']
|
||||||
elif gen_from in (1, 2):
|
elif gen_from in (1, 2):
|
||||||
if any(gen > gen_to for gen in thing_generations):
|
if max_generation and max_generation > gen_to:
|
||||||
return None
|
return None
|
||||||
elif gen_to in (1, 2):
|
elif gen_to in (1, 2):
|
||||||
return self.costs['trade']
|
return self.costs['trade']
|
||||||
|
@ -836,10 +836,10 @@ class PokemonNode(Node, Facade, namedtuple('PokemonNode',
|
||||||
target_vgs = set(search.pokemon_moves[self.pokemon_])
|
target_vgs = set(search.pokemon_moves[self.pokemon_])
|
||||||
target_vgs.add(search.goal_version_group)
|
target_vgs.add(search.goal_version_group)
|
||||||
target_vgs.discard(self.version_group_)
|
target_vgs.discard(self.version_group_)
|
||||||
|
max_generation = max(search.move_generations[m] for m in self.moves_)
|
||||||
for version_group in target_vgs:
|
for version_group in target_vgs:
|
||||||
cost = search.trade_cost(self.version_group_, version_group,
|
cost = search.trade_cost(self.version_group_, version_group,
|
||||||
*(search.move_generations[m] for m in self.moves_)
|
max_generation)
|
||||||
)
|
|
||||||
if cost is not None:
|
if cost is not None:
|
||||||
yield cost, TradeAction(search, version_group), self._replace(
|
yield cost, TradeAction(search, version_group), self._replace(
|
||||||
version_group_=version_group, new_level=False)
|
version_group_=version_group, new_level=False)
|
||||||
|
@ -1098,6 +1098,8 @@ def main(argv):
|
||||||
moves=''.join('.' if m in node.moves else ' ' for m in moves) +
|
moves=''.join('.' if m in node.moves else ' ' for m in moves) +
|
||||||
''.join(m.name[0].lower() for m in node.moves if m not in moves),
|
''.join(m.name[0].lower() for m in node.moves if m not in moves),
|
||||||
)
|
)
|
||||||
|
# XXX: Support more results
|
||||||
|
break
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
print
|
print
|
||||||
|
|
Loading…
Reference in a new issue