Combat tracker fixes

This commit is contained in:
LeRatierBretonnien 2023-07-24 13:35:35 +02:00
parent a943e6defa
commit b798cde48d
7 changed files with 36 additions and 25 deletions

View File

@ -53,6 +53,8 @@ export class Hero6ActorSheet extends ActorSheet {
subActors: duplicate(this.actor.getSubActors()), subActors: duplicate(this.actor.getSubActors()),
race: duplicate(this.actor.getRace()), race: duplicate(this.actor.getRace()),
encCapacity: this.actor.getEncumbranceCapacity(), encCapacity: this.actor.getEncumbranceCapacity(),
isHold: this.actor.getHoldAction(),
isAbort: this.actor.getAbortAction(),
description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}), description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}),
motivation: await TextEditor.enrichHTML(this.object.system.biodata.motivation, {async: true}), motivation: await TextEditor.enrichHTML(this.object.system.biodata.motivation, {async: true}),
quote: await TextEditor.enrichHTML(this.object.system.biodata.quote, {async: true}), quote: await TextEditor.enrichHTML(this.object.system.biodata.quote, {async: true}),

View File

@ -388,7 +388,7 @@ export class Hero6Actor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async cleanCombat() { async cleanCombat() {
await this.setFlag("world", "hold-action", false) 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() { async holdAction() {
await this.disableAbortAction() await this.disableAbortAction()
@ -423,6 +423,17 @@ export class Hero6Actor extends Actor {
//game.combat.abortAction(this.id, true) //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() { getHoldAction() {
return this.getFlag("world", "hold-action") return this.getFlag("world", "hold-action")
} }

View File

@ -31,7 +31,9 @@ export class Hero6Combat extends Combat {
option.condition = true; option.condition = true;
option.icon = '<i class="far fa-question-circle"></i>'; option.icon = '<i class="far fa-question-circle"></i>';
option.callback = target => { 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) //newOpt = duplicate(option)
} }
@ -43,23 +45,11 @@ export class Hero6Combat extends Combat {
holdAction(combatantId) { holdAction(combatantId) {
this.rebuildInitiative() this.rebuildInitiative()
console.log("Rebuilding.....") 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) { abortAction(actorId, abortState) {
this.rebuildInitiative() 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) { if (isOnAbort) {
name = c.actor.name + " (A)" name = c.actor.name + " (A)"
if ( hasSegment) { if ( c.actor.incAbortActionCount() ) {
c.actor.disableAbortAction() c.actor.disableAbortAction()
} }
} }

View File

@ -1258,6 +1258,9 @@ Focus FOC: #ff0084
background: black; background: black;
color: white; color: white;
} }
.item-packed {
flex-grow:0;
}
.items-title-text { .items-title-text {
margin-left: 4px; margin-left: 4px;
} }

View File

@ -91,14 +91,14 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"version": "10.0.48", "version": "10.0.49",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "11" "verified": "11"
}, },
"title": "Hero System v6 for FoundrtVTT (Official)", "title": "Hero System v6 for FoundrtVTT (Official)",
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json", "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/", "url": "https://www.uberwald.me/gitea/uberwald/",
"background": "images/ui/hero6_welcome_page.webp", "background": "images/ui/hero6_welcome_page.webp",
"id": "fvtt-hero-system-6" "id": "fvtt-hero-system-6"

View File

@ -56,6 +56,7 @@
"value": 10, "value": 10,
"base": 10, "base": 10,
"hasroll": true, "hasroll": true,
"initiative": 10,
"category": "main" "category": "main"
}, },
"con": { "con": {

View File

@ -178,17 +178,21 @@
<div> <div>
<ul class="item-list alternate-list"> <ul class="item-list alternate-list">
<li class="flexrow item"> <li class="flexrow item item-packed">
<label class="item-field-label-medium">SPD</label>
<label class="">Initiative</label>
<input type="text" class="item-field-label-short update-field" data-field-name="system.characteristics.dex.initiative" value="{{characteristics.dex.initiative}}" data-dtype="Number" />
<label class="items-title-text">SPD</label>
<input type="text" class="item-field-label-short update-field" data-field-name="system.characteristics.spd.value" value="{{characteristics.spd.value}}" data-dtype="Number" /> <input type="text" class="item-field-label-short update-field" data-field-name="system.characteristics.spd.value" value="{{characteristics.spd.value}}" data-dtype="Number" />
<span class="item-field-label-very-short">&nbsp;</span> <button class="chat-card-button item-field-label-medium hold-action">{{#if isHold}}Unhold{{else}}Hold{{/if}}</button>
<button class="chat-card-button item-field-label-medium hold-action">Hold/Unhold</button> <button class="chat-card-button item-field-label-medium abort-action">{{#if isAbort}}Unabort{{else}}Abort{{/if}}</button>
<button class="chat-card-button item-field-label-medium abort-action">Abort/Unabort</button>
<span class="">&nbsp;</span>
<label class="item-field-label-long">Presence attack</label> <label class="items-title-text">Presence attack</label>
<a class="roll-direct" data-roll-source="Presence attack" data-roll-formula="{{system.biodata.presenceattack.rollFormula}}"><i class="fas fa-dice"></i>{{system.biodata.presenceattack.displayFormula}}</a> <a class="roll-direct" data-roll-source="Presence attack" data-roll-formula="{{system.biodata.presenceattack.rollFormula}}">
<i class="fas fa-dice"></i>{{system.biodata.presenceattack.displayFormula}}
</a>
</li> </li>
</ul> </ul>