diff --git a/langs/en-ca.json b/langs/en-ca.json
index 184e559..35e28e1 100644
--- a/langs/en-ca.json
+++ b/langs/en-ca.json
@@ -64,7 +64,8 @@
"easy": "Easy",
"normal": "Normal",
"tough": "Tough",
- "hard": "Hard"
+ "hard": "Hard",
+ "random": "Random Condition"
},
"drag": "Drag",
"edit": "Edit",
diff --git a/module/Apps/DelveDiceHUD.mjs b/module/Apps/DelveDiceHUD.mjs
index 960665e..ae35895 100644
--- a/module/Apps/DelveDiceHUD.mjs
+++ b/module/Apps/DelveDiceHUD.mjs
@@ -5,6 +5,7 @@ import { localizer } from "../utils/Localizer.mjs";
import { Logger } from "../utils/Logger.mjs";
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
+const { ContextMenu } = foundry.applications.ui;
const { FatePath } = gameTerms;
const CompassRotations = {
@@ -96,6 +97,25 @@ export class DelveDiceHUD extends HandlebarsApplicationMixin(ApplicationV2) {
// Shortcut because users can't edit
if (!game.user.isGM) { return };
+
+ new ContextMenu(
+ this.element,
+ `#delve-difficulty`,
+ [
+ ...conditions.map(condition => ({
+ name: localizer(condition.label),
+ callback: DelveDiceHUD.#setDifficulty.bind(this, condition.value),
+ })),
+ {
+ name: localizer(`RipCrypt.common.difficulties.random`),
+ callback: () => {
+ const condition = conditions[Math.floor(Math.random() * conditions.length)];
+ DelveDiceHUD.#setDifficulty.bind(this)(condition.value);
+ },
+ },
+ ],
+ { jQuery: false, fixed: true },
+ );
};
async _preparePartContext(partId, ctx, opts) {
@@ -202,6 +222,12 @@ export class DelveDiceHUD extends HandlebarsApplicationMixin(ApplicationV2) {
this.#animateCompassTo(fate);
game.settings.set(`ripcrypt`, `currentFate`, fate);
};
+
+ /** @this {DelveDiceHUD} */
+ static async #setDifficulty(value) {
+ this._difficulty = value;
+ game.settings.set(`ripcrypt`, `dc`, value);
+ };
// #endregion
// #region Public API
diff --git a/templates/Apps/DelveDiceHUD/difficulty.hbs b/templates/Apps/DelveDiceHUD/difficulty.hbs
index d65b06b..74b1434 100644
--- a/templates/Apps/DelveDiceHUD/difficulty.hbs
+++ b/templates/Apps/DelveDiceHUD/difficulty.hbs
@@ -3,7 +3,7 @@
class="icon-container"
data-tooltip="Difficulty: 8"
>
- 8
+ {{dc}}