add parade dialog for parrying crits

This commit is contained in:
Sven Balzer 2024-11-12 00:25:47 +01:00
parent 5179ecba91
commit 7384e6cdcf
2 changed files with 72 additions and 18 deletions

34
src/Dialogs/Parade.hbs Normal file
View File

@ -0,0 +1,34 @@
<div class="parade_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}}({{/if}}
<ruby>{{options.item.basis_parade}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}}</rt></ruby>
+ <ruby>{{options.item.talent_parade}}<rt>{{localize "DSA41.talente.label"}}</rt></ruby>
{{#if (ne options.item.modifikator_parade 0)}}
+ <ruby>{{options.item.modifikator_parade}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.modifikator"}}</rt></ruby>
{{/if}}
{{#if (ne options.item.parierwaffe_parade 0)}}
+ <ruby>{{options.item.parierwaffe_parade}}<rt>{{localize "DSA41.bewaffnung.parierwaffe.label"}}</rt></ruby>
{{/if}}
{{#if (ne options.item.schild_parade 0)}}
+ <ruby>{{options.item.schild_parade}}<rt>{{localize "DSA41.bewaffnung.schild.label"}}</rt></ruby>
{{/if}}
{{#if (lt options.item.tp_kk 0)}}
+ <ruby>{{options.item.tp_kk}}<rt>{{localize "DSA41.attributes.long.strength"}}</rt></ruby>
{{/if}}
{{#if formData.crit}})<ruby> / 2<rt>{{localize "DSA41.kampf.crit"}}</rt></ruby>{{/if}}
+ <ruby>{{formData.modifikator}}<rt>{{localize "DSA41.kampf.modifikator"}}</rt></ruby>
</div>
</div>

View File

@ -590,6 +590,7 @@ function DSA41_ApplicationMixin(BaseApplication) {
class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) {
static PARTS = {
Parade: { template: "systems/dsa-4th-edition/src/Dialogs/Parade.hbs" },
Trefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/Trefferpunkte.hbs" },
FernkampfAngriff: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfAngriff.hbs" },
@ -678,6 +679,43 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
if (typeof success_value !== 'undefined') {
flavor += " <= " + success_value;
}
if (roll_type == "parade") {
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("Parade", { window: { title: title }, item: item });
if (data.crit == "on") {
roll_formula = "round((" + roll_formula + ") / 2)";
}
let roll = new Roll(roll_formula + " + " + data.modifikator, this.document.system);
roll.toMessage({
speaker: ChatMessage.getSpeaker({ actor: this.document }),
flavor: flavor,
});
return;
}
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;
}
if (roll_type == "fernkampf-attacke") {
const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name;
@ -715,24 +753,6 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
return;
}
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 }),