add functionality for rolls

This commit is contained in:
jalensailin
2023-12-09 18:29:12 -05:00
parent 5ff3d1805b
commit 32125aa83e
3 changed files with 18 additions and 6 deletions
+9
View File
@@ -73,19 +73,28 @@ export default class DeltaGreenActorSheet extends ActorSheet {
const simplifiedTraining = {
name: training.name,
id: training.id,
key: training.attribute,
rollType: "skill",
};
// Convert the machine-readable name to a human-readable one.
switch (true) {
case DG.statistics.includes(training.attribute):
simplifiedTraining.attribute = training.attribute.toUpperCase();
simplifiedTraining.targetNumber =
this.actor.system.statistics[training.attribute].value;
simplifiedTraining.rollType = "stat";
break;
case DG.skills.includes(training.attribute):
simplifiedTraining.attribute =
this.actor.system.skills[training.attribute].label;
simplifiedTraining.targetNumber =
this.actor.system.skills[training.attribute].proficiency;
break;
default:
simplifiedTraining.attribute =
this.actor.system.typedSkills[training.attribute].label;
simplifiedTraining.targetNumber =
this.actor.system.typedSkills[training.attribute].proficiency;
break;
}
return simplifiedTraining;
+7 -4
View File
@@ -504,10 +504,13 @@ export class DGDamageRoll extends DGRoll {
this.options.rollMode || game.settings.get("core", "rollMode");
let label = this.formula;
try {
label = `${game.i18n.localize("DG.Roll.Rolling",)} <b>${game.i18n.localize("DG.Roll.Damage").
toUpperCase()}</b> ${game.i18n.localize("DG.Roll.For",)} ${this.item.name}`;
} catch(ex) {
//console.log(ex);
label = `${game.i18n.localize("DG.Roll.Rolling")} <b>${game.i18n
.localize("DG.Roll.Damage")
.toUpperCase()}</b> ${game.i18n.localize("DG.Roll.For")} ${
this.item.name
}`;
} catch (ex) {
// console.log(ex);
label = `Rolling <b>DAMAGE</b> for <b>${label.toUpperCase()}</b>`;
}
return this.createMessage(this.total, label, rollMode);
+2 -2
View File
@@ -24,8 +24,8 @@
{{/each}}
{{#each specialTraining as |training|}}
<div class="item flexrow flex-group-center flex-thin-border">
<label class="">
{{training.name}} ({{training.attribute}})
<label class="{{if_gt training.targetNumber 0 'rollable' 'not-rollable'}}" data-key="{{training.key}}" data-rolltype="{{training.rollType}}">
{{training.name}} ({{training.attribute}} - {{training.targetNumber}})
</label>
<div class="item-controls">
<a class="item-control special-training-action" data-action="Edit" data-id="{{training.id}}" title="Edit Training"><i class="fas fa-edit"></i></a>