Scope genlocke retireHoF to HoF team instead of all alive Pokemon

advance_leg() now checks current_run.hof_encounter_ids first and only
retires those Pokemon and their families. Falls back to all alive
non-shiny Pokemon when no HoF team is selected (backwards compatible).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Julian Tabel
2026-02-09 10:26:49 +01:00
parent 58d36c4433
commit 056bef9f75
3 changed files with 31 additions and 13 deletions

View File

@@ -146,16 +146,23 @@ async def advance_leg(
# Compute retired Pokemon families if retireHoF is enabled
if genlocke.genlocke_rules.get("retireHoF", False):
# Query surviving caught Pokemon from the completed run
# "Surviving HoF" = caught, not fainted, not shiny
survivors_result = await session.execute(
select(Encounter.pokemon_id).where(
Encounter.run_id == current_leg.run_id,
Encounter.status == "caught",
Encounter.faint_level.is_(None),
Encounter.is_shiny.is_(False),
# Prefer the player's HoF team selection; fall back to all alive
if current_run.hof_encounter_ids:
survivors_result = await session.execute(
select(Encounter.pokemon_id).where(
Encounter.id.in_(current_run.hof_encounter_ids),
)
)
else:
# Fallback: all surviving caught, non-shiny Pokemon
survivors_result = await session.execute(
select(Encounter.pokemon_id).where(
Encounter.run_id == current_leg.run_id,
Encounter.status == "caught",
Encounter.faint_level.is_(None),
Encounter.is_shiny.is_(False),
)
)
)
survivor_ids = [row[0] for row in survivors_result]
if survivor_ids: