feat(game): trait outcome effects — extra haul item + recruit chance (#43)
This commit is contained in:
+8
-6
@@ -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) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user