Commit Graph

55 Commits

Author SHA1 Message Date
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
4fb6d43305 Add Pinwheel Clause support for zone-based encounters in route groups
Allows each sub-zone within a route group to have its own independent
encounter when the Pinwheel Clause rule is enabled (default on), instead
of the entire group sharing a single encounter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 20:22:36 +01:00
a65efa22da Add nullable region field to evolutions for regional form filtering
Regional evolutions (e.g., Pikachu → Alolan Raichu) only occur in specific
regions. This adds a nullable region column so the app can filter evolutions
by the game's region. When a regional evolution exists for a given trigger/item,
the non-regional counterpart is automatically hidden.

Full-stack: migration, model, schemas, API with region query param, seeder,
Go fetch tool, frontend types/API/hook/components, and admin form.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 20:05:07 +01:00
f57d4793f9 Regenerate seed data with Go fetch tool
Updated all game JSON files with data from the new Go-based PokeAPI
fetcher. Includes corrected encounter data and form identification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:44:14 +01:00
66ad41cf1c Replace Python fetch scripts with static special_encounters.json
Remove fetch_pokeapi.py and special_encounters.py (now handled by the
Go tool) and add special_encounters.json as the new config source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:44:10 +01:00
ab6c1adb1f Fix seeder crash on null game data and disable SQL logging by default
Skip games with null route data (Gen 8-9 have no PokeAPI encounters)
and silence SQLAlchemy echo unless --verbose/-v is passed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:43:09 +01:00
d168d99bba Separate PokeAPI ID from national dex for correct form identification
Pokemon forms (e.g., Alolan Rattata) had their PokeAPI ID (10091) stored as
national_dex, causing them to display incorrectly. This renames the unique
identifier to pokeapi_id and adds a real national_dex field shared between
forms and their base species, so Alolan Rattata correctly shows as #19.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 14:55:06 +01:00
cb027e5215 Extract version groups and route ordering to separate JSON files
Moves ~850 lines of inline data from fetch_pokeapi.py into
version_groups.json and route_order.json for easier editing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 14:35:30 +01:00
9cec9836b4 Add Pokemon form support to seeding (Alolan, regional variants, etc.)
Pokemon forms with dex IDs >= 10000 (e.g., Alolan Rattata = 10091) were
being collected in encounter data but missing from pokemon.json, causing
them to be silently dropped during DB seeding. Now fetch_all_pokemon()
also fetches form entries that appear in encounter data, with clean
display names like "Rattata (Alola)" and correct form-specific types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 14:32:13 +01:00
5edda2dba9 Improve UX with merged run view, method badges, grouped encounters, and mobile nav
Merges the run dashboard into the encounters page as a unified view at /runs/:runId,
adds encounter method grouping in the modal and badges on route rows, improves the
home page with recent runs, adds mobile hamburger nav, and polishes empty states.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 14:20:26 +01:00
9aca1806f6 Move starter Pokemon to dedicated route that appears first
Starters are now their own "Starter" route entry instead of being
merged into the location where you receive them (Pallet Town, New Bark
Town, Route 101). This makes them always appear first in the route
list for each game.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:53:40 +01:00
d488c252b8 Add starter, gift, and fossil encounters to seed data
Define special encounter data (starters, gifts, fossils) in a new
special_encounters module and merge them into route seed JSON during
generation. Add new route locations to ROUTE_ORDER for cities that
previously had no wild encounters (Saffron City, Pewter City, etc.).
Show colored method badges in the EncounterModal UI for special
encounter types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:50:49 +01:00
73d4a1831c Sort seed data routes by game progression instead of alphabetically
Add ROUTE_ORDER maps for Kanto (FRLG), Johto (HGSS), and Hoenn (Emerald)
progressions with aliases for related version groups. Add Export Order
button to admin game detail page for iterating on route orderings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:27:51 +01:00
110b864e95 Add ability to end a run as victory or defeat
Add End Run button to run dashboard with a confirmation modal offering
Victory/Defeat choice. Backend auto-sets completedAt timestamp and
validates only active runs can be ended. Ended runs show a completion
banner with date and duration, rename team to "Final Team", and hide
encounter logging and status change interactions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:12:56 +01:00
1f198aca4c Improve admin panel UX with toasts, evolution CRUD, sorting, drag-and-drop, and responsive layout
Add sonner toast notifications to all mutations, evolution management backend
(CRUD endpoints with search/pagination) and frontend (form modal with pokemon
selector, paginated list page), sortable AdminTable columns (Region/Gen/Year
on Games), drag-and-drop route reordering via @dnd-kit, skeleton loading states,
card-styled table wrappers, and responsive mobile nav in AdminLayout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:09:27 +01:00
Julian Tabel
f7f5417b6b Add all Gen 1-9 games with colors to seed data
- Add 37 games from Gen 1-9 (Red/Blue through Scarlet/Violet)
- Add color field to Game model matching box art/branding
- Add migration for games.color column
- Update fetch_pokeapi.py to fetch all games and output colors
- Update seed loader to upsert game colors
- Update frontend Game type to include color field

