Würfelerfolge einfärben & settings für die farben
Foundry VTT System Release / build-and-release (push) Successful in 2m10s

This commit was merged in pull request #11.
This commit is contained in:
Byroks committed 2026-10-27 20:21:49 +01:00
1 parent 914fe01a2c
commit e27c2a220f
3 files changed
+113 -4

No files matched your search

+23
View File
@@ -116,4 +116,27 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
);
});
}
const diceTotalElement = html.querySelector(".dice-total");
if (!diceTotalElement) return;
if (!message.rolls || message.rolls.length === 0) return;
const mainRoll = message.rolls[0];
const totalValue = mainRoll.total;
const firstDiceTerm = mainRoll.terms.find((t) => t instanceof foundry.dice.terms.DiceTerm);
const activeResult = firstDiceTerm.results.find((x) => x.active).result;
const maxPossible = firstDiceTerm.faces;
diceTotalElement.classList.remove("roll-crit-fail", "roll-crit-success", "roll-high");
if (activeResult === 1) {
diceTotalElement.classList.add("roll-crit-fail");
} else if (activeResult === maxPossible || mainRoll.isCritical || totalValue >= 30) {
diceTotalElement.classList.add("roll-crit-success");
} else if (totalValue >= 20) {
diceTotalElement.classList.add("roll-success");
} else if (totalValue <= 20) {
diceTotalElement.classList.add("roll-failure");
}
});