Skip to content

Commit a6e176a

Browse files
committed
Midnight Ops enemies: a round rolled as a miss can no longer wound you
Up close an enemy's muzzle sits almost inside the player's hit area, so his deliberate misses still landed: in the farmhouse doorway in Night Drop, 10 to 13 of every 30 rounds rolled as misses wounded the player, and in the open 2 to 7 percent did. A missed round now skips the man it was aimed at (it still flies past, cracks and suppresses), so the hit chance and the tell before each burst decide what hurts you, as intended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cw2rM8wxKCmGapChheUcgU
1 parent cc7aac9 commit a6e176a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎e63334287a3deaa3/ironveil/js/ai.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,13 @@
436436
const muz = e.weapon.userData.muzzle.getWorldPosition(new THREE.Vector3());
437437
const tp = targetPoint(tgt);
438438
// a hit lands on the body; only close in (under 20 m) can it stray up to the head, and never on a warning round
439+
// a miss can never wound the man it was aimed at (spare): close in, his muzzle is almost inside you, so otherwise
440+
// nearly any round he fires would land whatever the roll said; it still flies past, cracks and suppresses
439441
if (hit) { tp.y += d < 20 ? (Math.random() - 0.45) * 0.45 : (Math.random() - 0.6) * 0.35; }
440442
else { const a = Math.random() * 6.28, r = 0.7 + Math.random() * 2; tp.x += Math.cos(a) * r; tp.y += Math.sin(a) * r * 0.5 + 0.3; tp.z += Math.sin(a) * r; }
441443
const dx = tp.x - muz.x, dy = tp.y - muz.y, dz = tp.z - muz.z, l = Math.hypot(dx, dy, dz), v = 720;
442444
const dmg = e.kind === 'sniper' ? A.sniperDmg[diff()] : A.dmg[diff()] * (e.wkind === 'enemySmg' || e.wkind === 'pistol' ? A.smgDmg : 1) * (isP ? 1 : 0.6);
443-
IV.weapons.spawnBullet({ x: muz.x, y: muz.y, z: muz.z, vx: dx / l * v, vy: dy / l * v + (l / v) * 4.9, vz: dz / l * v, drag: 0, dmg, flat: true, owner: e, team: 'them', tracer: !W.day && (e.kind === 'gunner' || Math.random() < 0.45), enemy: true, life: 1.4 });
445+
IV.weapons.spawnBullet({ x: muz.x, y: muz.y, z: muz.z, vx: dx / l * v, vy: dy / l * v + (l / v) * 4.9, vz: dz / l * v, drag: 0, dmg, flat: true, owner: e, spare: hit ? null : tgt, team: 'them', tracer: !W.day && (e.kind === 'gunner' || Math.random() < 0.45), enemy: true, life: 1.4 });
444446
IV.fx.muzzle(muz.x, muz.y, muz.z, dx / l, dy / l, dz / l, e.kind !== 'officer');
445447
if (IV.weapons.gunShot) IV.weapons.gunShot(e.weapon, e.wkind); e.lastShotT = IV.time;
446448
IV.audio && IV.audio.play(e.kind === 'gunner' ? 'mg' : e.kind === 'officer' ? 'epistol' : e.kind === 'sniper' ? 'erifle' : (e.wkind === 'enemySmg' ? 'esmg' : 'erifle'), { x: muz.x, z: muz.z });

‎e63334287a3deaa3/ironveil/js/weapons.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@
144144
const ex = e.pos.x - x0, ez = e.pos.z - z0, along = ex * ux + ez * uz;
145145
if (along < -2 || along > len + 2) continue;
146146
const lat = Math.abs(ex * uz - ez * ux); if (lat > 2.2) continue;
147-
WP.spheres(e, sph);
148-
for (const s of sph) { const t = segSphere(x0, y0, z0, ux, uy, uz, best, s[0], s[1], s[2], s[3]); if (t >= 0 && t < best) { best = t; hitEnt = e; hitZone = s[4]; } }
147+
if (e !== b.spare) { WP.spheres(e, sph);
148+
for (const s of sph) { const t = segSphere(x0, y0, z0, ux, uy, uz, best, s[0], s[1], s[2], s[3]); if (t >= 0 && t < best) { best = t; hitEnt = e; hitZone = s[4]; } } } // spare: an enemy round rolled as a miss at this man (see ai.js shoot)
149149
// near miss: suppression and the crack of a passing round
150150
if (!hitEnt || hitEnt !== e) {
151151
const cx = e.pos.x, cy = e.pos.y + e.chestH(), cz = e.pos.z;

0 commit comments

Comments
 (0)