2026-02-14 16:41:24 +01:00
|
|
|
export function formatEvolutionMethod(evo: {
|
|
|
|
|
trigger: string
|
|
|
|
|
minLevel: number | null
|
|
|
|
|
item: string | null
|
|
|
|
|
heldItem: string | null
|
|
|
|
|
condition: string | null
|
|
|
|
|
}): string {
|
2026-02-08 14:03:43 +01:00
|
|
|
const parts: string[] = []
|
|
|
|
|
if (evo.trigger === 'level-up' && evo.minLevel) {
|
|
|
|
|
parts.push(`Level ${evo.minLevel}`)
|
|
|
|
|
} else if (evo.trigger === 'level-up') {
|
|
|
|
|
parts.push('Level up')
|
|
|
|
|
} else if (evo.trigger === 'use-item' && evo.item) {
|
2026-02-14 16:41:24 +01:00
|
|
|
parts.push(
|
|
|
|
|
evo.item.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())
|
|
|
|
|
)
|
2026-02-08 14:03:43 +01:00
|
|
|
} else if (evo.trigger === 'trade') {
|
|
|
|
|
parts.push('Trade')
|
|
|
|
|
} else {
|
2026-02-14 16:41:24 +01:00
|
|
|
parts.push(
|
|
|
|
|
evo.trigger.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())
|
|
|
|
|
)
|
2026-02-08 14:03:43 +01:00
|
|
|
}
|
|
|
|
|
if (evo.heldItem) {
|
2026-02-14 16:41:24 +01:00
|
|
|
parts.push(
|
|
|
|
|
`holding ${evo.heldItem.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())}`
|
|
|
|
|
)
|
2026-02-08 14:03:43 +01:00
|
|
|
}
|
|
|
|
|
if (evo.condition) {
|
|
|
|
|
parts.push(evo.condition)
|
|
|
|
|
}
|
|
|
|
|
return parts.join(', ')
|
|
|
|
|
}
|