From 98dcb0749d596f89bfcae91bccba16651b93dc3f Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:04:03 +0100 Subject: [PATCH] add dialog to attributes for custom modifier --- src/Dialogs/Attribute.hbs | 16 ++++++++++++++++ src/main.mjs | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/Dialogs/Attribute.hbs diff --git a/src/Dialogs/Attribute.hbs b/src/Dialogs/Attribute.hbs new file mode 100644 index 0000000..cbd9fc9 --- /dev/null +++ b/src/Dialogs/Attribute.hbs @@ -0,0 +1,16 @@ +
+ {{localize "DSA41.kampf.modifikator"}} + {{>editable-input type="number" name="modifikator" class="colspan2" value=(lookup formData "modifikator") }} + +
+ {{options.attribute.initial}}{{localize "DSA41.attributes.initial"}} + {{#if (ne options.attribute.advancement 0)}} + + {{options.attribute.advancement}}{{localize "DSA41.attributes.advancement"}} + {{/if}} + {{#if (ne options.attribute.modifier 0)}} + + {{options.attribute.modifier}}{{localize "DSA41.attributes.modifier"}} + {{/if}} + + + {{formData.modifikator}}{{localize "DSA41.kampf.modifikator"}} +
+
diff --git a/src/main.mjs b/src/main.mjs index 8f00392..711a82b 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -590,6 +590,8 @@ function DSA41_ApplicationMixin(BaseApplication) { class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) { static PARTS = { + Eigenschaft: { template: "systems/dsa-4th-edition/src/Dialogs/Attribute.hbs" }, + Attacke: { template: "systems/dsa-4th-edition/src/Dialogs/Attacke.hbs" }, Parade: { template: "systems/dsa-4th-edition/src/Dialogs/Parade.hbs" }, Trefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/Trefferpunkte.hbs" }, @@ -681,6 +683,25 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { flavor += " <= " + success_value; } + if (roll_type == "courage" || roll_type == "cleverness" || roll_type == "intuition" || roll_type == "charisma" || + roll_type == "dexterity" || roll_type == "agility" || roll_type == "constitution" || roll_type == "strength") { + const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + this.document.name; + const data = await DSA41_Dialog.wait("Eigenschaft", { window: { title: title }, attribute: this.document.system.attributes[roll_type] }); + + let flavor = game.i18n.localize("DSA41.roll_types." + roll_type); + if (typeof success_value !== 'undefined') { + flavor += " <= " + (Number(success_value) + data.modifikator); + } + + let roll = new Roll(roll_formula, this.document.system); + roll.toMessage({ + speaker: ChatMessage.getSpeaker({ actor: this.document }), + flavor: flavor, + }); + + return; + } + if (roll_type == "attacke") { const item = this.document.system.computed.kampf.waffen[item_id]; const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name;