mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Yet another breed compatibility check
This commit is contained in:
parent
4f8108d61b
commit
266f863334
1 changed files with 5 additions and 1 deletions
|
@ -871,6 +871,9 @@ class PokemonNode(Node, Facade, namedtuple('PokemonNode',
|
||||||
cost += search.costs['egg'] * len(moves)
|
cost += search.costs['egg'] * len(moves)
|
||||||
cost += search.costs['breed-penalty'] * len(search.egg_moves - moves)
|
cost += search.costs['breed-penalty'] * len(search.egg_moves - moves)
|
||||||
gender_rate = search.gender_rates[evo_chain]
|
gender_rate = search.gender_rates[evo_chain]
|
||||||
|
goal_family = search.goal_evolution_chain
|
||||||
|
goal_groups = search.egg_groups[goal_family]
|
||||||
|
goal_compatible = set(goal_groups).intersection(egg_groups)
|
||||||
if 0 <= gender_rate:
|
if 0 <= gender_rate:
|
||||||
# Only pokemon that have males can pas down moves to other species
|
# Only pokemon that have males can pas down moves to other species
|
||||||
# (and the other species must have females: checked in BreedNode)
|
# (and the other species must have females: checked in BreedNode)
|
||||||
|
@ -882,7 +885,8 @@ class PokemonNode(Node, Facade, namedtuple('PokemonNode',
|
||||||
# Since the target family is not included in our breed graph, we
|
# Since the target family is not included in our breed graph, we
|
||||||
# breed with it explicitly. But again, there must be a female to
|
# breed with it explicitly. But again, there must be a female to
|
||||||
# breed with.
|
# breed with.
|
||||||
if search.gender_rates[search.goal_evolution_chain] > 0:
|
if goal_compatible and search.gender_rates[
|
||||||
|
search.goal_evolution_chain] > 0:
|
||||||
yield cost, None, GoalBreedNode(search=self.search, dummy='g',
|
yield cost, None, GoalBreedNode(search=self.search, dummy='g',
|
||||||
version_group_=self.version_group_, moves_=self.moves_)
|
version_group_=self.version_group_, moves_=self.moves_)
|
||||||
elif evo_chain == search.goal_evolution_chain:
|
elif evo_chain == search.goal_evolution_chain:
|
||||||
|
|
Loading…
Reference in a new issue