zenno: use data from api
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user