zenno: use data from api

This commit is contained in:
2026-06-05 14:31:10 -04:00
parent 871fd5fdcc
commit a848c8eb72
15 changed files with 369 additions and 322 deletions
+4 -5
View File
@@ -1,5 +1,3 @@
import globalJSON from '../../../../global/affinity.json';
/**
* Precomputed character pair and trio affinity.
*/
@@ -24,9 +22,10 @@ export interface Affinity {
affinity: number;
}
export const affinity = {
global: globalJSON as Affinity[],
} as const;
export async function affinity(): Promise<Affinity[]> {
const resp = await fetch('/api/global/affinity');
return resp.json();
}
export function lookup(aff: Affinity[], chara_a: number, chara_b: number, chara_c?: number): number {
const [a, b, c] = [chara_a, chara_b, chara_c ?? Infinity].sort((a, b) => a - b);