Import gk-greyknight-0.6.4.4.zip do wg-greyknights (2025-08-23T20:15:27Z)

This commit is contained in:
2025-08-23 20:15:27 +00:00
parent 0e417ca6cb
commit 1d346db6c0
3 changed files with 28 additions and 2 deletions
+26
View File
@@ -142,3 +142,29 @@ Hooks.once("ready", () => {
});
});
// gk-greyknight 0.6.4.4 — QoL: Brotherhood Focus summary on sheet open
Hooks.on("renderActorSheet", async (sheet, htmlEl, data) => {
try {
const actor = sheet.actor; if (!actor) return;
const hasBro = actor.items?.some(i => i.type === "ability" && i.name === "Brotherhood of Psykers");
if (!hasBro) return;
const tokens = canvas?.tokens?.placeables || [];
const allied = new Set();
for (const t of tokens) {
const a = t.actor; if (!a) continue;
const ok = a.items?.some(i => i.type === "ability" && i.name === "Brotherhood of Psykers");
if (ok) allied.add(a.id);
}
const total = allied.size;
const bonus = allied.has(actor.id) ? Math.max(0, total - 1) : total;
const owners = Object.keys(actor.ownership || {}).filter(uid => actor.ownership[uid] >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER);
const content = `<div class="gk-brotherhood-summary">
<h3 style="margin:0 0 .25rem 0;">Brotherhood Focus — Summary</h3>
<p style="margin:0;">Allies with Brotherhood in scene: <b>${total}</b> (excluding self: <b>${bonus}</b> bonus die to <em>Psychic Mastery</em>).</p>
<p style="margin:.25rem 0 0;font-size:.9em;opacity:.85;">Reminder: each subsequent power cast this round using the shared focus adds one extra <em>Wrath die</em>. Only one linked character should use a psychic power as their <em>Action</em> per round.</p>
</div>`;
ChatMessage.create({content, whisper: owners, speaker: {actor: actor.id}});
} catch (e) { console.error("gk-greyknight QoL summary:", e); }
});