add dialog to attributes for custom modifier

This commit is contained in:
Sven Balzer 2024-11-12 01:04:03 +01:00
parent 3946a8116c
commit 98dcb0749d
2 changed files with 37 additions and 0 deletions

16
src/Dialogs/Attribute.hbs Normal file
View File

@ -0,0 +1,16 @@
<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.attribute.initial}}<rt>{{localize "DSA41.attributes.initial"}}</rt></ruby>
{{#if (ne options.attribute.advancement 0)}}
+ <ruby>{{options.attribute.advancement}}<rt>{{localize "DSA41.attributes.advancement"}}</rt></ruby>
{{/if}}
{{#if (ne options.attribute.modifier 0)}}
+ <ruby>{{options.attribute.modifier}}<rt>{{localize "DSA41.attributes.modifier"}}</rt></ruby>
{{/if}}
+ <ruby>{{formData.modifikator}}<rt>{{localize "DSA41.kampf.modifikator"}}</rt></ruby>
</div>
</div>

View File

@ -590,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 = {
Eigenschaft: { template: "systems/dsa-4th-edition/src/Dialogs/Attribute.hbs" },
Attacke: { template: "systems/dsa-4th-edition/src/Dialogs/Attacke.hbs" }, 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" },
@ -681,6 +683,25 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
flavor += " <= " + success_value; flavor += " <= " + success_value;
} }
if (roll_type == "courage" || roll_type == "cleverness" || roll_type == "intuition" || roll_type == "charisma" ||
roll_type == "dexterity" || roll_type == "agility" || roll_type == "constitution" || roll_type == "strength") {
const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + this.document.name;
const data = await DSA41_Dialog.wait("Eigenschaft", { window: { title: title }, attribute: this.document.system.attributes[roll_type] });
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 == "attacke") { if (roll_type == "attacke") {
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;