diff --git a/src/Dialogs/FernkampfTrefferpunkte.hbs b/src/Dialogs/FernkampfTrefferpunkte.hbs index 7a1a728..bc1dff5 100644 --- a/src/Dialogs/FernkampfTrefferpunkte.hbs +++ b/src/Dialogs/FernkampfTrefferpunkte.hbs @@ -16,9 +16,9 @@
{{#if formData.crit}}2 * {{localize "DSA41.kampf.crit"}}({{/if}} - {{options.item.system.fernkampfwaffe.basis}}{{localize "DSA41.bewaffnung.fernkampfwaffe.basis"}} + {{options.item.item.system.fernkampfwaffe.basis}}{{localize "DSA41.bewaffnung.fernkampfwaffe.basis"}} {{#if formData.crit}}){{/if}} - + {{lookup options.item.system.fernkampfwaffe formData.entfernung}}{{localize "DSA41.kampf.entfernung.label"}} + + {{lookup options.item.item.system.fernkampfwaffe formData.entfernung}}{{localize "DSA41.kampf.entfernung.label"}} + {{formData.modifikator}}{{localize "DSA41.kampf.modifikator"}}
diff --git a/src/Dialogs/Trefferpunkte.hbs b/src/Dialogs/Trefferpunkte.hbs new file mode 100644 index 0000000..5560bff --- /dev/null +++ b/src/Dialogs/Trefferpunkte.hbs @@ -0,0 +1,19 @@ +
+ {{localize "DSA41.kampf.modifikator"}} + {{>editable-input type="number" name="modifikator" value=(lookup formData "modifikator") }} + + {{localize "DSA41.kampf.crit"}} + {{>editable-input type="checkbox" name="crit" class="center" value=(lookup formData "crit")}} + +
+ {{#if formData.crit}}2 * {{localize "DSA41.kampf.crit"}}({{/if}} + {{options.item.item.system.nahkampfwaffe.basis}}{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}} + {{#if formData.crit}}){{/if}} + + {{#if (ne options.item.tp_kk 0)}} + + {{options.item.tp_kk}}{{localize "DSA41.attributes.long.strength"}} + {{/if}} + + + {{formData.modifikator}}{{localize "DSA41.kampf.modifikator"}} +
+
diff --git a/src/main.mjs b/src/main.mjs index c4e7dd1..69aa05b 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -44,6 +44,8 @@ Hooks.once("init", async function() { "fernkampf_attacke_tooltip": "systems/dsa-4th-edition/src/Tooltips/FernkampfAttacke.hbs", "fernkampf_trefferpunkte_tooltip": "systems/dsa-4th-edition/src/Tooltips/FernkampfTrefferpunkte.hbs", + "trefferpunkte_dialog": "systems/dsa-4th-edition/src/Dialog/Trefferpunkte.hbs", + "fernkampf_angriff_dialog": "systems/dsa-4th-edition/src/Dialogs/FernkampfAngriff.hbs", "fernkampf_trefferpunkte_dialog": "systems/dsa-4th-edition/src/Dialogs/FernkampfTrefferpunkte.hbs", }); @@ -588,6 +590,8 @@ function DSA41_ApplicationMixin(BaseApplication) { class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) { static PARTS = { + Trefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/Trefferpunkte.hbs" }, + FernkampfAngriff: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfAngriff.hbs" }, FernkampfTrefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfTrefferpunkte.hbs" }, @@ -669,6 +673,11 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { const success_value = event.target.closest("[data-success-value]")?.dataset.successValue; const item_id = event.target.closest("[data-item-id]")?.dataset.itemId; const item = this.document.items.get(item_id); + + let flavor = game.i18n.localize("DSA41.roll_types." + roll_type); + if (typeof success_value !== 'undefined') { + flavor += " <= " + success_value; + } if (roll_type == "fernkampf-attacke") { const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name; @@ -690,7 +699,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { if (roll_type == "fernkampf-trefferpunkte") { const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name; - const data = await DSA41_Dialog.wait("FernkampfTrefferpunkte", { window: { title: title }, item: item }); + const data = await DSA41_Dialog.wait("FernkampfTrefferpunkte", { window: { title: title }, item: this.document.system.computed.kampf.fernkampf_waffen[item_id] }); const entfernung = item.system.fernkampfwaffe[data.entfernung]; if (data.crit == "on") { @@ -705,11 +714,25 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { return; } - let flavor = game.i18n.localize("DSA41.roll_types." + roll_type); - if (typeof success_value !== 'undefined') { - flavor += " <= " + success_value; + + if (roll_type == "trefferpunkte") { + const item = this.document.system.computed.kampf.waffen[item_id]; + const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name; + const data = await DSA41_Dialog.wait("Trefferpunkte", { window: { title: title }, item: item }); + + if (data.crit == "on") { + roll_formula = "2 * (" + item.item.system.nahkampfwaffe.basis + ")" + " + " + item.tp_kk; + } + + let roll = new Roll(roll_formula + " + " + data.modifikator, this.document.system); + roll.toMessage({ + speaker: ChatMessage.getSpeaker({ actor: this.document }), + flavor: flavor, + }); + + return; } - + let roll = new Roll(roll_formula, this.document.system); roll.toMessage({ speaker: ChatMessage.getSpeaker({ actor: this.document }),