@adatechnology/game-stories 0.2.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/life.json","../src/data/life-text.json","../src/data/sheet.json","../src/casting.ts","../src/chronicle.ts","../src/conditions.ts","../src/story/apply.ts","../src/text.ts","../src/life/life.ts","../src/story/beat.ts","../src/sheet/sheet.ts","../src/world.ts","../src/bench/module.ts","../src/bench/example.ts","../src/bench/locale.ts","../src/index.ts"],"sourcesContent":["{\n \"sources\": {\n \"file\": \"specs/001-migracao-entregas-dos-times/sources/sobreviventes__os-vivos-do-vale.js (site/pages/sobreviventes/os-vivos-do-vale.html)\",\n \"states\": \"LIVE (line 368) for living; life() alive (line 628) for active\",\n \"affinity\": \"life() aff, line 634: fam 80, ali 60, odio -60, seg 10, medo -20; unknown pairs 10 + ((empathy a + empathy b)/2 - 50)/5\",\n \"clocks\": \"life() step 1, lines 643-656: heal in 3 + floor(R·8) days, a bite turns in 2, the missing come back in 2 + floor(R·5) days with chance 0.6; birth with a midwife 3% mother / 5% baby, without 15% / 20%\",\n \"risk\": \"life() step 2, lines 660-668: base risk by place (REG, default 0.006), exposure by person (EXPO, default 0.3; newcomers 0.05 under 12, else 0.35), ×(1 - defence), ×1.5 under 2 days of food, ×2 hurt; draw < 0.5 hurt, < 0.8 bitten, < 0.95 dead, else missing\",\n \"bonds\": \"life() step 3, lines 671-692: from 16 years; drift ((empathy a + empathy c)/2 - 50)/120 + (food < 5 ? -(greed a + greed c)/250 : 0.1) + (R - 0.5)·3; quiet 2 days after news; couple from 18, at most 15 years apart, affinity 65, chance 3%, then 90; pregnancy with 8 days of food, mother up to 42, 2%, due in 45 days, no story beat in 20 days; adoption 1%; rivalry at -50; fight at -70 with courage 60, 20%, affinity -40, < 0.6 hurt (heal 3 + floor(R·5)), < 0.7 dead, else the less loyal leaves\",\n \"betrayal\": \"life() lines 694-697: loyalty < 35, greed > 60, food < 5, 3%; takes 4 days of food; affinity -40 with everyone of the base\",\n \"food\": \"life() step 4, line 701: each day -0.11 (by option per base), between 0 and 60\",\n \"caravan\": \"lines 703-708: a base under 5 days of food, a host base over 12, someone there with affinity 55, 12%; 5 days of food, affinity +10; 8% the carrier is hurt (heal in 4)\",\n \"raid\": \"lines 709-718: 3% a day, not within 10 days of the last, targets with 3 days of food, the weakest defence first with ±0.15 of noise; up to 5 days of food; a hero with courage 70 and affinity 60 arrives with chance 50%; else 25% dead; heal in 5; affinity +20\",\n \"arrivals\": \"step 5, lines 721-737: every 5 days, chance 0.5 (0.25 after day 60) of 1 + (30% 1 more); population cap 104 (CAP), 8 per base (ROOM); first names unique up to 30; age 18 + floor(R·42); personality 20 + R·70 (greed 10 + R·70); the bond from 16 years; affinity 75; 20% a partner (age max(18, age + floor(R·9) - 4)), 35% pregnant if up to 42, due in 10 + floor(R·30)\",\n \"fill\": \"simulate() O.fill, lines 746-749: up to 8 per base, age 18 + floor(R·40), personality 20 + R·70\",\n \"infection\": \"the bitten band and the turn are the apocalypse layer: off by default (normal world first), the bitten band then hurts\"\n },\n \"unknownAge\": 8,\n \"livingStates\": [\"ok\", \"hurt\", \"party\", \"hostile\", \"moved\"],\n \"activeStates\": [\"ok\", \"hurt\", \"moved\", \"hostile\"],\n \"affinity\": { \"family\": 80, \"trust\": 60, \"hatred\": -60, \"secret\": 10, \"fear\": -20 },\n \"rivalKind\": \"hatred\",\n \"unknownAffinity\": { \"base\": 10, \"divisor\": 5 },\n \"clocks\": { \"healBase\": 3, \"healSpread\": 8, \"turnDays\": 2, \"backBase\": 2, \"backSpread\": 5, \"backChance\": 0.6 },\n \"birth\": { \"motherWithMidwife\": 0.03, \"motherAlone\": 0.15, \"babyWithMidwife\": 0.05, \"babyAlone\": 0.2, \"girl\": 0.5 },\n \"risk\": {\n \"defaultPlace\": 0.006,\n \"defaultExposure\": 0.3,\n \"newcomerChild\": 0.05,\n \"newcomerAdult\": 0.35,\n \"childAge\": 12,\n \"hungryBelow\": 2,\n \"hungry\": 1.5,\n \"hurt\": 2,\n \"bands\": { \"hurt\": 0.5, \"bitten\": 0.8, \"dead\": 0.95 }\n },\n \"bonds\": {\n \"minAge\": 16,\n \"quietDays\": 2,\n \"driftEmpathy\": 120,\n \"lowFood\": 5,\n \"driftGreed\": 250,\n \"driftFed\": 0.1,\n \"driftNoise\": 3,\n \"coupleAge\": 18,\n \"coupleGap\": 15,\n \"coupleAffinity\": 65,\n \"coupleChance\": 0.03,\n \"coupledAffinity\": 90,\n \"pregnancyFood\": 8,\n \"pregnancyAge\": 42,\n \"pregnancyChance\": 0.02,\n \"pregnancyDays\": 45,\n \"pregnancyStoryWindow\": 20,\n \"adoptionChance\": 0.01,\n \"rivalryAt\": -50,\n \"fightAt\": -70,\n \"fightCourage\": 60,\n \"fightChance\": 0.2,\n \"afterFight\": -40,\n \"fightHurt\": 0.6,\n \"fightDead\": 0.7,\n \"fightHealSpread\": 5\n },\n \"betrayal\": { \"loyaltyBelow\": 35, \"greedAbove\": 60, \"foodBelow\": 5, \"chance\": 0.03, \"takes\": 4, \"affinity\": -40 },\n \"food\": { \"drift\": -0.11, \"max\": 60 },\n \"caravan\": { \"below\": 5, \"hostAbove\": 12, \"affinity\": 55, \"chance\": 0.12, \"carries\": 5, \"bond\": 10, \"hurtChance\": 0.08, \"healDays\": 4 },\n \"raid\": { \"chance\": 0.03, \"cooldown\": 10, \"targetFood\": 3, \"noise\": 0.3, \"loot\": 5, \"heroCourage\": 70, \"heroAffinity\": 60, \"heroChance\": 0.5, \"deadChance\": 0.25, \"healDays\": 5, \"heroBond\": 20 },\n \"arrivals\": {\n \"every\": 5,\n \"chance\": 0.5,\n \"lateChance\": 0.25,\n \"lateAfter\": 60,\n \"secondChance\": 0.3,\n \"cap\": 104,\n \"room\": 8,\n \"uniqueNames\": 30,\n \"ageBase\": 18,\n \"ageSpread\": 42,\n \"bondAge\": 16,\n \"bondAffinity\": 75,\n \"pairChance\": 0.2,\n \"pairAgeSpread\": 9,\n \"pairAgeShift\": 4,\n \"pregnantChance\": 0.35,\n \"pregnantDueBase\": 10,\n \"pregnantDueSpread\": 30\n },\n \"fill\": { \"perBase\": 8, \"ageBase\": 18, \"ageSpread\": 40 },\n \"personality\": { \"base\": 20, \"spread\": 70, \"greedBase\": 10 },\n \"infection\": false\n}\n","{\n \"sources\": {\n \"file\": \"specs/001-migracao-entregas-dos-times/sources/sobreviventes__os-vivos-do-vale.js (site/pages/sobreviventes/os-vivos-do-vale.html), life(), lines 619-739\",\n \"pt-BR\": \"the team's texts, verbatim; {name}, {a}, {b}... are the people's short names (NICK, short), {o} the gender ending (o(id))\",\n \"en\": \"translation of the pt-BR texts\"\n },\n \"pt-BR\": {\n \"titles\": {\n \"turn\": \"Reanima\", \"back\": \"Volta\", \"lost\": \"Sem volta\", \"birth\": \"Nascimento\", \"risk\": \"Risco\", \"bond\": \"Laço\", \"pregnancy\": \"Gravidez\", \"adoption\": \"Adoção\",\n \"rivalry\": \"Rixa\", \"fight\": \"Briga\", \"betrayal\": \"Traição\", \"caravan\": \"Entre bases\", \"raid\": \"Ataque\", \"arrival\": \"Chegada\"\n },\n \"notes\": {\n \"healed\": \"curado\",\n \"undead_street\": \"zumbi nomeado na rua\",\n \"undead_near\": \"zumbi nomeado perto de {place}\",\n \"came_back\": \"voltou depois de sumir\",\n \"came_back_short\": \"voltou\",\n \"never_back\": \"nunca voltou\",\n \"newborn\": \"recém-nascido\",\n \"childbirth\": \"no parto\",\n \"hurt_out\": \"ferido fora da base\",\n \"bitten_out\": \"mordido fora da base\",\n \"hides_bite\": \"esconde a mordida\",\n \"dead_out\": \"morto fora da base\",\n \"did_not_return\": \"não voltou\",\n \"missing_out\": \"sumiu numa saída\",\n \"missing_short\": \"sumiu\",\n \"fight_with\": \"briga com {other}\",\n \"fight\": \"briga\",\n \"dead_fight\": \"morto numa briga com {other}\",\n \"left_after_fight\": \"foi embora depois da briga\",\n \"betrayed\": \"roubou {from} e foi para {to}\",\n \"betrayed_short\": \"traiu a base\",\n \"hurt_caravan\": \"ferido na caravana\",\n \"caravan\": \"caravana\",\n \"hurt_raid\": \"ferido no ataque\",\n \"dead_raid\": \"morto no ataque de {from}\",\n \"raid\": \"ataque\",\n \"arrived\": \"chegou{origin}\",\n \"pair_of\": \"par de {first}\"\n },\n \"lines\": {\n \"loses\": \" {partner} perde {name}.\",\n \"turn\": \"{name} reanima e passa a vagar pela rotina antiga.\",\n \"back\": \"{name} aparece no portão, magro e sem as botas, depois de dias sumido.\",\n \"lost\": \"Acham as coisas de {name} numa vala da estrada.{loss}\",\n \"birth\": \"{name} dá à luz em {place}{help}.\",\n \"birth_help\": \" com ajuda de quem sabe\",\n \"birth_alone\": \", sem ninguém que saiba fazer parto\",\n \"baby_dies\": \" O bebê não respira. Enterram ao lado da base.\",\n \"baby_born\": \" Nasce {baby}.\",\n \"mother_dies\": \"{loss} {name} não resiste ao parto.\",\n \"risk_hurt\": \"{name} volta ferid{o} de uma saída perto de {place}.\",\n \"risk_bitten\": \"{name} volta com uma mordida no antebraço e não conta a ninguém.\",\n \"risk_dead\": \"{name} não volta de uma saída perto de {place}.{loss}\",\n \"risk_missing\": \"{name} some numa saída perto de {place}.\",\n \"couple\": \"{a} e {b} {line}.\",\n \"pregnancy\": \"{a} e {b} vão ter um bebê. Nasce em uns {days} dias de jogo.\",\n \"adoption\": \"{a} e {b} adotam {child}.\",\n \"rivalry\": \"{a} e {b} {line}. Viraram rivais.\",\n \"fight_hurt\": \"A rixa explode: {winner} quebra o nariz de {loser} no pátio.\",\n \"fight_dead\": \"A rixa termina com faca: {loser} morre e {winner} carrega a morte para o resto da vida.{loss}\",\n \"fight_leaves\": \"{name} junta as coisas e vai para {to} depois da briga com {other}.\",\n \"betrayal\": \"{name} some de madrugada com a comida da despensa e o rádio de {from}. Dias depois é visto em {to}.\",\n \"caravan\": \"Caravana: {carrier} atravessa a cidade com comida de {from} para {to}, onde mora {host}.\",\n \"caravan_hurt\": \" Na volta, {carrier} é atacad{o} na avenida e chega ferid{o}.\",\n \"raid\": \"{who} atacam {target} de madrugada e levam {loot} dias de comida.\",\n \"raid_hero\": \" {hero}, de {heroBase}, ouve os tiros e chega a tempo: {victim} sai só ferid{o}.\",\n \"raid_dead\": \"{loss} {victim} morre na porta.\",\n \"raid_grazed\": \" {victim} leva um tiro de raspão.\",\n \"arrival\": \"{first}, {relation} de {bond}, chega{origin}{note}.\",\n \"arrival_gone\": \" Vinha procurando {bond} e descobre que {bond} {fate}. Fica em {base}.\",\n \"arrival_party\": \" Pergunta por {bond} e descobre que está com o jogador. Fica em {base} esperando.\",\n \"arrival_found\": \" Encontra {bond} em {base} e fica.\",\n \"arrival_elsewhere\": \" Descobre que {bond} está em {where} e prefere ficar em {base}.\",\n \"arrival_pair_pregnant\": \" Vem com {pair}, e {mother} está grávida.\",\n \"arrival_pair\": \" Vem com {pair}.\"\n },\n \"pools\": {\n \"couple\": [\"começam a dividir o turno de vigia, e depois o colchão\", \"se beijam no telhado durante a rádio das 20h\", \"assumem o namoro na frente da base inteira\"],\n \"rivalry\": [\"brigam pela última lata de sardinha\", \"discutem aos gritos sobre quem dorme perto da porta\", \"se acusam de roubar ração\"]\n },\n \"fates\": { \"dead\": \"morreu\", \"undead\": \"virou um dos mortos\", \"left\": \"saiu do vale no ônibus\", \"missing\": \"sumiu\", \"bitten\": \"foi mordido\", \"other\": \"não está mais aqui\" },\n \"places\": { \"where_died\": \"onde morreu\", \"road\": \"a estrada\", \"open_field\": \"campo aberto\", \"nowhere\": \"lugar nenhum\" },\n \"gender\": { \"female\": \"a\", \"male\": \"o\" },\n \"honorifics\": [\"Dona\", \"Seu\", \"Dr.\", \"Tenente\", \"Sargento\", \"Soldado\", \"Pastora\", \"Cabo\", \"Capitão\", \"Major\"]\n },\n \"en\": {\n \"titles\": {\n \"turn\": \"Turns\", \"back\": \"Back\", \"lost\": \"Never back\", \"birth\": \"Birth\", \"risk\": \"Risk\", \"bond\": \"Bond\", \"pregnancy\": \"Pregnancy\", \"adoption\": \"Adoption\",\n \"rivalry\": \"Rivalry\", \"fight\": \"Fight\", \"betrayal\": \"Betrayal\", \"caravan\": \"Between bases\", \"raid\": \"Raid\", \"arrival\": \"Arrival\"\n },\n \"notes\": {\n \"healed\": \"healed\",\n \"undead_street\": \"named undead in the street\",\n \"undead_near\": \"named undead near {place}\",\n \"came_back\": \"came back after going missing\",\n \"came_back_short\": \"came back\",\n \"never_back\": \"never came back\",\n \"newborn\": \"newborn\",\n \"childbirth\": \"in childbirth\",\n \"hurt_out\": \"hurt outside the base\",\n \"bitten_out\": \"bitten outside the base\",\n \"hides_bite\": \"hides the bite\",\n \"dead_out\": \"dead outside the base\",\n \"did_not_return\": \"did not return\",\n \"missing_out\": \"went missing on a run\",\n \"missing_short\": \"missing\",\n \"fight_with\": \"fight with {other}\",\n \"fight\": \"fight\",\n \"dead_fight\": \"killed in a fight with {other}\",\n \"left_after_fight\": \"left after the fight\",\n \"betrayed\": \"robbed {from} and went to {to}\",\n \"betrayed_short\": \"betrayed the base\",\n \"hurt_caravan\": \"hurt on the caravan\",\n \"caravan\": \"caravan\",\n \"hurt_raid\": \"hurt in the raid\",\n \"dead_raid\": \"killed in the raid of {from}\",\n \"raid\": \"raid\",\n \"arrived\": \"arrived{origin}\",\n \"pair_of\": \"partner of {first}\"\n },\n \"lines\": {\n \"loses\": \" {partner} loses {name}.\",\n \"turn\": \"{name} comes back and wanders the old routine.\",\n \"back\": \"{name} shows up at the gate, thin and without boots, after days missing.\",\n \"lost\": \"They find {name}'s things in a ditch by the road.{loss}\",\n \"birth\": \"{name} gives birth at {place}{help}.\",\n \"birth_help\": \" with help from someone who knows how\",\n \"birth_alone\": \", with no one who knows how to deliver a baby\",\n \"baby_dies\": \" The baby does not breathe. They bury it beside the base.\",\n \"baby_born\": \" {baby} is born.\",\n \"mother_dies\": \"{loss} {name} does not survive the birth.\",\n \"risk_hurt\": \"{name} comes back hurt from a run near {place}.\",\n \"risk_bitten\": \"{name} comes back with a bite on the forearm and tells no one.\",\n \"risk_dead\": \"{name} does not come back from a run near {place}.{loss}\",\n \"risk_missing\": \"{name} goes missing on a run near {place}.\",\n \"couple\": \"{a} and {b} {line}.\",\n \"pregnancy\": \"{a} and {b} are going to have a baby. Due in about {days} days.\",\n \"adoption\": \"{a} and {b} adopt {child}.\",\n \"rivalry\": \"{a} and {b} {line}. They are rivals now.\",\n \"fight_hurt\": \"The rivalry blows up: {winner} breaks {loser}'s nose in the yard.\",\n \"fight_dead\": \"The rivalry ends with a knife: {loser} dies and {winner} carries that death for the rest of their life.{loss}\",\n \"fight_leaves\": \"{name} packs up and goes to {to} after the fight with {other}.\",\n \"betrayal\": \"{name} vanishes before dawn with the pantry's food and the radio of {from}. Days later they are seen at {to}.\",\n \"caravan\": \"Caravan: {carrier} crosses town with food from {from} to {to}, where {host} lives.\",\n \"caravan_hurt\": \" On the way back, {carrier} is attacked on the avenue and arrives hurt.\",\n \"raid\": \"{who} raid {target} before dawn and take {loot} days of food.\",\n \"raid_hero\": \" {hero}, from {heroBase}, hears the shots and arrives in time: {victim} is only hurt.\",\n \"raid_dead\": \"{loss} {victim} dies at the door.\",\n \"raid_grazed\": \" {victim} is grazed by a bullet.\",\n \"arrival\": \"{first}, {relation} of {bond}, arrives{origin}{note}.\",\n \"arrival_gone\": \" They were looking for {bond} and learn that {bond} {fate}. They stay at {base}.\",\n \"arrival_party\": \" They ask for {bond} and learn that they are with the player. They stay at {base}, waiting.\",\n \"arrival_found\": \" They find {bond} at {base} and stay.\",\n \"arrival_elsewhere\": \" They learn that {bond} is at {where} and would rather stay at {base}.\",\n \"arrival_pair_pregnant\": \" They come with {pair}, and {mother} is pregnant.\",\n \"arrival_pair\": \" They come with {pair}.\"\n },\n \"pools\": {\n \"couple\": [\"start sharing the watch, and then the mattress\", \"kiss on the roof during the 8 pm radio\", \"go public in front of the whole base\"],\n \"rivalry\": [\"fight over the last tin of sardines\", \"shout about who sleeps by the door\", \"accuse each other of stealing rations\"]\n },\n \"fates\": { \"dead\": \"died\", \"undead\": \"became one of the dead\", \"left\": \"left on the bus\", \"missing\": \"went missing\", \"bitten\": \"was bitten\", \"other\": \"is not here any more\" },\n \"places\": { \"where_died\": \"where they died\", \"road\": \"the road\", \"open_field\": \"the open field\", \"nowhere\": \"nowhere\" },\n \"gender\": { \"female\": \"\", \"male\": \"\" },\n \"honorifics\": [\"Mrs.\", \"Mr.\", \"Dr.\", \"Lieutenant\", \"Sergeant\", \"Private\", \"Pastor\", \"Corporal\", \"Captain\", \"Major\"]\n }\n}\n","{\n \"sources\": {\n \"page\": \"site/pages/zumbis-personagens/personagens.html, \\\"Memória e opinião\\\" and \\\"Modelo de dados\\\"\",\n \"memories\": \"\\\"Cada NPC guarda até 30 lembranças com peso e data\\\"; memorias: [{ evento, alvoId, peso, dia }] // máx 30\",\n \"opinion\": \"\\\"A opinião sobre cada jogador vai de −100 a +100 e decai devagar para o neutro. Em +60 o NPC aceita entrar no grupo; abaixo de −60 pode roubar, delatar a base a outro grupo ou atacar à noite.\\\"\",\n \"decayPerDay\": \"not in the document (\\\"decai devagar\\\"): 1 point a day is the kit's reversible default, listed as a question\",\n \"memoryDrop\": \"not in the document: past 30, the lightest memory goes (the oldest first on a tie), listed as a question\"\n },\n \"memories\": { \"max\": 30 },\n \"opinion\": { \"min\": -100, \"max\": 100, \"joins\": 60, \"hostile\": -60, \"decayPerDay\": 1 }\n}\n","import type { NamePools } from '@adatechnology/game-characters-people'\n\nimport lifeNumbers from './data/life.json'\nimport type { Person, Role, Story } from './types'\n\n/** Who plays each role, and everyone in the world after the casting (the people given, then the people it made). */\nexport type Casting = {\n readonly roles: Readonly<Record<string, string>>\n readonly people: readonly Person[]\n /** The role of a person the casting made, or the first role a given person plays. */\n readonly roleOf: (id: string) => string | undefined\n}\n\nexport type CastOptions = {\n readonly stories: readonly Story[]\n readonly people?: readonly Person[]\n readonly names: NamePools\n readonly random: () => number\n /** The base of a made person whose role names none and has no bond (default the first base of a given person, else 'nomad'). */\n readonly defaultBase?: string\n}\n\nconst fits = (person: Person, role: Role): boolean => {\n const needs = role.needs\n if (!needs) return true\n if (needs.sex && Boolean(person.female) !== (needs.sex === 'f')) return false\n if (needs.age && (person.age === undefined || person.age < needs.age[0] || person.age > needs.age[1])) return false\n if (needs.profession && (!person.profession || !needs.profession.includes(person.profession))) return false\n if (needs.base && person.base !== needs.base) return false\n if (needs.tags && !needs.tags.every((tag) => person.tags?.includes(tag))) return false\n return true\n}\n\n/**\n * Casts every story's roles at the world's creation (decision P9: who plays each role is drawn, so every game is different). A role the game pins\n * (`person`) is that person; another is drawn among the people not cast yet who fit its needs; with none (or `create`), a new person is made from the\n * name pools: the sex and age the role needs (else drawn as a newcomer's: half and half, 18 + 0..41 years), the bond's surname and base when the role\n * asks, the newcomer's personality draw. Roles with the same id in two stories are the same person: that is how stories cross.\n */\nexport function castStories(options: CastOptions): Casting {\n const R = options.random\n const pick = <T>(list: readonly T[]): T => list[Math.floor(R() * list.length)]!\n const people = [...(options.people ?? [])]\n const byId = new Map(people.map((person) => [person.id, person]))\n const roles: Record<string, string> = {}\n const made = new Map<string, string>()\n const taken = new Set<string>()\n const Q = lifeNumbers.personality\n const A = lifeNumbers.arrivals\n for (const story of options.stories) {\n for (const role of story.roles) {\n if (roles[role.id]) continue\n if (role.person) {\n if (!byId.has(role.person)) throw new Error(`game-stories: role \"${role.id}\" of \"${story.id}\" names \"${role.person}\", who is not among the people`)\n roles[role.id] = role.person\n taken.add(role.person)\n continue\n }\n const candidates = role.create ? [] : people.filter((person) => !taken.has(person.id) && !person.extra && fits(person, role))\n if (candidates.length > 0) {\n const chosen = pick(candidates)\n roles[role.id] = chosen.id\n taken.add(chosen.id)\n continue\n }\n const bond = role.bond ? byId.get(roles[role.bond.role] ?? '') : undefined\n const female = role.needs?.sex ? role.needs.sex === 'f' : R() < 0.5\n const first = pick(female ? options.names.female : options.names.male)\n const surname = role.bond?.sameSurname && bond ? bond.name.split(' ').filter((x) => !/[“”]/.test(x)).slice(-1)[0]! : pick(options.names.surnames)\n const range = role.needs?.age\n const age = range ? range[0] + Math.floor(R() * (range[1] - range[0] + 1)) : A.ageBase + Math.floor(R() * A.ageSpread)\n const base = role.needs?.base ?? (role.bond?.sameBase !== false && bond ? bond.base : (options.defaultBase ?? people[0]?.base ?? 'nomad'))\n const personality = [Q.base + R() * Q.spread, Q.base + R() * Q.spread, Q.base + R() * Q.spread, Q.greedBase + R() * Q.spread, Q.base + R() * Q.spread].map(Math.round)\n const person: Person = {\n id: role.id,\n name: `${first} ${surname}`,\n age,\n female,\n base,\n personality,\n role: role.id,\n generated: true,\n ...(role.needs?.profession?.length ? { profession: pick(role.needs.profession) } : {}),\n ...(role.tags ? { tags: role.tags } : {}),\n ...(bond ? { bond: bond.id } : {}),\n ...(role.bond?.relation ? { relation: role.bond.relation } : {}),\n }\n if (byId.has(person.id)) throw new Error(`game-stories: role \"${role.id}\" would make a person with the id of someone given`)\n people.push(person)\n byId.set(person.id, person)\n roles[role.id] = person.id\n taken.add(person.id)\n made.set(person.id, role.id)\n }\n }\n const firstRole = new Map<string, string>()\n for (const [role, id] of Object.entries(roles)) if (!firstRole.has(id)) firstRole.set(id, role)\n return { roles, people, roleOf: (id) => made.get(id) ?? firstRole.get(id) }\n}\n","import type { ChronicleEntry } from './types'\n\n/** The world's chronicle: every story beat and every rule of the life simulation that happened, in order. */\nexport type Chronicle = {\n readonly entries: readonly ChronicleEntry[]\n add(entry: ChronicleEntry): void\n /** The lines of one day. */\n onDay(day: number): readonly ChronicleEntry[]\n /** The lines about a person: those that name them or change them. */\n about(id: string): readonly ChronicleEntry[]\n /** The lines up to a day. */\n until(day: number): readonly ChronicleEntry[]\n /** Follows the new lines. Returns the unsubscribe function. */\n on(listener: (entry: ChronicleEntry) => void): () => void\n}\n\nexport function createChronicle(): Chronicle {\n const entries: ChronicleEntry[] = []\n const listeners = new Set<(entry: ChronicleEntry) => void>()\n return {\n entries,\n add(entry) {\n entries.push(entry)\n for (const listener of listeners) listener(entry)\n },\n onDay: (day) => entries.filter((entry) => entry.day === day),\n about: (id) => entries.filter((entry) => entry.people.includes(id) || entry.changes.some((change) => change.id === id)),\n until: (day) => entries.filter((entry) => entry.day <= day),\n on(listener) {\n listeners.add(listener)\n return () => void listeners.delete(listener)\n },\n }\n}\n","import type { Actions, Condition, Flags, ResolvedChange, StateId, States } from './types'\n\n/** What a condition is read against. `cast` turns a role into the id of the person who plays it. */\nexport type ConditionContext = {\n readonly states: States\n readonly flags: Flags\n readonly actions: Actions\n readonly cast: (role: string) => string\n /** The states that count as living (the team's `LIVE`). */\n readonly living: readonly StateId[]\n readonly values?: Readonly<Record<string, string | null>>\n /** Inside an `each`: the person being listed. */\n readonly self?: string\n readonly changes?: readonly ResolvedChange[]\n /** Whether a person's sheet keeps that entry (the casting and the stories use what each one lived). */\n readonly remembers?: (id: string, entry: string) => boolean\n}\n\nconst stateOf = (context: ConditionContext, role: string): StateId | undefined => context.states[context.cast(role)]?.state\n\n/** Evaluates a condition (see `Condition`). An unknown person is neither living nor in any state. */\nexport function holds(condition: Condition, context: ConditionContext): boolean {\n if ('all' in condition) return condition.all.every((c) => holds(c, context))\n if ('any' in condition) return condition.any.some((c) => holds(c, context))\n if ('not' in condition) return !holds(condition.not, context)\n if ('action' in condition) return Boolean(context.actions[condition.action])\n if ('flag' in condition) return Boolean(context.flags[condition.flag])\n if ('state' in condition) {\n const state = stateOf(context, condition.state)\n return state !== undefined && (typeof condition.is === 'string' ? state === condition.is : condition.is.includes(state))\n }\n if ('living' in condition) {\n const state = stateOf(context, condition.living)\n return state !== undefined && context.living.includes(state)\n }\n if ('base' in condition) return context.states[context.cast(condition.base)]?.base === condition.is\n if ('value' in condition) return Boolean(context.values?.[condition.value])\n if ('self' in condition) return context.self === context.cast(condition.self)\n if ('changed' in condition) return (context.changes ?? []).some((change) => change.id === context.cast(condition.changed))\n if ('remembers' in condition) return context.remembers?.(context.cast(condition.remembers), condition.entry) ?? false\n return false\n}\n","import type { ResolvedChange, StateId, States } from '../types'\n\n/** The states nothing changes back: the dead, and those who left the world. */\nexport const FINAL_STATES: readonly StateId[] = ['dead', 'left']\n\n/**\n * Applies a beat's changes (Os Vivos do Vale `apply`, lines 741-743): the dead and the gone do not come back, the undead only die; a change to the\n * player's party with no base moves the person to `playerBase`; otherwise the base stays unless the change names one.\n */\nexport function applyChanges(states: States, changes: readonly ResolvedChange[] | undefined, playerBase: string): void {\n for (const { id, state, note, base } of changes ?? []) {\n const current = states[id]\n if (!current) continue\n if (FINAL_STATES.includes(current.state)) continue\n if (current.state === 'undead' && state !== 'dead') continue\n states[id] = { state, note, base: base || (state === 'party' ? playerBase : current.base) }\n }\n}\n\n/** The life simulation's own change (`life`'s `set`, line 630): the same guard, the base kept unless one is given. */\nexport function setState(states: States, id: string, state: StateId, note: string, base?: string): void {\n const current = states[id]!\n if (FINAL_STATES.includes(current.state) || (current.state === 'undead' && state !== 'dead')) return\n states[id] = { state, note, base: base || current.base }\n}\n","/** Fills `{name}` holes of a template; a hole with no value stays empty. */\nexport const fillText = (template: string, values: Readonly<Record<string, string | number>>): string => template.replace(/\\{(\\w+)\\}/g, (_, key: string) => String(values[key] ?? ''))\n\nconst escape = (text: string): string => text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n\n/**\n * The name a text calls a person by (Os Vivos do Vale `short`, line 618): the quoted nickname (“Brasa”) if there is one, else the first name after an\n * honorific (Dona, Seu, Dr.…).\n */\nexport function shortName(name: string, honorifics: readonly string[]): string {\n const quoted = name.match(/“(.*?)”/)\n if (quoted) return quoted[1]!\n const prefix = honorifics.length > 0 ? new RegExp(`^(${honorifics.map(escape).join('|')}) `) : null\n return (prefix ? name.replace(prefix, '') : name).split(' ')[0]!\n}\n","import type { NamePools } from '@adatechnology/game-characters-people'\n\nimport { holds } from '../conditions'\nimport type { ConditionContext } from '../conditions'\nimport { setState } from '../story/apply'\nimport { fillText, shortName } from '../text'\nimport type { Actions, ChronicleEntry, Flags, Person, ResolvedChange, StateId, States } from '../types'\nimport type { LifeNumbers, LifeOptions, LifeRule, LifeText, LifeWorld } from './types'\n\n/** What the life simulation reads of the world around it. */\nexport type LifeHost = {\n readonly states: States\n readonly flags: Flags\n readonly actions: Actions\n /** The people the world started with (named or cast), by id, in order. */\n readonly people: Readonly<Record<string, Person>>\n /** The days on which each person has a story beat (the team's `EV.some(e => e.who.includes(id) && …)`). */\n readonly beatDays: (id: string) => readonly number[]\n readonly random: () => number\n readonly names: NamePools\n readonly numbers: LifeNumbers\n readonly text: LifeText\n readonly options: LifeOptions\n readonly log: (entry: ChronicleEntry) => void\n}\n\ntype Row = readonly [string, StateId, string, string?]\nconst toChanges = (rows: readonly Row[]): ResolvedChange[] => rows.map(([id, state, note, base]) => ({ id, state, note, ...(base ? { base } : {}) }))\n\n/** The world of the life simulation at its start (Os Vivos do Vale `world`, lines 619-622). */\nexport function createLifeWorld(options: LifeOptions, numbers: LifeNumbers): LifeWorld {\n const W: LifeWorld = {\n raid: {}, food: {}, defence: {}, affinity: {}, partner: {}, rival: {}, adopted: {}, timers: {}, made: {}, count: 0, lastNews: {},\n stats: { births: 0, arrivals: 0, deaths: 0, couples: 0, fights: 0, betrayals: 0, caravans: 0, raids: 0, pregnancies: 0 },\n usedNames: new Set(),\n }\n for (const [id, group] of Object.entries(options.groups)) {\n W.food[id] = group.food\n W.defence[id] = group.defence\n }\n W.defence[options.playerBase ?? 'player'] = 1\n for (const [a, b, kind] of options.relations ?? []) if (kind === numbers.rivalKind) W.rival[a < b ? `${a}|${b}` : `${b}|${a}`] = 1\n for (const [a, b] of options.couples ?? []) {\n W.partner[a] = b\n W.partner[b] = a\n }\n return W\n}\n\n/**\n * One day of the life simulation (Os Vivos do Vale `life(d, S, F, R, W, log)`, lines 623-739), rule by rule and draw by draw: the clocks (healing,\n * turning, coming back, giving birth), the daily risk, the bonds inside each base (couples, pregnancy, adoption, rivalry, fights, betrayal), food,\n * caravans and raids between bases, and the newcomers every few days.\n */\nexport function lifeDay(d: number, W: LifeWorld, host: LifeHost): void {\n const { states: S, flags: F, random: R, numbers: N, text: T, options: O } = host\n const nomad = O.nomadBase ?? 'nomad'\n const playerBase = O.playerBase ?? 'player'\n const closed = new Set([nomad, ...(O.closedBases ?? [])])\n const groups = O.groups\n const P = (id: string): Person => host.people[id] ?? W.made[id]!\n const age = (id: string): number => P(id).age ?? N.unknownAge\n const fem = (id: string): boolean => Boolean(P(id).female)\n const nm = (id: string): string => P(id).nick ?? shortName(P(id).name, T.honorifics)\n const o = (id: string): string => (fem(id) ? T.gender.female : T.gender.male)\n const pers = (id: string): readonly number[] => {\n const p = P(id).personality\n return p && p.some((v) => v) ? p : [50, 50, 50, 50, 50]\n }\n const groupName = (b: string | undefined, fallback: string): string => (b !== undefined && groups[b] ? groups[b]!.name : fallback)\n const conditionContext = (): ConditionContext => ({ states: S, flags: F, actions: host.actions, cast: (id) => id, living: N.livingStates })\n const anchorDays = (id: string, from: number, to: number): boolean => host.beatDays(id).some((day) => day > from && day <= to)\n const anchor = (id: string): boolean =>\n anchorDays(id, d, d + 7) || Boolean(W.timers[id]?.due) || (O.anchors ?? []).some((a) => a.id === id && d < a.beforeDay) || Boolean(W.made[id]?.baby)\n const alive = (id: string): boolean => N.activeStates.includes(S[id]!.state)\n const ids = Object.keys(S).filter((id) => alive(id) && age(id) > 0)\n const set = (id: string, state: StateId, note: string, base?: string): void => setState(S, id, state, note, base)\n const say = (rule: LifeRule, text: string, rows: readonly Row[], base: string | null | undefined, people: readonly string[]): void => {\n host.log({ day: d, kind: 'life', id: rule, title: T.titles[rule], text, changes: toChanges(rows), people, ...(base ? { base } : {}) })\n if (base) W.lastNews[base] = d\n }\n const kill = (id: string, note: string): string => {\n set(id, 'dead', note)\n W.stats.deaths++\n const p = W.partner[id]\n if (p && alive(p)) return fillText(T.lines.loses, { partner: nm(p), name: nm(id) })\n return ''\n }\n const cnt = (b: string): number => Object.keys(S).filter((id) => alive(id) && S[id]!.base === b).length\n const pop = (): number => Object.keys(S).filter((id) => alive(id) || S[id]!.state === 'party').length\n const key = (a: string, b: string): string => (a < b ? `${a}|${b}` : `${b}|${a}`)\n const aff = (a: string, b: string): number => {\n const k = key(a, b)\n if (W.affinity[k] === undefined) {\n const r = (O.relations ?? []).find((rel) => (rel[0] === a && rel[1] === b) || (rel[0] === b && rel[1] === a))\n W.affinity[k] = r ? (N.affinity as Record<string, number>)[r[2]]! : N.unknownAffinity.base + ((pers(a)[1]! + pers(b)[1]!) / 2 - 50) / N.unknownAffinity.divisor\n }\n return W.affinity[k]!\n }\n const addAff = (a: string, b: string, v: number): void => {\n const k = key(a, b)\n W.affinity[k] = Math.max(-100, Math.min(100, aff(a, b) + v))\n }\n const pick = <T>(a: readonly T[]): T => a[Math.floor(R() * a.length)]!\n const hostileNow = (): Record<string, boolean> => {\n const out: Record<string, boolean> = {}\n for (const [b, rule] of Object.entries(O.hostileBases ?? {})) out[b] = rule === true ? true : holds(rule, conditionContext())\n return out\n }\n const bestBase = (): string => {\n const H = hostileNow()\n const c = Object.keys(groups).filter((b) => !closed.has(b) && !H[b] && cnt(b) > 0 && cnt(b) < N.arrivals.room)\n c.sort((a, b) => W.food[b]! * (0.5 + W.defence[b]!) - W.food[a]! * (0.5 + W.defence[a]!))\n return c.length ? c[Math.floor(R() * Math.min(3, c.length))]! : nomad\n }\n const newPerson = (person: Omit<Person, 'id'>): string => {\n const id = `g${++W.count}`\n W.made[id] = { id, generated: true, ...person }\n S[id] = { state: 'ok', note: '', base: person.base }\n return id\n }\n const heal = (spread: number): number => d + N.clocks.healBase + Math.floor(R() * spread)\n\n for (const { flag, a, b } of O.flagCouples ?? []) {\n if (F[flag] && !W.partner[a] && !W.partner[b]) {\n W.partner[a] = b\n W.partner[b] = a\n }\n }\n\n // 1. clocks: healing, turning, coming back, giving birth\n for (const [id, t] of Object.entries(W.timers)) {\n if (t.heal === d && S[id]!.state === 'hurt') S[id]!.note = T.notes.healed\n if (t.heal === d && S[id]!.state === 'hurt') S[id]!.state = 'ok'\n if (t.turn === d && S[id]!.state === 'bitten') {\n const b = S[id]!.base\n set(id, 'undead', b === nomad ? T.notes.undead_street : fillText(T.notes.undead_near, { place: groupName(b, T.places.where_died) }))\n say('turn', fillText(T.lines.turn, { name: nm(id) }), [[id, 'undead', S[id]!.note]], S[id]!.base, [id])\n }\n if (t.back === d && S[id]!.state === 'missing') {\n if (R() < N.clocks.backChance) {\n set(id, 'ok', T.notes.came_back)\n say('back', fillText(T.lines.back, { name: nm(id) }), [[id, 'ok', T.notes.came_back_short]], null, [id])\n } else {\n const x = kill(id, T.notes.never_back)\n say('lost', fillText(T.lines.lost, { name: nm(id), loss: x }), [[id, 'dead', T.notes.never_back]], null, [id])\n }\n }\n if (t.due === d) {\n t.due = 0\n if (!alive(id)) continue\n const b = S[id]!.base\n const med = (O.midwives ?? []).some((m) => S[m] && alive(m) && S[m]!.base === b)\n const pm = med ? N.birth.motherWithMidwife : N.birth.motherAlone\n const pb = med ? N.birth.babyWithMidwife : N.birth.babyAlone\n const dad = t.father\n const sx = R() < N.birth.girl ? 'f' : 'm'\n const bn = sx === 'f' ? pick(host.names.babyFemale) : pick(host.names.babyMale)\n const momDies = R() < pm && !anchor(id)\n const babyDies = R() < pb\n let txt = fillText(T.lines.birth, { name: nm(id), place: groupName(b, T.places.open_field), help: med ? T.lines.birth_help : T.lines.birth_alone })\n const ch: Row[] = []\n const people = [id]\n if (babyDies) txt += T.lines.baby_dies\n else {\n const surname = P(id).name.split(' ').filter((x) => !/[“”]/.test(x)).slice(-1)[0]\n const bid = newPerson({ name: `${bn} ${surname}`, age: 0, base: b, female: sx === 'f', baby: true, mother: id, ...(dad ? { father: dad } : {}) })\n W.stats.births++\n txt += fillText(T.lines.baby_born, { baby: bn })\n ch.push([bid, 'ok', T.notes.newborn, b])\n people.push(bid)\n }\n if (momDies) {\n txt += fillText(T.lines.mother_dies, { loss: kill(id, T.notes.childbirth), name: nm(id) })\n ch.push([id, 'dead', T.notes.childbirth])\n }\n say('birth', txt, ch, b, people)\n }\n }\n for (const id of ids) {\n if (S[id]!.state === 'hurt' && !(W.timers[id] && W.timers[id]!.heal! > d)) {\n W.timers[id] = W.timers[id] || {}\n W.timers[id]!.heal = heal(N.clocks.healSpread)\n }\n }\n\n // 2. the daily risk\n for (const id of ids) {\n if (!alive(id) || anchor(id) || (W.made[id] && W.made[id]!.baby)) continue\n const b = S[id]!.base\n if (b === playerBase) continue\n const ex = W.made[id] ? (age(id) < N.risk.childAge ? N.risk.newcomerChild : N.risk.newcomerAdult) : (O.exposure?.[id] ?? N.risk.defaultExposure)\n let r = (O.placeRisk?.[b] ?? N.risk.defaultPlace) * ex * (1 - (W.defence[b] ?? 0)) * (W.food[b]! < N.risk.hungryBelow ? N.risk.hungry : 1) * (S[id]!.state === 'hurt' ? N.risk.hurt : 1)\n for (const [flag, factor] of Object.entries(O.riskFlags ?? {})) r *= F[flag] ? factor : 1\n if (R() >= r) continue\n const x = R()\n const where = groupName(b, T.places.road)\n const hurtBand = N.infection ? N.risk.bands.hurt : N.risk.bands.bitten\n if (x < hurtBand) {\n set(id, 'hurt', T.notes.hurt_out)\n W.timers[id] = { ...W.timers[id], heal: heal(N.clocks.healSpread) }\n say('risk', fillText(T.lines.risk_hurt, { name: nm(id), o: o(id), place: where }), [[id, 'hurt', T.notes.hurt_out]], null, [id])\n } else if (x < N.risk.bands.bitten) {\n set(id, 'bitten', T.notes.bitten_out)\n W.timers[id] = { ...W.timers[id], turn: d + N.clocks.turnDays }\n say('risk', fillText(T.lines.risk_bitten, { name: nm(id) }), [[id, 'bitten', T.notes.hides_bite]], b, [id])\n } else if (x < N.risk.bands.dead) {\n const t = kill(id, T.notes.dead_out)\n say('risk', fillText(T.lines.risk_dead, { name: nm(id), place: where, loss: t }), [[id, 'dead', T.notes.did_not_return]], b, [id])\n } else {\n set(id, 'missing', T.notes.missing_out)\n W.timers[id] = { ...W.timers[id], back: d + N.clocks.backBase + Math.floor(R() * N.clocks.backSpread) }\n say('risk', fillText(T.lines.risk_missing, { name: nm(id), place: where }), [[id, 'missing', T.notes.missing_short]], null, [id])\n }\n }\n\n // 3. bonds inside each base\n const B = N.bonds\n const by: Record<string, string[]> = {}\n for (const id of Object.keys(S)) {\n if (!alive(id) || age(id) < B.minAge) continue\n const b = S[id]!.base\n if (!b || b === playerBase || b === nomad) continue\n ;(by[b] = by[b] || []).push(id)\n }\n for (const [b, m] of Object.entries(by)) {\n const quiet = W.lastNews[b]! >= d - B.quietDays\n for (let i = 0; i < m.length; i++) {\n for (let j = i + 1; j < m.length; j++) {\n const a = m[i]!\n const c = m[j]!\n const pa = pers(a)\n const pc = pers(c)\n addAff(a, c, ((pa[1]! + pc[1]!) / 2 - 50) / B.driftEmpathy + (W.food[b]! < B.lowFood ? -(pa[3]! + pc[3]!) / B.driftGreed : B.driftFed) + (R() - 0.5) * B.driftNoise)\n const v = aff(a, c)\n const k = key(a, c)\n if (quiet || W.lastNews[b]! >= d) continue\n if (!W.partner[a] && !W.partner[c] && age(a) >= B.coupleAge && age(c) >= B.coupleAge && Math.abs(age(a) - age(c)) <= B.coupleGap && v >= B.coupleAffinity && R() < B.coupleChance) {\n W.partner[a] = c\n W.partner[c] = a\n W.affinity[k] = B.coupledAffinity\n W.stats.couples++\n say('bond', fillText(T.lines.couple, { a: nm(a), b: nm(c), line: pick(T.pools.couple) }), [], b, [a, c])\n continue\n }\n if (W.partner[a] === c && W.food[b]! >= B.pregnancyFood) {\n const f = fem(a) && !fem(c) ? a : fem(c) && !fem(a) ? c : null\n if (f && age(f) <= B.pregnancyAge && !W.timers[f]?.due && !(anchorDays(a, d, d + B.pregnancyStoryWindow) || anchorDays(c, d, d + B.pregnancyStoryWindow)) && R() < B.pregnancyChance) {\n W.timers[f] = { ...W.timers[f], due: d + B.pregnancyDays, father: f === a ? c : a }\n W.stats.pregnancies++\n say('pregnancy', fillText(T.lines.pregnancy, { a: nm(a), b: nm(c), days: B.pregnancyDays }), [], b, [a, c])\n continue\n }\n if (!f && !W.adopted[k] && R() < B.adoptionChance) {\n const orphan = Object.keys(S).find((x) => alive(x) && S[x]!.base === b && (O.orphans?.[x] !== undefined || (W.made[x]?.baby && !alive(W.made[x]!.mother!))))\n if (orphan) {\n W.adopted[k] = 1\n say('adoption', fillText(T.lines.adoption, { a: nm(a), b: nm(c), child: O.orphans?.[orphan] ?? nm(orphan) }), [], b, [a, c, orphan])\n continue\n }\n }\n }\n if (!W.rival[k] && v <= B.rivalryAt) {\n W.rival[k] = 1\n say('rivalry', fillText(T.lines.rivalry, { a: nm(a), b: nm(c), line: pick(T.pools.rivalry) }), [], b, [a, c])\n continue\n }\n if (W.rival[k] && v <= B.fightAt && Math.max(pa[0]!, pc[0]!) >= B.fightCourage && R() < B.fightChance) {\n W.stats.fights++\n W.affinity[k] = B.afterFight\n const x = R()\n const lo = pa[0]! < pc[0]! ? a : c\n const hi = lo === a ? c : a\n if (x < B.fightHurt && !anchor(lo)) {\n set(lo, 'hurt', fillText(T.notes.fight_with, { other: nm(hi) }))\n W.timers[lo] = { ...W.timers[lo], heal: heal(B.fightHealSpread) }\n say('fight', fillText(T.lines.fight_hurt, { winner: nm(hi), loser: nm(lo) }), [[lo, 'hurt', T.notes.fight]], b, [hi, lo])\n } else if (x < B.fightDead && !anchor(lo)) {\n const t = kill(lo, fillText(T.notes.dead_fight, { other: nm(hi) }))\n say('fight', fillText(T.lines.fight_dead, { loser: nm(lo), winner: nm(hi), loss: t }), [[lo, 'dead', T.notes.fight]], b, [hi, lo])\n } else {\n const out = pa[2]! < pc[2]! ? a : c\n const dest = bestBase()\n if (dest !== b && !anchor(out)) {\n set(out, 'moved', T.notes.left_after_fight, dest)\n say('fight', fillText(T.lines.fight_leaves, { name: nm(out), to: groupName(dest, dest), other: nm(out === a ? c : a) }), [[out, 'moved', groupName(dest, dest), dest]], b, [out, out === a ? c : a])\n }\n }\n }\n }\n }\n // betrayal\n const V = N.betrayal\n for (const id of m) {\n const p = pers(id)\n if (quiet || W.lastNews[b]! >= d || !alive(id) || anchor(id)) continue\n if (p[2]! < V.loyaltyBelow && p[3]! > V.greedAbove && W.food[b]! < V.foodBelow && R() < V.chance) {\n const dest = (O.traitorDestinations ?? []).find((t) => t.base !== b && (!t.when || holds(t.when, conditionContext())))?.base ?? nomad\n W.food[b] = Math.max(0, W.food[b]! - V.takes)\n W.stats.betrayals++\n set(id, host.people[id] ? 'hostile' : 'moved', fillText(T.notes.betrayed, { from: groupName(b, b), to: groupName(dest, dest) }), dest)\n for (const other of m) if (other !== id) addAff(id, other, V.affinity)\n say('betrayal', fillText(T.lines.betrayal, { name: nm(id), from: groupName(b, b), to: groupName(dest, dest) }), [[id, S[id]!.state, T.notes.betrayed_short, dest]], b, [id])\n }\n }\n }\n\n // 4. food, caravans and raids between bases\n for (const b of Object.keys(W.food)) {\n const rule = O.foodDrift?.[b]\n const drift = rule === undefined ? N.food.drift : typeof rule === 'number' ? rule : F[rule.flag] ? rule.value : N.food.drift\n W.food[b] = Math.max(0, Math.min(N.food.max, W.food[b]! + drift))\n }\n const H = hostileNow()\n const C = N.caravan\n for (const [b, m] of Object.entries(by)) {\n if (W.food[b]! >= C.below || W.lastNews[b]! >= d - B.quietDays) continue\n caravan: for (const x of m) {\n for (const [c, mc] of Object.entries(by)) {\n if (c === b || H[c] || W.food[c]! <= C.hostAbove) continue\n const y = mc.find((member) => aff(x, member) >= C.affinity)\n if (!y || R() >= C.chance) continue\n W.food[b]! += C.carries\n W.food[c]! -= C.carries\n addAff(x, y, C.bond)\n W.stats.caravans++\n let t = fillText(T.lines.caravan, { carrier: nm(y), from: groupName(c, c), to: groupName(b, b), host: nm(x) })\n const ch: Row[] = []\n if (R() < C.hurtChance && !anchor(y)) {\n set(y, 'hurt', T.notes.hurt_caravan)\n W.timers[y] = { ...W.timers[y], heal: d + C.healDays }\n t += fillText(T.lines.caravan_hurt, { carrier: nm(y), o: o(y) })\n ch.push([y, 'hurt', T.notes.caravan])\n }\n say('caravan', t, ch, b, [y, x])\n break caravan\n }\n }\n }\n const A = N.raid\n const raids = (O.raids ?? []).map((raid) => ({ ...raid, on: holds(raid.when, conditionContext()) }))\n for (const { from: src, on, who } of raids) {\n if (!on || R() >= A.chance || (W.raid[src] || 0) > d - A.cooldown) continue\n const alvo = Object.keys(by)\n .filter((b) => b !== src && !H[b] && !(O.raidImmune ?? []).includes(b) && W.food[b]! >= A.targetFood)\n .sort((a, b) => W.defence[a]! - W.defence[b]! + (R() - 0.5) * A.noise)[0]\n if (!alvo || W.lastNews[alvo]! >= d - B.quietDays) continue\n W.raid[src] = d\n const v = pick(by[alvo]!)\n W.stats.raids++\n const loot = Math.min(A.loot, W.food[alvo]!)\n W.food[alvo]! -= loot\n W.food[src] = (W.food[src] || 0) + loot\n const hero = Object.entries(by)\n .filter(([b]) => b !== alvo && !H[b])\n .flatMap(([, mm]) => mm)\n .find((h) => pers(h)[0]! >= A.heroCourage && by[alvo]!.some((other) => aff(h, other) >= A.heroAffinity))\n let t = fillText(T.lines.raid, { who, target: groupName(alvo, alvo), loot: Math.round(loot) })\n const ch: Row[] = []\n const people = [v]\n if (hero && R() < A.heroChance) {\n t += fillText(T.lines.raid_hero, { hero: nm(hero), heroBase: groupName(S[hero]!.base, S[hero]!.base), victim: nm(v), o: o(v) })\n set(v, 'hurt', T.notes.hurt_raid)\n W.timers[v] = { ...W.timers[v], heal: d + A.healDays }\n addAff(hero, v, A.heroBond)\n ch.push([v, 'hurt', T.notes.raid])\n people.push(hero)\n } else if (R() < A.deadChance && !anchor(v)) {\n t += fillText(T.lines.raid_dead, { loss: kill(v, fillText(T.notes.dead_raid, { from: groupName(src, src) })), victim: nm(v) })\n ch.push([v, 'dead', T.notes.raid])\n } else if (!anchor(v)) {\n set(v, 'hurt', T.notes.hurt_raid)\n W.timers[v] = { ...W.timers[v], heal: d + A.healDays }\n t += fillText(T.lines.raid_grazed, { victim: nm(v) })\n ch.push([v, 'hurt', T.notes.raid])\n }\n say('raid', t, ch, alvo, people)\n }\n\n // 5. newcomers\n const V = N.arrivals\n // a newcomer always comes for someone: a world with nobody of the bond age gets no newcomers\n const pool = Object.values(host.people).filter((x) => !x.extra && typeof x.age === 'number' && x.age >= V.bondAge)\n if (O.arrivals !== false && d % V.every === 0 && pool.length > 0) {\n const origins = O.arrivals?.origins?.length ? O.arrivals.origins : ['']\n let n = R() < (d > V.lateAfter ? V.lateChance : V.chance) ? 1 + (R() < V.secondChance ? 1 : 0) : 0\n while (n-- > 0 && pop() < V.cap) {\n const f = R() < 0.5\n let nome: string\n do nome = `${pick(f ? host.names.female : host.names.male)} ${pick(host.names.surnames)}`\n while (W.usedNames.has(nome.split(' ')[0]!) && W.usedNames.size < V.uniqueNames)\n const first = nome.split(' ')[0]!\n W.usedNames.add(first)\n const origem = pick(origins)\n const bond = pick(pool).id\n const rel = pick(host.names.kinship[f ? 'female' : 'male'])\n const st = S[bond]!.state\n const live = alive(bond) || st === 'party'\n const bondBase = S[bond]!.base\n const b = live && bondBase !== playerBase && bondBase !== nomad && !H[bondBase] && cnt(bondBase) < V.room ? bondBase : bestBase()\n const Q = N.personality\n const id = newPerson({\n name: nome,\n age: V.ageBase + Math.floor(R() * V.ageSpread),\n base: b,\n female: f,\n personality: [Q.base + R() * Q.spread, Q.base + R() * Q.spread, Q.base + R() * Q.spread, Q.greedBase + R() * Q.spread, Q.base + R() * Q.spread].map(Math.round),\n bond,\n relation: rel,\n })\n W.stats.arrivals++\n const way = origem ? ` ${origem}` : ''\n const note = (O.arrivals ? O.arrivals.notes ?? [] : []).filter((x) => x.origin === origem && holds(x.when, conditionContext())).map((x) => x.text).join('')\n let t = fillText(T.lines.arrival, { first, relation: rel, bond: nm(bond), origin: way, note })\n if (!live) {\n const fate = (T.fates as Record<string, string>)[st] ?? T.fates.other\n t += fillText(T.lines.arrival_gone, { bond: nm(bond), fate, base: groupName(b, b) })\n } else {\n t +=\n st === 'party'\n ? fillText(T.lines.arrival_party, { bond: nm(bond), base: groupName(b, b) })\n : b === S[bond]!.base\n ? fillText(T.lines.arrival_found, { bond: nm(bond), base: groupName(b, b) })\n : fillText(T.lines.arrival_elsewhere, { bond: nm(bond), where: groupName(S[bond]!.base, T.places.nowhere), base: groupName(b, b) })\n W.affinity[key(id, bond)] = V.bondAffinity\n }\n for (const a of O.arrivals ? O.arrivals.announcements ?? [] : []) if (holds(a.when, conditionContext())) t += a.text\n const arrived = fillText(T.notes.arrived, { origin: way })\n const ch: Row[] = [[id, 'ok', arrived, b]]\n const people = [id, bond]\n if (R() < V.pairChance && pop() < V.cap) {\n const pf = !f\n let n2: string\n do n2 = pick(pf ? host.names.female : host.names.male)\n while (W.usedNames.has(n2) && W.usedNames.size < V.uniqueNames)\n W.usedNames.add(n2)\n const surname = nome.split(' ').slice(-1)[0]\n const id2 = newPerson({\n name: `${n2} ${surname}`,\n age: Math.max(V.ageBase, W.made[id]!.age! + Math.floor(R() * V.pairAgeSpread) - V.pairAgeShift),\n base: b,\n female: pf,\n personality: [1, 2, 3, 4, 5].map(() => Math.round(Q.base + R() * Q.spread)),\n bond,\n relation: fillText(T.notes.pair_of, { first }),\n })\n W.stats.arrivals++\n W.partner[id] = id2\n W.partner[id2] = id\n ch.push([id2, 'ok', arrived, b])\n people.push(id2)\n const mae = pf ? id2 : id\n if (R() < V.pregnantChance && W.made[mae]!.age! <= B.pregnancyAge) {\n W.timers[mae] = { due: d + V.pregnantDueBase + Math.floor(R() * V.pregnantDueSpread), father: mae === id ? id2 : id }\n W.stats.pregnancies++\n t += fillText(T.lines.arrival_pair_pregnant, { pair: n2, mother: nm(mae) })\n } else t += fillText(T.lines.arrival_pair, { pair: n2 })\n }\n say('arrival', t, ch, null, people)\n }\n }\n}\n\n/** The fill of the team's page (`simulate(…, { fill })`, lines 746-749): ordinary people, round the open bases, until that many are living. */\nexport function fillWorld(W: LifeWorld, host: Pick<LifeHost, 'states' | 'random' | 'names' | 'numbers' | 'options'>, target: number): void {\n const { states: S, random: R, numbers: N, options: O } = host\n const closed = new Set([O.nomadBase ?? 'nomad', ...(O.closedBases ?? [])])\n const bases = Object.keys(O.groups).filter((b) => !closed.has(b))\n const living = (): string[] => Object.keys(S).filter((id) => N.livingStates.includes(S[id]!.state))\n let i = 0\n let idle = 0\n while (living().length < target && bases.length > 0) {\n const b = bases[i++ % bases.length]!\n if (living().filter((id) => S[id]!.base === b).length >= N.fill.perBase) {\n if (++idle >= bases.length) break\n continue\n }\n idle = 0\n const id = `g${++W.count}`\n const f = R() < 0.5\n const first = f ? host.names.female : host.names.male\n W.made[id] = {\n id,\n generated: true,\n name: `${first[W.count % first.length]} ${host.names.surnames[W.count % host.names.surnames.length]}`,\n age: N.fill.ageBase + Math.floor(R() * N.fill.ageSpread),\n base: b,\n female: f,\n personality: [1, 2, 3, 4, 5].map(() => Math.round(N.personality.base + R() * N.personality.spread)),\n }\n S[id] = { state: 'ok', note: '', base: b }\n }\n}\n","import { holds } from '../conditions'\nimport type { ConditionContext } from '../conditions'\nimport type { BeatOutcome, ChangeItem, CodeBeat, ResolvedChange, StoryBeat, TextPart } from '../types'\n\nexport type BeatContext = ConditionContext & {\n /** The people an `each` with `cast: true` goes through, in order (the people the game wrote, without the extras). */\n readonly castList: readonly string[]\n readonly nameOf: (id: string) => string\n readonly codeBeats?: Readonly<Record<string, CodeBeat>>\n}\n\nconst resolveChanges = (items: readonly ChangeItem[], context: BeatContext, out: ResolvedChange[]): void => {\n for (const item of items) {\n const here: BeatContext = { ...context, changes: out }\n if ('when' in item) {\n if (holds(item.when, here)) resolveChanges(item.changes, context, out)\n continue\n }\n if ('each' in item) {\n const { roles, cast, where, except } = item.each\n const ids = roles ? roles.map((role) => context.cast(role)) : cast ? context.castList : []\n const skip = new Set((except ?? []).map((role) => context.cast(role)))\n for (const id of ids) {\n if (skip.has(id) || !context.states[id]) continue\n // inside an `each`, the role `self` is the person being listed\n if (where && !holds(where, { ...here, self: id, cast: (role) => (role === 'self' ? id : context.cast(role)) })) continue\n out.push({ id, state: item.change.state, note: item.change.note, ...(item.change.base ? { base: item.change.base } : {}) })\n }\n continue\n }\n const id = context.cast(item.role)\n const base = item.base === undefined ? undefined : typeof item.base === 'string' ? item.base : context.states[context.cast(item.base.baseOf)]?.base\n out.push({ id, state: item.state, note: item.note, ...(base ? { base } : {}) })\n }\n}\n\nconst renderText = (parts: readonly TextPart[], context: BeatContext, changes: readonly ResolvedChange[], join: string | undefined): string => {\n const piece = (part: TextPart): string => {\n if (typeof part === 'string') return part\n if ('when' in part) {\n const chosen = holds(part.when, { ...context, changes }) ? part.text : part.else\n if (chosen === undefined) return ''\n return typeof chosen === 'string' ? chosen : renderText(chosen, context, changes, undefined)\n }\n if ('value' in part) return context.values?.[part.value] ?? ''\n if ('count' in part) return String(changes.length)\n return context.nameOf(context.cast(part.name))\n }\n const pieces = parts.map(piece)\n return join === undefined ? pieces.join('') : pieces.filter((text) => text !== '').join(join)\n}\n\n/**\n * Runs one beat against the world as it is (nothing is applied here): the named values, the first variant whose condition holds, its changes and its\n * text. Null when no variant holds, when the variant is `none`, or when it needs changes and has none. A beat with `run` calls the game's code beat.\n */\nexport function runBeat(beat: StoryBeat, context: BeatContext): BeatOutcome | null {\n if (beat.run) {\n const code = context.codeBeats?.[beat.run]\n if (!code) throw new Error(`game-stories: code beat \"${beat.run}\" of \"${beat.id}\" is not registered`)\n return code({ states: context.states, actions: context.actions, flags: context.flags, cast: context.cast })\n }\n const values: Record<string, string | null> = {}\n for (const [name, options] of Object.entries(beat.values ?? {})) values[name] = options.find((option) => !option.when || holds(option.when, context))?.value ?? null\n const here: BeatContext = { ...context, values }\n const variant = (beat.variants ?? []).find((v) => !v.when || holds(v.when, here))\n if (!variant || variant.none) return null\n const changes: ResolvedChange[] = []\n resolveChanges(variant.changes ?? [], here, changes)\n if (variant.needsChanges && changes.length === 0) return null\n return {\n text: renderText(variant.text ?? [], here, changes, variant.join),\n ...(variant.alt ? { alt: true } : {}),\n ...(variant.changes ? { changes } : {}),\n ...(variant.flags ? { flags: variant.flags } : {}),\n }\n}\n","import { SHEET_RULESET } from '@adatechnology/game-characters-people'\nimport type { SheetAttributeId, SheetRuleset } from '@adatechnology/game-characters-people'\n\nimport sheetNumbers from '../data/sheet.json'\n\nexport type SheetNumbers = Omit<typeof sheetNumbers, 'sources'>\n\n/** One thing the person lived: a decision, a story beat, an event of the world. Every one is kept (P13). */\nexport type SheetEntry = { readonly kind: 'decision' | 'story' | 'event'; readonly id: string; readonly day: number; readonly weight?: number; readonly about?: string }\n/** A memory (Personagens \"Memória e opinião\"): what happened, about whom, how much it weighs and when. */\nexport type Memory = { readonly id: string; readonly about?: string; readonly weight: number; readonly day: number }\n\nexport type SheetInput = {\n readonly profession?: string\n readonly attributes?: Partial<Record<SheetAttributeId, number>>\n readonly traits?: readonly string[]\n readonly personality?: readonly number[]\n readonly skills?: Readonly<Record<string, number>>\n}\n\nexport type CharacterSheet = {\n readonly profession: string\n readonly attributes: Readonly<Record<SheetAttributeId, number>>\n readonly traits: readonly string[]\n /** Skill levels: the profession's start, plus what was given. */\n readonly skills: Readonly<Record<string, number>>\n /** The milestones reached at the current skill levels. */\n milestones(skill: string): readonly number[]\n /** Points left in the point buy (Personagens `pool()`): base + profession + traits − spent. Negative means the sheet is over budget. */\n pool(): number\n /** Whether the sheet follows the point buy (attributes in range, points not over, no excluded traits together). */\n valid(): boolean\n /** Every derived value of the ruleset (`derived()`), by id. */\n derived(): Readonly<Record<string, number>>\n /** Courage, empathy, loyalty, greed, stability, 0..100. */\n readonly personality: readonly number[]\n readonly memories: readonly Memory[]\n /** What this person thinks of others, −100..100. */\n readonly opinions: Readonly<Record<string, number>>\n /** Everything the person lived, in order. */\n readonly history: readonly SheetEntry[]\n /** Keeps an entry; one with a weight is also a memory (the lightest, then the oldest, goes past the limit). */\n record(entry: SheetEntry): void\n /** Whether the person lived this entry id. */\n remembers(id: string): boolean\n /** Moves the opinion of someone by `delta`, inside −100..100. */\n opine(about: string, delta: number): number\n /** The opinions decay towards neutral by `days` (Personagens: \"decai devagar para o neutro\"). */\n decay(days: number): void\n /** What the opinion means: joins the group at +60, may rob, betray or attack below −60. */\n stance(about: string): 'joins' | 'hostile' | 'neutral'\n}\n\nexport type SheetOptions = SheetInput & { readonly ruleset?: SheetRuleset; readonly numbers?: Partial<SheetNumbers> }\n\n/** A character sheet on the Personagens ruleset (`game-characters-people` `SHEET_RULESET`), with the memory and opinion rules of the document. */\nexport function createSheet(options: SheetOptions = {}): CharacterSheet {\n const rules = options.ruleset ?? SHEET_RULESET\n const N = { ...sheetNumbers, ...options.numbers }\n const professionId = options.profession ?? rules.professions[rules.professions.length - 1]!.id\n const profession = rules.professions.find((p) => p.id === professionId)\n if (!profession) throw new Error(`game-stories: unknown profession \"${professionId}\"`)\n const attributes = Object.fromEntries(rules.attributes.map((a) => [a.id, options.attributes?.[a.id] ?? rules.pointBuy.start])) as Record<SheetAttributeId, number>\n const traits = [...(options.traits ?? [])]\n for (const id of traits) if (!rules.traits.some((t) => t.id === id)) throw new Error(`game-stories: unknown trait \"${id}\"`)\n const skills: Record<string, number> = { ...profession.skills }\n for (const [id, level] of Object.entries(options.skills ?? {})) skills[id] = (skills[id] ?? 0) + level\n const memories: Memory[] = []\n const opinions: Record<string, number> = {}\n const history: SheetEntry[] = []\n const has = (id: string): boolean => traits.includes(id)\n const traitPoints = (): number => traits.reduce((sum, id) => sum + rules.traits.find((t) => t.id === id)!.cost, 0)\n const spent = (): number => Object.values(attributes).reduce((sum, v) => sum + (v - rules.pointBuy.start), 0)\n const clampOpinion = (v: number): number => Math.max(N.opinion.min, Math.min(N.opinion.max, v))\n return {\n profession: professionId,\n attributes,\n traits,\n skills,\n milestones: (skill) => rules.milestoneLevels.map((level, index) => ((skills[skill] ?? 0) >= level ? index : -1)).filter((index) => index >= 0),\n pool: () => rules.pointBuy.pool + profession.points + traitPoints() - spent(),\n valid() {\n const inRange = Object.values(attributes).every((v) => v >= rules.pointBuy.min && v <= rules.pointBuy.max)\n const excluded = traits.some((id) => rules.traits.find((t) => t.id === id)!.excludes.some(has))\n return inRange && !excluded && this.pool() >= 0\n },\n derived() {\n const out: Record<string, number> = {}\n for (const rule of rules.derived) {\n let value = rule.base\n for (const [attribute, factor] of Object.entries(rule.per)) value += factor! * attributes[attribute as SheetAttributeId]\n for (const t of rule.traits) if (has(t.trait) && t.add !== undefined) value += t.add\n for (const t of rule.traits) if (has(t.trait) && t.mul !== undefined) value *= t.mul\n out[rule.id] = rule.scale === undefined ? value : value * rule.scale\n }\n return out\n },\n personality: options.personality ?? [50, 50, 50, 50, 50],\n memories,\n opinions,\n history,\n record(entry) {\n history.push(entry)\n if (entry.weight === undefined) return\n memories.push({ id: entry.id, weight: entry.weight, day: entry.day, ...(entry.about ? { about: entry.about } : {}) })\n while (memories.length > N.memories.max) {\n let drop = 0\n for (let i = 1; i < memories.length; i++) if (Math.abs(memories[i]!.weight) < Math.abs(memories[drop]!.weight)) drop = i\n memories.splice(drop, 1)\n }\n },\n remembers: (id) => history.some((entry) => entry.id === id),\n opine: (about, delta) => (opinions[about] = clampOpinion((opinions[about] ?? 0) + delta)),\n decay(days) {\n for (const [about, value] of Object.entries(opinions)) {\n const step = N.opinion.decayPerDay * days\n opinions[about] = value > 0 ? Math.max(0, value - step) : Math.min(0, value + step)\n }\n },\n stance(about) {\n const value = opinions[about] ?? 0\n return value >= N.opinion.joins ? 'joins' : value < N.opinion.hostile ? 'hostile' : 'neutral'\n },\n }\n}\n\n/**\n * A sheet drawn at a person's creation (P13: drawn on creation): the person's profession or one drawn, the pool spent one point at a time on an\n * attribute drawn among those under the maximum. No traits unless given.\n */\nexport function drawSheet(random: () => number, input: SheetInput & { readonly ruleset?: SheetRuleset } = {}): CharacterSheet {\n const rules = input.ruleset ?? SHEET_RULESET\n const profession = input.profession && rules.professions.some((p) => p.id === input.profession) ? input.profession : rules.professions[Math.floor(random() * rules.professions.length)]!.id\n const sheet = createSheet({ ...input, profession })\n const attributes = sheet.attributes as Record<SheetAttributeId, number>\n let left = sheet.pool()\n while (left > 0) {\n const open = rules.attributes.filter((a) => attributes[a.id] < rules.pointBuy.max)\n if (open.length === 0) break\n attributes[open[Math.floor(random() * open.length)]!.id] += 1\n left -= 1\n }\n return sheet\n}\n","import { createRng } from '@adatechnology/game-characters'\nimport { getNamePools } from '@adatechnology/game-characters-people'\nimport type { NamePools } from '@adatechnology/game-characters-people'\n\nimport { castStories } from './casting'\nimport type { Casting } from './casting'\nimport { createChronicle } from './chronicle'\nimport type { Chronicle } from './chronicle'\nimport lifeNumbers from './data/life.json'\nimport lifeText from './data/life-text.json'\nimport { createLifeWorld, fillWorld, lifeDay } from './life/life'\nimport type { LifeNumbers, LifeOptions, LifeText, LifeWorld } from './life/types'\nimport { drawSheet } from './sheet/sheet'\nimport type { CharacterSheet } from './sheet/sheet'\nimport { applyChanges } from './story/apply'\nimport { runBeat } from './story/beat'\nimport { shortName } from './text'\nimport type { Actions, CodeBeat, Flags, Person, StateId, States, Story, StoryBeat } from './types'\n\nexport type StoryWorldOptions = {\n readonly stories?: readonly Story[]\n /** The people the game wrote, in order (named people first; `extra` ones are left out of the newcomers' bonds). */\n readonly people?: readonly Person[]\n readonly names?: NamePools\n /** The seed of the world's stream (default 1). The life simulation draws from it as the team's page draws from `rng(seed)`. */\n readonly seed?: number\n /** The life simulation's own stream, instead of `createRng(seed)` (a game with one stream for everything passes it). */\n readonly random?: () => number\n /** The life simulation; without it only the stories happen (the team's page without \"vale vivo\"). */\n readonly life?: LifeOptions\n /** Fills the world with ordinary people up to this many living ones (the team's `fill`). Needs `life`. */\n readonly fill?: number\n /** Code beats the game registers, by id (a beat with `run`). */\n readonly codeBeats?: Readonly<Record<string, CodeBeat>>\n /** The base of the people who join the player (default the life simulation's `playerBase`, else 'player'). */\n readonly playerBase?: string\n /** The player's actions at the start (more come through `act`). */\n readonly actions?: Actions\n readonly locale?: string\n}\n\nexport type StoryWorld = {\n readonly states: States\n readonly flags: Flags\n readonly actions: Actions\n readonly casting: Casting\n readonly chronicle: Chronicle\n /** The life simulation's world (food, affinities, partners, the people it made), or null without `life`. */\n readonly life: LifeWorld | null\n /** The last day run (0 before the first). */\n readonly day: number\n /** The person, given, cast or made by the life simulation. */\n person(id: string): Person | undefined\n /** Everyone, in the order they came into the world. */\n people(): readonly Person[]\n /** The short name the texts use. */\n nameOf(id: string): string\n /** The person who plays a role. */\n cast(role: string): string\n /** A player action: from now on the stories see it. */\n act(id: string): void\n /** Runs the next day: that day's beats of every story, in order, then a day of the life simulation. */\n advance(): void\n /** Runs days up to `day`. */\n runTo(day: number): void\n /** The person's sheet (drawn on first ask from the person's own stream: the same world, the same sheet). */\n sheet(id: string): CharacterSheet\n}\n\nconst hashId = (text: string): number => {\n let hash = 0x811c9dc5\n for (let i = 0; i < text.length; i++) hash = Math.imul(hash ^ text.charCodeAt(i), 0x01000193)\n return hash >>> 0\n}\n\n/** The text table of a locale with a game's patch over it. */\nexport const lifeTextOf = (locale: string, patch?: LifeOptions['text']): LifeText => {\n const table = (lifeText as unknown as Record<string, LifeText>)[locale] ?? lifeText['pt-BR']\n if (!patch) return table\n const out: Record<string, unknown> = { ...table }\n for (const [key, value] of Object.entries(patch)) out[key] = Array.isArray(value) ? value : { ...(table as Record<string, object>)[key], ...value }\n return out as LifeText\n}\n\nconst mergeNumbers = (base: Record<string, unknown>, patch: Record<string, unknown> | undefined): Record<string, unknown> => {\n if (!patch) return base\n const out: Record<string, unknown> = { ...base }\n for (const [key, value] of Object.entries(patch)) {\n out[key] = value !== null && typeof value === 'object' && !Array.isArray(value) ? mergeNumbers(base[key] as Record<string, unknown>, value as Record<string, unknown>) : value\n }\n return out\n}\n\n/** The life numbers with a game's patch over them. */\nexport const lifeNumbersOf = (patch?: LifeOptions['numbers']): LifeNumbers => {\n const { sources: _sources, ...defaults } = lifeNumbers\n void _sources\n return mergeNumbers(defaults, patch as Record<string, unknown> | undefined) as unknown as LifeNumbers\n}\n\n/**\n * A world of stories (Os Vivos do Vale `simulate`, lines 744-756, made generic): the stories cast at creation, then day by day every story's beats of\n * that day in order (each beat's changes applied, its flags raised, its line in the chronicle) and a day of the life simulation. What each person\n * lived goes into their sheet, so the next stories can read it.\n */\nexport function createStoryWorld(options: StoryWorldOptions = {}): StoryWorld {\n const seed = options.seed ?? 1\n const locale = options.locale ?? 'pt-BR'\n const names = options.names ?? getNamePools(locale)\n const stories = options.stories ?? []\n const castRandom = createRng((seed ^ 0x9e3779b9) >>> 0)\n const casting = castStories({ stories, ...(options.people ? { people: options.people } : {}), names, random: castRandom, ...(options.life?.nomadBase ? { defaultBase: options.life.nomadBase } : {}) })\n const given = Object.fromEntries(casting.people.map((person) => [person.id, person]))\n const numbers = lifeNumbersOf(options.life?.numbers)\n const text = lifeTextOf(locale, options.life?.text)\n const states: States = {}\n for (const person of casting.people) states[person.id] = { state: person.start?.state ?? 'ok', note: person.start?.note ?? '', base: person.base }\n const flags: Flags = {}\n const actions: Record<string, unknown> = { ...options.actions }\n const chronicle = createChronicle()\n const cast = (role: string): string => casting.roles[role] ?? role\n const beats: StoryBeat[] = stories.flatMap((story) => story.beats).map((beat, order) => ({ beat, order })).sort((a, b) => a.beat.day - b.beat.day || a.order - b.order).map(({ beat }) => beat)\n const beatDays = new Map<string, number[]>()\n for (const beat of beats) for (const role of beat.roles) (beatDays.get(cast(role)) ?? beatDays.set(cast(role), []).get(cast(role))!).push(beat.day)\n const random = options.random ?? createRng(seed)\n const life = options.life ? createLifeWorld(options.life, numbers) : null\n const sheets = new Map<string, CharacterSheet>()\n const castList = casting.people.filter((person) => !person.extra).map((person) => person.id)\n const person = (id: string): Person | undefined => given[id] ?? life?.made[id]\n const nameOf = (id: string): string => {\n const p = person(id)\n return p ? (p.nick ?? shortName(p.name, text.honorifics)) : id\n }\n const sheet = (id: string): CharacterSheet => {\n let made = sheets.get(id)\n if (!made) {\n const p = person(id)\n made = drawSheet(createRng((seed ^ hashId(id)) >>> 0), { ...(p?.profession ? { profession: p.profession } : {}), ...(p?.personality ? { personality: p.personality } : {}) })\n sheets.set(id, made)\n }\n return made\n }\n const living = numbers.livingStates as readonly StateId[]\n const playerBase = options.playerBase ?? options.life?.playerBase ?? 'player'\n let day = 0\n let next = 0\n\n if (life && options.fill) fillWorld(life, { states, random, names, numbers, options: options.life! }, options.fill)\n\n const log = (entry: Parameters<Chronicle['add']>[0]): void => {\n chronicle.add(entry)\n for (const id of entry.people) if (person(id)) sheet(id).record({ kind: entry.kind === 'story' ? 'story' : 'event', id: entry.id, day: entry.day })\n }\n\n const world: StoryWorld = {\n states,\n flags,\n actions,\n casting,\n chronicle,\n life,\n get day() {\n return day\n },\n person,\n people: () => [...casting.people, ...Object.values(life?.made ?? {})],\n nameOf,\n cast,\n act(id) {\n actions[id] = 1\n },\n advance() {\n day += 1\n const d = day\n while (next < beats.length && beats[next]!.day === d) {\n const beat = beats[next++]!\n const outcome = runBeat(beat, { states, flags, actions, cast, living, castList, nameOf, remembers: (id, entry) => sheet(id).remembers(entry), ...(options.codeBeats ? { codeBeats: options.codeBeats } : {}) })\n if (!outcome) continue\n applyChanges(states, outcome.changes, playerBase)\n Object.assign(flags, outcome.flags ?? {})\n log({ day: d, kind: 'story', id: beat.id, title: beat.title, text: outcome.text, ...(outcome.alt ? { alt: true } : {}), changes: outcome.changes ?? [], people: beat.roles.map(cast) })\n }\n while (next < beats.length && beats[next]!.day < d) next++\n if (life) lifeDay(d, life, { states, flags, actions, people: given, beatDays: (id) => beatDays.get(id) ?? [], random, names, numbers, text, options: options.life!, log })\n },\n runTo(target) {\n while (day < target) world.advance()\n },\n sheet,\n }\n return world\n}\n\n/** Runs a world `days` days (the team's `simulate(day, A, O)`). */\nexport function simulateStories(days: number, options: StoryWorldOptions = {}): StoryWorld {\n const world = createStoryWorld(options)\n world.runTo(days)\n return world\n}\n","import { getProfession } from '@adatechnology/game-characters-people'\nimport type { BenchChange, BenchSheet, ModuleControl, ModuleHost, ModuleMetric, ModuleScenario, TestableModule } from '@adatechnology/game-contracts'\n\nimport type { LifeOptions } from '../life/types'\nimport { createSheet } from '../sheet/sheet'\nimport type { Person, StateId, Story } from '../types'\nimport { createStoryWorld } from '../world'\nimport type { StoryWorld, StoryWorldOptions } from '../world'\nimport { STORIES_EXAMPLE } from './example'\nimport { storiesBenchTextOf } from './locale'\n\n/** What the bench runs: people, stories, the player's actions it offers and the life simulation. */\nexport type StoriesContent = {\n readonly people?: readonly Person[]\n readonly stories: readonly Story[]\n readonly actions?: readonly { readonly id: string; readonly name: string }[]\n readonly life?: LifeOptions\n readonly fill?: number\n readonly playerBase?: string\n /** How many days the scenarios run (default 90). */\n readonly days?: number\n /** The kit's own example content (not a game's). */\n readonly example?: boolean\n}\n\nexport type StoriesTestModuleOptions = { readonly content?: StoriesContent; readonly locale?: string; readonly seed?: number }\n\nexport interface StoriesScenarioLike {\n expect(condition: boolean, label: string, data?: Record<string, unknown>): void\n}\n\nexport type StoriesTestModule = TestableModule<StoriesScenarioLike> & {\n /** The world as the bench left it (seed, day, actions). */\n readonly world: StoryWorld\n /** Swaps the content (a game's stories, the zombiada slice) and starts again. */\n load(content: StoriesContent): void\n}\n\nexport const STORIES_AREA_ID = 'stories_area'\n/** The day slider goes up to a year, whatever the content. */\nconst MAX_DAYS = 365\n\nconst actionControl = (id: string): string => `act_${id.toLowerCase().replace(/[^a-z0-9]+/g, '_')}`\n\n/**\n * The stories area of a test room, against the generic contracts only, with no 3D: the seed and the day slider run a world of stories, the chronicle\n * of the day and one person's character sheet go to the host's sheet panel. The player's actions are switches. The kit ships two tiny example stories\n * (marked `example`); `load` takes a game's own content.\n */\nexport function createStoriesTestModule(options: StoriesTestModuleOptions = {}): StoriesTestModule {\n const locale = options.locale ?? 'pt-BR'\n const text = storiesBenchTextOf(locale)\n let content: StoriesContent = options.content ?? STORIES_EXAMPLE[locale === 'en' ? 'en' : 'pt-BR']\n const settings = { seed: options.seed ?? 1, day: Math.min(30, content.days ?? 90), life: true, infection: false, person: '' }\n let actions: Record<string, number> = {}\n let host: ModuleHost | null = null\n\n const worldOptions = (seed: number, withLife: boolean, infection: boolean, acts: Record<string, number>): StoryWorldOptions => {\n const life = withLife && content.life ? { ...content.life, numbers: { ...content.life.numbers, infection } } : undefined\n return {\n stories: content.stories,\n ...(content.people ? { people: content.people } : {}),\n seed,\n ...(life ? { life } : {}),\n ...(life && content.fill ? { fill: content.fill } : {}),\n ...(content.playerBase ? { playerBase: content.playerBase } : {}),\n actions: acts,\n locale,\n }\n }\n const run = (seed: number, day: number, withLife = settings.life, infection = settings.infection, acts: Record<string, number> = actions): StoryWorld => {\n const made = createStoryWorld(worldOptions(seed, withLife, infection, acts))\n made.runTo(day)\n return made\n }\n let world = run(settings.seed, settings.day)\n\n const personOptions = () =>\n world\n .people()\n .filter((p) => !p.extra || world.states[p.id]?.state !== 'unborn')\n .map((p) => ({ id: p.id, name: p.name }))\n const groupName = (base: string): string => content.life?.groups[base]?.name ?? base\n\n const showSheet = (): void => {\n if (!host?.bench?.sheet) return\n const id = settings.person && world.person(settings.person) ? settings.person : (personOptions()[0]?.id ?? '')\n const person = world.person(id)\n if (!person) {\n host.bench.sheet(null)\n return\n }\n const sheet = world.sheet(id)\n const derived = sheet.derived()\n const state = world.states[id]\n const lived = world.chronicle.about(id)\n const card: BenchSheet = {\n kicker: `${text.sheet.kicker} · ${text.sheet.day} ${world.day}`,\n title: person.name,\n ...(state?.note ? { body: state.note } : {}),\n facts: [\n { label: text.sheet.state, value: state ? text.states[state.state as StateId] : '' },\n { label: text.sheet.base, value: state ? groupName(state.base) : '' },\n ...(person.age !== undefined ? [{ label: text.sheet.age, value: String(person.age) }] : []),\n { label: text.sheet.profession, value: getProfession(sheet.profession)?.name[locale === 'en' ? 'en' : 'pt-BR'] ?? sheet.profession },\n { label: text.sheet.pool, value: String(sheet.pool()) },\n ...Object.entries(derived).map(([key, value]) => ({ label: text.derived[key as keyof typeof text.derived] ?? key, value: String(Math.round(value * 100) / 100) })),\n ],\n steps: lived.length > 0 ? lived.slice(-8).map((entry) => ({ at: `${text.sheet.day} ${entry.day}`, text: `${entry.title}: ${entry.text}` })) : [{ at: '', text: text.sheet.none }],\n }\n host.bench.sheet(card)\n }\n\n const rebuild = (): void => {\n world = run(settings.seed, settings.day)\n host?.bench?.patch('person', { options: personOptions(), ...(settings.person ? { value: settings.person } : {}) })\n showSheet()\n }\n\n const onChange = (change: BenchChange): void => {\n if (change.kind === 'action') {\n if (change.id === 'next_day') {\n settings.day = Math.min(MAX_DAYS, settings.day + 1)\n host?.bench?.patch('day', { value: settings.day })\n } else if (change.id === 'reset') actions = {}\n rebuild()\n return\n }\n if (change.kind !== 'control') return\n const { id, value } = change\n if (id === 'seed' && typeof value === 'number') settings.seed = value\n else if (id === 'day' && typeof value === 'number') settings.day = value\n else if (id === 'life' && typeof value === 'boolean') settings.life = value\n else if (id === 'infection' && typeof value === 'boolean') settings.infection = value\n else if (id === 'person' && typeof value === 'string') {\n settings.person = value\n showSheet()\n return\n } else {\n const act = (content.actions ?? []).find((a) => actionControl(a.id) === id)\n if (!act || typeof value !== 'boolean') return\n if (value) actions = { ...actions, [act.id]: 1 }\n else {\n const { [act.id]: _off, ...rest } = actions\n void _off\n actions = rest\n }\n }\n rebuild()\n }\n\n const controls = (): ModuleControl[] => {\n const people = personOptions()\n return [\n { kind: 'number', id: 'seed', name: text.controls.seed, hint: text.hints.seed, min: 1, max: 9999, step: 1, default: settings.seed },\n { kind: 'number', id: 'day', name: text.controls.day, hint: text.hints.day, min: 0, max: MAX_DAYS, step: 1, default: settings.day },\n { kind: 'boolean', id: 'life', name: text.controls.life, hint: text.hints.life, default: settings.life },\n { kind: 'boolean', id: 'infection', name: text.controls.infection, hint: text.hints.infection, default: settings.infection },\n { kind: 'choice', id: 'person', name: text.controls.person, hint: text.hints.person, options: people.length > 0 ? people : [{ id: '', name: '-' }], default: people[0]?.id ?? '' },\n ...(content.actions ?? []).map((a): ModuleControl => ({ kind: 'boolean', id: actionControl(a.id), name: a.name, hint: text.hints.action, default: false })),\n { kind: 'action', id: 'next_day', name: text.controls.next_day },\n { kind: 'action', id: 'reset', name: text.controls.reset },\n ]\n }\n\n const count = (states: readonly StateId[]): number => Object.values(world.states).filter((s) => states.includes(s.state)).length\n const metrics = (): ModuleMetric[] => [\n { id: 'current_day', name: text.metrics.day, digits: 0, read: () => world.day },\n { id: 'people', name: text.metrics.people, digits: 0, read: () => world.people().length },\n { id: 'living', name: text.metrics.living, digits: 0, read: () => count(['ok', 'hurt', 'party', 'hostile', 'moved']) },\n { id: 'dead', name: text.metrics.dead, digits: 0, read: () => count(['dead']) },\n { id: 'births', name: text.metrics.births, digits: 0, read: () => world.life?.stats.births ?? 0 },\n { id: 'arrivals', name: text.metrics.arrivals, digits: 0, read: () => world.life?.stats.arrivals ?? 0 },\n { id: 'lines', name: text.metrics.lines, digits: 0, read: () => world.chronicle.entries.length },\n { id: 'last', name: text.metrics.last, read: () => world.chronicle.entries.at(-1)?.title ?? '' },\n ]\n\n const days = (): number => content.days ?? 90\n const lines = (made: StoryWorld): string => made.chronicle.entries.map((e) => `${e.day}|${e.id}|${e.text}`).join('\\n')\n const scenarios = (): Array<ModuleScenario<StoriesScenarioLike>> => [\n {\n id: 'stories_determinism',\n name: text.scenarios.determinism,\n run: ({ expect }) => {\n const a = lines(run(7, days(), true, false, {}))\n expect(a === lines(run(7, days(), true, false, {})) && a.length > 0, 'the same seed gives the same chronicle')\n },\n },\n {\n id: 'stories_casting',\n name: text.scenarios.casting,\n run: ({ expect }) => {\n const names = (seed: number) => run(seed, 0, false, false, {}).people().map((p) => p.name).join(',')\n const drawn = new Set([1, 2, 3, 4, 5].map(names))\n expect(drawn.size > 1, 'five seeds do not all cast the same names', { casts: drawn.size })\n },\n },\n {\n id: 'stories_normal_world',\n name: text.scenarios.normal_world,\n run: ({ expect }) => {\n let bites = 0\n for (let seed = 1; seed <= 10; seed++) bites += run(seed, days(), true, false, {}).chronicle.entries.filter((e) => e.kind === 'life' && e.changes.some((c) => c.state === 'bitten' || c.state === 'undead')).length\n expect(bites === 0, 'ten worlds without the infection layer: no bite, nobody turns', { bites })\n },\n },\n {\n id: 'stories_sheet_keeps',\n name: text.scenarios.sheet_keeps,\n run: ({ expect }) => {\n const made = run(3, days(), false, false, {})\n const entry = made.chronicle.entries.find((e) => e.kind === 'story')\n const id = entry?.people[0]\n expect(Boolean(entry && id && made.sheet(id).remembers(entry.id)), 'whoever a beat is about keeps it in their sheet', { beat: entry?.id, person: id })\n },\n },\n {\n id: 'stories_point_buy',\n name: text.scenarios.point_buy,\n run: ({ expect }) => {\n const nurse = createSheet({ profession: 'nurse' })\n expect(nurse.pool() === 12, 'a nurse starts with 14 − 2 = 12 points', { pool: nurse.pool() })\n const spent = createSheet({ profession: 'nurse', attributes: { agility: 8 }, traits: ['athlete', 'smoker'] })\n expect(spent.pool() === 6 && spent.valid(), 'agility 8 (−5), athlete (−4), smoker (+3): 6 left', { pool: spent.pool() })\n const clash = createSheet({ traits: ['athlete', 'asthmatic'] })\n expect(!clash.valid(), 'athlete and asthmatic exclude each other')\n },\n },\n {\n id: 'stories_crossing',\n name: text.scenarios.crossing,\n run: ({ expect }) => {\n const differ = (content.actions ?? []).some((a) => lines(run(5, days(), false, false, {})) !== lines(run(5, days(), false, false, { [a.id]: 1 })))\n expect(differ, 'some player action changes the chronicle')\n },\n },\n ]\n\n const module: StoriesTestModule = {\n id: STORIES_AREA_ID,\n name: text.name,\n group: text.group,\n get world() {\n return world\n },\n load(next) {\n content = next\n actions = {}\n settings.person = ''\n rebuild()\n },\n items: () => [],\n controls: () => controls(),\n metrics: () => metrics(),\n scenarios: () => scenarios(),\n attach(lent) {\n host = lent\n const off = lent.bench?.onChange(onChange)\n showSheet()\n return () => {\n off?.()\n host?.bench?.sheet?.(null)\n host = null\n }\n },\n }\n return module\n}\n","import type { StoriesContent } from './module'\n\n/**\n * The kit's example content for the bench (design question 2: no team delivery has stories that are not ZombiAdA's). Two tiny stories on generic\n * roles, a farm and a town: everything here is marked `example` and is only there so the bench runs without a game. A game loads its own content\n * (`module.load(content)`), for example the zombiada slice (`specs/…/game-slice/stories/`).\n */\nconst content = (t: {\n farm: string\n town: string\n nomads: string\n stranger: string\n stay: string\n stays: string\n goes: string\n well: string\n wellDry: string\n fixed: string\n carried: string\n welcome: string\n fixWell: string\n cousin: string\n arrives: [string, string, string]\n staysText: [string, string]\n goesText: [string, string]\n dryText: [string, string]\n fixedText: [string, string, string]\n carriedText: [string, string]\n}): StoriesContent => ({\n example: true,\n days: 30,\n actions: [\n { id: 'welcome', name: t.welcome },\n { id: 'fix_well', name: t.fixWell },\n ],\n stories: [\n {\n id: 'stranger',\n example: true,\n roles: [\n { id: 'host', needs: { age: [30, 70], base: 'town' }, create: true },\n { id: 'newcomer', create: true, bond: { role: 'host', relation: t.cousin, sameSurname: false, sameBase: true } },\n ],\n beats: [\n { id: 'stranger_arrives', day: 3, title: t.stranger, roles: ['newcomer', 'host'], variants: [{ text: [{ name: 'newcomer' }, t.arrives[0], { name: 'host' }, t.arrives[1]] }] },\n {\n id: 'stranger_stays',\n day: 7,\n title: t.stay,\n roles: ['newcomer', 'host'],\n variants: [\n { when: { action: 'welcome' }, alt: true, text: [{ name: 'newcomer' }, t.staysText[0]], changes: [{ role: 'newcomer', state: 'ok', note: t.stays }] },\n { text: [{ name: 'newcomer' }, t.goesText[0]], changes: [{ role: 'newcomer', state: 'moved', note: t.goes, base: 'nomad' }] },\n ],\n },\n ],\n },\n {\n id: 'well',\n example: true,\n crosses: ['stranger'],\n roles: [{ id: 'keeper', needs: { base: 'farm' }, create: true }],\n beats: [\n { id: 'well_dry', day: 10, title: t.well, roles: ['keeper'], variants: [{ text: [{ name: 'keeper' }, t.dryText[0]], flags: { well_dry: 1 } }] },\n {\n id: 'well_after',\n day: 14,\n title: t.wellDry,\n roles: ['keeper', 'newcomer'],\n variants: [\n { when: { all: [{ action: 'fix_well' }, { living: 'newcomer' }, { state: 'newcomer', is: 'ok' }] }, alt: true, text: [{ name: 'newcomer' }, t.fixedText[0], { name: 'keeper' }, t.fixedText[1]], changes: [] },\n { text: [{ name: 'keeper' }, t.carriedText[0]], changes: [{ role: 'keeper', state: 'hurt', note: t.carried }] },\n ],\n },\n ],\n },\n ],\n life: {\n groups: { farm: { name: t.farm, defence: 0.5, food: 20 }, town: { name: t.town, defence: 0.4, food: 10 }, nomad: { name: t.nomads, defence: 0, food: 0 } },\n nomadBase: 'nomad',\n },\n fill: 14,\n})\n\nexport const STORIES_EXAMPLE: Readonly<Record<'pt-BR' | 'en', StoriesContent>> = {\n 'pt-BR': content({\n farm: 'Sítio (exemplo)',\n town: 'Vila (exemplo)',\n nomads: 'Estrada',\n stranger: 'Um estranho no portão',\n stay: 'Fica ou vai',\n stays: 'ficou',\n goes: 'seguiu pela estrada',\n well: 'O poço secou',\n wellDry: 'Depois do poço',\n fixed: 'consertou o poço',\n carried: 'carregou água de longe',\n welcome: 'Acolher o estranho',\n fixWell: 'Consertar o poço',\n cousin: 'primo',\n arrives: [' bate no portão de ', ' pedindo abrigo por uma noite.', ''],\n staysText: [' fica e passa a ajudar na horta.', ''],\n goesText: [' junta as coisas e segue pela estrada.', ''],\n dryText: [' acorda e o balde volta vazio do poço.', ''],\n fixedText: [' desce no poço com uma corda e destrava a bomba. ', ' agradece com um prato de comida.', ''],\n carriedText: [' passa a semana carregando água do rio e machuca as costas.', ''],\n }),\n en: content({\n farm: 'Farm (example)',\n town: 'Town (example)',\n nomads: 'Road',\n stranger: 'A stranger at the gate',\n stay: 'Stay or go',\n stays: 'stayed',\n goes: 'went down the road',\n well: 'The well ran dry',\n wellDry: 'After the well',\n fixed: 'fixed the well',\n carried: 'carried water from afar',\n welcome: 'Welcome the stranger',\n fixWell: 'Fix the well',\n cousin: 'cousin',\n arrives: [' knocks at the gate of ', ' asking for a night of shelter.', ''],\n staysText: [' stays and starts helping in the garden.', ''],\n goesText: [' packs up and goes down the road.', ''],\n dryText: [' wakes up and the bucket comes back empty from the well.', ''],\n fixedText: [' goes down the well on a rope and frees the pump. ', ' says thanks with a plate of food.', ''],\n carriedText: [' spends the week carrying water from the river and hurts their back.', ''],\n }),\n}\n","type Keys<K extends string> = Readonly<Record<K, string>>\n\nexport type StoriesBenchText = {\n readonly group: string\n readonly name: string\n readonly controls: Keys<'seed' | 'day' | 'life' | 'infection' | 'person' | 'next_day' | 'reset'>\n readonly hints: Keys<'seed' | 'day' | 'life' | 'infection' | 'person' | 'action'>\n readonly metrics: Keys<'day' | 'people' | 'living' | 'dead' | 'births' | 'arrivals' | 'lines' | 'last'>\n readonly scenarios: Keys<'determinism' | 'casting' | 'normal_world' | 'sheet_keeps' | 'point_buy' | 'crossing'>\n readonly sheet: Keys<'kicker' | 'state' | 'base' | 'age' | 'profession' | 'pool' | 'lived' | 'none' | 'day'>\n readonly states: Keys<'ok' | 'hurt' | 'bitten' | 'undead' | 'dead' | 'missing' | 'party' | 'hostile' | 'moved' | 'left' | 'unborn'>\n readonly derived: Keys<'health' | 'stamina' | 'carry' | 'run_speed' | 'detection' | 'noise' | 'learning' | 'composure' | 'melee'>\n}\n\nconst EN: StoriesBenchText = {\n group: 'Stories',\n name: 'Stories area',\n controls: { seed: 'Seed', day: 'Day', life: 'Life simulation', infection: 'Bites and the turned', person: 'Sheet of', next_day: 'Next day', reset: 'Start again' },\n hints: {\n seed: 'The world drawn again: who plays each role, their names and every chance of the life simulation.',\n day: 'The world runs to this day; the sheet and the chronicle show it.',\n life: 'Off, only the stories happen; on, people also get hurt, fall in love, have children, fight, betray, trade and arrive.',\n infection: 'The apocalypse layer of the life simulation: a run can end in a bite, and a bite turns in two days. Off by default: a normal world.',\n person: 'Whose sheet the panel shows.',\n action: 'A player action: the stories read it from its day on.',\n },\n metrics: { day: 'Day', people: 'People', living: 'Living', dead: 'Dead', births: 'Births', arrivals: 'Arrivals', lines: 'Chronicle lines', last: 'Last line' },\n scenarios: {\n determinism: 'The same seed, the same chronicle',\n casting: 'Another seed casts other names',\n normal_world: 'A normal world: nobody is bitten',\n sheet_keeps: 'The sheet keeps the stories the person lived',\n point_buy: 'Point buy: 14 points, the profession and traits',\n crossing: 'An action in one story changes another',\n },\n sheet: { kicker: 'Character sheet', state: 'State', base: 'Lives at', age: 'Age', profession: 'Profession', pool: 'Points left', lived: 'Lived', none: 'Nothing yet', day: 'Day' },\n states: { ok: 'well', hurt: 'hurt', bitten: 'bitten', undead: 'turned', dead: 'dead', missing: 'missing', party: 'with the player', hostile: 'hostile', moved: 'moved', left: 'left', unborn: 'not born yet' },\n derived: { health: 'Max health', stamina: 'Stamina', carry: 'Max load (kg)', run_speed: 'Running speed (m/s)', detection: 'Detection radius (m)', noise: 'Footstep noise (%)', learning: 'Learning speed (%)', composure: 'Composure', melee: 'Melee damage (%)' },\n}\n\nconst PT_BR: StoriesBenchText = {\n group: 'Histórias',\n name: 'Área das histórias',\n controls: { seed: 'Semente', day: 'Dia', life: 'Vida sorteada', infection: 'Mordidas e reanimados', person: 'Ficha de', next_day: 'Próximo dia', reset: 'Recomeçar' },\n hints: {\n seed: 'O mundo sorteado de novo: quem faz cada papel, os nomes e cada chance da vida sorteada.',\n day: 'O mundo corre até esse dia; a ficha e a crônica mostram.',\n life: 'Desligada, só as histórias acontecem; ligada, as pessoas também se ferem, se apaixonam, têm filhos, brigam, traem, trocam e chegam.',\n infection: 'A camada do apocalipse na vida sorteada: uma saída pode acabar em mordida, e a mordida reanima em dois dias. Desligada por padrão: mundo normal.',\n person: 'De quem é a ficha no painel.',\n action: 'Uma ação do jogador: as histórias leem a partir do dia dela.',\n },\n metrics: { day: 'Dia', people: 'Pessoas', living: 'Vivos', dead: 'Mortos', births: 'Nascimentos', arrivals: 'Chegadas', lines: 'Linhas da crônica', last: 'Última linha' },\n scenarios: {\n determinism: 'A mesma semente, a mesma crônica',\n casting: 'Outra semente escala outros nomes',\n normal_world: 'Mundo normal: ninguém é mordido',\n sheet_keeps: 'A ficha guarda as histórias que a pessoa viveu',\n point_buy: 'Compra de pontos: 14 pontos, a profissão e os traços',\n crossing: 'Uma ação numa história muda outra',\n },\n sheet: { kicker: 'Ficha do personagem', state: 'Estado', base: 'Mora em', age: 'Idade', profession: 'Profissão', pool: 'Pontos livres', lived: 'Viveu', none: 'Nada ainda', day: 'Dia' },\n states: { ok: 'vivo', hurt: 'ferido', bitten: 'mordido', undead: 'zumbi nomeado', dead: 'morto', missing: 'sumido', party: 'com o jogador', hostile: 'hostil', moved: 'mudou de base', left: 'saiu do vale', unborn: 'ainda não nasceu' },\n derived: { health: 'Vida máxima', stamina: 'Fôlego', carry: 'Carga máxima (kg)', run_speed: 'Velocidade de corrida (m/s)', detection: 'Raio de detecção (m)', noise: 'Ruído dos passos (%)', learning: 'Velocidade de aprendizado (%)', composure: 'Compostura', melee: 'Dano corpo a corpo (%)' },\n}\n\nconst TEXT: Readonly<Record<string, StoriesBenchText>> = { en: EN, 'pt-BR': PT_BR }\n\nexport const storiesBenchTextOf = (locale: string): StoriesBenchText => TEXT[locale] ?? PT_BR\n","/**\n * @adatechnology/game-stories: a pure, seeded story generator. Roles cast at the world's creation, stories as data that cross each other, a chronicle,\n * the character sheet that keeps what each person lived, and the life simulation of the team's Os Vivos do Vale as generic rules with options.\n * Knows nothing about any game: the people, the stories and the places come in as data.\n */\nimport lifeNumbersData from './data/life.json'\nimport lifeTextData from './data/life-text.json'\nimport sheetNumbersData from './data/sheet.json'\n\nexport type * from './types'\nexport type { LifeNumbers, LifeNumbersPatch, LifeOptions, LifeRule, LifeStats, LifeText, LifeTextPatch, LifeTimer, LifeWorld } from './life/types'\nexport type { Casting, CastOptions } from './casting'\nexport type { Chronicle } from './chronicle'\nexport type { ConditionContext } from './conditions'\nexport type { BeatContext } from './story/beat'\nexport type { CharacterSheet, Memory, SheetEntry, SheetInput, SheetNumbers, SheetOptions } from './sheet/sheet'\nexport type { StoryWorld, StoryWorldOptions } from './world'\nexport type { StoriesContent, StoriesTestModule, StoriesTestModuleOptions } from './bench/module'\n\nexport { castStories } from './casting'\nexport { createChronicle } from './chronicle'\nexport { holds } from './conditions'\nexport { createLifeWorld, fillWorld, lifeDay } from './life/life'\nexport { applyChanges, FINAL_STATES, setState } from './story/apply'\nexport { runBeat } from './story/beat'\nexport { createSheet, drawSheet } from './sheet/sheet'\nexport { fillText, shortName } from './text'\nexport { createStoryWorld, lifeNumbersOf, lifeTextOf, simulateStories } from './world'\nexport { createStoriesTestModule, STORIES_AREA_ID } from './bench/module'\nexport { STORIES_EXAMPLE } from './bench/example'\n\n/** The life simulation's numbers, each with its source line (`data/life.json`). */\nexport const LIFE_DEFAULTS = lifeNumbersData\n/** The life simulation's texts: the team's pt-BR and the English translation. */\nexport const LIFE_TEXT = lifeTextData\n/** The memory and opinion numbers of the sheet (Personagens). */\nexport const SHEET_DEFAULTS = sheetNumbersData\n"],"mappings":";AAAA;AAAA,EACE,SAAW;AAAA,IACT,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,UAAY;AAAA,IACZ,QAAU;AAAA,IACV,MAAQ;AAAA,IACR,OAAS;AAAA,IACT,UAAY;AAAA,IACZ,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,MAAQ;AAAA,IACR,UAAY;AAAA,IACZ,MAAQ;AAAA,IACR,WAAa;AAAA,EACf;AAAA,EACA,YAAc;AAAA,EACd,cAAgB,CAAC,MAAM,QAAQ,SAAS,WAAW,OAAO;AAAA,EAC1D,cAAgB,CAAC,MAAM,QAAQ,SAAS,SAAS;AAAA,EACjD,UAAY,EAAE,QAAU,IAAI,OAAS,IAAI,QAAU,KAAK,QAAU,IAAI,MAAQ,IAAI;AAAA,EAClF,WAAa;AAAA,EACb,iBAAmB,EAAE,MAAQ,IAAI,SAAW,EAAE;AAAA,EAC9C,QAAU,EAAE,UAAY,GAAG,YAAc,GAAG,UAAY,GAAG,UAAY,GAAG,YAAc,GAAG,YAAc,IAAI;AAAA,EAC7G,OAAS,EAAE,mBAAqB,MAAM,aAAe,MAAM,iBAAmB,MAAM,WAAa,KAAK,MAAQ,IAAI;AAAA,EAClH,MAAQ;AAAA,IACN,cAAgB;AAAA,IAChB,iBAAmB;AAAA,IACnB,eAAiB;AAAA,IACjB,eAAiB;AAAA,IACjB,UAAY;AAAA,IACZ,aAAe;AAAA,IACf,QAAU;AAAA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AAO,QAAQ,IAAI;AACzB,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;AG3OO,IAAM,gBAAgB;AAEtB,IAAM,YAAY;AAElB,IAAM,iBAAiB;","names":["person","H","V","id","id","person","content"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @adatechnology/game-stories: a pure, seeded story generator. Roles cast at the world's creation, stories as data that cross each other, a chronicle,\n * the character sheet that keeps what each person lived, and the life simulation of the team's Os Vivos do Vale as generic rules with options.\n * Knows nothing about any game: the people, the stories and the places come in as data.\n */\nimport lifeNumbersData from './data/life.json'\nimport lifeTextData from './data/life-text.json'\nimport sheetNumbersData from './data/sheet.json'\n\nexport type * from './types'\nexport type { LifeNumbers, LifeNumbersPatch, LifeOptions, LifeRule, LifeStats, LifeText, LifeTextPatch, LifeTimer, LifeWorld } from './life/types'\nexport type { Casting, CastOptions } from './casting'\nexport type * from './sheet/ruleset'\nexport type { Chronicle } from './chronicle'\nexport type { ConditionContext } from './conditions'\nexport type { BeatContext } from './story/beat'\nexport type { CharacterSheet, Memory, SheetEntry, SheetInput, SheetNumbers, SheetOptions } from './sheet/sheet'\nexport type { StoryWorld, StoryWorldOptions } from './world'\n/** @deprecated import from '@adatechnology/game-stories/testing' */\nexport type { StoriesContent, StoriesTestModule, StoriesTestModuleOptions } from './testing'\n\nexport { castStories } from './casting'\nexport { createChronicle } from './chronicle'\nexport { holds } from './conditions'\nexport { createLifeWorld, fillWorld, lifeDay } from './life/life'\nexport { applyChanges, FINAL_STATES, setState } from './story/apply'\nexport { runBeat } from './story/beat'\nexport { createSheet, drawSheet } from './sheet/sheet'\nexport { fillText, shortName } from './text'\nexport { createStoryWorld, lifeNumbersOf, lifeTextOf, simulateStories } from './world'\n/** @deprecated import from '@adatechnology/game-stories/testing' */\nexport { createStoriesTestModule, STORIES_AREA_ID } from './testing'\n/** @deprecated import from '@adatechnology/game-stories/testing' */\nexport { STORIES_EXAMPLE } from './testing'\n\n/** The life simulation's numbers, each with its source line (`data/life.json`). */\nexport const LIFE_DEFAULTS = lifeNumbersData\n/** The life simulation's texts: the team's pt-BR and the English translation. */\nexport const LIFE_TEXT = lifeTextData\n/** The memory and opinion numbers of the sheet (Personagens). */\nexport const SHEET_DEFAULTS = sheetNumbersData\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,IAAM,gBAAgB;AAEtB,IAAM,YAAY;AAElB,IAAM,iBAAiB;","names":[]}