Various initiative fixes + shield management messages
All checks were successful
Release Creation / build (release) Successful in 46s
All checks were successful
Release Creation / build (release) Successful in 46s
This commit is contained in:
@@ -100,6 +100,14 @@ export class LethalFantasyCombat extends Combat {
|
||||
return this.turns = turns;
|
||||
}
|
||||
|
||||
async startCombat() {
|
||||
this._playCombatSound("startEncounter")
|
||||
const updateData = { round: 0, turn: 0 }
|
||||
Hooks.callAll("combatStart", this, updateData)
|
||||
await this.update(updateData)
|
||||
return this
|
||||
}
|
||||
|
||||
async rollInitiative(ids, options) {
|
||||
console.log("%%%%%%%%% Roll Initiative", ids, options);
|
||||
|
||||
@@ -110,13 +118,12 @@ export class LethalFantasyCombat extends Combat {
|
||||
let updates = [];
|
||||
for (let cId of ids) {
|
||||
const c = this.combatants.get(cId);
|
||||
let user = game.users.find(u => u.active && u.character && u.character.id === c.actor.id);
|
||||
if (user?.hasPlayerOwner) {
|
||||
const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
|
||||
if (game.user.isGM && playerOwner) {
|
||||
console.log("Rolling initiative for", c.actor.name);
|
||||
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollInitiative", actorId: c.actor.id, combatId: this.id, combatantId: c.id });
|
||||
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollInitiative", userId: playerOwner.id, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
|
||||
} else {
|
||||
user = game.users.find(u => u.active && u.isGM);
|
||||
c.actor.system.rollInitiative(this.id, c.id);
|
||||
await c.actor.system.rollInitiative(this.id, c.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,12 +203,11 @@ export class LethalFantasyCombat extends Combat {
|
||||
|
||||
for (let c of this.combatants) {
|
||||
if (nextRound >= c.initiative) {
|
||||
let user = game.users.find(u => u.active && u.character && u.character.id === c.actor.id);
|
||||
if (user?.hasPlayerOwner) {
|
||||
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
|
||||
const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
|
||||
if (game.user.isGM && playerOwner) {
|
||||
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", userId: playerOwner.id, progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
|
||||
} else {
|
||||
user = game.users.find(u => u.active && u.isGM);
|
||||
c.actor.system.rollProgressionDice(this.id, c.id);
|
||||
await c.actor.system.rollProgressionDice(this.id, c.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user