Commit Graph

76 Commits

Author SHA1 Message Date
fd23d89e71 Add production Dockerfiles and nginx config
Backend: installs non-editable, runs uvicorn without reload.
Frontend: multi-stage build, serves static files via nginx with
API proxy to the backend service and SPA fallback routing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 18:00:28 +01:00
Julian Tabel
f0307f0625 Guard genlocke data integrity edge cases
Block deletion of runs linked to a genlocke leg, prevent reactivating
completed/failed genlocke-linked runs, and guard encounter deletion
against genlocke transfer references with clear 400 errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 12:03:58 +01:00
Julian Tabel
d3b65e3c79 Add genlocke lineage tracking with aligned timeline view
Implement read-only lineage view that traces Pokemon across genlocke legs
via existing transfer records. Backend walks transfer chains to build
lineage entries; frontend renders them as cards with a column-aligned
timeline grid so leg dots line up vertically across all lineages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 11:58:38 +01:00
Julian Tabel
c2e946f500 Restrict transfers to HoF team and prevent blocking starter route
Transfer modal now only appears when a Hall of Fame team is selected,
using the existing hofTeam data instead of the survivors endpoint.
Without a HoF selection, advance proceeds directly with no transfer step.

Transferred encounters are now a separate category: they appear in their
own "Transferred Pokemon" section, don't occupy route slots in the
encounter map, and don't block the route-lock check (excluded via
genlocke_transfers subquery). The run detail endpoint returns
transferEncounterIds so the frontend can distinguish them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 11:35:05 +01:00
Julian Tabel
e1dac10d27 Fix run deletion crash and transfer modal initialization error
Run deletion now properly cleans up boss_results, genlocke_transfers,
and genlocke_leg references before deleting the run. Also fix
showTransferModal being referenced before initialization in
RunEncounters by moving its useState declaration above useLegSurvivors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 11:28:22 +01:00
Julian Tabel
c5910ec75c Add genlocke transfer UI with transfer selection modal and backend support
When advancing to the next genlocke leg, users can now select surviving
Pokemon to transfer. Transferred Pokemon are bred down to their base
evolutionary form and appear as level-1 egg encounters in the next leg.
A GenlockeTransfer record links source and target encounters for lineage tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 11:20:49 +01:00
Julian Tabel
3bd4250305 Add genlocke cumulative graveyard with backend endpoint and UI
Aggregates all fainted encounters across every leg of a genlocke into a
unified graveyard view. Backend serves GET /genlockes/{id}/graveyard with
per-entry leg/game context and summary stats (total deaths, deaths per
leg, deadliest leg). Frontend adds a toggle button on the genlocke detail
page that reveals a filterable/sortable grid of grayscale Pokemon cards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 11:00:37 +01:00
Julian Tabel
a81a17c485 Add genlocke admin panel with CRUD endpoints and UI
Backend: PATCH/DELETE genlocke, POST/DELETE legs with order
re-numbering. Frontend: admin list page with status filter,
detail page with inline editing, legs table, and stats display.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:51:47 +01:00
Julian Tabel
08f6857451 Add genlocke list and detail pages
Add GET /genlockes and GET /genlockes/{id} endpoints with aggregate
encounter/death stats per leg, and a frontend list page at /genlockes
plus a detail page at /genlockes/:genlockeId showing progress timeline,
cumulative stats, configuration, retired families, and quick actions.
Update nav link to point to the list page instead of /genlockes/new.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:39:59 +01:00
Julian Tabel
056bef9f75 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>
2026-02-09 10:26:49 +01:00
Julian Tabel
08a5e5c621 Add Hall of Fame team selection for completed runs
After marking a run as completed, a modal prompts the player to select
which Pokemon (up to 6) entered the Hall of Fame. The selection is stored
as hof_encounter_ids on the run, displayed in the victory banner, and
can be edited later. This lays the foundation for scoping genlocke
retireHoF to only the actual HoF team.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:19:56 +01:00
Julian Tabel
48b56f9360 Implement Retire HoF (Gauntlet) rule enforcement for genlockes
When retireHoF is enabled, surviving HoF Pokemon and their evolutionary
families are retired at leg advancement and treated as duplicates in all
subsequent legs — both in the encounter modal and bulk randomize.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:05:03 +01:00
Julian Tabel
07343e94e2 Add genlocke leg progression with advance endpoint and run context
When a run belonging to a genlocke is completed or failed, the genlocke
status updates accordingly. The run detail API now includes genlocke
context (leg order, total legs, genlocke name). A new advance endpoint
creates the next leg's run, and the frontend shows genlocke-aware UI
including a "Leg X of Y" banner, advance button, and contextual
messaging in the end-run modal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:47:28 +01:00
Julian Tabel
7851e14c2f Add genlocke creation wizard with backend API and 4-step frontend
Implements the genlocke creation feature end-to-end: Genlocke and
GenlockeLeg models with migration, POST /genlockes endpoint that
creates the genlocke with all legs and auto-starts the first run,
and a 4-step wizard UI (Name, Select Games with preset templates,
Rules, Confirm) at /genlockes/new.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:33:37 +01:00
Julian Tabel
aaaeb2146e Add game category and region metadata for genlocke presets
Add `category` field (original/remake/enhanced/sequel/spinoff) to the
Game model and tag all 38 games. Create regions.json with generation
mapping, ordering, and genlocke preset defaults per region. Add
GET /games/by-region endpoint returning games grouped by region.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:06:15 +01:00
6a36738b8b Update seed data and boss sprites from latest export
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 22:40:07 +01:00
58787460c4 Update seed data 2026-02-08 22:33:25 +01:00
2ff9e81cc4 Fix image export in container and skip already-local URLs
Mount frontend/public into the api container so the export can write
badge/sprite images. Skip re-downloading URLs that are already local
paths from a previous export.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 22:32:00 +01:00
35df9023f1 Add egg encounter logging with route-lock bypass
Egg hatches can now be logged at any location without consuming the
route's encounter slot. Adds an EggEncounterModal with pokemon search
and a "Log Egg" button on the run encounters page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 22:25:47 +01:00
8bd4ad1ecf Download badge and boss sprite images locally during export
The seed export command now downloads badge images and boss sprites
from remote URLs and stores them in frontend/public/, rewriting the
JSON URLs to local paths. Sprites are namespaced by game version
(e.g. /boss-sprites/red/brock.png) so each generation can have
its own sprite style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 22:13:30 +01:00
a2127f2126 Handle Nincada split evolution (Ninjask + Shedinja)
When evolving Nincada, a confirmation prompt now offers to also add
Shedinja as a new encounter on the same route. The Shedinja encounter
uses a "shed_evolution" origin to bypass route-locking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 21:47:35 +01:00
a6bf8b4af2 Add conditional boss battle teams (variant teams by condition)
Wire up the existing condition_label column on boss_pokemon to support
variant teams throughout the UI. Boss battles can now have multiple team
configurations based on conditions (e.g., starter choice in Gen 1).

