Skip to content

An unidentified enchanted arm cannot be declared with, but the engine identifies one on its first attack roll #76

Description

@mmacy

The gap

resolve_attack identifies an enchanted arm on the first attack roll made with it (exploration._identify_item_events, called from _resolve_party_attack). That first swing is the intended path from "picked up a strange sword" to "it is a sword +1."

A wire front end cannot offer that swing. _masked_magic_item gives an unidentified instance only instance_type, instance_id, and a category display string — "a sword with a faint aura." No qualities, no missile_ranges, and nothing marking the instance as a weapon at all rather than a ring or a shield. So a front end building a declaration menu from inventory.wielded has to skip it: it cannot label the choice, cannot tell a swing from a throw, and cannot judge whether the declaration is legal at the current distance.

The engine takes the declaration perfectly well — _find_wielded matches on instance_id and never consults identification. Only the projection is short.

#75 fixed the identified half of this (an identified arm now shows the qualities and missile_ranges of the weapon underneath it). The unidentified half is the one left.

Why it is not obviously the same fix

The masked display string already names the base weapon — "a sword with a faint aura" is the documented concession to detect magic existing. So the base's category is not secret, and its qualities and missile_ranges arguably leak nothing beyond what the string already says: a player who reads "a sword" knows swords are swung and that they do not throw.

What would need deciding:

  • Does an unidentified arm show the same two fields as an identified one, or a narrower shape? The magic bonus is not in either field, so the plus stays hidden either way.
  • Does a cursed arm show them? sword_minus_1_cursed has a plain sword's qualities, so showing them reveals nothing the mundane base does not — but it is worth stating out loud rather than falling out of the implementation.
  • Does anything change for an instance whose base_item_id resolves to no weapon? Today attack_facet returns None and the item gains no fields, which is already the right answer.

Consumer

mmacy/osr-web skips unidentified arms in wieldedWeapons() for exactly this reason and cannot stop until the projection says more. Recorded in its AGENTS.md.

https://claude.ai/code/session_015RWZTCGUCS2X6nogtLPKKx

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions