From b798cde48da5f04ba5cc9b61c95afa5d3ba175f6 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Mon, 24 Jul 2023 13:35:35 +0200 Subject: [PATCH] Combat tracker fixes --- modules/hero6-actor-sheet.js | 2 ++ modules/hero6-actor.js | 13 ++++++++++++- modules/hero6-combat.js | 18 ++++-------------- styles/simple.css | 3 +++ system.json | 4 ++-- template.json | 1 + templates/actors/actor-sheet.hbs | 20 ++++++++++++-------- 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/modules/hero6-actor-sheet.js b/modules/hero6-actor-sheet.js index b369a01..955dcbe 100644 --- a/modules/hero6-actor-sheet.js +++ b/modules/hero6-actor-sheet.js @@ -53,6 +53,8 @@ export class Hero6ActorSheet extends ActorSheet { subActors: duplicate(this.actor.getSubActors()), race: duplicate(this.actor.getRace()), encCapacity: this.actor.getEncumbranceCapacity(), + isHold: this.actor.getHoldAction(), + isAbort: this.actor.getAbortAction(), description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}), motivation: await TextEditor.enrichHTML(this.object.system.biodata.motivation, {async: true}), quote: await TextEditor.enrichHTML(this.object.system.biodata.quote, {async: true}), diff --git a/modules/hero6-actor.js b/modules/hero6-actor.js index ed93348..73e97ba 100644 --- a/modules/hero6-actor.js +++ b/modules/hero6-actor.js @@ -388,7 +388,7 @@ export class Hero6Actor extends Actor { /* -------------------------------------------- */ async cleanCombat() { await this.setFlag("world", "hold-action", false) - await this.setFlag("world", "abort-action", false) + await this.setFlag("world", "abort-action", { state: false, count: 0 } ) } async holdAction() { await this.disableAbortAction() @@ -423,6 +423,17 @@ export class Hero6Actor extends Actor { //game.combat.abortAction(this.id, true) } } + async incAbortActionCount() { + let abort = this.getFlag("world", "abort-action") + if (abort.state) { + abort.count++ + await this.setFlag("world", "abort-action", abort) + if (abort.count == 2) { + return true + } + } + return false + } getHoldAction() { return this.getFlag("world", "hold-action") } diff --git a/modules/hero6-combat.js b/modules/hero6-combat.js index 96c9e7d..1533fec 100644 --- a/modules/hero6-combat.js +++ b/modules/hero6-combat.js @@ -31,7 +31,9 @@ export class Hero6Combat extends Combat { option.condition = true; option.icon = ''; option.callback = target => { - Hero6Combat.holdAction(target.data('combatant-id')); + let id = target.data('combatant-id') + let c = game.combat.combatants.get(id) + c.actor.holdAction() } //newOpt = duplicate(option) } @@ -43,23 +45,11 @@ export class Hero6Combat extends Combat { holdAction(combatantId) { this.rebuildInitiative() console.log("Rebuilding.....") - /*const combatant = game.combat.combatants.get(combatantId) - if (combatant.actor.holdAction()) { - let id = combatant._id || combatant.id - let name = combatant.actor.name + " (H)" - await game.combat.updateEmbeddedDocuments("Combatant", [{ _id: id, name: name, holdAction: true }]); - }*/ } /* -------------------------------------------- */ abortAction(actorId, abortState) { this.rebuildInitiative() - /*const combatant = game.combat.combatants.find(c => c.actor.id == actorId) - if (abortState) { - let id = combatant._id || combatant.id - let name = combatant.actor.name + " (A)" - await game.combat.updateEmbeddedDocuments("Combatant", [{ _id: id, name: name }]); - }*/ } /* -------------------------------------------- */ @@ -120,7 +110,7 @@ export class Hero6Combat extends Combat { } if (isOnAbort) { name = c.actor.name + " (A)" - if ( hasSegment) { + if ( c.actor.incAbortActionCount() ) { c.actor.disableAbortAction() } } diff --git a/styles/simple.css b/styles/simple.css index 3c2bd68..d490251 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1258,6 +1258,9 @@ Focus FOC: #ff0084 background: black; color: white; } +.item-packed { + flex-grow:0; +} .items-title-text { margin-left: 4px; } diff --git a/system.json b/system.json index f3a53f2..70e8ac7 100644 --- a/system.json +++ b/system.json @@ -91,14 +91,14 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.48", + "version": "10.0.49", "compatibility": { "minimum": "10", "verified": "11" }, "title": "Hero System v6 for FoundrtVTT (Official)", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.48.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.49.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/hero6_welcome_page.webp", "id": "fvtt-hero-system-6" diff --git a/template.json b/template.json index a0d34be..6a4f3ff 100644 --- a/template.json +++ b/template.json @@ -56,6 +56,7 @@ "value": 10, "base": 10, "hasroll": true, + "initiative": 10, "category": "main" }, "con": { diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index dac2988..51958ab 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -178,17 +178,21 @@