/** * Targeted repro: AmmoSystem.fire() return shape vs Projectile._hydrateShell expectations */ const { Projectile } = require("./src/game/entities/Projectile.js"); const { shells } = require("./src/data/shells.js"); // Simulate exactly what AmmoSystem.fire() returns const fireResult = { type: "apcbc", velocity: 750, penetration: 100, splash: 0 }; const proj = new Projectile(0, 0, 0, fireResult); console.log("=== From AmmoSystem.fire() return value ==="); console.log("shellType:", proj.shellType, "(expected 'apcbc')"); console.log("penetration:", proj.penetration, "(expected 100)"); console.log("velocity:", proj.velocity, "(expected 750)"); console.log("limited:", proj.limited, "(expected false)"); console.log("color:", proj.color, "(expected '#808080' gray)"); console.log("splash:", proj.splash, "(expected 0)"); console.log(""); // With proper shells.js definition const proj2 = new Projectile(0, 0, 0, shells.apcbc); console.log("=== From shells.apcbc directly ==="); console.log("shellType:", proj2.shellType); console.log("limited:", proj2.limited); console.log("color:", proj2.color); console.log(""); // Collision still works because penetration is correct const target = { armor: 80, hp: 100, active: true, x: 0, y: 0, takeDamage: function(d) { this.hp -= d; }, maxHp: 100 }; const hitResult = proj.onHit(target); console.log("=== onHit() with fireResult-originated projectile ==="); console.log("penetrated:", hitResult.penetrated, "(expected true for pen 100 vs armor 80)"); console.log("damage:", hitResult.damage); console.log("splashRadius:", hitResult.splashRadius);