update: talent, state props

This commit is contained in:
Vick Scarlet
2026-08-16 20:06:16 +08:00
committed by 神戸小鳥
parent 85c871cec1
commit 32f703be0f
12 changed files with 534 additions and 192 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ export function random(max: number, min: number = 0, rng?: RNG): number {
}
export function pick<T>(items: T[], rng?: RNG) {
if (items.length === 0) return null
return items[random(items.length - 1, 0, rng)]
return items[random(items.length - 1, 0, rng)] ?? null
}
export type WeightItem<T> = [T, number]
export function pickWeight<T>(items: WeightItem<T>[], rng?: RNG) {