Combat Tracker + power enhancements
This commit is contained in:
@ -25,7 +25,7 @@ export class BoLCombatManager extends Combat {
|
||||
// calculate initiative
|
||||
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 } )
|
||||
let fvttInit = combatant.actor.getInitiativeRank(false, true, { combatId: this.id, combatantId: combatant.id })
|
||||
fvttInit += (cId / 100)
|
||||
await this.updateEmbeddedDocuments("Combatant", [{ _id: ids[cId], initiative: fvttInit }]);
|
||||
}
|
||||
@ -34,9 +34,18 @@ export class BoLCombatManager extends Combat {
|
||||
/************************************************************************************/
|
||||
nextRound() {
|
||||
let combatants = this.combatants.contents
|
||||
let autoRemoveDead = game.settings.get("bol", "auto-remove-dead") // Optionnal auto-removal of dead char.
|
||||
for (let c of combatants) {
|
||||
let actor = game.actors.get( c.actorId )
|
||||
actor.clearRoundModifiers()
|
||||
//let actor = game.actors.get(c.actorId)
|
||||
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) {
|
||||
toRemove.push( c.id || c._id)
|
||||
}
|
||||
//console.log("REM", autoRemoveDead, toRemove, c.actor)
|
||||
if (toRemove.length>0) {
|
||||
this.deleteEmbeddedDocuments('Combatant', toRemove)
|
||||
}
|
||||
}
|
||||
super.nextRound()
|
||||
}
|
||||
@ -45,12 +54,12 @@ export class BoLCombatManager extends Combat {
|
||||
startCombat() {
|
||||
let combatants = this.combatants.contents
|
||||
for (let c of combatants) {
|
||||
let actor = game.actors.get( c.actorId )
|
||||
let actor = game.actors.get(c.actorId)
|
||||
actor.storeVitaliteCombat()
|
||||
}
|
||||
return super.startCombat()
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
_onDelete() {
|
||||
let combatants = this.combatants.contents
|
||||
@ -63,4 +72,4 @@ export class BoLCombatManager extends Combat {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BoLDefaultRoll } from "../controllers/bol-rolls.js";
|
||||
import { BoLRoll, BoLDefaultRoll } from "../controllers/bol-rolls.js";
|
||||
|
||||
// Spell circle to min PP cost
|
||||
const __circle2minpp = { 0: 0, 1: 2, 2: 6, 3: 11 }
|
||||
@ -26,6 +26,14 @@ export class BoLUtility {
|
||||
type: Boolean,
|
||||
onChange: lang => window.location.reload()
|
||||
})
|
||||
game.settings.register("bol", "auto-remove-dead", {
|
||||
name: "Enlever les PNJs morts automatiquement",
|
||||
hint: "Supprime les PNJ (piétaille, créatures, coriaces) automatiquement du combat lorsqu'ils sont à 0 Vitalité ou moins",
|
||||
scope: "world",
|
||||
config: true,
|
||||
default: false,
|
||||
type: Boolean
|
||||
})
|
||||
game.settings.register("bol", "dice-formula", {
|
||||
name: "Formule de dés",
|
||||
hint: "Sélectionne la formule de dés (par défaut 2d6)",
|
||||
@ -305,6 +313,14 @@ export class BoLUtility {
|
||||
let message = game.messages.get(messageId)
|
||||
return message.getFlag("world", "bol-roll-data")
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static requestInitRoll(actorId, combatData ) {
|
||||
let actor = game.actors.get( actorId )
|
||||
if (actor && actor.isOwner) {
|
||||
ui.notifications.info(game.i18n.localize("BOL.ui.warninitiative"))
|
||||
BoLRoll.aptitudeCheck(actor, "init", undefined, combatData)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static cleanupButtons(id) {
|
||||
@ -574,6 +590,9 @@ export class BoLUtility {
|
||||
if (sockmsg.name == "msg_cleanup_buttons") {
|
||||
$(`#${sockmsg.data.id}`).hide() // Hide the options roll buttons
|
||||
}
|
||||
if (sockmsg.name == "msg_request_init_roll") {
|
||||
this.requestInitRoll( sockmsg.data.actorId, sockmsg.data.combatData)
|
||||
}
|
||||
if (sockmsg.name == "msg_damage_handling") {
|
||||
BoLUtility.processDamageHandling(sockmsg.data.attackId, sockmsg.data.defenseMode, sockmsg.data.weaponId, sockmsg.data.msgId)
|
||||
}
|
||||
|
Reference in New Issue
Block a user