Skip to content

feat: add melee detection to the damage dataset - #35

Open
ghaif wants to merge 1 commit into
pnxenopoulos:mainfrom
ghaif:feat/damage-melee-detection
Open

feat: add melee detection to the damage dataset#35
ghaif wants to merge 1 commit into
pnxenopoulos:mainfrom
ghaif:feat/damage-melee-detection

Conversation

@ghaif

@ghaif ghaif commented Aug 16, 2026

Copy link
Copy Markdown

Problem

The damage dataset could not tell whether a hit was a melee attack. load_damage decodes the full CCitadelUserMessage_Damage protobuf but surfaced only 10 of its fields, dropping ability_id, type, and citadel_type, which are the fields that identify a hit.

Change

Surface those fields on the damage frame and add an is_melee convenience flag:

  • ability_id: the ability that dealt the hit (0 if none; resolve with ability_names())
  • damage_type: the raw type bitfield
  • citadel_type: Deadlock's damage-type category (3 is melee damage)
  • is_melee: a light/heavy melee attack

is_melee is citadel_type == 3 AND a hit from a melee ability (its name contains melee). citadel_type == 3 on its own is too broad: it also tags melee-typed abilities (uppercut, hook, crushing fists) and ownerless auto-melees (ability_id == 0, e.g. a trooper's own swing). Restricting to a melee ability keeps a hero's light and heavy melee against any target (heroes, troopers, denizens) and drops the rest. citadel_type stays exposed for anyone who wants the broad damage type.

The melee-id set is derived once from all_abilities(), so it is cheap and stays correct as heroes are added.

Tests

crates/boon-python/tests/test_demo.py: extend the damage schema test and add TestDamageMelee (the new fields resolve and are typed; is_melee equals citadel_type == 3 combined with a melee-ability hit; a match lands at least one melee).

load_damage decoded the full CCitadelUserMessage_Damage but surfaced only 10
fields, dropping ability_id, type, and citadel_type, so a hit could not be
identified as melee.

Surface those fields on the damage frame (ability_id, damage_type, citadel_type)
and add an is_melee flag. is_melee is citadel_type == 3 (Deadlock's melee damage
type) AND a hit from a melee ability (name contains "melee"). citadel_type == 3
alone is too broad: it also covers melee-typed abilities such as uppercut and
hook and ownerless auto-melees (ability_id == 0). Restricting to a melee ability
keeps a hero's light/heavy melee against any target (heroes, troopers, denizens)
and drops the rest. The melee-id set is derived once from all_abilities().

Extend the damage schema test and add TestDamageMelee.
@ghaif
ghaif force-pushed the feat/damage-melee-detection branch from 88489aa to 88819fb Compare August 16, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant