hensei-web/src/lib/utils/uncap.ts
Justin Edmund 1fa6429749 summons: add creation page and section components
- /database/summons/new route with full form
- UncapSection with FLB/ULB/Transcendence cascade
- TaxonomySection with element and series
- StatsSection with HP/ATK at all uncap levels
- Nicknames via TagInput component
- getSummonMaxUncapLevel() utility function

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 03:00:58 -08:00

77 lines
2.1 KiB
TypeScript

/**
* Utility functions for character uncap calculations
*/
export interface UncapData {
flb: boolean
ulb: boolean
transcendence?: boolean
}
export interface CharacterUncapData {
special: boolean
uncap: UncapData
}
export interface SummonUncapData {
uncap: UncapData
}
/**
* Calculate the maximum uncap level for a character based on their uncap data
* @param special - Whether the character is special (limited/seasonal)
* @param flb - Whether the character has FLB (4th uncap)
* @param ulb - Whether the character has ULB (5th uncap)
* @returns The maximum uncap level
*/
export function getMaxUncapLevel(special: boolean, flb: boolean, ulb: boolean): number {
if (special) {
// Special characters: 3 base + FLB + ULB
return ulb ? 5 : flb ? 4 : 3
} else {
// Regular characters: 4 base + FLB + ULB/transcendence
return ulb ? 6 : flb ? 5 : 4
}
}
/**
* Calculate the maximum uncap level from character uncap data
* @param character - Character data with uncap information
* @returns The maximum uncap level
*/
export function getCharacterMaxUncapLevel(character: CharacterUncapData): number {
const { special, uncap } = character
return getMaxUncapLevel(special, uncap.flb, uncap.ulb)
}
/**
* Calculate the maximum uncap level from summon uncap data
* Summons: 3 base, +1 for FLB (4), +1 for ULB (5), transcendence stage tracked separately
* @param summon - Summon data with uncap information
* @returns The maximum uncap level
*/
export function getSummonMaxUncapLevel(summon: SummonUncapData): number {
const { uncap } = summon
if (uncap.ulb) return 5
if (uncap.flb) return 4
return 3
}
/**
* Get the default max uncap level for an item type (without transcendence)
* @param type - The type of item (character, weapon, or summon)
* @returns The default maximum uncap level
*/
export function getDefaultMaxUncapLevel(type: 'character' | 'weapon' | 'summon'): number {
switch (type) {
case 'character':
// Most characters can go to 5* (uncap level 5)
return 5
case 'weapon':
case 'summon':
// Weapons and summons typically max at 3* without transcendence
return 3
default:
return 3
}
}