dnd5e icon indicating copy to clipboard operation
dnd5e copied to clipboard

Add original string placeholder option in `override` active effect

Open arbron opened this issue 10 months ago • 0 comments

With upcoming work on enchantment (https://github.com/foundryvtt/dnd5e/issues/3305) there is sometimes a need to add text to the beginning of an existing string or around an existing string. For example, for the "Returning Weapon" Artificer infusion you might want to change the name to indicate its infusion while still showing the original weapon type, so "Returning Dagger" or "Returning Handaxe". This currently isn't possible because there is no prefix active effect mode that would add to the beginning of a string in the same way add appends to the end.

Rather than trying to include a new change mode, which core makes difficult, I propose adding support for a placeholder value that can be used with the override mode that would be replaced with the original string. So that infusion could be written Returning {} and the text {} would be replaced with the name before the active effect was applied.

We should add a restriction to ensure this can only be applied to places we can identify as StringField or HTMLField using data models, because attempting to infer whether the replacement should happen elsewhere may cause issues with data that just looks like strings. We could also potentially make it more restrictive and require a specific option be set on the field like interpolation which must be set to true for this to work. That would allow us to further restrict this to only fields that we explicitly specify, preventing it from causing issues on stringy but not textual data.

arbron avatar Apr 07 '24 15:04 arbron