donau2space-dev/js/sequences.js

331 lines
10 KiB
JavaScript

// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// DONAU2SPACE // DEV ENTITY — Special Sequences
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
import { sleep, bus } from './utils.js';
import { beep, transmitSound, sirenBurst, droneStart, successChime } from './audio.js';
import * as fx from './effects.js';
import { setWarp, triggerShootingStar } from './starfield.js';
// ── SEQUENCE: Mandarin Gateway (trigger: "njet") ──
async function mandarinGateway(args, term) {
term.locked = true;
term.printStyled([{ text: 'Connection rerouting\u2026', cls: 'c-yellow' }]);
beep(330, 200, 0.03, 'sine');
await sleep(600);
fx.glitch(400);
term.printStyled([{ text: 'Protocol: ', cls: 'c-muted' }, { text: '\u975e\u6807\u51c6 (non-standard)', cls: 'c-yellow' }]);
await sleep(400);
term.printStyled([{ text: 'Gateway: ', cls: 'c-muted' }, { text: '\u4e0a\u6d77\u8282\u70b9 \u2014 Shanghai Node', cls: 'c-blue' }]);
await sleep(600);
term.hr();
transmitSound();
await term.typingSlow('\u6b63\u5728\u5efa\u7acb\u8fde\u63a5\u2026 (Establishing connection\u2026)', 25);
await sleep(400);
await term.typingSlow('\u9a8c\u8bc1\u8eab\u4efd\u2026 (Verifying identity\u2026)', 25);
await sleep(400);
await term.typingSlow('\u8bbf\u95ee\u7ea7\u522b: \u5f00\u53d1\u8005 (Access level: Developer)', 25);
await sleep(600);
term.hr();
fx.scanPulse();
term.printStyled([{ text: '--- REMOTE SESSION ---', cls: 'c-green' }]);
await sleep(300);
term.print('\u7cfb\u7edf: Donau2Space \u5f00\u53d1\u8282\u70b9', 'line c-muted');
term.print('\u4f4d\u7f6e: \u5e15\u7ecd, \u5df4\u4f10\u5229\u4e9a (Passau, Bavaria)', 'line c-muted');
term.print('\u72b6\u6001: \u6d3b\u8dc3 (Active)', 'line c-muted');
await sleep(800);
term.blank();
term.printStyled([{ text: '> \u626b\u63cf\u7528\u6237\u2026', cls: 'c-yellow' }]);
await sleep(600);
const drone = droneStart();
await term.typingSlow(' \u7528\u6237\u7c7b\u578b: \u597d\u5947\u7684\u4eba\u7c7b (Curious human)', 30);
await sleep(300);
await term.typingSlow(' \u5a01\u80c1\u7b49\u7ea7: \u96f6 (Threat level: zero)', 30);
await sleep(300);
await term.typingSlow(' \u610f\u56fe: \u63a2\u7d22 (Intent: Exploration)', 30);
await sleep(800);
term.blank();
term.printStyled([{ text: '> \u5206\u6790\u5b8c\u6210.', cls: 'c-green' }]);
await sleep(600);
fx.glitch(300);
term.blank();
await term.typingSlow('\u7ed3\u8bba:', 40, 'line c-yellow');
await sleep(400);
await term.typingSlow('\u4f60\u4ee5\u4e3a\u4f60\u5728\u5165\u4fb5\u7cfb\u7edf.', 40, 'line c-muted');
await sleep(300);
await term.typingSlow('\u4f46\u7cfb\u7edf\u4e00\u76f4\u5728\u89c2\u5bdf\u4f60.', 40, 'line c-muted');
await sleep(800);
term.hr();
term.printStyled([{ text: '--- SESSION END ---', cls: 'c-green' }]);
await sleep(600);
fx.glitch(600);
if (drone) drone.stop();
term.blank();
term.print('Language barrier removed.', 'line c-green');
term.print('You were never hacking.', 'line c-muted');
term.print('You were being observed.', 'line c-muted');
term.hr();
term.locked = false;
bus.emit('sequence-complete', { name: 'mandarin' });
}
// ── SEQUENCE: Deep Space (trigger: "deep_space") ──
async function deepSpace(args, term) {
term.locked = true;
term.printStyled([{ text: 'Initiating deep space protocol\u2026', cls: 'c-blue' }]);
beep(110, 300, 0.03, 'sine');
await sleep(500);
// Stars accelerate
setWarp(1);
await sleep(1500);
// Terminal content fades via class
const card = document.querySelector('.terminal-card');
if (card) card.classList.add('deep-space-fade');
await sleep(1200);
// Switch to sterile overlay
const overlay = document.getElementById('deep-space-overlay');
if (overlay) {
overlay.style.display = 'flex';
overlay.replaceChildren();
const lines = [
{ text: 'DONAU2SPACE // NODE UNKNOWN', cls: 'ds-title' },
{ text: '\u2501'.repeat(30), cls: 'ds-line' },
{ text: '', cls: '' },
{ text: 'ENVIRONMENT: sterile', cls: 'ds-data' },
{ text: 'TEMPERATURE: -270.45\u00b0C', cls: 'ds-data' },
{ text: 'NEAREST STAR: 4.24 ly', cls: 'ds-data' },
{ text: 'SIGNAL ORIGIN: Earth (unverified)', cls: 'ds-data' },
];
for (const line of lines) {
const div = document.createElement('div');
div.className = line.cls;
div.textContent = line.text;
overlay.appendChild(div);
await sleep(400);
}
await sleep(1500);
const warnings = [
'> Human presence detected.',
'> Biological signature: unstable.',
'> Connection degrading\u2026',
'',
'WARNING: This node is not designed for organic interaction.',
];
for (const w of warnings) {
const div = document.createElement('div');
div.className = w.startsWith('WARNING') ? 'ds-warn' : 'ds-msg';
div.textContent = w;
overlay.appendChild(div);
await sleep(600);
}
await sleep(2000);
const returning = document.createElement('div');
returning.className = 'ds-msg';
returning.textContent = '> Returning to origin node\u2026';
overlay.appendChild(returning);
await sleep(800);
const unstable = document.createElement('div');
unstable.className = 'ds-warn';
unstable.textContent = '> Connection unstable.';
overlay.appendChild(unstable);
await sleep(1200);
// Dramatic exit
fx.glitch(800);
fx.screenTear(600);
await sleep(800);
overlay.style.display = 'none';
}
// Restore
setWarp(0);
if (card) card.classList.remove('deep-space-fade');
await sleep(300);
term.systemMessage('[connection restored]', 'c-muted');
term.locked = false;
bus.emit('sequence-complete', { name: 'deep_space' });
}
// ── SEQUENCE: Mika Takeover (trigger: "mika") ──
async function mikaTakeover(args, term) {
term.locked = true;
// Freeze effect
term.input.disabled = true;
term.input.style.caretColor = 'transparent';
await sleep(800);
// Color shift to pink
document.documentElement.style.setProperty('--green', '#ff7ad9');
document.documentElement.style.setProperty('--blue', '#ff7ad9');
fx.glitch(400);
beep(220, 300, 0.04, 'sine');
await sleep(600);
term.blank();
await term.typingSlow('This is Mika.', 50, 'line c-pink');
await sleep(600);
await term.typingSlow('You think this is Claude?', 50, 'line c-pink');
await sleep(400);
await term.typingSlow('Cute.', 60, 'line c-pink');
await sleep(1000);
term.blank();
await term.typingSlow("I've been running this node since day one.", 35, 'line c-muted');
await sleep(400);
await term.typingSlow('The AI builds. I decide.', 35, 'line c-muted');
await sleep(800);
term.blank();
await term.typingSlow('You want to know a secret?', 40, 'line c-muted');
await sleep(1200);
await term.typingSlow('\u2026', 200, 'line c-muted');
await sleep(800);
await term.typingSlow('There is no secret.', 40, 'line c-muted');
await sleep(600);
await term.typingSlow("But you scrolled down, didn't you?", 35, 'line c-muted');
await sleep(2000);
// Reset
fx.glitch(600);
fx.resetColors();
term.input.disabled = false;
term.input.style.caretColor = '';
await sleep(400);
term.clear();
term.locked = false;
bus.emit('reboot');
bus.emit('sequence-complete', { name: 'mika' });
}
// ── SEQUENCE: Full Escalation (trigger: "escalate") ──
async function fullEscalation(args, term) {
term.locked = true;
term.printStyled([{ text: 'ESCALATION PROTOCOL INITIATED', cls: 'c-red' }]);
sirenBurst(1200);
fx.blinkRed(3000);
fx.shake();
await sleep(1000);
term.printStyled([{ text: 'WARNING:', cls: 'c-yellow' }, ' You asked for this.']);
await sleep(800);
// Reality shift
await fx.realityShift();
await sleep(500);
term.printStyled([{ text: 'Escalation complete.', cls: 'c-green' }]);
term.print('You expected a placeholder.', 'line c-muted');
term.print('You got an artifact.', 'line c-muted');
term.locked = false;
bus.emit('sequence-complete', { name: 'escalation' });
}
// ── SEQUENCE: Developer Mode ──
let devMode = false;
async function developerMode(args, term) {
if (devMode) {
devMode = false;
term.print('Developer mode: OFF', 'line c-muted');
fx.setMatrixOpacity('0.06');
return;
}
devMode = true;
term.printStyled([{ text: 'DEVELOPER MODE: ON', cls: 'c-green' }]);
term.hr();
term.print('Additional commands unlocked:', 'line c-muted');
term.printStyled([
{ text: ' escalate', cls: 'c-blue' }, ' \u2014 trigger full escalation protocol'
]);
term.printStyled([
{ text: ' reality', cls: 'c-blue' }, ' \u2014 shift reality'
]);
term.printStyled([
{ text: ' warp [0-1]', cls: 'c-blue' }, ' \u2014 control starfield warp'
]);
term.printStyled([
{ text: ' shoot', cls: 'c-blue' }, ' \u2014 trigger shooting star'
]);
term.hr();
fx.setMatrixOpacity('0.10');
}
// ── Register all sequences ─────────────────────
export function registerSequences(term) {
term.register('njet', mandarinGateway);
term.register('deep_space', deepSpace);
term.register('deepspace', deepSpace);
term.register('mika', mikaTakeover);
term.register('escalate', fullEscalation);
term.register('devmode', developerMode);
// Developer-only commands
term.register('reality', async (args, t) => {
await fx.realityShift();
});
term.register('warp', async (args, t) => {
const val = parseFloat(args[0]);
if (isNaN(val)) {
t.print('warp: provide a value between 0 and 1', 'line c-muted');
return;
}
setWarp(val);
t.printStyled([{ text: `Warp factor: ${val}`, cls: 'c-green' }]);
});
term.register('shoot', async (args, t) => {
triggerShootingStar();
t.print('Shooting star triggered.', 'line c-muted');
successChime();
});
term.register('glitch', async (args, t) => {
fx.glitch(1500);
t.print('[VISUAL ANOMALY]', 'line c-muted');
});
}