Files
healer-man/docs/ENEMY_HIT_SOURCE_INPUTS_2026-10-07.md
T
2026-10-07 13:05:04 -04:00

3.2 KiB

Enemy hit source inputs — 2026-10-07

The enemy damage source exporter now preserves the raw WoW attribute words that the pinned 3.3.5a hit-result path checks before miss, avoidance, and deflect resolution. The work adds source inputs only; the runtime consumer owns how these flags affect hit resolution.

Pinned source and field mapping

The WoW source is the local 3.3.5a Spell.dbc at ../wow-pvt-server-backups-2/wow335a/Data/patch-A.MPQ/DBFilesClient/Spell.dbc. Its SHA-256 is 57011d528fd66cf39f5ab6fb168e389ab9e4cc1b8050f7201a54239d489b415c; the verified layout is 234 fields and 936-byte rows.

The pinned AzerothCore src/server/shared/DataStores/DBCStructure.h maps Spell.dbc field 4 to Attributes, field 7 to AttributesEx3, and field 11 to AttributesEx7. SpellInfo.cpp copies those DBC words to the corresponding server fields. SharedDefines.h identifies the relevant source bits:

Field Core bit Core meaning
Attributes (4) SPELL_ATTR0_NO_ACTIVE_DEFENSE, 0x00200000 Prevent physical avoidance
AttributesEx3 (7) SPELL_ATTR3_ALWAYS_HIT, 0x00040000 Ignore hit result
AttributesEx7 (11) SPELL_ATTR7_NO_ATTACK_MISS, 0x02000000 Spell cannot be missed

In the pinned Unit.cpp, MeleeSpellHitResult returns early for SPELL_ATTR3_ALWAYS_HIT and SPELL_ATTR0_NO_ACTIVE_DEFENSE; the latter follows the miss check and precedes resist, avoidance, and deflect handling. MagicSpellHitResult returns early for SPELL_ATTR3_ALWAYS_HIT and SPELL_ATTR7_NO_ATTACK_MISS before its ordinary hit/deflect checks. The exact raw attributes remain available so the runtime can follow these source gates.

Data path and limits

scripts/dungeon-pipeline/export-enemy-damage-types.mjs reads fields 4, 7, and 11 into a structured hitSource object for each exported WoW damage row. It records explicit zeros when the matched DBC row contains zero. The generated catalog records these source field indexes in generatedFrom.wowSpellHitFields and the pinned DBC hash above.

src/game/mobDamageTypes.ts carries hitSource only from a matched wow335 source spell. src/game/enemyAttacks.ts copies the same object to wowHitSource during normalization. Unknown spell IDs have no source object; RuneWaker rows remain in their separate numeric spell namespace and do not receive WoW hit metadata.

This metadata does not define complete WoW hit, miss, resist, dodge, parry, block, or deflect tables. Those outcomes and their ordering remain in the combat runtime. Non-damage/script rows excluded by the exporter, unknown DBC spells, and native/RuneWaker attacks remain without this WoW source object.

Focused checks

  • node --test scripts/dungeon-pipeline/export-enemy-damage-types.test.mjs builds a small WDBC fixture and proves fields 4/7/11 are read independently, including a real zero-valued raw word.
  • npx vitest run src/game/mobDamageTypes.test.ts checks the generated WoW metadata through resolution and attack normalization, and verifies absent metadata for unknown and RuneWaker source lookups.

The exporter can target a temporary JSON path with --output for its focused fixture; the production output remains src/game/generated/enemyDamageTypeSources.generated.json.