forked from public/foundryvtt-reve-de-dragon
Gestion des soins avancés
- raccourci soins HUD - edition rapide des Item blessure - gestion des taches de soins liées aux blessures
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
import { Targets } from "./targets.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDTokenHud {
|
||||
@ -23,6 +24,9 @@ export class RdDTokenHud {
|
||||
let token = canvas.tokens.get(tokenId);
|
||||
let actor = token.actor;
|
||||
app.hasExtension = true;
|
||||
// soins
|
||||
await RdDTokenHud.addExtensionHudSoins(html, actor);
|
||||
|
||||
if (isCombat) {
|
||||
let combatant = game.combat.combatants.find(c => c.tokenId == tokenId);
|
||||
if (!(combatant?.actor)) {
|
||||
@ -81,6 +85,27 @@ export class RdDTokenHud {
|
||||
});
|
||||
}
|
||||
|
||||
static async addExtensionHudSoins(html, sourceActor) {
|
||||
const target = Targets.getTarget({ warn: false });
|
||||
if (target?.actor) {
|
||||
const hudSoins = {
|
||||
targetActor: target.actor,
|
||||
blessures: target.actor.blessuresASoigner() ?? []
|
||||
};
|
||||
if (hudSoins.blessures.length > 0) {
|
||||
// soins
|
||||
const controlIconTarget = html.find('.control-icon[data-action=combat]');
|
||||
await RdDTokenHud._configureSubMenu(controlIconTarget,
|
||||
'systems/foundryvtt-reve-de-dragon/templates/hud-actor-soins.hbs',
|
||||
hudSoins,
|
||||
(event) => {
|
||||
const blessureId = event.currentTarget.attributes['data-blessure-id']?.value;
|
||||
sourceActor.rollSoins(target.actor, blessureId)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static _initiativeCommand(initCommand, combatantId) {
|
||||
switch (initCommand) {
|
||||
case 'inc': return RdDCombatManager.incDecInit(combatantId, 0.01);
|
||||
|
Reference in New Issue
Block a user