Allow returning to the safe trainer start

This commit is contained in:
nyan404 committed 2026-11-22 18:06:12 +03:00
1 parent ba25b64190
commit ba074df4ec
10 files changed
+102 -48

No files matched your search

+10 -7
View File
@@ -43,8 +43,9 @@ function describe(cell, view, showNotes = true, isMap = false) {
if (cell.hazard) return `опасная клетка${rating}`;
if (cell.entrance || cell.opened || ended(view)) {
const fact = simple() || ended(view) ? `, ${levelText(cell.value).slice(0, -1).toLowerCase()}` : '';
if (cell.entrance) return `вход${fact}`;
return `${cell.opened ? 'проверено' : 'безопасная клетка'}${fact}${rating}${!isMap && cell.available ? ', можно прыгнуть' : ''}`;
const jump = !isMap && cell.available ? ', можно прыгнуть' : '';
if (cell.entrance) return `стартовая клетка${fact}${jump}`;
return `${cell.opened ? 'проверено' : 'безопасная клетка'}${fact}${rating}${jump}`;
}
if (cell.marked && showNotes) return `ваш флажок опасности${rating}`;
if (hints.has(cell.id)) return `подсказка: опасность${rating}`;
@@ -189,7 +190,7 @@ function render() {
$('lu-value').textContent = `${view.options.lu} ЛУ`;
$('height-value').textContent = `${view.options.height} из 5`;
$('scene-height').textContent = `Высота ${view.options.height}`;
$('transition-coordinates').textContent = `Вход: ${coordinate(view.start)} · Выход: ${coordinate(view.exit)}`;
$('transition-coordinates').textContent = `Старт: ${coordinate(view.start)} · Выход: ${coordinate(view.exit)}`;
$('season-value').textContent = {'-3':'Лето',0:'Демисезон',5:'Зима'}[view.options.season];
$('growth-value').textContent = {12:'45–75%',15:'76–85%',18:'81–88%',22:'89–95%',25:'96–100%'}[view.options.growth];
$('hint-chance').textContent = simple() ? `${Math.round(hintChance(view.options.lu) * 100)}%` : 'Выкл.';
@@ -202,15 +203,17 @@ function render() {
$('scene-instructions').textContent = compact.matches ? 'Выберите клетку, затем нажмите нужную кнопку под полем.' : 'Нажмите на соседнюю клетку, чтобы прыгнуть. Правая кнопка мыши или Shift+Enter ставят или снимают флажок.';
const cell = view.cells[selected], note = cell.marked ? 'Снять отметку' : 'Отметить опасной';
const selectionState = finished ? 'попытка завершена' : cell.id === view.position ? 'вы здесь' :
cell.transition ? (cell.entrance ? 'вход' : 'выход') : cell.marked ? 'есть отметка' :
cell.entrance ? (cell.available ? 'старт' : 'старт, вне досягаемости') :
cell.transition ? 'выход' : cell.marked ? 'есть отметка' :
!cell.available ? 'вне досягаемости' : '';
$('touch-actions').hidden = !compact.matches;
$('selection').textContent = `Клетка ${coordinate(selected)}${selectionState ? ` (${selectionState})` : ''}`;
$('map-selection').textContent = `Клетка ${coordinate(selected)} · ${describe(cell, view, true, true)}`;
$('mark').textContent = note; $('map-mark').textContent = note;
$('jump').disabled = finished || !cell.available || cell.marked;
for (const id of ['mark','map-mark']) $(id).disabled = finished || cell.opened || cell.transition;
$('map-levels').disabled = finished || cell.transition;
const notesLocked = finished || cell.entrance || cell.transition;
for (const id of ['mark','map-mark']) $(id).disabled = notesLocked || cell.opened;
$('map-levels').disabled = notesLocked;
for (const button of $('map-levels').querySelectorAll('[data-level]')) button.setAttribute('aria-pressed', String(Number(button.dataset.level) === cell.rating));
$('map-clear-level').disabled = cell.rating === null;
$('clear-marks').disabled = finished || (view.marks === 0 && view.ratings === 0);
@@ -321,7 +324,7 @@ $('new-game').addEventListener('click', event => confirmAction('Начать з
$('clear-marks').addEventListener('click', event => confirmAction('Очистить отметки?', 'Исчезнут только ваши флажки и оценки. Проверенные клетки и история останутся, а игру можно будет продолжить.', 'Очистить отметки', () => { game.clearMarks(); $('status').textContent = 'Флажки и оценки убраны. Можно продолжать.'; render(); }, event.currentTarget));
$('simple-mode').addEventListener('change', () => {
stopSound(); clearHints();
$('status').textContent = simple() ? 'В упрощённом режиме уровни видны на входе и на проверенных клетках.' : 'В звуковом режиме оцените клетку по шорохам.';
$('status').textContent = simple() ? 'В упрощённом режиме уровни видны на стартовой и проверенных клетках.' : 'В звуковом режиме оцените клетку по шорохам.';
$('messages').replaceChildren(); messages.forEach(renderMessage);
$('history').replaceChildren(); renderedHistory = 0;
render();