Restored the data model, config and settings html

This commit is contained in:
WBHarry 2026-06-23 22:59:16 +02:00
parent 25642b80b1
commit 1017437480
5 changed files with 75 additions and 4 deletions

View file

@ -155,6 +155,10 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
.querySelector('.stacking-change-checkbox')
?.addEventListener('change', this.stackingChangeToggle.bind(this));
htmlElement
.querySelector('.range-dependence-change-checkbox')
?.addEventListener('change', this.rangeDependenceChangeToggle.bind(this));
htmlElement
.querySelector('.armor-change-checkbox')
?.addEventListener('change', this.armorChangeToggle.bind(this));
@ -224,6 +228,20 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
return this.submit({ updateData: { system: systemData } });
}
rangeDependenceChangeToggle(event) {
const rangeFields = this.document.system.schema.fields.rangeDependence.fields;
const systemData = {
rangeDependence: event.target.checked
? {
type: rangeFields.type.initial,
target: rangeFields.target.initial,
range: rangeFields.range.initial
}
: null
};
return this.submit({ updateData: { system: systemData } });
}
armorChangeToggle(event) {
if (event.target.checked) {
this.addArmorChange();

View file

@ -106,11 +106,18 @@ export const templateTypes = {
}
};
export const targetTypes = {
self: {
id: 'self',
label: 'DAGGERHEART.CONFIG.TargetTypes.self'
export const rangeInclusion = {
withinRange: {
id: 'withinRange',
label: 'DAGGERHEART.CONFIG.RangeInclusion.withinRange'
},
outsideRange: {
id: 'outsideRange',
label: 'DAGGERHEART.CONFIG.RangeInclusion.outsideRange'
}
};
export const otherTargetTypes = {
friendly: {
id: 'friendly',
label: 'DAGGERHEART.CONFIG.TargetTypes.friendly'
@ -123,6 +130,14 @@ export const targetTypes = {
id: 'any',
label: 'DAGGERHEART.CONFIG.TargetTypes.any'
}
}
export const targetTypes = {
self: {
id: 'self',
label: 'DAGGERHEART.CONFIG.TargetTypes.self'
},
...otherTargetTypes
};
export const burden = {

View file

@ -56,6 +56,26 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
}),
description: new fields.HTMLField({ label: 'DAGGERHEART.GENERAL.description' })
}),
rangeDependence: new fields.SchemaField({
type: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.rangeInclusion,
initial: CONFIG.DH.GENERAL.rangeInclusion.withinRange.id,
label: 'DAGGERHEART.GENERAL.type'
}),
target: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.otherTargetTypes,
initial: CONFIG.DH.GENERAL.otherTargetTypes.hostile.id,
label: 'DAGGERHEART.GENERAL.Target.single'
}),
range: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.range,
initial: CONFIG.DH.GENERAL.range.melee.id,
label: 'DAGGERHEART.GENERAL.range'
})
}, { nullable: true, initial: null }),
stacking: new fields.SchemaField(
{
value: new fields.NumberField({