add dialog to attacke for custom modifier
This commit is contained in:
parent
7384e6cdcf
commit
3946a8116c
28
src/Dialogs/Attacke.hbs
Normal file
28
src/Dialogs/Attacke.hbs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<div class="parade_dialog">
|
||||||
|
<span class="colspan2">{{localize "DSA41.kampf.modifikator"}}</span>
|
||||||
|
{{>editable-input type="number" name="modifikator" class="colspan2" value=(lookup formData "modifikator") }}
|
||||||
|
|
||||||
|
<div class="dsa41-calculation colspan4 center">
|
||||||
|
<ruby>{{options.item.basis_attacke}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}}</rt></ruby>
|
||||||
|
|
||||||
|
+ <ruby>{{options.item.talent_attacke}}<rt>{{localize "DSA41.talente.label"}}</rt></ruby>
|
||||||
|
|
||||||
|
{{#if (ne options.item.modifikator_attacke 0)}}
|
||||||
|
+ <ruby>{{options.item.modifikator_attacke}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.modifikator"}}</rt></ruby>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (ne options.item.parierwaffe_attacke 0)}}
|
||||||
|
+ <ruby>{{options.item.parierwaffe_attacke}}<rt>{{localize "DSA41.bewaffnung.parierwaffe.label"}}</rt></ruby>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (ne options.item.schild_attacke 0)}}
|
||||||
|
+ <ruby>{{options.item.schild_attacke}}<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}}
|
||||||
|
|
||||||
|
+ <ruby>{{formData.modifikator}}<rt>{{localize "DSA41.kampf.modifikator"}}</rt></ruby>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
32
src/main.mjs
32
src/main.mjs
@ -590,10 +590,11 @@ function DSA41_ApplicationMixin(BaseApplication) {
|
|||||||
|
|
||||||
class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) {
|
class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) {
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
|
Attacke: { template: "systems/dsa-4th-edition/src/Dialogs/Attacke.hbs" },
|
||||||
Parade: { template: "systems/dsa-4th-edition/src/Dialogs/Parade.hbs" },
|
Parade: { template: "systems/dsa-4th-edition/src/Dialogs/Parade.hbs" },
|
||||||
Trefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/Trefferpunkte.hbs" },
|
Trefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/Trefferpunkte.hbs" },
|
||||||
|
|
||||||
FernkampfAngriff: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfAngriff.hbs" },
|
FernkampfAttacke: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfAttacke.hbs" },
|
||||||
FernkampfTrefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfTrefferpunkte.hbs" },
|
FernkampfTrefferpunkte: { template: "systems/dsa-4th-edition/src/Dialogs/FernkampfTrefferpunkte.hbs" },
|
||||||
|
|
||||||
footer: { template: "templates/generic/form-footer.hbs" },
|
footer: { template: "templates/generic/form-footer.hbs" },
|
||||||
@ -680,17 +681,40 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
flavor += " <= " + success_value;
|
flavor += " <= " + success_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
const data = await DSA41_Dialog.wait("Attacke", { window: { title: title }, item: item });
|
||||||
|
|
||||||
|
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 == "parade") {
|
if (roll_type == "parade") {
|
||||||
const item = this.document.system.computed.kampf.waffen[item_id];
|
const item = this.document.system.computed.kampf.waffen[item_id];
|
||||||
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("Parade", { window: { title: title }, item: item });
|
const data = await DSA41_Dialog.wait("Parade", { window: { title: title }, item: item });
|
||||||
|
|
||||||
|
let flavor = game.i18n.localize("DSA41.roll_types." + roll_type);
|
||||||
|
if (typeof success_value !== 'undefined') {
|
||||||
|
flavor += " <= " + (Number(success_value) + data.modifikator);
|
||||||
|
}
|
||||||
|
|
||||||
if (data.crit == "on") {
|
if (data.crit == "on") {
|
||||||
roll_formula = "round((" + roll_formula + ") / 2)";
|
roll_formula = "round((" + roll_formula + ") / 2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
let roll = new Roll(roll_formula + " + " + data.modifikator, this.document.system);
|
let roll = new Roll(roll_formula, this.document.system);
|
||||||
roll.toMessage({
|
roll.toMessage({
|
||||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||||
flavor: flavor,
|
flavor: flavor,
|
||||||
@ -719,7 +743,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
|
|
||||||
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("FernkampfAttacke", { window: { title: title }, item: this.document.system.computed.kampf.fernkampf_waffen[item_id] });
|
||||||
|
|
||||||
const groessen_modifikator = Math.max(data.ziel_groesse + data.deckung + data.ziel_bewegung, -2);
|
const groessen_modifikator = Math.max(data.ziel_groesse + data.deckung + data.ziel_bewegung, -2);
|
||||||
const andere_modifikator = data.entfernung + data.wind + data.modifikator;
|
const andere_modifikator = data.entfernung + data.wind + data.modifikator;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user