Import gk-greyknight-0.6.4.1-patch.zip do wg-greyknights (2025-08-23T19:02:02Z)

This commit is contained in:
2025-08-23 19:02:02 +00:00
parent 4dbce12b5a
commit f4074855d6
3 changed files with 29 additions and 2 deletions
+27
View File
@@ -52,3 +52,30 @@ Hooks.once("ready", () => {
console.log("gk-greyknight helpers active (v0.6.4): Brotherhood discipline prompt enabled.");
});
/* gk-greyknight 0.6.4.1 — house-rule reminder (non-blocking):
If multiple Actors with 'Brotherhood of Psykers' attempt to use a Psychic Power as their Action in the same round,
show a notification that only one should do so (GM adjudication). */
Hooks.on("preCreateChatMessage", (doc, data, options, userId) => {
try {
// Quick heuristic: message flavor mentions a psychic power roll
const flavor = (data.flavor || "").toLowerCase();
const isPsychic = flavor.includes("psychic") || flavor.includes("power");
if (!isPsychic) return;
// Find speaker's actor
const speaker = data.speaker || {}; const actor = game.actors?.get(speaker.actor);
if (!actor) return;
const hasBrotherhood = actor.items?.some(i => i.type === "ability" && i.name === "Brotherhood of Psykers");
if (!hasBrotherhood) return;
// Count other GK-brotherhood casters who already posted an action this round
const combat = game.combat;
if (!combat) return;
const key = `gk-greyknight.usedPsychicAction.r${combat.round}`;
const prev = combat.getFlag("gk-greyknight", key) || null;
if (prev && prev !== actor.id) {
ui.notifications?.warn("House rule (Brotherhood Focus): only one Grey Knight should use a psychic power as their Action this round.");
} else if (!prev) {
combat.setFlag("gk-greyknight", key, actor.id);
}
} catch (e) { console.error("gk-greyknight helpers (house-rule reminder):", e); }
});