Make the ActiveEffects able to pull values from properties on the target object for it's value
This commit is contained in:
parent
76cca3f672
commit
0064e10635
1 changed files with 14 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue