Companion Combat (Phase 1 — offense)

The key words MUST, MUST NOT, REQUIRED, SHOULD, MAY, and OPTIONAL below are used as in RFC 2119.

Phase 1 makes the companion NPC a combatant on offense only, modeled on PSO's partner NPCs (which the original client implements as player objects in a party slot, sharing the player's entity-vs-entity damage pipeline). The companion acquires targets near the player, closes, and attacks through the same hit geometry and damage entry points the player uses. Out of scope for phase 1 (deferred to phase 2): the companion taking damage, enemies targeting the companion, incapacitation/recovery, techniques, healing, and ranged weapons.

Combat states

A combat FSM (FOLLOW / ENGAGE / ATTACK / REGROUP) sits alongside the existing follow behavior:

Combat gating

Target selection

Target selection is a pure function (CompanionCombat.select_target) of candidate data — no scene access — so the unit tests exercise it directly. Candidates are the alive members of the "enemies" group. The rules:

Attack resolution

The companion reuses the player's hit pipeline end-to-end; it introduces no new damage path:

Animation contract (reconciles /states/companion)

Autopilot oracles

Implemented by

Pinned by test_companion_combat_decisions in scripts/tools/test_runner.gd (target priority, leash filtering, damage math, damaging-frame crossing — all against the pure functions, no scene needed).