diff --git a/lang/fr.json b/lang/fr.json index 98b858c..35aa50d 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -171,6 +171,7 @@ "BOL.ui.effectbonusmalus": "Bonus ou Malus à appliquer", "BOL.ui.boleffects": "Effets (automatiques)", "BOL.ui.modifier": "Modificateur", + "BOL.ui.effects": "Effets en cours", "BOL.featureCategory.origins": "Origines", "BOL.featureCategory.races": "Races", diff --git a/module/actor/actor.js b/module/actor/actor.js index 583bbf0..51bba89 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -28,6 +28,7 @@ export class BoLActor extends Actor { } return this.system.chartype } + /* -------------------------------------------- */ getVillainy() { if (this.type === 'character') { @@ -52,7 +53,7 @@ export class BoLActor extends Actor { /* -------------------------------------------- */ prepareDerivedData() { - if ( this.type == "vehicle") { + if (this.type == "vehicle") { } else { super.prepareDerivedData() @@ -102,6 +103,13 @@ export class BoLActor extends Actor { if (fo && fo.system.properties.fightoptiontype == "attack") { defMod += -1 } + // Apply defense effects + for (let i of this.items) { + if (i.type === "feature" && i.system.subtype === "boleffect" && i.system.properties.identifier.includes("aptitudes.def") ) { + defMod += Number(i.system.properties.modifier) + } + } + console.log("Defense : ", defMod) return this.system.aptitudes.def.value + defMod } @@ -216,7 +224,7 @@ export class BoLActor extends Actor { return duplicate(this.items.filter(i => i.type === "feature" && i.system.subtype === "flaw") || []); } get careers() { - return duplicate( this.items.filter(i => i.type === "feature" && i.system.subtype === "career") || []) + return duplicate(this.items.filter(i => i.type === "feature" && i.system.subtype === "career") || []) } get origins() { return this.items.filter(i => i.type === "feature" && i.system.subtype === "origin"); @@ -240,7 +248,7 @@ export class BoLActor extends Actor { return this.items.filter(i => i.type === "item") } get equipmentCreature() { - return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && (( i.system.subtype === "weapon" && i.system.properties.natural === true) || (i.system.subtype === "armor")) ) + return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && ((i.system.subtype === "weapon" && i.system.properties.natural === true) || (i.system.subtype === "armor"))) } get armors() { return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && i.system.subtype === "armor"); @@ -252,7 +260,7 @@ export class BoLActor extends Actor { return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && i.system.subtype === "shield"); } get vehicleWeapons() { - return this.items.filter(i => i.type === "item" && i.system.category === "vehicleweapon" ) + return this.items.filter(i => i.type === "item" && i.system.category === "vehicleweapon") } get weapons() { return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && i.system.subtype === "weapon") @@ -298,10 +306,10 @@ export class BoLActor extends Actor { get bonusBoons() { let boons = this.items.filter(i => i.type === "feature" && i.system.subtype === "boon" && i.system.properties.isbonusdice) - return duplicate( boons || []) + return duplicate(boons || []) } get malusFlaws() { - return duplicate( this.items.filter(i => i.type === "feature" && i.system.subtype === "flaw" && i.system.properties.ismalusdice) || []); + return duplicate(this.items.filter(i => i.type === "feature" && i.system.subtype === "flaw" && i.system.properties.ismalusdice) || []); } isSorcerer() { @@ -332,6 +340,23 @@ export class BoLActor extends Actor { return ppCostArmor } /*-------------------------------------------- */ + getDamageAttributeValue(attrDamage) { + let attrDamageValue = 0 + if (attrDamage.includes("vigor")) { + attrDamageValue = actor.system.attributes.vigor.value + if (attrDamage.includes("half")) { + attrDamageValue = Math.floor(attrDamageValue / 2) + } + // Apply vigor effects + for (let i of this.items) { + if (i.type === "feature" && i.system.subtype === "boleffect" && i.system.properties.identifier.includes("vigor") ) { + attrDamageValue += Number(i.system.properties.modifier) + } + } + } + return attrDamageValue + } + /*-------------------------------------------- */ getArmorAgiMalus() { let malusAgi = 0 for (let armor of this.protections) { @@ -568,7 +593,7 @@ export class BoLActor extends Actor { async manageHealthState() { let hpID = "lastHP" + this.id let lastHP = await this.getFlag("world", hpID) - if (lastHP != this.system.resources.hp.value && game.user.isGM ) { // Only GM sends this + if (lastHP != this.system.resources.hp.value && game.user.isGM) { // Only GM sends this await this.setFlag("world", hpID, this.system.resources.hp.value) if (this.system.resources.hp.value <= 0) { ChatMessage.create({ @@ -600,7 +625,7 @@ export class BoLActor extends Actor { /*-------------------------------------------- */ async sufferDamage(damage) { let newHP = this.system.resources.hp.value - damage - await this.update({ 'system.resources.hp.value': newHP }) + await this.update({ 'system.resources.hp.value': newHP }) } /* -------------------------------------------- */ @@ -615,7 +640,7 @@ export class BoLActor extends Actor { if (!protect.system.properties.soak.formula || protect.system.properties.soak.formula == "") { ui.notifications.warn(`L'armure ${protect.name} n'a pas de formule pour la protection !`) } else { - formula += "+" + " max(" + protect.system.properties.soak.formula +",0)" + formula += "+" + " max(" + protect.system.properties.soak.formula + ",0)" } } else { if (protect.system.properties.soak.value == undefined) { @@ -634,7 +659,7 @@ export class BoLActor extends Actor { rollProtection(itemId) { let armor = duplicate(this.items.get(itemId)) if (armor) { - let armorFormula = "max("+armor.system.properties.soak.formula + ", 0)" + let armorFormula = "max(" + armor.system.properties.soak.formula + ", 0)" let rollArmor = new Roll(armorFormula) rollArmor.roll({ async: false }).toMessage() } diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index e7227c2..e34ccc9 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -645,16 +645,8 @@ export class BoLDefaultRoll { /* -------------------------------------------- */ getDamageAttributeValue(attrDamage, actorId = undefined) { - let attrDamageValue = 0 - let actor = game.actors.get( (actorId) ? actorId: this.rollData.actorId) - if (attrDamage.includes("vigor")) { - attrDamageValue = actor.system.attributes.vigor.value - if (attrDamage.includes("half")) { - attrDamageValue = Math.floor(attrDamageValue / 2) - } - } - return attrDamageValue + return actor.getDamageAttributeValue( attrDamage ) } /* -------------------------------------------- */ diff --git a/system.json b/system.json index f930bf5..7ad09cd 100644 --- a/system.json +++ b/system.json @@ -14,7 +14,7 @@ ], "url": "https://www.uberwald.me/gitea/public/bol", "license": "LICENSE.txt", - "version": "10.4.0", + "version": "10.4.1", "compatibility": { "minimum": "10", "verified": "10", @@ -203,7 +203,7 @@ ], "socket": true, "manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json", - "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.4.0.zip", + "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.4.1.zip", "background": "systems/images/map_lemurie.webp", "gridDistance": 1.5, "gridUnits": "m", diff --git a/template.json b/template.json index 9eafab2..d808b38 100644 --- a/template.json +++ b/template.json @@ -102,10 +102,10 @@ "hp": { "key": "hp", "label": "BOL.resources.hp", - "base": 0, - "value": 0, + "base": 1, + "value": 1, "bonus": 0, - "max": 0 + "max": 1 }, "hero": { "key": "hero", diff --git a/templates/actor/actor-sheet.hbs b/templates/actor/actor-sheet.hbs index efbe568..1db4be4 100644 --- a/templates/actor/actor-sheet.hbs +++ b/templates/actor/actor-sheet.hbs @@ -7,6 +7,23 @@