Refactor ArmorChange schema and fix some bugs

This commit is contained in:
Carlos Fernandez 2026-03-21 02:42:43 -04:00
parent 6193153596
commit 251baba5b3
60 changed files with 128 additions and 317 deletions

View file

@ -1891,7 +1891,7 @@
"armor": {
"newArmorEffect": "Armor Effect",
"FIELDS": {
"armorInteraction": {
"interaction": {
"label": "Armor Interaction",
"hint": "Does the character wearing armor suppress this effect?"
}

View file

@ -190,23 +190,14 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
}));
break;
case 'changes':
const fields = this.document.system.schema.fields.changes.element.fields;
const singleTypes = ['armor'];
const { base, ...typedChanges } = context.source.changes.reduce((acc, change, index) => {
const type = CONFIG.DH.GENERAL.baseActiveEffectModes[change.type] ? 'base' : change.type;
if (singleTypes.includes(type)) {
acc[type] = { ...change, index };
} else {
if (!acc[type]) acc[type] = [];
acc[type].push({ ...change, index });
const typedChanges = context.source.changes.reduce((acc, change, index) => {
if (singleTypes.includes(change.type)) {
acc[change.type] = { ...change, index };
}
return acc;
}, {});
partContext.changes = await Promise.all(
foundry.utils.deepClone(base ?? []).map(c => this._prepareChangeContext(c, fields))
);
partContext.changes = partContext.changes.filter(c => !!c);
partContext.typedChanges = typedChanges;
break;
}
@ -238,29 +229,38 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
return this.submit({ updateData: { system: { changes } } });
}
_prepareChangeContext(change, fields) {
/** @inheritdoc */
_renderChange(context) {
const { change, index, defaultPriority } = context;
if (!(change.type in CONFIG.DH.GENERAL.baseActiveEffectModes)) return null;
const changeTypesSchema = this.document.system.schema.fields.changes.element.types;
const fields = context.fields ?? (changeTypesSchema[change.type] ?? changeTypesSchema.add).fields;
if (typeof change.value !== 'string') change.value = JSON.stringify(change.value);
const defaultPriority = game.system.api.documents.DhActiveEffect.CHANGE_TYPES[change.type]?.defaultPriority;
Object.assign(
change,
['key', 'type', 'value', 'priority'].reduce((paths, fieldName) => {
paths[`${fieldName}Path`] = `system.changes.${change.index}.${fieldName}`;
paths[`${fieldName}Path`] = `system.changes.${index}.${fieldName}`;
return paths;
}, {})
);
return (
game.system.api.documents.DhActiveEffect.CHANGE_TYPES[change.type].render?.(
change,
change.index,
index,
defaultPriority
) ??
foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/activeEffect/change.hbs',
{
change,
index: change.index,
index,
defaultPriority,
fields
fields,
types: Object.keys(CONFIG.DH.GENERAL.baseActiveEffectModes).reduce((r, key) => {
r[key] = CONFIG.DH.GENERAL.baseActiveEffectModes[key].label;
return r;
}, {})
}
)
);

View file

@ -18,23 +18,34 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
const baseChanges = Object.keys(CONFIG.DH.GENERAL.baseActiveEffectModes).reduce((r, type) => {
r[type] = new fields.SchemaField({
key: new fields.StringField({ required: true }),
type: new fields.StringField({
required: true,
choices: [type],
initial: type,
validate: BaseEffect.#validateType
}),
value: new fields.AnyField({
required: true,
nullable: true,
serializable: true,
initial: ''
}),
phase: new fields.StringField({ required: true, blank: false, initial: 'initial' }),
priority: new fields.NumberField()
});
return r;
}, {});
return {
...super.defineSchema(),
changes: new fields.ArrayField(
new fields.SchemaField({
key: new fields.StringField({ required: true }),
type: new fields.StringField({
required: true,
blank: false,
choices: CONFIG.DH.GENERAL.activeEffectModes,
initial: CONFIG.DH.GENERAL.activeEffectModes.add.id,
validate: BaseEffect.#validateType
}),
value: new fields.AnyField({ required: true, nullable: true, serializable: true, initial: '' }),
phase: new fields.StringField({ required: true, blank: false, initial: 'initial' }),
priority: new fields.NumberField(),
typeData: new fields.TypedSchemaField(changeTypes, { nullable: true, initial: null })
})
new fields.TypedSchemaField(
{ ...changeTypes, ...baseChanges },
{ initial: baseChanges.add.getInitialValue() }
)
),
duration: new fields.SchemaField({
type: new fields.StringField({
@ -97,7 +108,7 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
const armorChange = this.armorChange;
if (!armorChange) return null;
return armorChange.typeData.getArmorData(armorChange);
return armorChange.getArmorData(armorChange);
}
static getDefaultObject() {

View file

@ -2,42 +2,35 @@ import { itemAbleRollParse } from '../../../helpers/utils.mjs';
const fields = foundry.data.fields;
export default class Armor extends foundry.abstract.DataModel {
export default class ArmorChange extends foundry.abstract.DataModel {
static defineSchema() {
return {
type: new fields.StringField({ required: true, initial: 'armor', blank: false }),
max: new fields.StringField({
required: true,
nullable: false,
initial: '1',
label: 'DAGGERHEART.GENERAL.max'
priority: new fields.NumberField(),
phase: new fields.StringField({ required: true, blank: false, initial: 'initial' }),
value: new fields.SchemaField({
max: new fields.StringField({
required: true,
nullable: false,
initial: '1',
label: 'DAGGERHEART.GENERAL.max'
}),
interaction: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.activeEffectArmorInteraction,
initial: CONFIG.DH.GENERAL.activeEffectArmorInteraction.none.id,
label: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.interaction.label',
hint: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.interaction.hint'
})
}),
armorInteraction: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.activeEffectArmorInteraction,
initial: CONFIG.DH.GENERAL.activeEffectArmorInteraction.none.id,
label: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.armorInteraction.label',
hint: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.armorInteraction.hint'
})
};
}
static changeEffect = {
label: 'Armor',
defaultPriortiy: 20,
defaultPriority: 20,
handler: (actor, change, _options, _field, replacementData) => {
const parsedMax = itemAbleRollParse(change.typeData.max, actor, change.effect.parent);
game.system.api.documents.DhActiveEffect.applyChange(
actor,
{
...change,
key: 'system.armorScore.value',
type: CONFIG.DH.GENERAL.activeEffectModes.add.id,
value: change.value
},
replacementData
);
const parsedMax = itemAbleRollParse(change.value.max, actor, change.effect.parent);
game.system.api.documents.DhActiveEffect.applyChange(
actor,
{
@ -54,7 +47,7 @@ export default class Armor extends foundry.abstract.DataModel {
};
get isSuppressed() {
switch (this.armorInteraction) {
switch (this.value.interaction) {
case CONFIG.DH.GENERAL.activeEffectArmorInteraction.active.id:
return !this.parent.parent?.actor.system.armor;
case CONFIG.DH.GENERAL.activeEffectArmorInteraction.inactive.id:
@ -68,9 +61,7 @@ export default class Armor extends foundry.abstract.DataModel {
return {
key: 'Armor',
type: CONFIG.DH.GENERAL.activeEffectModes.armor.id,
value: 0,
typeData: {
type: 'armor',
value: {
max: 0,
locked
},
@ -84,7 +75,7 @@ export default class Armor extends foundry.abstract.DataModel {
name: game.i18n.localize('DAGGERHEART.EFFECTS.ChangeTypes.armor.newArmorEffect'),
img: 'icons/equipment/chest/breastplate-helmet-metal.webp',
system: {
changes: [Armor.getInitialValue(true)]
changes: [ArmorChange.getInitialValue(true)]
}
};
}

View file

@ -1,5 +1,5 @@
import { itemAbleRollParse } from '../helpers/utils.mjs';
import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
import { RefreshType } from '../systemRegistration/socket.mjs';
export default class DhActiveEffect extends foundry.documents.ActiveEffect {
/* -------------------------------------------- */
@ -155,11 +155,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
/* Methods */
/* -------------------------------------------- */
/**@inheritdoc */
static applyChange(actor, change, options) {
super.applyChange(actor, change, options);
}
/**@inheritdoc*/
static applyChangeField(model, change, field) {
change.value = Number.isNumeric(change.value)
@ -168,7 +163,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
super.applyChangeField(model, change, field);
}
_applyChangeUnguided(actor, change, changes, options) {
static _applyChangeUnguided(actor, change, changes, options) {
change.value = DhActiveEffect.getChangeValue(actor, change, change.effect);
super._applyChangeUnguided(actor, change, changes, options);
}

View file

@ -94,15 +94,12 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "1",
"armorInteraction": "active"
"interaction": "active"
}
}
]

View file

@ -26,15 +26,12 @@
"system": {
"changes": [
{
"value": 0,
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"typeData": {
"type": "armor",
"value": {
"max": "3 + @system.traits.strength.value",
"armorInteraction": "inactive"
"interaction": "inactive"
}
}
]

View file

@ -263,13 +263,10 @@
},
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "1"
}
}

View file

@ -95,13 +95,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "1"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -76,13 +76,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -33,13 +33,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -70,13 +70,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -96,13 +96,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "7"
}
}

View file

@ -72,13 +72,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -94,13 +94,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -76,13 +76,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "3"
}
}

View file

@ -87,13 +87,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -76,13 +76,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -33,13 +33,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -83,13 +83,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -33,13 +33,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "3"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "7"
}
}

View file

@ -76,13 +76,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "7"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -33,13 +33,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -71,13 +71,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -63,13 +63,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -70,13 +70,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -70,13 +70,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "4"
}
}

View file

@ -101,13 +101,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "8"
}
}

View file

@ -76,13 +76,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -63,13 +63,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "5"
}
}

View file

@ -63,13 +63,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "6"
}
}

View file

@ -118,13 +118,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier"
}
}

View file

@ -156,13 +156,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier + 1"
}
}

View file

@ -118,13 +118,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier"
}
}

View file

@ -156,13 +156,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier + 1"
}
}

View file

@ -118,13 +118,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier"
}
}

View file

@ -118,13 +118,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier"
}
}

View file

@ -156,13 +156,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier + 1"
}
}

View file

@ -118,13 +118,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier"
}
}

View file

@ -160,13 +160,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "1"
}
}

View file

@ -156,13 +156,10 @@
"system": {
"changes": [
{
"key": "Armor",
"type": "armor",
"phase": "initial",
"priority": 20,
"value": 0,
"typeData": {
"type": "armor",
"value": {
"max": "ITEM.@system.tier + 1"
}
}

View file

@ -50,7 +50,7 @@
header,
ol {
grid-template-columns: 6rem 6rem 12rem 4rem;
grid-template-columns: 7rem 12rem 4rem;
}
}
}

View file

@ -1,20 +0,0 @@
<section class="tab scrollable{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
{{formGroup fields.tint value=source.tint rootId=rootId placeholder="#ffffff"}}
{{formGroup fields.description value=source.description rootId=rootId}}
{{formGroup fields.disabled value=source.disabled rootId=rootId}}
{{#if isActorEffect}}
<div class="form-group">
<label>{{localize "EFFECT.FIELDS.origin.label"}}</label>
<div class="form-fields">
<input type="text" value="{{source.origin}}" disabled />
</div>
</div>
{{/if}}
{{#if isItemEffect}}
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=(localize "DAGGERHEART.EFFECTS.Attachments.transferHint")}}
{{/if}}
{{formGroup fields.showIcon value=source.showIcon options=showIconOptions rootId=rootId}}
</section>

View file

@ -1,3 +0,0 @@
<section class='tab-form-footer padded'>
<button type="button" data-action="finish"><i class="fa-solid fa-floppy-disk"></i> {{localize "Save"}}</button>
</section>

View file

@ -1,17 +0,0 @@
<section class="tab{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
<fieldset>
<legend>{{localize "Armor"}}</legend>
<div class="two-columns even">
{{#each source.system.changes as |change index|}}
{{formGroup @root.systemFields.changes.element.fields.value name=(concat 'system.changes.' index '.value') value=change.value localize=true}}
{{formGroup @root.systemFields.changes.element.fields.max name=(concat 'system.changes.' index '.max') value=change.max localize=true}}
{{/each}}
</div>
</fieldset>
<fieldset>
<legend>{{localize "DAGGERHEART.GENERAL.general"}}</legend>
{{formGroup @root.systemFields.armorInteraction name="system.armorInteraction" value=source.system.armorInteraction localize=true}}
</fieldset>
</section>

View file

@ -3,7 +3,9 @@
<input type="text" class="effect-change-input" name="{{change.keyPath}}" value="{{change.key}}" />
</div>
<div class="type">
{{formInput fields.type name=change.typePath value=change.type localize=true}}
<select name="{{change.typePath}}">
{{selectOptions types selected=change.type localize=true}}
</select>
</div>
<div class="value">
{{formInput fields.value name=change.valuePath value=change.value elementType="input"}}

View file

@ -18,13 +18,12 @@
<legend>{{localize "DAGGERHEART.GENERAL.armor"}} <input type="checkbox" class="armor-change-checkbox" data-index="{{typedChanges.armor.index}}" {{checked typedChanges.armor}} /></legend>
{{#if typedChanges.armor}}
<header>
<div>{{localize "EFFECT.FIELDS.changes.element.value.label"}}</div>
<div>{{localize "DAGGERHEART.GENERAL.max"}}</div>
<div>{{localize "DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.armorInteraction.label"}}</div>
<div>{{localize "DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.interaction.label"}}</div>
<div>{{localize "EFFECT.FIELDS.changes.element.priority.label"}}</div>
</header>
<ol class="scrollable">
{{> "systems/daggerheart/templates/sheets/activeEffect/typeChanges/armorChange.hbs" typedChanges.armor fields=@root.systemFields.changes.element.fields}}
{{> "systems/daggerheart/templates/sheets/activeEffect/typeChanges/armorChange.hbs" typedChanges.armor fields=@root.systemFields.changes.element.types.armor.fields}}
</ol>
{{/if}}
</fieldset>

View file

@ -1,10 +1,7 @@
<li data-index="{{index}}">
<input type="hidden" name="{{concat "system.changes." index ".key"}}" value="{{key}}" />
<input type="hidden" name="{{concat "system.changes." index ".type"}}" value="{{type}}" />
<input type="hidden" name="{{concat "system.changes." index ".phase"}}" value="{{phase}}" />
<input type="hidden" name="{{concat "system.changes." index ".typeData.type"}}" value="{{typeData.type}}" />
{{formInput fields.value name=(concat "system.changes." index ".value") value=value elementType="input" data-dtype="Number"}}
{{formInput fields.typeData.types.armor.fields.max name=(concat "system.changes." index ".typeData.max") value=typeData.max data-dtype="Number"}}
{{formInput fields.typeData.types.armor.fields.armorInteraction name=(concat "system.changes." index ".typeData.armorInteraction") value=typeData.armorInteraction localize=true}}
{{formInput fields.value.fields.max name=(concat "system.changes." index ".value.max") value=value.max data-dtype="Number"}}
{{formInput fields.value.fields.interaction name=(concat "system.changes." index ".value.interaction") value=value.interaction localize=true}}
{{formInput fields.priority name=(concat "system.changes." index ".priority") value=priority}}
</li>