diff --git a/module/applications/dialogs/resourceDiceDialog.mjs b/module/applications/dialogs/resourceDiceDialog.mjs index b79ff895..8205dee5 100644 --- a/module/applications/dialogs/resourceDiceDialog.mjs +++ b/module/applications/dialogs/resourceDiceDialog.mjs @@ -67,7 +67,7 @@ export default class ResourceDiceDialog extends HandlebarsApplicationMixin(Appli static async rerollDice() { const max = itemAbleRollParse(this.item.system.resource.max, this.actor, this.item); - const diceFormula = `${max}d${this.item.system.resource.dieFaces}`; + const diceFormula = `${max}${this.item.system.resource.dieFaces}`; const roll = await new Roll(diceFormula).evaluate(); if (game.modules.get('dice-so-nice')?.active) await game.dice3d.showForRoll(roll, game.user, true); this.rollValues = roll.terms[0].results.map(x => ({ value: x.result, used: false })); diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index 6fe66a53..6b0a2fd7 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -252,13 +252,13 @@ export default class DhCharacter extends BaseDataActor { features = []; for (let item of this.parent.items) { - if (item.system.type === CONFIG.DH.ITEM.featureTypes.ancestry.id) { + if (item.system.originItemType === CONFIG.DH.ITEM.featureTypes.ancestry.id) { ancestryFeatures.push(item); - } else if (item.system.type === CONFIG.DH.ITEM.featureTypes.community.id) { + } else if (item.system.originItemType === CONFIG.DH.ITEM.featureTypes.community.id) { communityFeatures.push(item); - } else if (item.system.type === CONFIG.DH.ITEM.featureTypes.class.id) { + } else if (item.system.originItemType === CONFIG.DH.ITEM.featureTypes.class.id) { classFeatures.push(item); - } else if (item.system.type === CONFIG.DH.ITEM.featureTypes.subclass.id) { + } else if (item.system.originItemType === CONFIG.DH.ITEM.featureTypes.subclass.id) { const subclassState = this.class.subclass.system.featureState; const identifier = item.system.identifier; if ( @@ -268,7 +268,7 @@ export default class DhCharacter extends BaseDataActor { ) { subclassFeatures.push(item); } - } else if (item.system.type === CONFIG.DH.ITEM.featureTypes.companion.id) { + } else if (item.system.originItemType === CONFIG.DH.ITEM.featureTypes.companion.id) { companionFeatures.push(item); } else if (item.type === 'feature' && !item.system.type) { features.push(item); diff --git a/module/data/item/base.mjs b/module/data/item/base.mjs index e99c85c3..24e5e0cc 100644 --- a/module/data/item/base.mjs +++ b/module/data/item/base.mjs @@ -53,11 +53,14 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel { }), diceStates: new fields.TypedObjectField( new fields.SchemaField({ - value: new fields.NumberField({ integer: true, nullable: true, initial: null }), + value: new fields.NumberField({ integer: true, initial: 1, min: 1 }), used: new fields.BooleanField({ initial: false }) }) ), - dieFaces: new fields.StringField({ initial: '4' }) + dieFaces: new fields.StringField({ + choices: CONFIG.DH.GENERAL.diceTypes, + initial: CONFIG.DH.GENERAL.diceTypes.d4 + }) }, { nullable: true, initial: null } ); diff --git a/templates/dialogs/dice-roll/resourceDice.hbs b/templates/dialogs/dice-roll/resourceDice.hbs index 33c93386..bebe8f4e 100644 --- a/templates/dialogs/dice-roll/resourceDice.hbs +++ b/templates/dialogs/dice-roll/resourceDice.hbs @@ -3,14 +3,14 @@ {{#times (rollParsed item.system.resource.max actor item numerical=true)}} {{#with (ifThen (lookup ../diceStates this) (lookup ../diceStates this) this) as | state |}}
- - + +
{{/with}} {{/times}} \ No newline at end of file diff --git a/templates/sheets/global/partials/item-resource.hbs b/templates/sheets/global/partials/item-resource.hbs index 9b92dea0..d90f0b3f 100644 --- a/templates/sheets/global/partials/item-resource.hbs +++ b/templates/sheets/global/partials/item-resource.hbs @@ -10,7 +10,7 @@
- + {{#if state.used}}{{/if}}
diff --git a/templates/sheets/global/partials/resource-section.hbs b/templates/sheets/global/partials/resource-section.hbs index f0d322d3..ab329efc 100644 --- a/templates/sheets/global/partials/resource-section.hbs +++ b/templates/sheets/global/partials/resource-section.hbs @@ -19,7 +19,7 @@ {{formGroup systemFields.resource.fields.value value=source.system.resource.value localize=true}} {{formGroup systemFields.resource.fields.max value=source.system.resource.max localize=true}} {{else}} - {{formGroup systemFields.resource.fields.dieFaces value=source.system.resource.dieFaces localize=true}} + {{formGroup systemFields.resource.fields.dieFaces value=source.system.resource.dieFaces localize=true blank=false}} {{formGroup systemFields.resource.fields.max value=source.system.resource.max label="DAGGERHEART.ITEMS.FIELDS.resource.amount.label" localize=true}} {{/if}}