Combat tracker fixes

This commit is contained in:
LeRatierBretonnien 2023-07-07 15:35:24 +02:00
parent 3762e6185b
commit 6d6b7075df
4 changed files with 32 additions and 10 deletions

View File

@ -14,5 +14,11 @@
"TypeEquipment": "Equipment",
"TypeCurrency": "Currency",
"TypeManeuver": "Maneuver"
},
"COMBAT": {
"TurnPrev": "Previous initiative",
"RoundPrev": "Previous segment",
"TurnNext": "Next initiative",
"RoundNext": "Next segment"
}
}

View File

@ -393,10 +393,11 @@ export class Hero6Actor extends Actor {
async holdAction() {
if (this.getFlag("world", "hold-action")) {
await this.setFlag("world", "hold-action", false)
return false
} else {
await this.setFlag("world", "hold-action", true)
return true
}
game.combat.rebuildInitiative()
}
async disableHoldAction() {
await this.setFlag("world", "hold-action", false)
@ -408,10 +409,11 @@ export class Hero6Actor extends Actor {
let abort = this.getFlag("world", "abort-action")
if (abort.state) {
await this.setFlag("world", "abort-action", { state: false, count: 0 })
game.combat.abortAction(this.id, false)
} else {
await this.setFlag("world", "abort-action", { state: true, count: 0 })
game.combat.abortAction(this.id, true)
}
game.combat.rebuildInitiative()
}
getHoldAction() {
return this.getFlag("world", "hold-action")

View File

@ -40,9 +40,23 @@ export class Hero6Combat extends Combat {
}
/* -------------------------------------------- */
static holdAction(combatantId) {
static async holdAction(combatantId) {
const combatant = game.combat.combatants.get(combatantId)
combatant.actor.holdAction()
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 }]);
}
}
/* -------------------------------------------- */
static async abortAction(actorId, abortState) {
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 }]);
}
}
/* -------------------------------------------- */
@ -121,8 +135,8 @@ export class Hero6Combat extends Combat {
if (updList.length > 0) {
await this.updateEmbeddedDocuments("Combatant", updList);
console.log("Rebuild INIT", updList)
for(let c of updList) {
if ( c.initiative != 0) {
for (let c of updList) {
if (c.initiative != 0) {
return true
}
}

View File

@ -91,7 +91,7 @@
"styles": [
"styles/simple.css"
],
"version": "10.0.45",
"version": "10.0.46",
"compatibility": {
"minimum": "10",
"verified": "10",
@ -99,8 +99,8 @@
},
"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.45.zip",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.46.zip",
"url": "https://www.uberwald.me/gitea/uberwald/",
"background": "images/ui/hro6_welcome_page.webp",
"background": "images/ui/hero6_welcome_page.webp",
"id": "fvtt-hero-system-6"
}