2PlayerGame/detective-game/casegen/motives/jealousy.js
2026-08-15 14:07:39 +03:00

40 lines
3.4 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/jealousy.js — мотив "Ревнощі"
const { md5, caesar } = require('../rng');
function generate(ctx) {
const { r, add, addPuzzle, motiveEvs, victim, killer, herring, citizens, tSpouse } = ctx;
const motiveId = 'Ревнощі';
const pin = String(victim.birthYear);
const pinPuzzle = addPuzzle({
id: 'pz_pin', kind: 'pin', prompt: 'Телефон жертви заблоковано 4-значним PIN-кодом.',
hash: md5(pin), answer: pin, hint: 'Люди ставлять те, що не забудуть: спробуйте рік народження з досьє.'
});
add({
id: 'sf_phone_locked', side: 'field', at: { type: 'spot', building: ctx.atScene.building, spot: ctx.atScene.spot },
title: 'Телефон жертви (заблокований)', tag: 'мотив',
detail: 'Екран розбитий, але телефон живий. Заблокований PIN-кодом. Аналітик може спробувати підібрати.'
});
motiveEvs.push(add({
id: 'mot_messages', side: 'analyst', at: { type: 'lab' }, requires: ['sf_phone_locked'], needsIdentity: true, puzzle: pinPuzzle,
title: 'Листування в телефоні', tag: 'мотив',
detail: `Місяці переписки з номером ${tSpouse.phone}: зустрічі, готелі, «коли ${tSpouse.sex === 'ч' ? 'він' : 'вона'} у відрядженні». Номер зареєстровано: ${tSpouse.name}.`,
gives: { pointsTo: tSpouse.id }
}));
motiveEvs.push(add({
id: 'mot_confess', side: 'field', at: { type: 'person', cid: tSpouse.id }, requires: ['mot_messages'],
title: `Розмова: ${tSpouse.name}`, tag: 'мотив',
detail: `Довге мовчання. «Так, ми зустрічалися. Тиждень тому ${killer.first} ${ctx.g(killer, 'знайшов', 'знайшла')} листування. ${ctx.g(killer, 'Сказав', 'Сказала')}: „Я це закінчу". Я ${ctx.g(tSpouse, 'думав', 'думала')} — про шлюб…»`,
gives: { pointsTo: killer.id, motive: true }
}));
motiveEvs.push(add({
id: 'mot_witness', side: 'field', at: { type: 'person', cid: ctx.witnessFrom(citizens.filter(c => c.workplace === 'bar')).id }, needsIdentity: true,
title: 'Свідчення бармена', tag: 'мотив',
detail: `«${victim.first}? Бували тут. У четвер ${ctx.g(victim, 'сидів', 'сиділа')} за стійкою, коли ${ctx.g(killer, 'влетів', 'влетіла')} ${killer.name}${ctx.g(killer, 'кричав', 'кричала')} щось про «не лізь у мою сім'ю». Ледь розборонили.»`,
gives: { pointsTo: killer.id, motive: true }
}));
const recapWhy = `${killer.name} ${ctx.g(killer, 'дізнався', 'дізналася')} про роман. Другою стороною роману були ${tSpouse.first} і жертва. Пробачення не сталося.`;
const herringLead = `«Та в ${ctx.g(victim, 'нього', 'неї')} був конфлікт! ${herring.name} з ${herring.home} місяць тому ${ctx.g(herring, 'влаштував', 'влаштувала')} скандал через залите авто — усі чули погрози.»`;
return { motiveId, recapWhy, herringLead };
}
module.exports = { generate };