Skip to content

Commit d54ecaf

Browse files
pdbethkeclaude
andcommitted
Fix two incorrect comments about template maneuver XMLIDs
Defect 1: Comments incorrectly claimed all 53 template maneuvers carry XMLID="MANEUVER". FACT: template maneuvers carry NO XMLID — DISPLAY is their sole identity. The XMLIDs all being "MANEUVER" applies only to maneuvers written into HDC files, not the template itself. That's why the template index is keyed by display. Corrected comments at: - kirby_cost/campaign/rules.py:147 (comment) - kirby_cost/campaign/rules.py:155-158 (ValueError message text) - kirby_cost/template/hdt_provider.py:720-722 (docstring) Defect 2: Comment at rules.py:41-43 claimed nine fields were "observed changing a real object". FACT: only six were probed on real character loads (killing, does_body, does_damage, does_knockback, defense, target, range, uses_end, level_cost, display, level_value, level_power, level_multiplier, min_set, max_set, base_value). The other three (all_cost, group_cost, sense_cost) were probed via apply_template on a constructed SenseAdder, not a real character load. Narrowed the claim and added caveat explaining the testing method for those three fields. All 53 tests still passing. Refusal-message assertions still hold. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xof4ZUS5n6A5ibX3PXNYbs
1 parent 511429f commit d54ecaf

2 files changed

Lines changed: 25 additions & 21 deletions

File tree

kirby_cost/campaign/rules.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
#: level_multiplier, min_set, max_set: read directly by `apply_template`
4040
#: (base.py:398, :487-:509, :545, :551) and by `Adder.apply_template`.
4141
#: * The nine below were the ones the first pass never probed. Each was
42-
#: then forced through `CampaignRules` and observed changing a real
43-
#: object, on 2026-08-25:
42+
#: then forced through `CampaignRules` and observed changing a loaded
43+
#: object, on 2026-08-25 (six via real character loads; three via
44+
#: constructed objects, noted below):
4445
#: * types -> forcing ("PROBE",) on RKA gave Ravel's RKA `_types
4546
#: == ["PROBE"]` (base.py, the `tmpl.types` loop).
4647
#: * attributes -> forcing SHOWOPTIONONLY="Yes" on PENETRATING flipped
@@ -53,8 +54,11 @@
5354
#: * base_value -> forcing 42.0 on STR moved Ravel's STR `base_level`
5455
#: from 10.0 to 42.0 (hdc_loader.py:655).
5556
#: * all_cost / group_cost / sense_cost -> forcing 55.0 on a sense-rate
56-
#: xmlid put 55.0 on all three of a SenseAdder
57+
#: xmlid put 55.0 on all three of a constructed SenseAdder
5758
#: (base.py, the sense-rate loop; hdc_loader.py:1615).
59+
#: (These three were probed via apply_template on a built
60+
#: object, not a real character load, because none of the
61+
#: authored characters carries a SenseAdder.)
5862
#:
5963
#: The one field that is neither wired nor listed as a rule is `class_name`,
6064
#: below: it has ZERO reads off a `TemplateData` anywhere in `kirby_cost/`.
@@ -144,20 +148,20 @@ def set(self, xmlid: str, field: str, value: Any) -> None:
144148
f"a field to its class default is not a capability that "
145149
f"exists today.)"
146150
)
147-
# Every one of the 53 template maneuvers carries XMLID="MANEUVER", so
148-
# the maneuver index is keyed by DISPLAY and `hdc_loader` routes them
149-
# to `get_maneuver`, never to `get_template_data`. "MANEUVER" is
150-
# nonetheless IN the flat index (as Basic Strike, first wins), so the
151-
# existence check below would accept this rule and it would be 100%
152-
# inert. Refused here instead, before the check that would pass.
151+
# Template maneuvers carry no XMLID — DISPLAY is their sole identity.
152+
# So `hdc_loader` routes them to `get_maneuver` (keyed by display), not
153+
# to `get_template_data`. If allowed here, this rule would find nothing
154+
# on the template side and do nothing. Moreover, patching here by xmlid
155+
# would rewrite all 53 maneuvers at once (they all parse with the same
156+
# XMLID="MANEUVER" in HDC). Refused here instead, before the check.
153157
if xmlid.upper() == "MANEUVER":
154158
raise ValueError(
155-
"'MANEUVER' cannot be the subject of a campaign rule: all 53 "
156-
"template maneuvers share XMLID=\"MANEUVER\" and are looked "
157-
"up by their display name, so this rule would never be read "
158-
"-- and applying it by xmlid would rewrite all 53 at once. "
159-
"Overriding one maneuver needs a rule keyed by display, "
160-
"which does not exist yet."
159+
"'MANEUVER' cannot be the subject of a campaign rule: template "
160+
"maneuvers carry no XMLID (DISPLAY is their identity), so this "
161+
"rule would find nothing on the template side. Moreover, all 53 "
162+
"HDC maneuvers are written XMLID=\"MANEUVER\", so patching by "
163+
"xmlid would rewrite all 53 at once. Overriding one maneuver "
164+
"needs a rule keyed by display, which does not exist yet."
161165
)
162166
if self._provider.get_template_data(xmlid) is None:
163167
raise ValueError(

kirby_cost/template/hdt_provider.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -717,12 +717,12 @@ def get_maneuver(self, display: str) -> Optional[TemplateData]:
717717
None means "custom maneuver": Java builds one from the HDC element
718718
alone when no template maneuver matches the display.
719719
720-
NOT campaign-patched, deliberately. All 53 template maneuvers carry
721-
XMLID="MANEUVER" -- that is why this index is keyed by display at all
722-
-- so patching here by xmlid would apply one MANEUVER rule to all 53
723-
at once. `CampaignRules.set()` therefore REFUSES "MANEUVER" outright,
724-
so there is no accepted rule for this door to drop. A rule keyed by
725-
maneuver display is a real feature; it is not this one.
720+
NOT campaign-patched, deliberately. Template maneuvers carry no XMLID
721+
(DISPLAY is their sole identity), so this index is keyed by display.
722+
`CampaignRules.set()` therefore REFUSES "MANEUVER" outright: the rule
723+
would find nothing on the template side, and even if it did, all 53
724+
HDC maneuvers parse as XMLID="MANEUVER", so patching would rewrite all
725+
53 at once. A rule keyed by maneuver display is a real feature, not this.
726726
"""
727727
return self._maneuvers.get(display)
728728

0 commit comments

Comments
 (0)