feat: tirage MJ, hotbarDrop, blessures incapacitantes

1. Tirage MJ dans le dialogue de compétence :
   - Bouton tirer une carte dans la section difficulté
   - Pioche dans le deck, affiche la carte tirée
   - Calcule la difficulté sous tension

2. Drag & drop vers barre de raccourcis :
   - Acteurs → ouvre la feuille
   - Compétences → lance le jet de compétence
   - Sorts → ouvre le dialogue de lancement
   - Armes → lance le jet d'arme

3. Blessures incapacitantes (règle p.159) :
   - Champs blessureIncapacitante / malusBlessure
   - Dialogue proposant la blessure quand Épée diminue
   - Malus -2 appliqué aux jets de compétence
   - Bannière dans la feuille (mode jeu)
   - Bouton guérison
This commit is contained in:
2026-07-10 23:08:06 +02:00
parent 441134c23b
commit 4a14604581
7 changed files with 140 additions and 19 deletions
+35 -8
View File
@@ -243,15 +243,42 @@ Hooks.on("createChatMessage", async (message, options, userId) => {
})
/**
* Create a macro when dropping an entity on the hotbar
* Item - open roll dialog
* Actor - open actor sheet
* Journal - open journal sheet
*/
Hooks.on("hotbarDrop", (bar, data, slot) => {
if (["Actor", "Item", "JournalEntry", "skill", "weapon"].includes(data.type)) {
// TODO -> Manage this
if (data.type === "Actor") {
const actor = fromUuidSync(data.uuid)
if (!actor) return false
Macro.create({
name: actor.name,
type: "script",
img: actor.img,
command: `game.actors.get("${actor.id}")?.sheet?.render(true)`,
scope: "global",
}).then(macro => bar.assignMacro(macro, slot))
return false
}
if (data.type === "Item") {
const item = fromUuidSync(data.uuid)
if (!item) return false
const actor = item.parent
let command = ""
if (item.type === "competence") {
command = `const a = game.actors.get("${actor?.id}"); const i = a?.items?.get("${item.id}"); if (i) a?.system?.roll?.("competence", i)`
} else if (item.type === "sortilege") {
command = `const { default: Cast } = await import("${game.system.id}/module/applications/sortilege-casting.mjs"); const a = game.actors.get("${actor?.id}"); const i = a?.items?.get("${item.id}"); if (i) Cast.prompt(i, a)`
} else if (item.type === "arme") {
command = `const a = game.actors.get("${actor?.id}"); const i = a?.items?.get("${item.id}"); if (i) a?.system?.roll?.("weapon", i)`
} else {
command = `const a = game.actors.get("${actor?.id}"); a?.items?.get("${item.id}")?.sheet?.render(true)`
}
if (command) {
Macro.create({
name: item.name,
type: "script",
img: item.img,
command,
scope: "actor",
}).then(macro => bar.assignMacro(macro, slot))
}
return false
}
})