import fs from 'node:fs'; const root = new URL('../', import.meta.url); const source = fs.readFileSync(new URL('game.js', root), 'utf8'); const requiredAssets = [ 'assets/mafuyu-ice-bow.png', 'assets/mafuyu-attack-16.png', 'assets/mafuyu-ice-charge.png', 'assets/mafuyu-ice-release.png', 'assets/sekai-enemies-16.png', 'assets/sekai-interactables-16.png', 'assets/audio/sfx-ice-bow-charge.ogg', 'assets/audio/sfx-ice-arrow.ogg', 'assets/audio/sfx-ice-charge.ogg', 'assets/audio/sfx-ice-heavy.ogg', 'assets/audio/sfx-freeze.ogg' ]; const checks = [ ['all ice combat assets exist', requiredAssets.every(path => fs.existsSync(new URL(path, root)))], ['all revised player attacks use 16 frames', ['attack','iceBow','iceCharge','iceRelease'].every(state => source.includes(`${state}:{image:`)) && source.includes('Array.from({length:16}')], ['ranged shot costs energy and carries freeze chance', source.includes('const cost=25') && source.includes('freezeChance:FREEZE_CHANCE')], ['normal enemies freeze longer than boss', source.includes('enemy.frozen=boss?.62:2.15')], ['charge is mobile and free', source.includes('moveSpeed=RUN_SPEED*(player.chargeActive?.68:1)') && !/chargeActive[^\n]{0,120}energy\s*-=/.test(source)], ['charge releases only after full state', source.includes('if(charged)releaseChargedAttack()') && source.includes('player.chargeTimer>=CHARGE_FULL_TIME')], ['heavy hit is short-range and three damage', source.includes('w:138,h:86') && source.includes('damage:3,heavy:true')], ['new high-frame actions avoid alpha cross-fade', source.includes('highFrame||reducedMotion?0')], ['interactables render one of sixteen fixed frames', source.includes('phase%16') && source.includes('sekai-interactables-16.png')], ['first-area enemies use a fixed 16-frame atlas', source.includes('drawAtlasSixteenPhase') && source.includes('sekai-enemies-16.png')], ['full-screen flash replaced by restrained radial glow', source.includes("Math.min(.13,flash*.16)") && !source.includes('flash*.45')] ]; for (const [label, passed] of checks) console.log(`${passed ? 'PASS' : 'FAIL'} ${label}`); if (checks.some(([, passed]) => !passed)) process.exitCode = 1;