aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


docs/npc-engagement.md (5400B)


NPC combat engagement and range

Admitted NPC combat profiles retain their opponent and next attack deadline while outside weapon range. A due swing waits until the existing three-dimensional range check succeeds; waiting neither deals damage nor restarts the clock. Subsequent damage from the same opponent does not replay AttackIIR. Target death, loading, a different playfield or an unavailable connection ends engagement through the existing target-selection and StopFight path. Browser reconnect grace still determines when a temporarily closed transport becomes unavailable.

This rule applies independently of species, level and idle roaming. Appearance stand-ins without an admitted combat profile keep their previous behavior. The shared pursuit policy now supplies approach and return independently of idle placement. The original outdoor give-up rules remain open.

Recovery and the native mismatch

The original client selects NPC health recovery using weapon-controller state. Idle state 1 and zero stat519 use one check per two seconds with max(1, maximumHP / 120) health. Combat doubles HealInterval342 and retains HealDelta343; current spawn inputs give three HP at counter multiples of60. The original recovery source and its server-policy limits are in NPC regeneration.

Previously only the mobile level-1 Leet kept its engagement outside range. Other admitted NPCs repeatedly received AttackIIR after incoming damage and StopFight at the next out-of-range visit. The server then used idle recovery, while independently phased clients sometimes checked recovery during the brief combat state. Absolute corrections remained deferred behind incoming weapon queues. Those state transitions accumulated visible health differences.

An ordinary Clan Training boss fight reproduced zero native HP on the owner, seven HP on the observer and a still-living authoritative NPC. No corpse packet or fifth XP award existed. Reloading ended that attempt and the NPC recovered. A separate pistol-only capture reproduced differing native HP without nanos; stopping the player reconciled the clients through the existing quiet correction. Native zero HP therefore cannot serve as the test's authoritative death gate. The updated native test waits for CorpseFullUpdate for that actual NPC identity.

The fix extends the existing engagement rule to every admitted profile. It changes no damage, health value, recovery rate or packet format. It also avoids extra stop/start traffic rather than adding a new health-correction workaround. Healing while incoming weapon results are queued retains its separately documented limitation.

Verification

Public combat-path regressions cover fixed and roaming level-1/2 Leets and the Clan Training boss. They check retained engagement/deadlines, no out-of-range hit, no repeated native attack/stop, one due hit after entering range, combat recovery and target death/loading/disconnection/playfield changes. Existing pursuit and recovery tests retain movement exclusions and recovery phase across actual disengagement. The new retention and recovery checks fail against the previous implementation.

Five consecutive ordinary native fights after the fix each received one NPC AttackIIR and one authoritative corpse on both clients, earning 500 additional XP. The first fight took about 39 seconds; both clients retained combat state through the encounter. Opening and closing the first four empty corpses credited their cash once. The fifth generated both QL4 items, which expired before pickup; that result is not counted as successful acquisition.

A sixth ordinary kill produced QL4 gloves. Native left-click pickup retained the same instance 709 in player inventory slot 67. Right-click wear reported the missing Agility 16 requirement and left it in inventory. A clean server restart retained all seventeen owned item instances, learned nanos, the player's 1000 cumulative XP and 18 credits. Both WASM clients reconnected, and the gloves were visible in the native inventory. These encounters used issued equipment, ordinary skill training, recovery and native inputs without edited resources or rewards. Those acquisition checks preceded the shared pursuit change; qualified wear and funded equipment upgrades remain separate acceptance checks.

The owner then walked to the original Clan training terminal and offered those gloves for 12 credits. Decline restored the same instance and changed no wallet; accepting the second offer removed only that instance and credited exactly 12. After native reconnect, the inventory contained every remaining issued item, with 1000 XP and 30 credits. The training terminal's purchase stock is still unsupported; this sale does not establish a funded equipment purchase.

The full Go suite passed 1460 test roots and 15097 results. The focused selection passed 36 roots/84 results, the race selection 25 roots/46 results, and vet passed. Source, binary and published-client digests matched the tested manifest. The WASM client was unchanged and neither client reported browser exceptions.

The matching original KKR digest and retained recovery Evidence ID are checked under local/npc-engagement/, alongside baseline/fixed native captures, wire streams, regression logs, source/binary hashes and the final verification ledger.