diff --git a/module/actor/actor.js b/module/actor/actor.js index 4d9d241..9bc4872 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -21,6 +21,18 @@ export class BoLActor extends Actor { super.prepareData() } + /* -------------------------------------------- */ + async _preCreate(data, options, user) { + await super._preCreate(data, options, user); + + // Configure prototype token settings + const prototypeToken = {}; + if (this.type === "character") Object.assign(prototypeToken, { + sight: { enabled: true }, actorLink: true, disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY + }); + this.updateSource({ prototypeToken }); + } + /* -------------------------------------------- */ isHeroAdversary() { if (this.type === 'character') { diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index 789fdec..0f699e1 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -424,6 +424,7 @@ export class BoLRoll { } else { this.rollData.shieldMalus = 0 } + this.updateTotalDice() }) html.find('#career').change((event) => { @@ -492,10 +493,10 @@ export class BoLRoll { rollData.armorMalus = defender.armorMalusValue rollData.shieldBlock = 'none' let shields = defender.shields + //console.log("Defender stats", defender) for (let shield of shields) { rollData.shieldBlock = (shield.system.properties.blocking.blockingAll) ? 'blockall' : 'blockone'; rollData.shieldAttackMalus = (shield.system.properties.blocking.malus) ? shield.system.properties.blocking.malus : 1; - rollData.applyShieldMalus = false } } } @@ -528,11 +529,6 @@ export class BoLRoll { rollData.nbFlaws = 0 rollData.nbDice = 0 rollData.isHeroAdversary = actor.isHeroAdversary() - if (rollData.shieldBlock == 'blockall') { - rollData.shieldMalus = rollData.shieldAttackMalus; - } else { - rollData.shieldMalus = 0 - } rollData.careerBonus = rollData.careerBonus ?? 0 rollData.modRanged = rollData.modRanged ?? 0 rollData.mod = rollData.mod ?? 0 @@ -545,6 +541,12 @@ export class BoLRoll { this.preProcessFightOption(rollData) this.updateArmorMalus(rollData) this.updatePPCost(rollData) + // Prepare blocking case + if (rollData.shieldBlock == 'blockall') { + rollData.shieldMalus = rollData.shieldAttackMalus; + } else { + rollData.shieldMalus = 0 + } // Save this.rollData = rollData console.log("ROLLDATA", rollData) @@ -571,24 +573,21 @@ export class BoLRoll { ui.notifications.warn("Pas assez de Points de Pouvoir !") return } - //console.log("ROLLMALUS", rollData) - rollData.registerInit = (rollData.aptitude && rollData.aptitude.key == 'init') ? $('#register-init').is(":checked") : false; const isMalus = (rollData.bmDice < 0) - //rollData.nbDice += (rollData.attackBonusDice) ? 1 : 0 let rollbase = rollData.attrValue + rollData.aptValue if (rollData.weapon && rollData.weapon.system.properties.onlymodifier) { rollbase = 0 } - let diceData = BoLUtility.getDiceData() let malusInit = rollData.combatData?.malusInit || 0 const modifiers = rollbase + rollData.careerBonus + rollData.mod + rollData.weaponModifier - rollData.defence - rollData.modArmorMalus + rollData.shieldMalus + rollData.attackModifier + rollData.appliedArmorMalus + rollData.effectModifier - malusInit const formula = (isMalus) ? rollData.nbDice + "d" + diceData.diceFormula + "kl2 + " + modifiers : rollData.nbDice + "d" + diceData.diceFormula + "kh2 + " + modifiers rollData.formula = formula rollData.modifiers = modifiers + console.log("Rolldata before", rollData) let r = new BoLDefaultRoll(rollData); r.roll(); diff --git a/system.json b/system.json index e13e63e..cc7416d 100644 --- a/system.json +++ b/system.json @@ -17,8 +17,7 @@ "version": "11.0.7", "compatibility": { "minimum": "10", - "maximum": "11", - "verified": "11" + "maximum": "11" }, "esmodules": [ "module/bol.js"