Make the ActiveEffects able to pull values from properties on the target object for it's value

This commit is contained in:
Oliver-Akins 2024-04-27 02:05:59 -06:00
parent 76cca3f672
commit 0064e10635

View file

@ -4,4 +4,18 @@ export class DotDungeonActiveEffect extends ActiveEffect {
// embedded controls
get enabled() { return !this.disabled };
set enabled(newValue) { this.disabled = !newValue };
apply(object, change) {
change.value = change.value.replace(
/@(?<key>[\w\.]+)/gi,
(...args) => {
const key = args[1];
if (foundry.utils.hasProperty(object, key)) {
return foundry.utils.getProperty(object, key)
};
return args[0];
}
)
return super.apply(object, change);
}
};