Games without PokeAPI encounter data (ORAS, Let's Go, Sword/Shield,
BDSP, Legends Arceus, Scarlet/Violet) have location structure but
empty encounter tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 11:46:10 +01:00
Julian Tabel
fce6756cc2 Seed all Pokemon species and add admin pagination
- Update fetch_pokeapi.py to import all 1025 Pokemon species instead of
  only those appearing in encounters
- Add paginated response for /pokemon endpoint with total count
- Add pagination controls to AdminPokemon page (First/Prev/Next/Last)
- Show current page and total count in admin UI
- Add bean for Pokemon forms support task
- Update UX improvements bean with route grouping polish item

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 11:19:05 +01:00
Julian Tabel
2aa60f0ace Add hierarchical route grouping for multi-area locations
Locations like Mt. Moon (with 1F, B1F, B2F floors) are now grouped so
only one encounter can be logged per location group, enforcing Nuzlocke
first-encounter rules correctly.

- Add parent_route_id column with self-referential FK to routes table
- Add parent/children relationships on Route model
- Update games API to return hierarchical route structure
- Add validation in encounters API to prevent parent route encounters
  and duplicate encounters within sibling routes (409 conflict)
- Update frontend with collapsible RouteGroup component
- Auto-derive route groups from PokeAPI location/location-area structure
- Regenerate seed data with 70 parent routes and 315 child routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 11:07:45 +01:00
9728773a94 Add pokemon evolution support across the full stack
- Evolution model with trigger, level, item, and condition fields
- Encounter.current_pokemon_id tracks evolved species separately
- Alembic migration for evolutions table and current_pokemon_id column
- Seed pipeline loads evolution data with manual overrides
- GET /pokemon/{id}/evolutions and PATCH /encounters/{id} endpoints
- Evolve button in StatusChangeModal with evolution method details
- PokemonCard shows evolved species with "Originally" label

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 19:26:49 +01:00
c8d8e4b445 Fix ambiguous foreign keys on Pokemon.encounters relationship
Encounter has two FKs to pokemon (pokemon_id and current_pokemon_id),
so the reverse relationship needs an explicit foreign_keys argument.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 19:20:19 +01:00
001ee98bb5 Rewrite fetch_pokeapi.py to read from local submodule instead of PokeAPI
Replace all pokebase API calls with local JSON file reads from the
PokeAPI/api-data git submodule, removing the network dependency and
pokebase package. The script now runs with stdlib Python only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 19:17:03 +01:00
55e6650e0e Add admin panel with CRUD endpoints and management UI
Add admin API endpoints for games, routes, pokemon, and route encounters
with full CRUD operations including bulk import. Build admin frontend
with game/route/pokemon management pages, navigation, and data tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:36:19 +01:00