mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
f
This commit is contained in:
parent
c6741b1c7a
commit
7cbe4b7580
4 changed files with 83 additions and 24 deletions
|
|
@ -1,6 +1,19 @@
|
|||
import { itemAbleRollParse } from '../helpers/utils.mjs';
|
||||
|
||||
export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @inheritdoc */
|
||||
// static defineSchema() {
|
||||
// const fields = foundry.data.fields;
|
||||
|
||||
// return {
|
||||
// ...super.defineSchema(),
|
||||
// test: new fields.StringField()
|
||||
// }
|
||||
// }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Properties */
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -85,6 +98,14 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
change.value = evalValue ?? change.value;
|
||||
super.applyField(model, change, field);
|
||||
}
|
||||
|
||||
/**@inheritdoc*/
|
||||
apply(actor, change) {
|
||||
if(!this.verifyConditional(actor)) return {};
|
||||
// const changes = super.apply(actor, change);
|
||||
// console.log(actor, change, changes);
|
||||
return super.apply(actor, change);
|
||||
}
|
||||
|
||||
/**
|
||||
* Altered Foundry safeEval to allow non-numeric return
|
||||
|
|
@ -104,6 +125,13 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
return result;
|
||||
}
|
||||
|
||||
verifyConditional(actor) {
|
||||
if(!this.system.conditional.key) return true;
|
||||
// const prop = foundry.utils.getProperty(actor, this.system.conditional.key);
|
||||
// if(prop === undefined) return false;
|
||||
return foundry.applications.ux.SearchFilter.evaluateFilter(actor, this.system.conditional);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a list of localized tags based on this item's type-specific properties.
|
||||
* @returns {string[]} An array of localized tag strings.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue