aorecomp

Anarchy Online classic in the browser

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


docs/combat-equipment-modifiers.md (11575B)


Combat equipment modifiers in 14.9.1

Normal-hit added damage

The server adds matching worn equipment and active nano modifiers after attack-rating scaling, the roll and armor's minimum-damage floor. Complete weapon-damage nanos use the shared timed-effect path. Robust Backpack 158790 therefore adds 60 to projectile, energy, radiation and fire hits. It does not add damage to fists or the supported melee axe. Inventory contents have no combat effect; the bag must occupy an authored equipment position.

The July 2002 damage discussion describes additions after attack-rating scaling. On July 9, Krneki explicitly places the bonus after armor, responding to a conflicting interpretation in the same thread. This is contemporary player evidence, not recovered server code. The existing endpoint and AC integer truncation policies remain provisional.

The original kkr.dll::FUN_10031700 stat-name table identifies the modifiers:

Attack protection stat Matching damage modifier
Projectile 90 278
Melee 91 279
Energy 92 280
Chemical 93 281
Radiation 94 282
Cold 95 311
Disease 96 Poison 317
Fire 97 316
Nano 168 315

An invalid weapon damage type already falls back to projectile, including its matching addition. Currently accepted damage bonuses are nonnegative. Unsupported equipment and effect interpreters are not enabled by this mapping. The supported partial overequipping tiers adjust weapon endpoints before attack rating; they do not scale the flat equipment addition. The critical reconstruction also adds matching flat damage after its AC floor; its original order still needs verification. Signed damage debuffs, reflect/absorb ordering and eligibility at zero weapon effectiveness remain separate work. No original miss probability is inferred from this mapping. The current arithmetic adds the flat bonus even if overequipping reduces both base endpoints to zero; the original server's attack eligibility at that tier is not established.

Weapon range

Sniper's Friend 157685 modifies stat 380, RangeIncreaserWeapon, by +2 percent. Critical chance is the distinct stat 379, CriticalIncrease. The stat-name evidence is ev_98e4abebdc945ad44f630f266643a271f9826c40b98314ddfc955b1513b1e525 in local/backpack-equipment-research/native-evidence.json.

Original kkr.dll::FUN_100aae10 reads weapon stat 287 and actor stat 380. It multiplies them as signed 32-bit integers, loads that signed product into the FPU, multiplies by the float32 constant 0x3c23d70a at 0x10170894, then adds the original signed weapon range. It truncates toward zero and caps at 40. There is no float32 store before truncation and no lower clamp. The server then applies the existing actor extents and three-dimensional range predicate. A negative final distance cannot become an accepted distance by squaring it.

Assembly evidence ev_caffa5ac96df90e71084d5f068e035270b37d97a28beb95abb889dd010d2527d is retained in local/damage-modifier-research/range-evidence.json. The original DLL SHA-256 is a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. The translated implementation is client/game/kkr.dll/lifted-0050.c::sub_360AAE10.

Weapon range Percent modifier Adjusted range before extents
22 0 22
22 2 22
22 5 23
10 10 10
20 5 20
22 50 32
22 100 40
50 0 40
2 -100 0
22 -200 -21

The +50 percent example yields 32 because the authored float32 constant is slightly smaller than exact 0.01. Replacing it with an exact decimal percentage, or rounding the sum to float32, would yield 33. Sniper's Friend alone does not increase the adjusted range of the supported 22-meter pistol.

AggDef timing modifiers

Ordinary player weapon and fist timing adds worn stat51 and active nano stat51 to the base AggDef slider before applying the shared attack/recharge formula. The effective sum is signed and is not capped at the slider's -100..100 input range. Attack and recharge retain their one-second minimum. The slider value sent to clients and stored in SQLite remains the base; reconnect reconstructs equipment modifiers once from the same owned instances.

The maintained client/game/kkr.dll/lifted-0035.c::sub_3607AB40 and sub_3607AC10 request actor51 in mode0. The getter in lifted-0033.c::sub_3606DFB0 dispatches that mode to lifted-0034.c::sub_36075CA0, adding the modifier map to the foundation and trickle path. Stat51 is outside the selected trickle and overequipping ranges; these paths do not clamp it. Timing subtracts that sum after the initiative binary32 store and before truncation to centiseconds.

Nano casting uses a different read. The queue in lifted-0030.c::sub_360650F0 requests actor51 in mode2 at36065209..3606520D, which returns its base dword. It divides that signed base by100, truncating toward zero. Equipment AggDef therefore does not change that queue duration. Its separate category3 HUD timer omits AggDef entirely; a HUD duration alone does not establish the queue or authoritative packet deadline.

The original-record audit covers all87,611 item/program identities and reparses all69 literal51 candidates. Sixteen weapons have unconditional OnWear51, with bonuses2..15. All have event10 descriptors; three MTI and three BBI records also have independent Use53089 effects. Verifying their timing and companion modifiers does not establish those other contracts. Both Bracelet of Pacifism records remain rejected because their OnWear53068 effect is unsupported. No decoded stat51 implant modifier was found. Timed consumables, pet trimmers and the20 program contracts remain separate admission work.

