update: talent, state props

This commit is contained in:
Vick Scarlet
2026-08-02 17:36:04 +08:00
parent f60e279f62
commit b4177d7657
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) {