add crits to nahkampfwaffe damage

This commit is contained in:
Sven Balzer 2024-11-12 00:05:53 +01:00
parent d9e1721459
commit 5179ecba91
3 changed files with 49 additions and 7 deletions

View File

@ -16,9 +16,9 @@
<div class="dsa41-calculation colspan4 center"> <div class="dsa41-calculation colspan4 center">
{{#if formData.crit}}<ruby>2 * <rt>{{localize "DSA41.kampf.crit"}}</rt></ruby>({{/if}} {{#if formData.crit}}<ruby>2 * <rt>{{localize "DSA41.kampf.crit"}}</rt></ruby>({{/if}}
<ruby>{{options.item.system.fernkampfwaffe.basis}}<rt>{{localize "DSA41.bewaffnung.fernkampfwaffe.basis"}}</rt></ruby> <ruby>{{options.item.item.system.fernkampfwaffe.basis}}<rt>{{localize "DSA41.bewaffnung.fernkampfwaffe.basis"}}</rt></ruby>
{{#if formData.crit}}){{/if}} {{#if formData.crit}}){{/if}}
+ <ruby>{{lookup options.item.system.fernkampfwaffe formData.entfernung}}<rt>{{localize "DSA41.kampf.entfernung.label"}}</rt></ruby> + <ruby>{{lookup options.item.item.system.fernkampfwaffe formData.entfernung}}<rt>{{localize "DSA41.kampf.entfernung.label"}}</rt></ruby>
+ <ruby>{{formData.modifikator}}<rt>{{localize "DSA41.kampf.modifikator"}}</rt></ruby> + <ruby>{{formData.modifikator}}<rt>{{localize "DSA41.kampf.modifikator"}}</rt></ruby>
</div> </div>
</div> </div>

View File

@ -0,0 +1,19 @@
<div class="trefferpunkte_dialog">
<span>{{localize "DSA41.kampf.modifikator"}}</span>
{{>editable-input type="number" name="modifikator" value=(lookup formData "modifikator") }}
<span>{{localize "DSA41.kampf.crit"}}</span>
{{>editable-input type="checkbox" name="crit" class="center" value=(lookup formData "crit")}}
<div class="dsa41-calculation colspan4 center">
{{#if formData.crit}}<ruby>2 * <rt>{{localize "DSA41.kampf.crit"}}</rt></ruby>({{/if}}
<ruby>{{options.item.item.system.nahkampfwaffe.basis}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}}</rt></ruby>
{{#if formData.crit}}){{/if}}
{{#if (ne options.item.tp_kk 0)}}
+ <ruby>{{options.item.tp_kk}}<rt>{{localize "DSA41.attributes.long.strength"}}</rt></ruby>
{{/if}}
+ <ruby>{{formData.modifikator}}<rt>{{localize "DSA41.kampf.modifikator"}}</rt></ruby>
</div>
</div>

View File

@ -44,6 +44,8 @@ Hooks.once("init", async function() {
"fernkampf_attacke_tooltip": "systems/dsa-4th-edition/src/Tooltips/FernkampfAttacke.hbs", "fernkampf_attacke_tooltip": "systems/dsa-4th-edition/src/Tooltips/FernkampfAttacke.hbs",
"fernkampf_trefferpunkte_tooltip": "systems/dsa-4th-edition/src/Tooltips/FernkampfTrefferpunkte.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_angriff_dialog": "systems/dsa-4th-edition/src/Dialogs/FernkampfAngriff.hbs",
"fernkampf_trefferpunkte_dialog": "systems/dsa-4th-edition/src/Dialogs/FernkampfTrefferpunkte.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) { class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) {
static PARTS = { static PARTS = {
Trefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/Trefferpunkte.hbs" },
FernkampfAngriff: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfAngriff.hbs" }, FernkampfAngriff: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfAngriff.hbs" },
FernkampfTrefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfTrefferpunkte.hbs" }, FernkampfTrefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfTrefferpunkte.hbs" },
@ -670,6 +674,11 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
const item_id = event.target.closest("[data-item-id]")?.dataset.itemId; const item_id = event.target.closest("[data-item-id]")?.dataset.itemId;
const item = this.document.items.get(item_id); 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") { if (roll_type == "fernkampf-attacke") {
const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name; const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name;
const data = await DSA41_Dialog.wait("FernkampfAngriff", { window: { title: title }, item: this.document.system.computed.kampf.fernkampf_waffen[item_id] }); const data = await DSA41_Dialog.wait("FernkampfAngriff", { window: { title: title }, item: this.document.system.computed.kampf.fernkampf_waffen[item_id] });
@ -690,7 +699,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
if (roll_type == "fernkampf-trefferpunkte") { if (roll_type == "fernkampf-trefferpunkte") {
const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name; 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]; const entfernung = item.system.fernkampfwaffe[data.entfernung];
if (data.crit == "on") { if (data.crit == "on") {
@ -705,9 +714,23 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
return; return;
} }
let flavor = game.i18n.localize("DSA41.roll_types." + roll_type);
if (typeof success_value !== 'undefined') { if (roll_type == "trefferpunkte") {
flavor += " <= " + success_value; 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); let roll = new Roll(roll_formula, this.document.system);