With zero initiative, Tium124210's raw122/130 centiseconds and worn+5 produce 192/200 at slider0,292/300 at-100, and100/100 at100. Sako124336 at slider100 produces100/103 with+2, demonstrating that the effective sum102 is not capped at100. The BBI Sense companions also contribute initiative trickle; tests use their complete modifiers rather than treating those weapons as zero-initiative cases. Starting a phase freezes its deadline. A slider change affects the next calculation and cannot spend existing recharge by stopping/restarting combat.

Full records, original resource weights, source hashes, cap/search boundaries and remaining questions are retained in local/aggdef-consumer-research/.

server/aggdef_equipment_test.go checks all16 original functional definitions and48 public attack/recharge scenarios, every authored OnWear companion, pending/removal/reconnect behavior, delayed requirement failures, atomic move failure/retry, held phase deadlines, unchanged base slider replication and the nano queue's signed quotient boundaries. The broader weapon-contract audit and original server timing fidelity remain open.

The full server/game-data suite passes13,787 tests/subtests; the exporter compiles and has no tests. Repeated focused race runs pass7,516 checks. Vet and the preview build also pass.

Two headed GPU WASM clients verify26 modifier states,420 weapon-timer samples and12 identical owner/observer shot pairs. The same rifle instance retains its ammunition across cold restoration and returns to inventory on removal; all three modifiers clear while Strength Boost remains. Native weapon timers match192/200,292/300 and100/100cs at slider0,-100 and100 respectively. Strength Boost's queue completes after1.432s at slider100 and3.391s at-100, including the current250ms server tick and delivery latency. Both keep the separate220/60cs HUD timer and make exactly one44-point durable reservation. The defense case distinguishes base-100 from effective-95. Periodic regeneration can leave the previous SQLite checkpoint behind the live balance, so the debit check compares the last replicated balance with the durable reservation.

The remote-player snapshot supplies matching raw AggDef/initiative foundations; see remote combat stats. Fresh fight clocks agree, but an existing observer timer can retain its old durations after a live slider change. The native SpecialAttackWeapon timing surface also changes holder state and clears modifier entries; it is not a safe generic stat update. The original active-update contract remains a separate TODO. AggDef modifier captures and assertions are in local/aggdef-consumer-smoke/; only normal GUI controls drove gameplay. Those test clients and fixtures were removed, unrelated rows were unchanged, and the single HTTPS preview remains available.

Verification

client/tests/weapon_range.c calls the original translated range procedure, with only its item/actor getters and integer-conversion boundary supplied by the fixture. The table above passes both native Linux and WASM builds. server/combat_equipment_modifiers_test.go sends public combat requests at each resulting boundary and at the next representable float beyond it.

The Go tests also cover every protection type with Robust, invalid-type fallback, unchanged nonmatching damage, removal, controlled endpoint rolls, AR 400/800, armor's minimum floor, partial overequipping, SQLite reload and identical owner/observer damage packets with ammunition consumption. Failed ammunition persistence cannot publish a bonus hit; failed removal keeps the same equipped identity and bonus in memory and SQLite.

Replacing a visible world session removes its old remote actor before sending the new spawn. The equipment snapshot follows CharacterReady, after the native actor has loaded; sending it with the spawn can lose the OnWear effects. Keeping the old actor instead applies those effects twice. Repeated ready messages acknowledge the actor without replaying equipment. Joining observers receive equipment in their initial snapshot only for players who have finished loading; other players' equipment follows their ready notification.

Fresh and unfinished logins do not need the initial removal. server/world_output_test.go exercises all three paths through the world protocol, including removal/spawn/ready/equipment order and repeated ready messages.

The published WASM client was exercised through native inventory, clothing, Tab targeting and Q combat controls against the single HTTPS preview. Evidence and the checking script are retained in local/damage-modifier-research/. Owner and observer both display the same 9-point baseline hit, 72-point Robust hit and 68-point Robust hit after the corrected reconnect. Loaded rounds move 20 -> 19 -> 18 -> 17; the loose stack remains 100.

Ten native modifier captures verify Sniper's Friend and Robust on both clients before and after replacement, including clearing Sniper's modifiers when Robust replaces it. Maximum health stays 2876 with Robust, rather than doubling its 400-point addition or losing it. All 190 item instances are accounted for; the 186 pre-existing instances and placements are unchanged. There are no page errors or unimplemented adapter calls. Both test contexts close afterward, and the existing profile editor ends their resumable combat sessions.

The complete Go suite passes (ao/server 278.413s). Focused race checks pass in 104.831s, covering combat, armor, ranged ammunition, equipment effects, persistence failures and world-session replacement. The original range contract also passes native Linux and WASM execution.