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()),
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}),

View File

@ -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")
}

View File

@ -31,7 +31,9 @@ export class Hero6Combat extends Combat {
option.condition = true;
option.icon = '<i class="far fa-question-circle"></i>';
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()
}
}

View File

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

View File

@ -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"

View File

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

View File

@ -178,17 +178,21 @@
<div>
<ul class="item-list alternate-list">
<li class="flexrow item">
<label class="item-field-label-medium">SPD</label>
<li class="flexrow item item-packed">
<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" />
<span class="item-field-label-very-short">&nbsp;</span>
<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">Abort/Unabort</button>
<span class="">&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 abort-action">{{#if isAbort}}Unabort{{else}}Abort{{/if}}</button>
<label class="item-field-label-long">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>
<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>
</li>
</ul>