allow spell rolls to be affeted by MR

This commit is contained in:
Sven Balzer 2025-05-24 16:20:21 +02:00
parent ae0ca2018f
commit f21a5ebf06
5 changed files with 18 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<div class="zauber_chat_message">
<h3>{{zauber.name}} ({{localize (concat "DSA41.chat.zauberfertigkeitswert_short")}}: {{zauber.system.zauberfertigkeitswert}}{{#if (ne modifikator 0)}} + {{modifikator}}{{/if}})</h3>
<h3>{{zauber.name}} ({{localize (concat "DSA41.chat.zauberfertigkeitswert_short")}}: {{zauber.system.zauberfertigkeitswert}}{{#if (ne modifikator 0)}} + {{modifikator}}{{/if}}{{#if (ne magieresistenz 0)}} + {{magieresistenz}}{{/if}})</h3>
<div class="info">
<div>
<div>{{localize (concat "DSA41.chat.attribute")}}</div>

View File

@ -1,4 +1,9 @@
<div>
<span class="colspan2">{{localize "DSA41.kampf.modifikator"}}</span>
<input class="colspan2" type="number" name="modifikator" value="{{lookup formData "modifikator"}}">
{{#if options.item.system.magieresistenz}}
<span class="colspan2">{{localize "DSA41.zauber.label_magieresistenz"}}</span>
<input class="colspan2" type="number" name="magieresistenz" value="{{lookup formData "magieresistenz"}}">
{{/if}}
</div>

View File

@ -24,6 +24,9 @@
<span>{{localize "DSA41.zauber.merkmale.label"}}</span>
{{DSA41_input "system.merkmale"}}
<span>{{localize "DSA41.zauber.label_magieresistenz"}}</span>
{{DSA41_input "system.magieresistenz"}}
</div>
<div>

View File

@ -545,6 +545,7 @@
"label_zauberdauer": "Zauberdauer",
"label_wirkungsdauer": "Wirkungsdauer",
"label_zauberfertigkeitswert": "Zauberfertigkeitswert",
"label_magieresistenz": "Magieresistenz",
"merkmale": {
"label": "Merkmale",

View File

@ -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,