feat(game): trait outcome effects — extra haul item + recruit chance (#43)

This commit is contained in:
2026-10-04 21:04:24 +00:00
parent 92c2c26047
commit 39920b3e05
4 changed files with 190 additions and 14 deletions
+8 -6
View File
@@ -90,12 +90,14 @@ export function generateStartingCrew(rng: () => number): CrewMember[] {
return crew
}
// The exploration crew roll: with CREW_CHANCE a member is found and joins the ship. Draws
// from the SAME per-planet rng stream as the resource/part haul (called after it in
// save.ts), so the outcome stays deterministic per save+planet. `taken` is the current
// roster's names, keeping every name on the ship unique.
export function rollCrewMember(rng: () => number, taken: Set<string>): CrewMember | null {
if (rng() >= CREW_CHANCE) return null
// The exploration crew roll: with the given chance (defaults to CREW_CHANCE, matching
// RECRUIT_CHANCE_BASE in crew-costs) a member is found and joins the ship. Draws from the
// SAME per-planet rng stream as the resource/part haul (called after it in save.ts), so the
// outcome stays deterministic per save+planet. `taken` is the current roster's names, keeping
// every name on the ship unique. The chance is raised to RECRUIT_CHANCE_TALKER when the
// assigned team includes TALKS TO ANYONE (wired in save.ts, #43).
export function rollCrewMember(rng: () => number, taken: Set<string>, chance: number = CREW_CHANCE): CrewMember | null {
if (rng() >= chance) return null
const role = pick(rng, ROLES)
return { name: makeCrewName(rng, taken), role, traitGood: pick(rng, GOOD_TRAITS), traitBad: pick(rng, BAD_TRAITS) }
}