weapon rolls work;

getting an error that may require a slight refactor
This commit is contained in:
jalensailin
2023-09-19 13:33:04 -04:00
parent 23b148263c
commit 939cf54a1b
3 changed files with 34 additions and 7 deletions
+7 -2
View File
@@ -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;
}
+25 -3
View File
@@ -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;
}
+2 -2
View File
@@ -322,8 +322,8 @@
<div
class="flexrow rollable"
data-iid="{{item._id}}"
data-rolltype="weaponskill"
data-skill="{{item.system.skill}}"
data-rolltype="weapon"
data-key="{{item.system.skill}}"
title="{{localize 'DG.Tooltip.SkillLabel'}} ({{localizeWeaponSkill item.system.skill}})"
><img class="item-image" src="{{item.img}}" width="24" height="24"/>