- Add condition_label to BossPokemonInput schema (frontend + backend bulk import)
- Rewrite BossTeamEditor with variant tabs (Default + named conditions)
- Add variant pill selector to BossDefeatModal team preview
- Add BossTeamPreview component to RunEncounters boss cards
- Fix MissingGreenlet error in set_boss_team via session.expunge_all()
- Fix PokemonSelector state bleed between tabs via composite React key
- Add Alembic migration for condition_label column

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 21:20:30 +01:00
c6521dd206 Add filter controls to admin tables
Pokemon (type), Evolutions (trigger), Games (region/generation),
and Runs (status/game) now have dropdown filters alongside search.
Server-side filtering for paginated tables, client-side for small datasets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 20:29:55 +01:00
8f6d72a9c4 Add bulk import for evolutions, routes, and bosses
Add three new bulk import endpoints that accept the same JSON format as
their corresponding export endpoints, enabling round-trip compatibility:

- POST /evolutions/bulk-import (upsert by from/to pokemon pair)
- POST /games/{id}/routes/bulk-import (reuses seed loader for hierarchy)
- POST /games/{id}/bosses/bulk-import (reuses seed loader with team data)

Generalize BulkImportModal to support all entity types with configurable
title, example, and result labels. Wire up Bulk Import buttons on
AdminEvolutions, and AdminGameDetail routes/bosses tabs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 20:14:19 +01:00
b29b716fe5 Update Boss and Route data 2026-02-08 15:53:36 +01:00
758750b7b8 Add after_route_name to boss battle export/seed pipeline
Exports now include after_route_name (resolved from the route FK),
and the seed loader resolves it back to an ID on import. Also adds
a draft bean for displaying encounter-less locations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:51:23 +01:00
47c8fa8e88 Update seed data with boss battles and route changes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:40:07 +01:00
0e4fac8790 Add optional specialty type field to boss battles
Gym leaders, Elite Four, and champions can now have a Pokemon type
specialty (e.g. Rock, Water). Shown as a type image badge on boss
cards in the run view, and editable via dropdown in the admin form.
Includes migration, export, and seed pipeline support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:23:59 +01:00
1a7476f811 Add section field to boss battle export and seed pipeline
The section field was missing from the export endpoint, seed loader
(insert + upsert), and the seed export function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:05:36 +01:00
1bf37a6bd9 Add drag-and-drop boss reordering and new feature beans
Adds boss battle reorder API endpoint with two-phase order update to
avoid unique constraint violations. Includes frontend mutation hook
and API client. Also adds draft beans for progression dividers and
conditional boss battle teams features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:58:49 +01:00
a4f814e66e Add section field to boss battles for run progression dividers
Adds a nullable `section` column to boss battles (e.g. "Main Story",
"Endgame") with dividers rendered in the run view between sections.
Admin UI gets a Section column in the table and a text input in the form.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:55:26 +01:00
a01d01c565 Add Pokemon detail card with tabbed encounter/evolution views
Pokemon edit modal now shows three tabs (Details, Evolutions, Encounters)
instead of a single long form. Evolution chain entries are clickable to
open the EvolutionFormModal for direct editing. Encounter locations link
to admin route detail pages. Create mode shows only the form (no tabs).

Backend adds GET /pokemon/{id}/encounter-locations (grouped by game) and
GET /pokemon/{id}/evolution-chain (BFS family discovery). Extracts
formatEvolutionMethod to shared utility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:03:43 +01:00
bbac19677a Fix duplicate sub-areas caused by PokeAPI casing (e.g. 1f vs 1F)
PokeAPI returns both lowercase and uppercase floor names as separate
sub-areas with identical encounter data, causing 649 duplicate routes
across all 22 seed files. Merged case-insensitive duplicates, keeping
the uppercase name and deduplicating encounters. Re-seed required.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:22:50 +01:00
46f246028f Add randomize encounters feature (per-route + bulk)
Per-route: Randomize/Re-roll button in EncounterModal picks a uniform
random pokemon from eligible (non-duped) encounters. Bulk: new
POST /runs/{run_id}/encounters/bulk-randomize endpoint fills all
remaining routes in order, respecting dupes clause cascading, pinwheel
zones, and route group locking. Frontend Randomize All button on the
run page triggers the bulk endpoint with a confirm dialog.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:14:43 +01:00
6779e3effa Update bean status and add Rotom encounter to Pokemon X seed data
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:00:51 +01:00
069093ebae Add non-evolution form change support (Rotom, Oricorio, etc.)
Add a "Change Form" button in StatusChangeModal for Pokemon with
alternate forms sharing the same national_dex number. Mirrors the
existing evolution UI pattern, reusing currentPokemonId to track
the active form.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:55:11 +01:00
2d4aa9d562 Re-export all seed data from database
Ran --export to refresh seed JSON files with current database state.
Includes updated games, pokemon, routes/encounters, evolutions, and
new firered-bosses.json boss battle data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:39:45 +01:00
0a2d42a6d0 Add --export flag to export all seed data from DB to JSON
Replaces --export-bosses with a unified --export that dumps games,
pokemon, evolutions, routes/encounters, and bosses to seeds/data/.
Each export function mirrors the corresponding API export endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:39:00 +01:00
053dece33e Add boss seed data pipeline for export and import
Add seeder support for boss battles so new database instances come
pre-populated. Adds --export-bosses CLI flag to dump boss data from the
database to JSON seed files, and loads those files during normal seeding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:36:08 +01:00
3e88ba50fa Add version groups to share routes and boss battles across games
Routes and boss battles now belong to a version_group instead of
individual games, so paired versions (e.g. Red/Blue, Gold/Silver)
share the same route structure and boss battles. Route encounters
gain a game_id column to support game-specific encounter tables
within a shared route. Includes migration, updated seeds, API
changes, and frontend type updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:07:42 +01:00
5d54c00af0 Add tabbed UI for routes/bosses and boss export endpoint
Refactors AdminGameDetail to use tabs instead of stacked sections,
adds GET /export/games/{game_id}/bosses endpoint, and adds Export
button to the Boss Battles tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:52:18 +01:00
190b08eb26 Add boss battles, level caps, and badge tracking
Introduces full boss battle system: data models (BossBattle, BossPokemon,
BossResult), API endpoints for CRUD and per-run defeat tracking, and frontend
UI including a sticky level cap bar with badge display on the run page,
interleaved boss battle cards in the encounter list, and an admin panel
section for managing boss battles and their pokemon teams.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:16:13 +01:00
5cdcd149b6 Add export buttons to all admin panel screens
Backend export endpoints return DB data in seed JSON format
(games, routes+encounters, pokemon, evolutions). Frontend
downloads the JSON via new Export buttons on each admin page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 10:50:14 +01:00
d50d189114 Update seed data from latest fetch-pokeapi run
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 22:09:53 +01:00
1d1a1f1927 Populate Legends: Z-A Wild Zone 1-20 encounter data
Sourced from Bulbapedia. 147 encounters across 20 zones, using walk
method with overworld spawn rates. Excludes fixed alphas and event-only
spawns. Pumpkaboo (Zone 15) omitted as it's not yet in pokemon.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 22:05:49 +01:00
1884a085f3 Add Pokemon Legends: Z-A to the game list
Add version group entry with region_id 0 (no PokeAPI region) and region
"lumiose". The Go fetch tool now skips route fetching for region_id 0 so
manually provided data won't be overwritten by re-runs. Includes
placeholder data file and box art.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 21:56:50 +01:00
14ce0c1ce7 Fix migration down_revision to chain from pinwheel clause migration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 21:10:27 +01:00
ad1eb0524c Enforce Dupes Clause and Shiny Clause rules
Dupes Clause greys out Pokemon in the encounter modal whose evolution
family has already been caught, preventing duplicate selections. Shiny
Clause adds a dedicated Shiny Box and lets shiny catches bypass the
one-per-route lock via a new is_shiny column on encounters and a
/pokemon/families endpoint that computes evolution family groups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 21:08:25 +01:00
fb90410055 Add stats screen with backend endpoint and frontend page
Implements a dedicated /stats page showing cross-run aggregate statistics:
run overview with win rate, runs by game bar chart, encounter breakdowns,
top caught/encountered pokemon rankings, mortality analysis with death
causes, and type distribution. Backend endpoint uses aggregate SQL queries
to avoid N+1 fetching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 20:46:36 +01:00
78d31f2856 Add test data injection script with varied runs and encounters
Creates 6 runs across FireRed, Platinum, Emerald, HeartGold, Black, and
Crystal with mixed statuses (failed/completed/active), diverse encounter
states (caught/fainted/missed/evolved/dead), and varied rule configs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 20:35:59 +01:00