Init again !!!!

This commit is contained in:
sladecraven 2022-12-02 13:15:48 +01:00
parent 085265df5d
commit 399c22d623
2 changed files with 8 additions and 6 deletions

View File

@ -648,14 +648,16 @@ export class BoLActor extends Actor {
} }
/*-------------------------------------------- */ /*-------------------------------------------- */
registerInit(rollData) { async registerInit(rollData) {
rollData.actor = undefined // Cleanup if present rollData.actor = undefined // Cleanup if present
this.setFlag("world", "last-initiative", rollData) await this.setFlag("world", "last-initiative", rollData)
} }
/*-------------------------------------------- */ /*-------------------------------------------- */
getInitiativeRank() { getInitiativeRank(rollData = undefined) {
let rollData = this.getFlag("world", "last-initiative") if (!rollData) {
rollData = this.getFlag("world", "last-initiative")
}
let fvttInit = 4 // Pietaille par defaut let fvttInit = 4 // Pietaille par defaut
if (this.type == 'character' ) { if (this.type == 'character' ) {
fvttInit = 5 fvttInit = 5

View File

@ -548,7 +548,7 @@ export class BoLDefaultRoll {
async roll() { async roll() {
const r = new Roll(this.rollData.formula) const r = new Roll(this.rollData.formula)
// console.log("Roll formula", this.rollData.formula) //console.log("Roll formula", this.rollData.formula)
await r.roll({ "async": false }) await r.roll({ "async": false })
const activeDice = r.terms[0].results.filter(r => r.active) const activeDice = r.terms[0].results.filter(r => r.active)
const diceTotal = activeDice.map(r => r.result).reduce((a, b) => a + b) const diceTotal = activeDice.map(r => r.result).reduce((a, b) => a + b)
@ -571,7 +571,7 @@ export class BoLDefaultRoll {
if (this.rollData.registerInit) { if (this.rollData.registerInit) {
actor.registerInit(this.rollData) actor.registerInit(this.rollData)
this.rollData.initiativeRank = actor.getInitiativeRank() this.rollData.initiativeRank = actor.getInitiativeRank(this.rollData)
} }
if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management
this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor) this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor)