diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 5b00438..862df56 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -609,7 +609,7 @@ export class DeltaGreenActorSheet extends ActorSheet { case "skill": case "typedskill": case "sanity": { - const roll = new DGPercentileRoll(dataset.rolltype, dataset.key, this.actor) + const roll = new DGPercentileRoll(dataset.rolltype, dataset.key, this.actor); if (event.shiftKey || event.which === 3) { const dialogData = await roll.showDialog(dataset.key); if (!dialogData) return; @@ -624,7 +624,12 @@ export class DeltaGreenActorSheet extends ActorSheet { return ui.notifications.error("No item id provided.") } const item = this.actor.items.get(dataset.iid); - const roll = new DGPercentileRoll(dataset.rolltype, dataset.key, this.actor, item) + const roll = new DGPercentileRoll(dataset.rolltype, dataset.key, this.actor, item); + if (event.shiftKey || event.which === 3) { + const dialogData = await roll.showDialog(dataset.key); + if (!dialogData) return; + roll.modifier += dialogData.targetModifier; + } roll.toChat(); break; } diff --git a/module/roll/roll.js b/module/roll/roll.js index 7619dc2..d27264f 100644 --- a/module/roll/roll.js +++ b/module/roll/roll.js @@ -10,20 +10,42 @@ export class DGPercentileRoll extends Roll { this.actor = actor; this.item = item; this.modifier = 0; + + const skillKeys = Object.keys(actor.system.skills); + const typedSkillKeys = Object.keys(actor.system.typedSkills); + const statKeys = Object.keys(actor.system.statistics); + switch (rollType) { case "stat": - this.rollBasis = actor.system.statistics[key] this.target = actor.system.statistics[key].x5; this.localizedKey = game.i18n.localize(`DG.Attributes.${key}`); break; case "skill": - this.target = actor.system.skills[key].proficiency; - this.localizedKey = game.i18n.localize(`DG.Skills.${key}`); + if (skillKeys.includes(key)) { + this.target = actor.system.skills[key].proficiency; + this.localizedKey = game.i18n.localize(`DG.Skills.${key}`); + } + if (typedSkillKeys.includes(key)) { + this.target = actor.system.typedSkills[key].proficiency; + this.localizedKey = game.i18n.localize(`DG.Skills.${key}`); + } break; case "sanity": this.target = actor.system.sanity.value; this.localizedKey = game.i18n.localize("DG.Attributes.SAN"); break; + case "weapon": + if (key === "custom") { + this.target = item.system.customSkillTarget; + this.localizedKey = game.i18n.localize("DG.ItemWindow.Custom"); + } else if (skillKeys.includes(key)) { + this.target = actor.system.skills[key].proficiency; + this.localizedKey = game.i18n.localize(`DG.Skills.${key}`); + } else if (statKeys.includes(key)) { + this.target = actor.system.statistics[key].x5; + this.localizedKey = game.i18n.localize(`DG.Attributes.${key}`); + } + break; default: break; } diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index b3cf84a..41d869f 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -322,8 +322,8 @@