mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Add current back to schema
This commit is contained in:
parent
251baba5b3
commit
809bdc8678
4 changed files with 15 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ export default class ArmorChange extends foundry.abstract.DataModel {
|
|||
priority: new fields.NumberField(),
|
||||
phase: new fields.StringField({ required: true, blank: false, initial: 'initial' }),
|
||||
value: new fields.SchemaField({
|
||||
current: new fields.NumberField({ integer: true, min: 0, initial: 0 }),
|
||||
max: new fields.StringField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
|
|
@ -31,6 +32,16 @@ export default class ArmorChange extends foundry.abstract.DataModel {
|
|||
defaultPriority: 20,
|
||||
handler: (actor, change, _options, _field, replacementData) => {
|
||||
const parsedMax = itemAbleRollParse(change.value.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.current
|
||||
},
|
||||
replacementData
|
||||
);
|
||||
game.system.api.documents.DhActiveEffect.applyChange(
|
||||
actor,
|
||||
{
|
||||
|
|
@ -62,6 +73,7 @@ export default class ArmorChange extends foundry.abstract.DataModel {
|
|||
key: 'Armor',
|
||||
type: CONFIG.DH.GENERAL.activeEffectModes.armor.id,
|
||||
value: {
|
||||
current: 0,
|
||||
max: 0,
|
||||
locked
|
||||
},
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
header,
|
||||
ol {
|
||||
grid-template-columns: 7rem 12rem 4rem;
|
||||
grid-template-columns: 5rem 7rem 12rem 4rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
<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.interaction.label"}}</div>
|
||||
<div>{{localize "EFFECT.FIELDS.changes.element.priority.label"}}</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<li data-index="{{index}}">
|
||||
<input type="hidden" name="{{concat "system.changes." index ".type"}}" value="{{type}}" />
|
||||
<input type="hidden" name="{{concat "system.changes." index ".phase"}}" value="{{phase}}" />
|
||||
{{formInput fields.value.fields.current name=(concat "system.changes." index ".value.current") value=value.current data-dtype="Number"}}
|
||||
{{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}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue