#14 Update Roll Dialog

+ Hintergrundfarbe für ausgewählte Spezialisierung & Würfel
+ Maximale Anzahl an Spezialisierungen festgelt + Setting
This commit was merged in pull request #34.
This commit is contained in:
Byroks committed 2026-10-28 12:29:17 +01:00
1 parent e8caa591c4
commit 3406f2134c
6 files changed
+79 -72

No files matched your search

+19 -7
View File
@@ -302,32 +302,44 @@ async function rollDialog(rollDialogRequest) {
const dialogHTML = dialog.element;
const display = dialogHTML.querySelector("#rollDisplay");
let mainRoll = `1d20 + ${skillValue}`;
let spezText = "";
// Variable bei jeder Änderung aktualisieren
document.querySelectorAll('input[name="vorteil-segment"]').forEach((radio) => {
radio.addEventListener("change", (e) => {
vorteil = parseInt(e.target.value);
switch (vorteil) {
case 1:
display.placeholder = `2d20kh + ${skillValue} (Vorteil)`;
mainRoll = `2d20kh + ${skillValue} (Vorteil)`;
break;
case -1:
display.placeholder = `2d20kl + ${skillValue} (Nachteil)`;
mainRoll = `2d20kl + ${skillValue} (Nachteil)`;
break;
default:
display.placeholder = `1d20 + ${skillValue}`;
mainRoll = `1d20 + ${skillValue}`;
break;
}
display.placeholder = mainRoll + spezText;
});
});
document.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
radio.addEventListener("change", (e) => {
spezLevel = parseInt(e.target.value);
spezName = e.target.dataset.name;
radio.addEventListener("click", (e) => {
if (spezName !== e.target.dataset.name) {
spezLevel = parseInt(e.target.value);
spezName = e.target.dataset.name;
spezText = ` + ${spezLevel + 1}`;
} else {
spezLevel = null;
spezName = null;
e.target.checked = false;
spezText = "";
}
display.placeholder = mainRoll + spezText;
});
if (radio.dataset.name === preSelectedSpez) {
radio.click();
display.placeholder = mainRoll + spezText;
}
});
},
@@ -6,7 +6,12 @@ export async function addSpezialisierung(event, target) {
const path = dataset.path.replace(".value", "");
const name = dataset.name;
const skill = foundry.utils.getProperty(this.actor, path);
const maxSpez = game.settings.get("midgard6-lvd", "maxSpezialisierung");
if (skill.bonuses.length >= maxSpez) {
ui.notifications.warn(game.i18n.localize("Midgard6.Warnings.maxSpezReached"));
return;
}
let level = 1;
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");