Gestion des hordes et divers améliorations + traduction espagnole

This commit is contained in:
2024-09-05 20:14:17 +02:00
parent e6bdc427f2
commit ed68c17304
111 changed files with 1443 additions and 343 deletions

View File

@@ -21,12 +21,12 @@ export class BoLCombatManager extends Combat {
// Structure input data
ids = typeof ids === "string" ? [ids] : ids;
// Get initiative malus from tough/adversary
let malusInit = 0
let malusInit = 0
for (let combatant of this.combatants) {
malusInit = Math.max(malusInit, combatant.actor.getInitiativeMalus())
}
// calculate initiative
for (let cId = 0; cId < ids.length; cId++) {
for (let cId = 0; cId < ids.length; cId++) {
const combatant = this.combatants.get(ids[cId])
let fvttInit = combatant.actor.getInitiativeRank(false, true, { combatId: this.id, combatantId: combatant.id, malusInit })
fvttInit += (cId / 100)
@@ -39,17 +39,25 @@ export class BoLCombatManager extends Combat {
if (game.user.isGM) {
let combatants = this.combatants.contents
let autoRemoveDead = game.settings.get("bol", "auto-remove-dead") // Optionnal auto-removal of dead char.
let updates = []
for (let c of combatants) {
//let actor = game.actors.get(c.actorId)
if (c.actor.type == "horde") {
let actor = game.actors.get(c.actorId)
updates.push({ _id: c.id, name: actor.name + " (" + actor.system.hordesize + ")" })
}
c.actor.clearRoundModifiers()
let toRemove = []
if (autoRemoveDead && c.actor.type == "encounter" && (c.actor.system.chartype == "tough" || c.actor.system.chartype == "creature" || c.actor.system.chartype == "base") && c.actor.system.resources.hp.value <= 0) {
if (autoRemoveDead && c.actor.type == "encounter" &&
(c.actor.system.chartype == "tough" || c.actor.system.chartype == "creature" || c.actor.system.chartype == "base") && c.actor.system.resources.hp.value <= 0) {
toRemove.push(c.id || c._id)
}
//console.log("REM", autoRemoveDead, toRemove, c.actor)
if (toRemove.length > 0) {
this.deleteEmbeddedDocuments('Combatant', toRemove)
}
if (updates.length > 0) {
this.updateEmbeddedDocuments('Combatant', updates)
}
}
}
super.nextRound()
@@ -58,11 +66,19 @@ export class BoLCombatManager extends Combat {
/************************************************************************************/
startCombat() {
if (game.user.isGM) {
let updates = []
let combatants = this.combatants.contents
for (let c of combatants) {
let actor = game.actors.get(c.actorId)
actor.storeVitaliteCombat()
if (c.actor.type == "horde") {
let actor = game.actors.get(c.actorId)
updates.push({ _id: c.id, name: actor.name + " (" + actor.system.hordesize + ")" })
}
}
if (updates.length > 0) {
this.updateEmbeddedDocuments('Combatant', updates)
}
}
return super.startCombat()
}