mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
j
This commit is contained in:
parent
7cbe4b7580
commit
4bdafeff6d
10 changed files with 89 additions and 36 deletions
|
|
@ -2,18 +2,6 @@ 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 */
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -101,9 +89,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
|
||||
/**@inheritdoc*/
|
||||
apply(actor, change) {
|
||||
if(!this.verifyConditional(actor)) return {};
|
||||
// const changes = super.apply(actor, change);
|
||||
// console.log(actor, change, changes);
|
||||
if(!this.verifyCondition(actor)) return {};
|
||||
return super.apply(actor, change);
|
||||
}
|
||||
|
||||
|
|
@ -125,10 +111,8 @@ 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;
|
||||
verifyCondition(actor) {
|
||||
if(!this.system.conditional?.field) return true;
|
||||
return foundry.applications.ux.SearchFilter.evaluateFilter(actor, this.system.conditional);
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +127,9 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
this.isTemporary ? 'DAGGERHEART.EFFECTS.Duration.temporary' : 'DAGGERHEART.EFFECTS.Duration.passive'
|
||||
)
|
||||
];
|
||||
|
||||
if(this.target instanceof CONFIG.Actor.documentClass && !this.verifyCondition(this.target))
|
||||
tags.push(`<i>${game.i18n.localize('DAGGERHEART.GENERAL.conditional.notMet')}</i>`);
|
||||
|
||||
for (const statusId of this.statuses) {
|
||||
const status = CONFIG.statusEffects.find(s => s.id === statusId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue