"use strict"; const fs = require("fs"); function ok(cond, msg) { if (!cond) throw new Error(msg); console.log(`[OK] ${msg}`); } const sim = fs.readFileSync("js/simulation_effects_system.js", "utf8"); const combat = fs.readFileSync("js/world_combat_effects.js", "utf8"); const all = fs.readdirSync("js").filter(x => x.endsWith(".js")).map(x => fs.readFileSync(`js/${x}`, "utf8")).join("\n"); ok(!/\.map\([\s\S]{0,300}\.sort\(/.test(sim), "effect pressure compaction no longer map/sorts all effects"); ok(sim.includes("for (let priority = 1; priority <= 3"), "effect pressure drops by priority tiers"); ok(combat.includes('new Set(["ring", "fight", "flame", "fall"])'), "effect pool is limited to simple high-frequency types"); ok(combat.includes("offscreenCulled"), "low-importance offscreen spawns are tracked and culled"); ok(sim.includes('if (effect.type === "ring")') && sim.includes("lightweight"), "rings bypass the budgeted physics update path"); ok(sim.includes("spawnRequested") && sim.includes("poolEligible") && sim.includes("pooled"), "effect runtime diagnostics expose spawn and pool counters"); const direct = [...all.matchAll(/effects\.push\(new Effect\(/g)].length; ok(direct === 0, "normal Effect construction is routed through spawnEffect"); console.log("[OK] effect runtime regression audit passed");