fix: utilGame format에서 한단계 다르게 차이나는 버그 수정
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import bs from 'binary-search';
|
||||
import { clamp } from 'lodash-es';
|
||||
|
||||
export const DexLevelMap: [number, string, string][] = [
|
||||
[0, 'navy', 'F-'],
|
||||
@@ -39,7 +38,7 @@ export type DexInfo = {
|
||||
|
||||
export function formatDexLevel(dex: number): DexInfo {
|
||||
const rawIdx = bs(DexLevelMap, dex, ([dexKey], needle) => dexKey - needle);
|
||||
const level = rawIdx >= 0 ? rawIdx : clamp(-(rawIdx + 1), 0, DexLevelMap.length - 1);
|
||||
const level = rawIdx >= 0 ? rawIdx : (~rawIdx) - 1;
|
||||
|
||||
const [, color, name] = DexLevelMap[level];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user