feat: actions complexes avec suivi de résistance

- Nouvelle fenêtre Actions complexes (GM-only)
- Création d'actions avec nom, symbole, résistance (nb de succès requis)
- Barre de progression + compteurs succès/échecs
- Boutons Réussite/Échec pour suivre l'avancement
- Notification et message chat quand l'objectif est atteint
- Persistance dans un setting world-scope
- Bouton dans les contrôles de scène (icône tasks)
- Accessible via game.system.api.openActionComplexe()

Conforme aux règles p.157 : actions nécessitant 2-5 victoires
This commit is contained in:
2026-07-10 20:30:20 +02:00
parent ca20330e29
commit 8a27211ff5
5 changed files with 295 additions and 2 deletions
+18 -2
View File
@@ -29,6 +29,7 @@ Hooks.once("init", function () {
models,
documents,
openTarotDeckManager: () => applications.HamalronTarotDeckManager.openManager(),
openActionComplexe: () => applications.HamalronActionComplexe.open(),
}
// Global reference needed by initiative override
@@ -124,6 +125,15 @@ Hooks.once("init", function () {
default: { deck: [], discard: [] },
})
game.settings.register("fvtt-hamalron", "actionComplexeState", {
name: "Action Complexe State",
hint: "Stores ongoing complex actions",
scope: "world",
config: false,
type: Object,
default: { actions: [] },
})
// Activate socket handler
game.socket.on(`system.${SYSTEM.id}`, handleSocketEvent)
@@ -156,10 +166,9 @@ Hooks.once("ready", function () {
})
// Add button to scene controls for Tarot Deck Manager
// Add button to scene controls for Tarot Deck Manager and Actions Complexes
Hooks.on("getSceneControlButtons", (controls) => {
if (game.user.isGM) {
// Handle both old and new Foundry API
const controlsArray = Array.isArray(controls) ? controls : controls.controls || [];
const tokenControls = controlsArray.find(c => c.name === "token")
if (tokenControls) {
@@ -170,6 +179,13 @@ Hooks.on("getSceneControlButtons", (controls) => {
button: true,
onClick: () => applications.HamalronTarotDeckManager.openManager(),
})
tokenControls.tools.push({
name: "action-complexe",
title: "HAMALRON.ActionComplexe.Title",
icon: "fas fa-tasks",
button: true,
onClick: () => applications.HamalronActionComplexe.open(),
})
}
}
})