Implement the Pomeg glitch; the readouts aren't so good but should work

This commit is contained in:
Petr Viktorin 2011-05-04 17:15:12 +03:00
parent 2862444402
commit 731a172854
2 changed files with 23 additions and 3 deletions

View file

@ -65,6 +65,9 @@ OK pikachu volt-tackle encore headbutt grass-knot
NO nidoran-m horn-drill head-smash -l 5 -v platinum --pomeg-glitch NO nidoran-m horn-drill head-smash -l 5 -v platinum --pomeg-glitch
NO bulbasaur charm skull-bash NO bulbasaur charm skull-bash
NO chansey aromatherapy counter copycat NO chansey aromatherapy counter copycat
OK magnemite thundershock -v platinum
NO magnemite thundershock -v platinum -l 5
OK magnemite thundershock -v platinum -l 5 --pomeg-glitch
""".strip().splitlines() """.strip().splitlines()
@single_params(*argstrings) @single_params(*argstrings)

View file

@ -45,6 +45,7 @@ class MovesetSearch(object):
_cache = WeakKeyDictionary() _cache = WeakKeyDictionary()
def __init__(self, session, pokemon, version, moves, level=100, costs=None, def __init__(self, session, pokemon, version, moves, level=100, costs=None,
pomeg_glitch=False,
exclude_versions=(), exclude_pokemon=(), debug_level=0): exclude_versions=(), exclude_pokemon=(), debug_level=0):
self.session = session self.session = session
@ -76,6 +77,8 @@ class MovesetSearch(object):
self.debug_level = debug_level self.debug_level = debug_level
self.pomeg_glitch = pomeg_glitch
if not moves: if not moves:
raise NoMoves('No moves specified.') raise NoMoves('No moves specified.')
elif len(moves) > 4: elif len(moves) > 4:
@ -998,6 +1001,13 @@ class InitialNode(Node, namedtuple('InitialNode', 'search')):
# (For everybody else, three duplicate nodes aren't a problem) # (For everybody else, three duplicate nodes aren't a problem)
for version_group in search.generation_id_by_version_group: for version_group in search.generation_id_by_version_group:
pokemon_vgs.append((pokemon, version_group)) pokemon_vgs.append((pokemon, version_group))
# And for the Pomeg glitch, it we may need to start by breeding
# an empty moveset
if search.pomeg_glitch:
for version_group in search.generation_id_by_version_group:
cost = search.costs['breed']
yield cost, None, GoalBreedNode(search=search, dummy='g',
version_group_=version_group, moves_=frozenset())
for pokemon, version_group in pokemon_vgs: for pokemon, version_group in pokemon_vgs:
action = StartAction(search, pokemon, version_group) action = StartAction(search, pokemon, version_group)
node = PokemonNode( node = PokemonNode(
@ -1327,14 +1337,15 @@ class BaseBreedNode(Node):
if method == 'light-ball-egg': if method == 'light-ball-egg':
extra_moves.add(move) extra_moves.add(move)
elif method == 'level-up': elif method == 'level-up':
# The bred pokémon starts out with starting # The bred pokémon starts out with "starting"
# level-up moves # level-up moves
# XXX: these may get overwritten. This doesn't # XXX: these may get overwritten. This doesn't
# affect moveset legality because games with # affect moveset legality because games with
# breeding have move relearners, but the # breeding have move relearners, but the
# instructions won't be right. # instructions won't be right.
if any(level <= hatch_level for level, cost if (search.pomeg_glitch and gen == 3) or any(
in levels_costs): level <= hatch_level
for level, cost in levels_costs):
extra_moves.add(move) extra_moves.add(move)
cost = search.costs['per-hatch-counter'] * search.hatch_counters[baby] cost = search.costs['per-hatch-counter'] * search.hatch_counters[baby]
for extra in powerset(extra_moves): for extra in powerset(extra_moves):
@ -1446,6 +1457,11 @@ def main(argv, session=None):
help='Pokemon to exclude (along with their families, e.g. `pichu` ' help='Pokemon to exclude (along with their families, e.g. `pichu` '
'will also exclude Pikachu and Raichu).') 'will also exclude Pikachu and Raichu).')
parser.add_argument('-p', '--pomeg-glitch', action='store_true', default=False,
help='Allow the Pomeg glitch, i.e. levelling up eggs in the 3rd '
"generation. (Note that the printouts won't mention the glitch "
'explicitly.)')
parser.add_argument('-d', '--debug', action='append_const', const=1, parser.add_argument('-d', '--debug', action='append_const', const=1,
default=[], default=[],
help='Output timing and debugging information. Can be specified more ' help='Output timing and debugging information. Can be specified more '
@ -1508,6 +1524,7 @@ def main(argv, session=None):
result = verify_moveset(session, pokemon, version, moves, args.level, result = verify_moveset(session, pokemon, version, moves, args.level,
exclude_versions=excl_versions, exclude_pokemon=excl_pokemon, exclude_versions=excl_versions, exclude_pokemon=excl_pokemon,
pomeg_glitch=args.pomeg_glitch,
debug_level=args.debug) debug_level=args.debug)
# XXX: Support more than one result # XXX: Support more than one result
if result: if result: