diff --git a/src/module/actor/actor.ts b/src/module/actor/actor.ts index f0abfaf8..15291e38 100644 --- a/src/module/actor/actor.ts +++ b/src/module/actor/actor.ts @@ -317,7 +317,11 @@ export class DS4Actor extends Actor { * @param options - Additional options to customize the roll */ async rollGenericCheck(options: { speaker?: { token?: TokenDocument; alias?: string } } = {}): Promise { - const { attribute, trait } = await this.selectAttributeAndTrait(); + const attributeAndTrait = await this.selectAttributeAndTrait(); + if (!attributeAndTrait) { + return; + } + const { attribute, trait } = attributeAndTrait; const checkTargetNumber = this.data.data.attributes[attribute].total + this.data.data.traits[trait].total; const speaker = ChatMessage.getSpeaker({ actor: this, ...options.speaker }); await createCheckRoll(checkTargetNumber, { @@ -337,7 +341,7 @@ export class DS4Actor extends Actor { protected async selectAttributeAndTrait(): Promise<{ attribute: keyof typeof DS4.i18n.attributes; trait: keyof typeof DS4.i18n.traits; - }> { + } | null> { const attributeIdentifier = "attribute-trait-selection-attribute"; const traitIdentifier = "attribute-trait-selection-trait"; return Dialog.prompt({ @@ -347,12 +351,26 @@ export class DS4Actor extends Actor { { label: getGame().i18n.localize("DS4.Attribute"), identifier: attributeIdentifier, - options: DS4.i18n.attributes, + options: Object.fromEntries( + (Object.entries(DS4.i18n.attributes) as [keyof typeof DS4.i18n.attributes, string][]).map( + ([attribute, translation]) => [ + attribute, + `${translation} (${this.data.data.attributes[attribute].total})`, + ], + ), + ), }, { label: getGame().i18n.localize("DS4.Trait"), identifier: traitIdentifier, - options: DS4.i18n.traits, + options: Object.fromEntries( + (Object.entries(DS4.i18n.traits) as [keyof typeof DS4.i18n.traits, string][]).map( + ([trait, translation]) => [ + trait, + `${translation} (${this.data.data.traits[trait].total})`, + ], + ), + ), }, ], }), @@ -385,6 +403,7 @@ export class DS4Actor extends Actor { trait: selectedTrait, }; }, + rejectClose: false, }); } }