diff --git a/module/applications/dialogs/downtime.mjs b/module/applications/dialogs/downtime.mjs index 15ffc189..10708d02 100644 --- a/module/applications/dialogs/downtime.mjs +++ b/module/applications/dialogs/downtime.mjs @@ -94,7 +94,10 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV const actionItems = this.actor.items.reduce((acc, x) => { if (x.system.actions) { const recoverable = x.system.actions.reduce((acc, action) => { - if (action.uses.recovery && (action.uses.recovery === 'shortRest') === this.shortrest) { + if ( + (action.uses.recovery && (action.uses.recovery === 'longRest') === !this.shortrest) || + action.uses.recovery === 'shortRest' + ) { acc.push({ title: x.name, name: action.name, @@ -116,7 +119,8 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV if ( x.system.resource && x.system.resource.type && - (x.system.resource.recovery === 'shortRest') === this.shortrest + ((x.system.resource.recovery === 'longRest') === !this.shortrest || + x.system.resource.recovery === 'shortRest') ) { acc.push({ title: game.i18n.localize(`TYPES.Item.${x.type}`), @@ -226,7 +230,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV ) { for (var data of this.refreshables.actionItems) { const action = await foundry.utils.fromUuid(data.uuid); - await action.parent.parent.update({ [`system.actions.${action.id}.uses.value`]: action.uses.max ?? 1 }); + await action.parent.parent.update({ [`system.actions.${action.id}.uses.value`]: 0 }); } for (var data of this.refreshables.resourceItems) { diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index 8e665265..ee84aa7d 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -73,7 +73,7 @@ export default class DhCharacter extends BaseDataActor { ), gold: new fields.SchemaField({ coins: new fields.NumberField({ initial: 0, integer: true }), - handfulls: new fields.NumberField({ initial: 0, integer: true }), + handfulls: new fields.NumberField({ initial: 1, integer: true }), bags: new fields.NumberField({ initial: 0, integer: true }), chests: new fields.NumberField({ initial: 0, integer: true }) }), diff --git a/module/data/fields/action/usesField.mjs b/module/data/fields/action/usesField.mjs index 14ceba61..3993ca3b 100644 --- a/module/data/fields/action/usesField.mjs +++ b/module/data/fields/action/usesField.mjs @@ -12,7 +12,10 @@ export default class UsesField extends fields.SchemaField { initial: null, nullable: true }), - consumeOnSuccess: new fields.BooleanField({ initial: false, label: "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.label" }) + consumeOnSuccess: new fields.BooleanField({ + initial: false, + label: 'DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.label' + }) }; super(usesFields, options, context); } @@ -30,6 +33,7 @@ export default class UsesField extends fields.SchemaField { if (!uses) return null; return { ...uses, + remaining: this.remainingUses, enabled: uses.hasOwnProperty('enabled') ? uses.enabled : true }; } diff --git a/module/data/fields/actionField.mjs b/module/data/fields/actionField.mjs index a31197b5..c3bdcaaa 100644 --- a/module/data/fields/actionField.mjs +++ b/module/data/fields/actionField.mjs @@ -1,4 +1,5 @@ import DHActionConfig from '../../applications/sheets-configs/action-config.mjs'; +import { itemAbleRollParse } from '../../helpers/utils.mjs'; import MappingField from './mappingField.mjs'; /** @@ -167,7 +168,10 @@ export function ActionMixin(Base) { get remainingUses() { if (!this.uses) return null; - return Math.max((this.uses.max ?? 0) - (this.uses.value ?? 0), 0); + return Math.max( + (this.uses.max ? itemAbleRollParse(this.uses.max, this.actor) : 0) - (this.uses.value ?? 0), + 0 + ); } static async create(data, operation = {}) { diff --git a/templates/dialogs/dice-roll/costSelection.hbs b/templates/dialogs/dice-roll/costSelection.hbs index cf906538..765fbaf9 100644 --- a/templates/dialogs/dice-roll/costSelection.hbs +++ b/templates/dialogs/dice-roll/costSelection.hbs @@ -9,7 +9,7 @@ - + {{/if}} {{#each costs as | cost index |}} diff --git a/templates/sheets/actors/character/header.hbs b/templates/sheets/actors/character/header.hbs index 827d49d6..4c4304aa 100644 --- a/templates/sheets/actors/character/header.hbs +++ b/templates/sheets/actors/character/header.hbs @@ -127,6 +127,6 @@ {{#> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}} - + {{/'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}} \ No newline at end of file