Compare commits
5 Commits
fvtt-hero-
...
fvtt-hero-
Author | SHA1 | Date | |
---|---|---|---|
b798cde48d | |||
a943e6defa | |||
9099e812d5 | |||
6d6b7075df | |||
3762e6185b |
@ -14,5 +14,11 @@
|
|||||||
"TypeEquipment": "Equipment",
|
"TypeEquipment": "Equipment",
|
||||||
"TypeCurrency": "Currency",
|
"TypeCurrency": "Currency",
|
||||||
"TypeManeuver": "Maneuver"
|
"TypeManeuver": "Maneuver"
|
||||||
|
},
|
||||||
|
"COMBAT": {
|
||||||
|
"TurnPrev": "Previous initiative",
|
||||||
|
"RoundPrev": "Previous segment",
|
||||||
|
"TurnNext": "Next initiative",
|
||||||
|
"RoundNext": "Next segment"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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}),
|
||||||
|
@ -388,15 +388,21 @@ 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()
|
||||||
if (this.getFlag("world", "hold-action")) {
|
if (this.getFlag("world", "hold-action")) {
|
||||||
await this.setFlag("world", "hold-action", false)
|
await this.setFlag("world", "hold-action", false)
|
||||||
|
//game.combat.holdAction(this.id, false)
|
||||||
|
game.combat.forceHold(this, false)
|
||||||
|
return false
|
||||||
} else {
|
} else {
|
||||||
await this.setFlag("world", "hold-action", true)
|
await this.setFlag("world", "hold-action", true)
|
||||||
|
//game.combat.holdAction(this.id, false)
|
||||||
|
game.combat.forceHold(this, true)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
game.combat.rebuildInitiative()
|
|
||||||
}
|
}
|
||||||
async disableHoldAction() {
|
async disableHoldAction() {
|
||||||
await this.setFlag("world", "hold-action", false)
|
await this.setFlag("world", "hold-action", false)
|
||||||
@ -405,13 +411,28 @@ export class Hero6Actor extends Actor {
|
|||||||
await this.setFlag("world", "abort-action", { state: false, count: 0 })
|
await this.setFlag("world", "abort-action", { state: false, count: 0 })
|
||||||
}
|
}
|
||||||
async abortAction() {
|
async abortAction() {
|
||||||
|
await this.disableHoldAction()
|
||||||
let abort = this.getFlag("world", "abort-action")
|
let abort = this.getFlag("world", "abort-action")
|
||||||
if (abort.state) {
|
if (abort.state) {
|
||||||
await this.setFlag("world", "abort-action", { state: false, count: 0 })
|
await this.setFlag("world", "abort-action", { state: false, count: 0 })
|
||||||
|
game.combat.forceAbort(this, false)
|
||||||
|
//game.combat.abortAction(this.id, false)
|
||||||
} else {
|
} else {
|
||||||
await this.setFlag("world", "abort-action", { state: true, count: 0 })
|
await this.setFlag("world", "abort-action", { state: true, count: 0 })
|
||||||
|
game.combat.forceAbort(this, true)
|
||||||
|
//game.combat.abortAction(this.id, true)
|
||||||
}
|
}
|
||||||
game.combat.rebuildInitiative()
|
}
|
||||||
|
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")
|
||||||
@ -439,10 +460,13 @@ export class Hero6Actor extends Actor {
|
|||||||
return __speed2Segments[index].toString()
|
return __speed2Segments[index].toString()
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getBaseInit() {
|
getBaseInit(turn) {
|
||||||
|
if ( turn != this.turn) {
|
||||||
let r = new Roll("1d6").roll({ async: false })
|
let r = new Roll("1d6").roll({ async: false })
|
||||||
let base = this.system.characteristics.dex.value + (r.total / 10)
|
this.currentInit = this.system.characteristics.dex.value + (r.total / 10)
|
||||||
return base
|
this.turn = turn
|
||||||
|
}
|
||||||
|
return this.currentInit
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
@ -40,9 +42,14 @@ export class Hero6Combat extends Combat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static holdAction(combatantId) {
|
holdAction(combatantId) {
|
||||||
const combatant = game.combat.combatants.get(combatantId)
|
this.rebuildInitiative()
|
||||||
combatant.actor.holdAction()
|
console.log("Rebuilding.....")
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
abortAction(actorId, abortState) {
|
||||||
|
this.rebuildInitiative()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -68,15 +75,32 @@ export class Hero6Combat extends Combat {
|
|||||||
|
|
||||||
super.startCombat();
|
super.startCombat();
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
forceHold(actor, isHold) {
|
||||||
|
let updList = []
|
||||||
|
let c = this.combatants.find(c => c.actor._id == actor.id)
|
||||||
|
let name = actor.name + ((isHold) ? " (H)" : "")
|
||||||
|
updList.push({ _id: c.id || c._id, name: name, initiative: actor.getBaseInit(this.segmentNumber) })
|
||||||
|
this.updateEmbeddedDocuments("Combatant", updList)
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
forceAbort(actor, isAbort) {
|
||||||
|
let updList = []
|
||||||
|
let c = this.combatants.find(c => c.actor._id == actor.id)
|
||||||
|
let name = actor.name + ((isAbort) ? " (A)" : "")
|
||||||
|
updList.push({ _id: c.id || c._id, name: name, initiative: actor.getBaseInit(this.segmentNumber) })
|
||||||
|
this.updateEmbeddedDocuments("Combatant", updList)
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeInitiative(c, updList) {
|
computeInitiative(c, updList) {
|
||||||
let id = c._id || c.id
|
let id = c._id || c.id
|
||||||
let hasSegment = c.actor.hasPhase(this.segmentNumber)
|
let hasSegment = c.actor.hasPhase(this.segmentNumber)
|
||||||
let isOnHold = c.actor.isOnHold()
|
let isOnHold = c.actor.getHoldAction()
|
||||||
if (hasSegment || isOnHold) {
|
let isOnAbort = c.actor.getAbortAction()
|
||||||
let baseInit = c.actor ? c.actor.getBaseInit() : 0;
|
|
||||||
let name = c.actor.name
|
let name = c.actor.name
|
||||||
|
if (hasSegment || isOnHold || isOnAbort) {
|
||||||
|
let baseInit = c.actor ? c.actor.getBaseInit(this.segmentNumber) : 0;
|
||||||
if (isOnHold) {
|
if (isOnHold) {
|
||||||
if (hasSegment) { // On hold + current segment -> auto-disable on hold
|
if (hasSegment) { // On hold + current segment -> auto-disable on hold
|
||||||
c.actor.disableHoldAction()
|
c.actor.disableHoldAction()
|
||||||
@ -84,10 +108,12 @@ export class Hero6Combat extends Combat {
|
|||||||
name = c.actor.name + " (H)"
|
name = c.actor.name + " (H)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c.actor.getAbortAction()) {
|
if (isOnAbort) {
|
||||||
name = c.actor.name + " (A)"
|
name = c.actor.name + " (A)"
|
||||||
|
if ( c.actor.incAbortActionCount() ) {
|
||||||
c.actor.disableAbortAction()
|
c.actor.disableAbortAction()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
updList.push({ _id: id, name: name, initiative: baseInit, holdAction: c.holdAction })
|
updList.push({ _id: id, name: name, initiative: baseInit, holdAction: c.holdAction })
|
||||||
} else {
|
} else {
|
||||||
updList.push({ _id: id, name: name, initiative: 0, holdAction: c.holdAction })
|
updList.push({ _id: id, name: name, initiative: 0, holdAction: c.holdAction })
|
||||||
@ -98,7 +124,6 @@ export class Hero6Combat extends Combat {
|
|||||||
async rollInitiative(ids, formula = undefined, messageOptions = {}) {
|
async rollInitiative(ids, formula = undefined, messageOptions = {}) {
|
||||||
ids = typeof ids === "string" ? [ids] : ids;
|
ids = typeof ids === "string" ? [ids] : ids;
|
||||||
|
|
||||||
console.log("Roll INIT")
|
|
||||||
let updList = []
|
let updList = []
|
||||||
for (let cId = 0; cId < ids.length; cId++) {
|
for (let cId = 0; cId < ids.length; cId++) {
|
||||||
const c = this.combatants.get(ids[cId])
|
const c = this.combatants.get(ids[cId])
|
||||||
@ -130,6 +155,17 @@ export class Hero6Combat extends Combat {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
nextTurn() {
|
||||||
|
let nbC = this.combatants.filter(c => c.initiative > 0).length
|
||||||
|
//console.log("Next turn called....", this.turn, nbC)
|
||||||
|
if (this.turn < nbC-1) {
|
||||||
|
super.nextTurn()
|
||||||
|
} else {
|
||||||
|
this.nextRound()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async nextRound() {
|
async nextRound() {
|
||||||
let hasCombatants = false
|
let hasCombatants = false
|
||||||
@ -138,9 +174,8 @@ export class Hero6Combat extends Combat {
|
|||||||
let turn = this.turn === null ? null : 0; // Preserve the fact that it's no-one's turn currently.
|
let turn = this.turn === null ? null : 0; // Preserve the fact that it's no-one's turn currently.
|
||||||
let turnData = this.getFlag("world", "hero6-turn-data")
|
let turnData = this.getFlag("world", "hero6-turn-data")
|
||||||
|
|
||||||
console.log("Next round called....", nextRound, turnData)
|
//console.log("Next round called....", nextRound, turnData)
|
||||||
while (!hasCombatants) {
|
while (!hasCombatants) {
|
||||||
turn = turn; // Preserve the fact that it's no-one's turn currently.
|
|
||||||
if (this.settings.skipDefeated && (turn !== null)) {
|
if (this.settings.skipDefeated && (turn !== null)) {
|
||||||
turn = this.turns.findIndex(t => !t.isDefeated);
|
turn = this.turns.findIndex(t => !t.isDefeated);
|
||||||
if (turn === -1) {
|
if (turn === -1) {
|
||||||
@ -151,7 +186,7 @@ export class Hero6Combat extends Combat {
|
|||||||
advanceTime = Math.max(this.turns.length - this.turn, 0) * CONFIG.time.turnTime;
|
advanceTime = Math.max(this.turns.length - this.turn, 0) * CONFIG.time.turnTime;
|
||||||
advanceTime += CONFIG.time.roundTime;
|
advanceTime += CONFIG.time.roundTime;
|
||||||
nextRound = nextRound + 1;
|
nextRound = nextRound + 1;
|
||||||
console.log("Next round called....2", nextRound, turnData)
|
//console.log("Next round called....2", nextRound, turnData)
|
||||||
turnData = this.getFlag("world", "hero6-turn-data")
|
turnData = this.getFlag("world", "hero6-turn-data")
|
||||||
if (!turnData) {
|
if (!turnData) {
|
||||||
turnData = { turnNumber: 0, segmentNumber: 12 }
|
turnData = { turnNumber: 0, segmentNumber: 12 }
|
||||||
@ -166,11 +201,11 @@ export class Hero6Combat extends Combat {
|
|||||||
await this.setFlag("world", "hero6-turn-data", turnData)
|
await this.setFlag("world", "hero6-turn-data", turnData)
|
||||||
this.turnNumber = turnData.turnNumber;
|
this.turnNumber = turnData.turnNumber;
|
||||||
this.segmentNumber = turnData.segmentNumber;
|
this.segmentNumber = turnData.segmentNumber;
|
||||||
console.log("Next round called....3", nextRound, turnData)
|
//console.log("Next round called....3", nextRound, turnData)
|
||||||
|
|
||||||
// Re-compute init of actors
|
// Re-compute init of actors
|
||||||
hasCombatants = await this.rebuildInitiative()
|
hasCombatants = await this.rebuildInitiative()
|
||||||
console.log("Going round....", nextRound, hasCombatants)
|
//console.log("Going round....", nextRound, hasCombatants)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the document, passing data through a hook first
|
// Update the document, passing data through a hook first
|
||||||
@ -183,12 +218,14 @@ export class Hero6Combat extends Combat {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onCreateEmbeddedDocuments(type, documents, result, options, userId) {
|
async _onCreateEmbeddedDocuments(type, documents, result, options, userId) {
|
||||||
super._onCreateEmbeddedDocuments(type, documents, result, options, userId)
|
//console.log("Added...")
|
||||||
|
await super._onCreateEmbeddedDocuments(type, documents, result, options, userId)
|
||||||
|
await this.rebuildInitiative()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* --------------------------------------------
|
||||||
_onUpdate(changed, options, userId) {
|
_onUpdate(changed, options, userId) {
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async checkTurnPosition() {
|
static async checkTurnPosition() {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -91,16 +91,15 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"styles/simple.css"
|
"styles/simple.css"
|
||||||
],
|
],
|
||||||
"version": "10.0.44",
|
"version": "10.0.49",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10",
|
"verified": "11"
|
||||||
"maximum": "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.44.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/hro6_welcome_page.webp",
|
"background": "images/ui/hero6_welcome_page.webp",
|
||||||
"id": "fvtt-hero-system-6"
|
"id": "fvtt-hero-system-6"
|
||||||
}
|
}
|
@ -56,6 +56,7 @@
|
|||||||
"value": 10,
|
"value": 10,
|
||||||
"base": 10,
|
"base": 10,
|
||||||
"hasroll": true,
|
"hasroll": true,
|
||||||
|
"initiative": 10,
|
||||||
"category": "main"
|
"category": "main"
|
||||||
},
|
},
|
||||||
"con": {
|
"con": {
|
||||||
|
@ -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"> </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=""> </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>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
{{#if charac.lift}}
|
{{#if charac.lift}}
|
||||||
<h4 class="item-field-label-short margin-item-list"> </h4>
|
<h4 class="item-field-label-short margin-item-list"> </h4>
|
||||||
<h4 class="item-field-label-short margin-item-list">{{charac.lift}}</h4>
|
<h4 class="item-field-label-short margin-item-list">{{charac.lift}}</h4>
|
||||||
<h4 class="item-field-label-short margin-item-list"><a class="roll-lift-dice" data-charac-key="{{key}}"><i
|
<h4 class="item-field-label-medium margin-item-list"><a class="roll-lift-dice" data-charac-key="{{key}}"><i
|
||||||
class="fas fa-dice"></i>{{charac.liftDice}}</a></h4>
|
class="fas fa-dice"></i>{{charac.liftDice}}</a></h4>
|
||||||
|
|
||||||
<select class="actor-computer-str-end" name="system.characteristics.str.strendmode"
|
<select class="actor-computer-str-end" name="system.characteristics.str.strendmode"
|
||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
{{#if charac.phasesString}}
|
{{#if charac.phasesString}}
|
||||||
<h4 class="item-field-label-short margin-item-list"> </h4>
|
<h4 class="item-field-label-short margin-item-list"> </h4>
|
||||||
<h4 class="item-field-label-long margin-item-list">Phases : {{charac.phasesString}}</h4>
|
<h4 class="item-field-label-long2 margin-item-list">Phases : {{charac.phasesString}}</h4>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if charac.presenceattack}}
|
{{#if charac.presenceattack}}
|
||||||
|
Reference in New Issue
Block a user