breakout71/src/pure_functions.ts

8 lines
217 B
TypeScript
Raw Normal View History

export function clamp(value: number, min: number, max: number) {
2025-03-29 21:28:05 +01:00
return Math.max(min, Math.min(value, max));
}
export function comboKeepingRate(level: number) {
2025-03-29 21:28:05 +01:00
return clamp(1 - (1 / (1 + level)) * 1.5, 0, 1);
}