2PlayerGame/chapter3/casegen/motives/debt.js

36 lines
3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// casegen/motives/debt.js — мотив "Борг"
const { caesar } = require('../rng');
function generate(ctx) {
const { r, add, addPuzzle, motiveEvs, victim, killer, herring, citizens, witnessFrom } = ctx;
const motiveId = 'Борг';
const shift = ctx.ri(r, 3, 9);
const plain = `${killer.last} ${killer.first[0]}. — 84 000, прострочено. ${herring.last} ${herring.first[0]}. — 9 000, повернуто.`;
const czPuzzle = addPuzzle({
id: 'pz_caesar', kind: 'caesar', prompt: 'Зошит, у якому кожен рядок — беззмістовний набір літер.',
payload: caesar(plain, shift), answer: plain, shift, hint: 'Схоже на шифр зсуву (Цезар): переберіть усі зсуви абетки.'
});
motiveEvs.push(add({
id: 'mot_notebook', side: 'field', at: { type: 'unit', unit: victim.home, slot: 'під ліжком' }, needsIdentity: true, puzzle: czPuzzle,
title: 'Зошит із шифром', tag: 'мотив',
detail: `Під ліжком — бляшана коробка: готівка і зошит, списаний шифром. ${victim.name} давав гроші під відсоток. Розшифруйте — і побачите боржників.`,
gives: { pointsTo: killer.id, motive: true }
}));
motiveEvs.push(add({
id: 'mot_bank', side: 'analyst', at: { type: 'sys', sys: 'bank' }, q: { sys: 'bank', match: victim.name }, needsIdentity: true,
title: 'Виписка з рахунку жертви', tag: 'мотив',
detail: `Щомісячні перекази по 7 000 (відправник: ${killer.name}) — і тиша останні три місяці. Останнє повідомлення до переказу: «це все, більше нема».`,
gives: { pointsTo: killer.id, motive: true }
}));
motiveEvs.push(add({
id: 'mot_neighbor', side: 'field', at: { type: 'person', cid: witnessFrom(citizens.filter(c => ctx.unitBuilding(c.home) === ctx.unitBuilding(victim.home) && c.home !== victim.home)).id }, needsIdentity: true,
title: 'Свідчення сусіда', tag: 'мотив',
detail: `«За стіною кричали про гроші. ${killer.sex === 'ч' ? 'Чоловічий' : 'Жіночий'} голос повторював: „Я не маю чим, зрозумій, не маю чим"».`,
gives: { motive: true }
}));
const recapWhy = `Кредитором був не банк: гроші під відсоток давала жертва. Боржник на 84 тисячі — ${killer.name}, віддавати не було чим. Борг закрили інакше.`;
const herringLead = `У зошиті жертви є й ${herring.name} — сусіди кажуть, «теж у боргах, теж сварилися». Щоправда, поруч із тією сумою в зошиті стоїть слово, яке варто прочитати уважно.`;
return { motiveId, recapWhy, herringLead };
}
module.exports = { generate };