From f21a5ebf061566c0cf18c430ba75724db458c717 Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Sat, 24 May 2025 16:20:21 +0200 Subject: [PATCH] allow spell rolls to be affeted by MR --- src/Chat/Zauber.hbs | 2 +- src/Dialogs/Zauber.hbs | 5 +++++ src/ItemSheets/Zauber.hbs | 3 +++ src/lang/de.json | 1 + src/main.mjs | 12 ++++++++---- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Chat/Zauber.hbs b/src/Chat/Zauber.hbs index 872208f..8e9cde7 100644 --- a/src/Chat/Zauber.hbs +++ b/src/Chat/Zauber.hbs @@ -1,5 +1,5 @@
-

{{zauber.name}} ({{localize (concat "DSA41.chat.zauberfertigkeitswert_short")}}: {{zauber.system.zauberfertigkeitswert}}{{#if (ne modifikator 0)}} + {{modifikator}}{{/if}})

+

{{zauber.name}} ({{localize (concat "DSA41.chat.zauberfertigkeitswert_short")}}: {{zauber.system.zauberfertigkeitswert}}{{#if (ne modifikator 0)}} + {{modifikator}}{{/if}}{{#if (ne magieresistenz 0)}} + {{magieresistenz}}{{/if}})

{{localize (concat "DSA41.chat.attribute")}}
diff --git a/src/Dialogs/Zauber.hbs b/src/Dialogs/Zauber.hbs index 604c2f6..4bb7ec7 100644 --- a/src/Dialogs/Zauber.hbs +++ b/src/Dialogs/Zauber.hbs @@ -1,4 +1,9 @@
{{localize "DSA41.kampf.modifikator"}} + + {{#if options.item.system.magieresistenz}} + {{localize "DSA41.zauber.label_magieresistenz"}} + + {{/if}}
diff --git a/src/ItemSheets/Zauber.hbs b/src/ItemSheets/Zauber.hbs index 0267edb..57191f4 100644 --- a/src/ItemSheets/Zauber.hbs +++ b/src/ItemSheets/Zauber.hbs @@ -24,6 +24,9 @@ {{localize "DSA41.zauber.merkmale.label"}} {{DSA41_input "system.merkmale"}} + + {{localize "DSA41.zauber.label_magieresistenz"}} + {{DSA41_input "system.magieresistenz"}}
diff --git a/src/lang/de.json b/src/lang/de.json index 0971e9c..425b1d2 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -545,6 +545,7 @@ "label_zauberdauer": "Zauberdauer", "label_wirkungsdauer": "Wirkungsdauer", "label_zauberfertigkeitswert": "Zauberfertigkeitswert", + "label_magieresistenz": "Magieresistenz", "merkmale": { "label": "Merkmale", diff --git a/src/main.mjs b/src/main.mjs index ff7a0cf..b5cec2e 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -1115,6 +1115,8 @@ class DSA41_ZauberData extends TypeDataModel { }, })), + magieresistenz: new BooleanField({ initial: false }), + haus: new BooleanField({ initial: false }), zauberfertigkeitswert: new NumberField({ integer: true, initial: 0 }), @@ -1293,7 +1295,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { modifikator: -data.modifikator, attribute1: { type: item.system.attribute1, value: attribute1 }, - attribute2: { type: item.system.attribute2, value: attribute3 }, + attribute2: { type: item.system.attribute2, value: attribute2 }, attribute3: { type: item.system.attribute3, value: attribute3 }, roll1: roll1, @@ -1442,7 +1444,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name; const data = await DSA41_Dialog.wait("Zauber", { window: {title: title}, item: item }); - const zauberfertigkeitswert = item.system.zauberfertigkeitswert - data.modifikator; + const zauberfertigkeitswert = item.system.zauberfertigkeitswert - data.modifikator - data.magieresistenz; const roll_modifier = zauberfertigkeitswert < 0 ? -zauberfertigkeitswert: 0; const roll1 = (await new Roll("1d20").evaluate()).total + roll_modifier; @@ -1461,10 +1463,12 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { const context = { zauber: item, - modifikator: -data.modifikator, + + modifikator: -data.modifikator, + magieresistenz: -data.magieresistenz, attribute1: { type: item.system.attribute1, value: attribute1 }, - attribute2: { type: item.system.attribute2, value: attribute3 }, + attribute2: { type: item.system.attribute2, value: attribute2 }, attribute3: { type: item.system.attribute3, value: attribute3 }, roll1: roll1,