Skip to content

feat: resolve dynamic placeholders in flag names - #1778

Merged
Travja merged 2 commits into
devfrom
split/1677-flag-dynamic-placeholders
Jul 23, 2026
Merged

feat: resolve dynamic placeholders in flag names#1778
Travja merged 2 commits into
devfrom
split/1677-flag-dynamic-placeholders

Conversation

@Travja

@Travja Travja commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Split out of #1677 (piece 5 of 8 — see that PR for the full breakdown).

What

Flag names/keys are matched literally today, so a skill can't build a flag name from cast data (e.g. per-target flags like stun-{targetUUID}). This resolves {player}, {target}, {targetUUID}, and any custom cast-data keys in flag names consistently across both the producing and consuming sides:

  • FlagMechanic, FlagToggleMechanic, FlagClearMechanic: apply EffectComponent#filter() to the configured flag key/name before use.
  • FlagTrigger, FlagExpireTrigger: resolve the same placeholders when matching a fired/expired flag against the configured flags list, mirroring EffectComponent#filter with the trigger's caster entity acting as both caster and target.
  • FlagCondition: applies filter() to the configured flag name.
  • FlagClearMechanic (regex mode): a pattern that fails to compile for one target's resolved key now skips just that target (and the mechanic reports failure) instead of aborting entirely.

Also cleans up a couple of minor pre-existing issues noticed in the same files (min-duration tick math, a stray semicolon in FlagTrigger).

Why split out separately

Cohesive, testable unit around one feature (dynamic flag names) touching only the flag subsystem. Independent of the FlagManager reentrancy fix (#1777) and everything else in #1677.

Testing

Could not build locally (private Maven repo unreachable in this sandbox). Needs manual/CI verification: a skill using {targetUUID}-style flag names, plus regression-testing existing static flag names still match.


Generated by Claude Code

Split out of #1677 (piece 5 of 8).

Flag names/keys are matched literally today, so a skill can't use a flag
name built from cast data (e.g. per-target or per-cast flags like
"stun-{targetUUID}"). This resolves {player}, {target}, {targetUUID},
and any custom cast-data keys in flag names consistently across the
producing and consuming sides:

- FlagMechanic, FlagToggleMechanic, FlagClearMechanic: apply
  EffectComponent#filter() to the configured flag key/name before use.
- FlagTrigger, FlagExpireTrigger: resolve the same placeholders when
  matching a fired/expired flag against the configured "flags" list,
  mirroring EffectComponent#filter with the trigger's caster entity
  acting as both caster and target.
- FlagCondition: apply filter() to the configured flag name.
- FlagClearMechanic: on regex mode, a pattern that fails to compile for
  one target's resolved key now skips just that target (and the
  mechanic reports failure) instead of aborting the whole mechanic.

Also cleans up minor issues in FlagTrigger/FlagExpireTrigger noticed
along the way (min-duration tick math, a stray semicolon).
@Travja Travja mentioned this pull request Jul 21, 2026
Adds/extends tests for the flag-placeholder feature:

- FlagMechanicTest, FlagToggleMechanicTest (new): per-target and
  cast-data placeholders resolve before the flag is applied/toggled.
- FlagClearMechanicTest: adds placeholder resolution cases, including
  the regex-mode change where one target's unresolved/invalid pattern
  now only skips that target instead of aborting the whole mechanic.
- FlagConditionTest (new): static and dynamic ({target}) flag names,
  plus the "not set" type.
- FlagTriggerTest, FlagExpireTriggerTest (new): matching a fired/expired
  flag against a configured flags list containing {player}/cast-data
  placeholders, including the existing min-duration/inverted behavior.
@Travja
Travja merged commit 24caf9c into dev Jul 23, 2026
3 checks passed
@Travja
Travja deleted the split/1677-flag-dynamic-placeholders branch July 23, 2026 02:58
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.

2 participants