add Anmerkung field to Attacke and Parade dialogs
This commit is contained in:
parent
e320c2f9ac
commit
716d5b0413
@ -2,6 +2,9 @@
|
|||||||
<span class="colspan2">{{localize "DSA41.kampf.modifikator"}}</span>
|
<span class="colspan2">{{localize "DSA41.kampf.modifikator"}}</span>
|
||||||
<input class="colspan2" type="number" name="modifikator" value="{{lookup formData "modifikator"}}">
|
<input class="colspan2" type="number" name="modifikator" value="{{lookup formData "modifikator"}}">
|
||||||
|
|
||||||
|
<span class="colspan2">{{localize "DSA41.kampf.anmerkung"}}</span>
|
||||||
|
<input class="colspan2" type="text" name="anmerkung" value="{{lookup formData "anmerkung"}}">
|
||||||
|
|
||||||
<div class="dsa41-calculation colspan4 center">
|
<div class="dsa41-calculation colspan4 center">
|
||||||
<ruby>{{options.item.basis_attacke}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}}</rt></ruby>
|
<ruby>{{options.item.basis_attacke}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}}</rt></ruby>
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
<span>{{localize "DSA41.kampf.crit"}}</span>
|
<span>{{localize "DSA41.kampf.crit"}}</span>
|
||||||
<input class="center" type="checkbox" name="crit" {{checked (lookup formData "crit")}}>
|
<input class="center" type="checkbox" name="crit" {{checked (lookup formData "crit")}}>
|
||||||
|
|
||||||
|
<span>{{localize "DSA41.kampf.anmerkung"}}</span>
|
||||||
|
<input type="text" name="anmerkung" value="{{lookup formData "anmerkung"}}">
|
||||||
|
|
||||||
<div class="dsa41-calculation colspan4 center">
|
<div class="dsa41-calculation colspan4 center">
|
||||||
{{#if formData.crit}}({{/if}}
|
{{#if formData.crit}}({{/if}}
|
||||||
<ruby>{{options.item.basis_parade}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}}</rt></ruby>
|
<ruby>{{options.item.basis_parade}}<rt>{{localize "DSA41.bewaffnung.nahkampfwaffe.basis"}}</rt></ruby>
|
||||||
|
|||||||
@ -491,6 +491,7 @@
|
|||||||
"modifikator": "Modifikator",
|
"modifikator": "Modifikator",
|
||||||
"crit": "Glückliche Attacke",
|
"crit": "Glückliche Attacke",
|
||||||
"zauber": "Zauber",
|
"zauber": "Zauber",
|
||||||
|
"anmerkung": "Anmerkung",
|
||||||
|
|
||||||
"zielgroesse": {
|
"zielgroesse": {
|
||||||
"label": "Zielgröße",
|
"label": "Zielgröße",
|
||||||
|
|||||||
14
src/main.mjs
14
src/main.mjs
@ -1281,10 +1281,12 @@ class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
get formData() {
|
get formData() {
|
||||||
|
const inputs = this.element.querySelector("[data-application-part]")?.querySelectorAll("input") ?? [];
|
||||||
|
const types = Object.fromEntries(Array.from(inputs, x => [x.name, x.type]));
|
||||||
const data = Object.fromEntries(
|
const data = Object.fromEntries(
|
||||||
new FormData(this.element).entries().map(([key, value])=>{
|
new FormData(this.element).entries().map(([key, value])=>{
|
||||||
if (typeof value != "string") return [key, value];
|
if (types[key] == "number") return [key, Number(value)];
|
||||||
return isNaN(value) ? [key, value] : [key, Number(value)];
|
return [key, value];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1445,6 +1447,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
flavor += " <= " + (Number(success_value) + data.modifikator);
|
flavor += " <= " + (Number(success_value) + data.modifikator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.anmerkung) {
|
||||||
|
flavor += "<br>" + data.anmerkung;
|
||||||
|
}
|
||||||
|
|
||||||
if (hp_roll_modifier !== 0)
|
if (hp_roll_modifier !== 0)
|
||||||
roll_formula = roll_formula + " + " + hp_roll_modifier;
|
roll_formula = roll_formula + " + " + hp_roll_modifier;
|
||||||
|
|
||||||
@ -1471,6 +1477,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
let flavor = game.i18n.localize("DSA41.roll_types." + roll_type);
|
let flavor = game.i18n.localize("DSA41.roll_types." + roll_type);
|
||||||
flavor += " <= " + (Number((data.crit == "on") ? item.parade_crit : item.parade) + data.modifikator);
|
flavor += " <= " + (Number((data.crit == "on") ? item.parade_crit : item.parade) + data.modifikator);
|
||||||
|
|
||||||
|
if (data.anmerkung) {
|
||||||
|
flavor += "<br>" + data.anmerkung;
|
||||||
|
}
|
||||||
|
|
||||||
if (hp_roll_modifier !== 0)
|
if (hp_roll_modifier !== 0)
|
||||||
roll_formula = roll_formula + " + " + hp_roll_modifier;
|
roll_formula = roll_formula + " + " + hp_roll_modifier;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user