zenno/lib: style
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { AptitudeLevel, Mood, RunningStyle } from './race';
|
||||
import type { Runner } from './runner';
|
||||
|
||||
const aptitude_map = {
|
||||
const aptMap = {
|
||||
G: AptitudeLevel.G,
|
||||
F: AptitudeLevel.F,
|
||||
E: AptitudeLevel.E,
|
||||
@@ -11,9 +11,9 @@ const aptitude_map = {
|
||||
A: AptitudeLevel.A,
|
||||
S: AptitudeLevel.S,
|
||||
} as const;
|
||||
type AptitudeString = keyof typeof aptitude_map;
|
||||
type AptitudeString = keyof typeof aptMap;
|
||||
|
||||
const style_map = {
|
||||
const styleMap = {
|
||||
Nige: RunningStyle.FrontRunner,
|
||||
Sentou: RunningStyle.PaceChaser,
|
||||
Sasi: RunningStyle.LateSurger,
|
||||
@@ -29,7 +29,7 @@ export interface ImportUma {
|
||||
power: number;
|
||||
guts: number;
|
||||
wisdom: number;
|
||||
strategy: keyof typeof style_map;
|
||||
strategy: keyof typeof styleMap;
|
||||
distanceAptitude: AptitudeString;
|
||||
surfaceAptitude: AptitudeString;
|
||||
strategyAptitude: AptitudeString;
|
||||
@@ -55,23 +55,23 @@ export function load(obj: ImportUma, name?: string): Runner {
|
||||
return {
|
||||
name: name ?? '',
|
||||
chara_card_id: obj.outfitId !== '' ? parseInt(obj.outfitId) : 0,
|
||||
style: style_map[obj.strategy],
|
||||
style: styleMap[obj.strategy],
|
||||
mood: obj.mood,
|
||||
speed: obj.speed,
|
||||
stamina: obj.stamina,
|
||||
power: obj.power,
|
||||
guts: obj.guts,
|
||||
wit: obj.wisdom,
|
||||
sprint: aptitude_map[obj.aptitudes[0]],
|
||||
mile: aptitude_map[obj.aptitudes[1]],
|
||||
medium: aptitude_map[obj.aptitudes[2]],
|
||||
long: aptitude_map[obj.aptitudes[3]],
|
||||
front: aptitude_map[obj.aptitudes[4]],
|
||||
pace: aptitude_map[obj.aptitudes[5]],
|
||||
late: aptitude_map[obj.aptitudes[6]],
|
||||
end: aptitude_map[obj.aptitudes[7]],
|
||||
turf: aptitude_map[obj.aptitudes[8]],
|
||||
dirt: aptitude_map[obj.aptitudes[9]],
|
||||
sprint: aptMap[obj.aptitudes[0]],
|
||||
mile: aptMap[obj.aptitudes[1]],
|
||||
medium: aptMap[obj.aptitudes[2]],
|
||||
long: aptMap[obj.aptitudes[3]],
|
||||
front: aptMap[obj.aptitudes[4]],
|
||||
pace: aptMap[obj.aptitudes[5]],
|
||||
late: aptMap[obj.aptitudes[6]],
|
||||
end: aptMap[obj.aptitudes[7]],
|
||||
turf: aptMap[obj.aptitudes[8]],
|
||||
dirt: aptMap[obj.aptitudes[9]],
|
||||
skills: obj.skills.map((s) => parseInt(s)),
|
||||
unique_level: obj.uniqueLv,
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ export interface Runner {
|
||||
* @param base_uma Character card (trainee or uma) to use for aptitudes; otherwise all aptitudes are A
|
||||
* @returns Baseline runner
|
||||
*/
|
||||
export function new_runner(name?: string, base_uma?: Uma): Runner {
|
||||
export function newRunner(name?: string, base_uma?: Uma): Runner {
|
||||
return {
|
||||
name: name ?? '',
|
||||
chara_card_id: base_uma?.chara_card_id ?? 0,
|
||||
@@ -72,7 +72,7 @@ export function new_runner(name?: string, base_uma?: Uma): Runner {
|
||||
* @param name Name or memo to apply to the runner
|
||||
* @returns Imported runner, or null if import was not possible
|
||||
*/
|
||||
export function import_runner(obj: unknown, name?: string): Runner | null {
|
||||
export function importRunner(obj: unknown, name?: string): Runner | null {
|
||||
// TODO(zeph): check for keys that identify the uma source
|
||||
if (typeof obj === 'object') {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user