---
# nuzlocke-tracker-h3fw
title: Use HoF team for genlocke retirement instead of all alive Pokemon
status: completed
type: task
priority: normal
created_at: 2026-02-09T09:15:00Z
updated_at: 2026-02-09T09:26:54Z
parent: nuzlocke-tracker-8w9s
blocking:
    - nuzlocke-tracker-25mh
---

The current retireHoF implementation in `advance_leg()` retires ALL alive, non-shiny, caught Pokemon from the completed run. This is incorrect — only the Hall of Fame team (up to 6 Pokemon selected by the player) should be retired.

## Current behavior
```python
# genlockes.py — retires everything alive
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),
)
```

## Desired behavior
- If the run has `hof_encounter_ids` set, use those encounter IDs to determine which Pokemon to retire
- If `hof_encounter_ids` is not set (legacy/skipped), fall back to the current "all alive" behavior for backwards compatibility
- Only the HoF team members and their evolutionary families get added to the retired list

## Changes needed
- Update `advance_leg()` in `backend/src/app/api/genlockes.py` to check `current_run.hof_encounter_ids` first
- If present, query only those encounters for retirement
- If absent, keep the current fallback query
- Update the frontend `RunEncounters.tsx` to also scope `retiredPokemonIds` correctly (no change needed — it reads from the backend response)

## Checklist
- [x] Update `advance_leg()` to prefer `hof_encounter_ids` over all-alive query
- [x] Verify backwards compatibility when `hof_encounter_ids` is null