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>
This commit is contained in:
@@ -15,6 +15,12 @@ interface BossBattleFormModalProps {
|
||||
onEditTeam?: () => void
|
||||
}
|
||||
|
||||
const POKEMON_TYPES = [
|
||||
'normal', 'fire', 'water', 'electric', 'grass', 'ice',
|
||||
'fighting', 'poison', 'ground', 'flying', 'psychic', 'bug',
|
||||
'rock', 'ghost', 'dragon', 'dark', 'steel', 'fairy',
|
||||
]
|
||||
|
||||
const BOSS_TYPES = [
|
||||
{ value: 'gym_leader', label: 'Gym Leader' },
|
||||
{ value: 'elite_four', label: 'Elite Four' },
|
||||
@@ -37,6 +43,7 @@ export function BossBattleFormModal({
|
||||
}: BossBattleFormModalProps) {
|
||||
const [name, setName] = useState(boss?.name ?? '')
|
||||
const [bossType, setBossType] = useState(boss?.bossType ?? 'gym_leader')
|
||||
const [specialtyType, setSpecialtyType] = useState(boss?.specialtyType ?? '')
|
||||
const [badgeName, setBadgeName] = useState(boss?.badgeName ?? '')
|
||||
const [badgeImageUrl, setBadgeImageUrl] = useState(boss?.badgeImageUrl ?? '')
|
||||
const [levelCap, setLevelCap] = useState(String(boss?.levelCap ?? ''))
|
||||
@@ -51,6 +58,7 @@ export function BossBattleFormModal({
|
||||
onSubmit({
|
||||
name,
|
||||
bossType,
|
||||
specialtyType: specialtyType || null,
|
||||
badgeName: badgeName || null,
|
||||
badgeImageUrl: badgeImageUrl || null,
|
||||
levelCap: Number(levelCap),
|
||||
@@ -83,7 +91,7 @@ export function BossBattleFormModal({
|
||||
</button>
|
||||
) : undefined}
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1">Name</label>
|
||||
<input
|
||||
@@ -109,6 +117,21 @@ export function BossBattleFormModal({
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1">Specialty</label>
|
||||
<select
|
||||
value={specialtyType}
|
||||
onChange={(e) => setSpecialtyType(e.target.value)}
|
||||
className="w-full px-3 py-2 border rounded-md dark:bg-gray-700 dark:border-gray-600 capitalize"
|
||||
>
|
||||
<option value="">None</option>
|
||||
{POKEMON_TYPES.map((t) => (
|
||||
<option key={t} value={t} className="capitalize">
|
||||
{t.charAt(0).toUpperCase() + t.slice(1)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
RuleBadges,
|
||||
ShinyBox,
|
||||
ShinyEncounterModal,
|
||||
TypeBadge,
|
||||
} from '../components'
|
||||
import { BossDefeatModal } from '../components/BossDefeatModal'
|
||||
import type {
|
||||
@@ -1097,6 +1098,9 @@ export function RunEncounters() {
|
||||
<span className="px-2 py-0.5 text-xs font-medium rounded-full bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300">
|
||||
{bossTypeLabel[boss.bossType] ?? boss.bossType}
|
||||
</span>
|
||||
{boss.specialtyType && (
|
||||
<TypeBadge type={boss.specialtyType} />
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
{boss.location} · Level Cap: {boss.levelCap}
|
||||
|
||||
@@ -141,6 +141,7 @@ export interface PokemonEncounterLocation {
|
||||
export interface CreateBossBattleInput {
|
||||
name: string
|
||||
bossType: string
|
||||
specialtyType?: string | null
|
||||
badgeName?: string | null
|
||||
badgeImageUrl?: string | null
|
||||
levelCap: number
|
||||
@@ -154,6 +155,7 @@ export interface CreateBossBattleInput {
|
||||
export interface UpdateBossBattleInput {
|
||||
name?: string
|
||||
bossType?: string
|
||||
specialtyType?: string | null
|
||||
badgeName?: string | null
|
||||
badgeImageUrl?: string | null
|
||||
levelCap?: number
|
||||
|
||||
@@ -145,6 +145,7 @@ export interface BossBattle {
|
||||
versionGroupId: number
|
||||
name: string
|
||||
bossType: BossType
|
||||
specialtyType: string | null
|
||||
badgeName: string | null
|
||||
badgeImageUrl: string | null
|
||||
levelCap: number
|
||||
|
||||
Reference in New Issue
Block a user