feat: show stats in generic check roll dialog
This commit is contained in:
parent
447779279d
commit
81cda543e2
1 changed files with 23 additions and 4 deletions
|
@ -317,7 +317,11 @@ export class DS4Actor extends Actor {
|
||||||
* @param options - Additional options to customize the roll
|
* @param options - Additional options to customize the roll
|
||||||
*/
|
*/
|
||||||
async rollGenericCheck(options: { speaker?: { token?: TokenDocument; alias?: string } } = {}): Promise<void> {
|
async rollGenericCheck(options: { speaker?: { token?: TokenDocument; alias?: string } } = {}): Promise<void> {
|
||||||
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 checkTargetNumber = this.data.data.attributes[attribute].total + this.data.data.traits[trait].total;
|
||||||
const speaker = ChatMessage.getSpeaker({ actor: this, ...options.speaker });
|
const speaker = ChatMessage.getSpeaker({ actor: this, ...options.speaker });
|
||||||
await createCheckRoll(checkTargetNumber, {
|
await createCheckRoll(checkTargetNumber, {
|
||||||
|
@ -337,7 +341,7 @@ export class DS4Actor extends Actor {
|
||||||
protected async selectAttributeAndTrait(): Promise<{
|
protected async selectAttributeAndTrait(): Promise<{
|
||||||
attribute: keyof typeof DS4.i18n.attributes;
|
attribute: keyof typeof DS4.i18n.attributes;
|
||||||
trait: keyof typeof DS4.i18n.traits;
|
trait: keyof typeof DS4.i18n.traits;
|
||||||
}> {
|
} | null> {
|
||||||
const attributeIdentifier = "attribute-trait-selection-attribute";
|
const attributeIdentifier = "attribute-trait-selection-attribute";
|
||||||
const traitIdentifier = "attribute-trait-selection-trait";
|
const traitIdentifier = "attribute-trait-selection-trait";
|
||||||
return Dialog.prompt({
|
return Dialog.prompt({
|
||||||
|
@ -347,12 +351,26 @@ export class DS4Actor extends Actor {
|
||||||
{
|
{
|
||||||
label: getGame().i18n.localize("DS4.Attribute"),
|
label: getGame().i18n.localize("DS4.Attribute"),
|
||||||
identifier: attributeIdentifier,
|
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"),
|
label: getGame().i18n.localize("DS4.Trait"),
|
||||||
identifier: traitIdentifier,
|
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,
|
trait: selectedTrait,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
rejectClose: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue