diff --git a/lang/de.json b/lang/de.json index 51ec088..129b070 100644 --- a/lang/de.json +++ b/lang/de.json @@ -172,7 +172,14 @@ "beschreibungChatActive": { "name": "Chat-Beschreibungen automatisch ausklappen", "hint": "Legt fest, ob Beschreibungen von Zaubern und Co. im Chat eingeklappt angezeigt werden oder vollständig." + }, + "maxSpezialisierung": { + "name": "Maximale Anzahl an Spezialisierungen pro Skill", + "hint": "Legt die Maximale Anzahl der möglichen Spezialisierungen für einen Skill fest die man besitzen kann." } + }, + "Warnings": { + "maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht" } }, "TYPES": { diff --git a/src/helpers/settings.mjs b/src/helpers/settings.mjs index 09b7eca..97130c4 100644 --- a/src/helpers/settings.mjs +++ b/src/helpers/settings.mjs @@ -2,7 +2,7 @@ export const loadSettings = async function () { game.settings.register("midgard6-lvd", "zauberAlsTag", { name: game.i18n.localize("Midgard6.Settings.zauberAlsTag.name"), hint: game.i18n.localize("Midgard6.Settings.zauberAlsTag.hint"), - scope: "user", + scope: "client", config: true, default: false, type: Boolean, @@ -18,13 +18,13 @@ export const loadSettings = async function () { type: Boolean }); - game.settings.register("midgard6-lvd", "beschreibungChatActive", { - name: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.name"), - hint: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.hint"), - scope: "client", + game.settings.register("midgard6-lvd", "maxSpezialisierung", { + name: game.i18n.localize("Midgard6.Settings.maxSpezialisierung.name"), + hint: game.i18n.localize("Midgard6.Settings.maxSpezialisierung.hint"), + scope: "world", config: true, - default: false, - type: Boolean + default: 3, + type: Number }); game.settings.register("midgard6-lvd", "colorSuccessBg", { diff --git a/src/sheets/components/roll-actions.mjs b/src/sheets/components/roll-actions.mjs index 37993dd..0913106 100644 --- a/src/sheets/components/roll-actions.mjs +++ b/src/sheets/components/roll-actions.mjs @@ -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; } }); }, diff --git a/src/sheets/components/spezialisierung-actions.mjs b/src/sheets/components/spezialisierung-actions.mjs index 694d7bf..bc4b1e7 100644 --- a/src/sheets/components/spezialisierung-actions.mjs +++ b/src/sheets/components/spezialisierung-actions.mjs @@ -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"); diff --git a/src/styles/dialog.scss b/src/styles/dialog.scss index c1ae867..50305f4 100644 --- a/src/styles/dialog.scss +++ b/src/styles/dialog.scss @@ -59,22 +59,22 @@ } } -/* Container für die gesamte Reihe */ .segmented-button-row { display: inline-flex; - overflow: hidden; + overflow: visible; height: 32px; + white-space: nowrap; + flex-wrap: wrap; } -/* Einzelnes Segment */ .segmented-button { position: relative; cursor: pointer; display: flex; align-items: center; + height: 100%; } -/* Versteckt den echten Radio-Button, behält aber die Tastatur-Navigation */ .segmented-button input[type="radio"] { position: absolute; opacity: 0; @@ -82,7 +82,6 @@ height: 0; } -/* Inhalt des Segments (Layout & Abstände) */ .segmented-button__content { display: flex; align-items: center; @@ -96,19 +95,11 @@ user-select: none; } -/* --- ZUSTÄNDE --- */ - -/* Selektiert (Selected State) */ .segmented-button input[type="radio"]:checked + .segmented-button__content { - // background-color: #e8def8; /* M3 Secondary Container Color */ - text-shadow: 0 0 10px var(--M6-text-brown) !important; - color: #1d192b; /* M3 On-Secondary Container Text */ - .icon { - text-shadow: 0 0 10px var(--M6-text-brown) !important; - } + background-color: var(--M6-background-brown); + color: #1d192b; } -/* Hover-Effekt */ .segmented-button:hover .segmented-button__content { background-color: rgba(73, 69, 79, 0.08); } @@ -116,7 +107,6 @@ background-color: rgba(232, 222, 248, 0.85); } -/* Tastatur-Fokus (Barrierefreiheit) */ .segmented-button input[type="radio"]:focus-visible + .segmented-button__content { outline: 2px solid #6750a4; outline-offset: -2px; diff --git a/templates/dialog/roll-dialog.hbs b/templates/dialog/roll-dialog.hbs index cbd3490..a8a3994 100644 --- a/templates/dialog/roll-dialog.hbs +++ b/templates/dialog/roll-dialog.hbs @@ -3,25 +3,23 @@ Modifikation
- {{!
}} -
+
-
+
@@ -29,7 +27,7 @@ @@ -37,55 +35,50 @@
- {{!
}} -
-
-
- - {{#each bonuses}} - - {{/each}} -
-
-
- {{#if damageRoll}} -
+
+ {{#if damageRoll}} + {{/if}}
- {{/if}} -
-
- +
+
+ + {{#each bonuses}} + + {{/each}} +
+
+
+ +
- \ No newline at end of file