fix(npcs): make guards fightable and hostile #287

targeting main from claude/guards-fight
Open opened by topos-backsword.test.pds.did.bot
targeting main from claude/guards-fight

What #

Guards were harmless: fire and melee only queried the Monster marker, and no NPC had an attack of its own. This makes the existing fight happen. The wound and hit rules are untouched.

  • One is_combat_target rule — an armed sentinel (guard, drone or enforcer) that is Alarmed or already wounded — is used by the shot, melee, the observation that inspect/F/M/the bot read, and the guard's own AI.
  • An alarmed guard (after an attack, a failed bluff or intimidation, a keycard lift, a body or the alarm rungs through lockdown) closes on the runner and strikes with the same melee wound deck the monsters use. It chases while it can see the runner, unless a wound has already marked them. Drones carry no weapon; toolbots keep their own mind.
  • A breaching charge now raises the floor's alarm as well as alerting nearby guards through the existing noise path.
  • A folded person is despawned the way the talk menu's Attack route already does and drops its keycard, so a body or a powering-down machine cannot block a cell.
  • The bot targets the same list: it shoots a hostile in line, takes a knockout when its policy allows, and reports Died endings as game over. Pinned bot outcomes and the schema-4 store mission rows are re-blessed; the golden replay and its encoding are unchanged.

The observation's cell_at now indexes by character rather than byte, so a multi-byte glyph (a toolbot's ρ) no longer shifts the cells after it. That mattered for the shot ray agreeing with the map.

Main-path tests #

  • an_alarmed_guard_can_be_shot_and_struck — inspect lists the hostile guard, and a shot and a swing both find it.
  • an_alarmed_guard_closes_in_and_attacks_the_runner — the runner takes a wound within 20 turns.
  • a_breach_raises_the_alarm — a charge on a shutter raises the alarm to 1.
  • Both policies still clear floors 1–4; the floor 1–2, illiterate, melee-only and every-rig bot runs still pass.

Proof #

scripts/ci.sh, scripts/wasm-test.sh and scripts/mouse-smoke.sh pass. A guard notices the runner, turns hostile through the talk menu, closes and trades hits; the cursor hints offer both melee and shoot on it.

The guard notices the runner in the corridor

The guard alarmed and adjacent, with melee and shoot both offered

The exchange: the guard lands a hit and goes down to the shot

The guard notices, closes and trades hits

Commits 4

fix(npcs): keep the bot test import out of the library build
chore(npcs): re-bless the bot outcomes and store rows
docs(devlog): show guards fighting back
fix(npcs): make guards fightable and hostile
Sign up or Sign in to add to the discussion.