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>
This commit is contained in:
@@ -28,8 +28,10 @@ const typeColors: Record<string, string> = {
|
||||
}
|
||||
|
||||
export function PokemonCard({ encounter, showFaintLevel, onClick }: PokemonCardProps) {
|
||||
const { pokemon, route, nickname, catchLevel, faintLevel, deathCause } = encounter
|
||||
const { pokemon, currentPokemon, route, nickname, catchLevel, faintLevel, deathCause } = encounter
|
||||
const isDead = faintLevel !== null
|
||||
const displayPokemon = currentPokemon ?? pokemon
|
||||
const isEvolved = currentPokemon !== null
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -38,15 +40,15 @@ export function PokemonCard({ encounter, showFaintLevel, onClick }: PokemonCardP
|
||||
isDead ? 'opacity-60 grayscale' : ''
|
||||
} ${onClick ? 'cursor-pointer hover:ring-2 hover:ring-blue-400 transition-shadow' : ''}`}
|
||||
>
|
||||
{pokemon.spriteUrl ? (
|
||||
{displayPokemon.spriteUrl ? (
|
||||
<img
|
||||
src={pokemon.spriteUrl}
|
||||
alt={pokemon.name}
|
||||
src={displayPokemon.spriteUrl}
|
||||
alt={displayPokemon.name}
|
||||
className="w-16 h-16"
|
||||
/>
|
||||
) : (
|
||||
<div className="w-16 h-16 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center text-xl font-bold text-gray-600 dark:text-gray-300">
|
||||
{pokemon.name[0].toUpperCase()}
|
||||
{displayPokemon.name[0].toUpperCase()}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -55,17 +57,17 @@ export function PokemonCard({ encounter, showFaintLevel, onClick }: PokemonCardP
|
||||
className={`w-2 h-2 rounded-full shrink-0 ${isDead ? 'bg-red-500' : 'bg-green-500'}`}
|
||||
/>
|
||||
<span className="font-semibold text-gray-900 dark:text-gray-100 text-sm">
|
||||
{nickname || pokemon.name}
|
||||
{nickname || displayPokemon.name}
|
||||
</span>
|
||||
</div>
|
||||
{nickname && (
|
||||
<div className="text-xs text-gray-500 dark:text-gray-400">
|
||||
{pokemon.name}
|
||||
{displayPokemon.name}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex gap-1 mt-1">
|
||||
{pokemon.types.map((type) => (
|
||||
{displayPokemon.types.map((type) => (
|
||||
<span
|
||||
key={type}
|
||||
className={`px-1.5 py-0.5 rounded text-[10px] font-medium text-white ${typeColors[type] ?? 'bg-gray-500'}`}
|
||||
@@ -85,6 +87,12 @@ export function PokemonCard({ encounter, showFaintLevel, onClick }: PokemonCardP
|
||||
{route.name}
|
||||
</div>
|
||||
|
||||
{isEvolved && (
|
||||
<div className="text-[10px] text-gray-400 dark:text-gray-500 mt-0.5">
|
||||
Originally: {pokemon.name}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isDead && deathCause && (
|
||||
<div className="text-[10px] italic text-gray-400 dark:text-gray-500 mt-0.5 line-clamp-2">
|
||||
{deathCause}
|
||||
|
||||
Reference in New Issue
Block a user