added dialogue for modifying damage rolls
This commit is contained in:
+26
-1
@@ -11,4 +11,29 @@
|
||||
.numeric-label-field{
|
||||
width: 50px !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.damage-modify-label-grid{
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
align-content: left;
|
||||
justify-content: left;
|
||||
align-items: left;
|
||||
padding: 10px;
|
||||
grid-gap: 10px 15px;
|
||||
}
|
||||
.damage-modify-formula-modify-grid{
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto auto auto auto;
|
||||
align-content: left;
|
||||
justify-content: left;
|
||||
align-items: left;
|
||||
padding: 10px;
|
||||
grid-gap: 10px 15px;
|
||||
}
|
||||
|
||||
.damage-roll-formula-part{
|
||||
min-width: 100px !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
+5
-1
@@ -207,5 +207,9 @@
|
||||
"DG.ModifySkillRollDialogue.Test": "Test:",
|
||||
"DG.ModifySkillRollDialogue.OriginalTarget": "Original Target:",
|
||||
"DG.ModifySkillRollDialogue.TargetModifier": "Modify Target:",
|
||||
"DG.ModifySkillRollDialogue.ModifierTooltip": "Give a positive or negative modifier here to add/subtract from the target for the skill check."
|
||||
"DG.ModifySkillRollDialogue.ModifierTooltip": "Give a positive or negative modifier here to add/subtract from the target for the skill check.",
|
||||
|
||||
"DG.ModifyDamageRollDialogue.Weapon": "Weapon:",
|
||||
"DG.ModifyDamageRollDialogue.OuterModifierTooltip": "Use this field to modify the outer part of the formula, such as to double the result.",
|
||||
"DG.ModifyDamageRollDialogue.InnerModifierTooltip": "Use this field to add a flat modifier such as '+1' or another dice term such as '+1d4'."
|
||||
}
|
||||
+5
-1
@@ -207,5 +207,9 @@
|
||||
"DG.ModifySkillRollDialogue.Test": "テスト:",
|
||||
"DG.ModifySkillRollDialogue.OriginalTarget": "元のターゲット:",
|
||||
"DG.ModifySkillRollDialogue.TargetModifier": "変換:",
|
||||
"DG.ModifySkillRollDialogue.ModifierTooltip": "スキルチェックのターゲットに加算/減算します。"
|
||||
"DG.ModifySkillRollDialogue.ModifierTooltip": "スキルチェックのターゲットに加算/減算します。",
|
||||
|
||||
"DG.ModifyDamageRollDialogue.Weapon": "武器:",
|
||||
"DG.ModifyDamageRollDialogue.OuterModifierTooltip": "ここでダイスの式の外を変えられる、結果を二倍にするために使われる。",
|
||||
"DG.ModifyDamageRollDialogue.InnerModifierTooltip": "ここでダイスの式の内側を変えられる、結果を「+1」とか、「+1d4」とかにするために使われる。"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { sendPercentileTestToChat, sendLethalityTestToChat, sendDamageRollToChat, showModifyPercentileTestDialogue } from "../roll/roll.js"
|
||||
import { sendPercentileTestToChat, sendLethalityTestToChat, sendDamageRollToChat, showModifyPercentileTestDialogue, showModifyDamageRollDialogue } from "../roll/roll.js"
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
@@ -344,7 +344,7 @@ export class DeltaGreenActorSheet extends ActorSheet {
|
||||
|
||||
if(isDamageRoll){
|
||||
if(requestedModifyRoll){
|
||||
// TO DO: Damage roll modifier dialogue
|
||||
showModifyDamageRollDialogue(this.actor, label, dataset.roll);
|
||||
}
|
||||
else{
|
||||
sendDamageRollToChat(this.actor, label, dataset.roll);
|
||||
@@ -362,7 +362,6 @@ export class DeltaGreenActorSheet extends ActorSheet {
|
||||
else{
|
||||
sendPercentileTestToChat(this.actor, label, targetVal);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,4 +233,56 @@ export function sendPercentileTestToChat(actor, skill, target){
|
||||
}
|
||||
}
|
||||
).render(true);
|
||||
}
|
||||
|
||||
export async function showModifyDamageRollDialogue(actor, label, originalFormula){
|
||||
|
||||
let template = "systems/deltagreen/templates/dialog/modify-damage-roll.html";
|
||||
let backingData = {
|
||||
data:{
|
||||
label: label,
|
||||
originalFormula: originalFormula,
|
||||
outerModifier: "2 * ",
|
||||
innerModifier: "+ 0"
|
||||
},
|
||||
};
|
||||
|
||||
let html = await renderTemplate(template, backingData);
|
||||
|
||||
new Dialog({
|
||||
content: html,
|
||||
title: game.i18n.localize("DG.ModifySkillRollDialogue.Title"),
|
||||
default: "roll",
|
||||
buttons: {
|
||||
roll:{
|
||||
label: game.i18n.translations.DG.Roll.Roll,
|
||||
|
||||
callback: html => {
|
||||
try{
|
||||
let outerModifier = html.find("[name='outerModifier']").val(); // this is text as a heads up
|
||||
let innerModifier = html.find("[name='innerModifier']").val(); // this is text as a heads up
|
||||
let modifiedBaseRoll = html.find("[name='originalFormula']").val(); // this is text as a heads up
|
||||
|
||||
if(innerModifier.replace(" ", "") === "+0"){
|
||||
innerModifier = "";
|
||||
}
|
||||
|
||||
let newRoll = "";
|
||||
if(outerModifier.trim() != ""){
|
||||
newRoll += outerModifier + "(" + modifiedBaseRoll + innerModifier.trim() + ")";
|
||||
}
|
||||
else{
|
||||
newRoll += modifiedBaseRoll + innerModifier.trim();
|
||||
}
|
||||
|
||||
sendDamageRollToChat(actor, label, newRoll);
|
||||
}
|
||||
catch(ex){
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
).render(true);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<form>
|
||||
<div class="damage-modify-label-grid">
|
||||
<span>{{localize 'DG.ModifyDamageRollDialogue.Weapon'}}</span>
|
||||
<span>{{data.label}}</span>
|
||||
</div>
|
||||
<div class="damage-modify-formula-modify-grid">
|
||||
<input class="damage-roll-formula-part" type="text" name="outerModifier" value="{{data.outerModifier}}" title="{{localize 'DG.ModifyDamageRollDialogue.OuterModifierTooltip'}}" />
|
||||
<span>(</span>
|
||||
<input class="damage-roll-formula-part" type="text" name="originalFormula" value="{{data.originalFormula}}" />
|
||||
<input class="damage-roll-formula-part" type="text" name="innerModifier" value="{{data.innerModifier}}" title="{{localize 'DG.ModifyDamageRollDialogue.InnerModifierTooltip'}}" />
|
||||
<span>)</span>
|
||||
</div>
|
||||
</form>
|
||||
Reference in New Issue
Block a user