feat: resolve dynamic placeholders in flag names - #1778
Merged
Conversation
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).
Open
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: applyEffectComponent#filter()to the configured flag key/name before use.FlagTrigger,FlagExpireTrigger: resolve the same placeholders when matching a fired/expired flag against the configuredflagslist, mirroringEffectComponent#filterwith the trigger's caster entity acting as both caster and target.FlagCondition: appliesfilter()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
FlagManagerreentrancy 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