Display effects in main sheet (left) and manage it for defense and damages

This commit is contained in:
sladecraven 2022-11-25 08:49:37 +01:00
parent add6893864
commit 5e7dc3ad9d
6 changed files with 59 additions and 24 deletions

View File

@ -171,6 +171,7 @@
"BOL.ui.effectbonusmalus": "Bonus ou Malus à appliquer", "BOL.ui.effectbonusmalus": "Bonus ou Malus à appliquer",
"BOL.ui.boleffects": "Effets (automatiques)", "BOL.ui.boleffects": "Effets (automatiques)",
"BOL.ui.modifier": "Modificateur", "BOL.ui.modifier": "Modificateur",
"BOL.ui.effects": "Effets en cours",
"BOL.featureCategory.origins": "Origines", "BOL.featureCategory.origins": "Origines",
"BOL.featureCategory.races": "Races", "BOL.featureCategory.races": "Races",

View File

@ -28,6 +28,7 @@ export class BoLActor extends Actor {
} }
return this.system.chartype return this.system.chartype
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getVillainy() { getVillainy() {
if (this.type === 'character') { if (this.type === 'character') {
@ -102,6 +103,13 @@ export class BoLActor extends Actor {
if (fo && fo.system.properties.fightoptiontype == "attack") { if (fo && fo.system.properties.fightoptiontype == "attack") {
defMod += -1 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 return this.system.aptitudes.def.value + defMod
} }
@ -332,6 +340,23 @@ export class BoLActor extends Actor {
return ppCostArmor 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() { getArmorAgiMalus() {
let malusAgi = 0 let malusAgi = 0
for (let armor of this.protections) { for (let armor of this.protections) {

View File

@ -645,16 +645,8 @@ export class BoLDefaultRoll {
/* -------------------------------------------- */ /* -------------------------------------------- */
getDamageAttributeValue(attrDamage, actorId = undefined) { getDamageAttributeValue(attrDamage, actorId = undefined) {
let attrDamageValue = 0
let actor = game.actors.get( (actorId) ? actorId: this.rollData.actorId) let actor = game.actors.get( (actorId) ? actorId: this.rollData.actorId)
if (attrDamage.includes("vigor")) { return actor.getDamageAttributeValue( attrDamage )
attrDamageValue = actor.system.attributes.vigor.value
if (attrDamage.includes("half")) {
attrDamageValue = Math.floor(attrDamageValue / 2)
}
}
return attrDamageValue
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -14,7 +14,7 @@
], ],
"url": "https://www.uberwald.me/gitea/public/bol", "url": "https://www.uberwald.me/gitea/public/bol",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"version": "10.4.0", "version": "10.4.1",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "10", "verified": "10",
@ -203,7 +203,7 @@
], ],
"socket": true, "socket": true,
"manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json", "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", "background": "systems/images/map_lemurie.webp",
"gridDistance": 1.5, "gridDistance": 1.5,
"gridUnits": "m", "gridUnits": "m",

View File

@ -102,10 +102,10 @@
"hp": { "hp": {
"key": "hp", "key": "hp",
"label": "BOL.resources.hp", "label": "BOL.resources.hp",
"base": 0, "base": 1,
"value": 0, "value": 1,
"bonus": 0, "bonus": 0,
"max": 0 "max": 1
}, },
"hero": { "hero": {
"key": "hero", "key": "hero",

View File

@ -7,6 +7,23 @@
<div class="sidebar flex0 bol-actor-sidebar"> <div class="sidebar flex0 bol-actor-sidebar">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="100" width="100" <img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="100" width="100"
style="border:1px outset lightgray; box-shadow: 5px 5px 5px gray" /> style="border:1px outset lightgray; box-shadow: 5px 5px 5px gray" />
<div></div>
{{#if (count boleffects)}}
<ol class="items-list">
<li class="item flexrow item-header">
<div class="item-name flex2">{{localize "BOL.ui.effects"}}</div>
</li>
{{#each boleffects as |effect keyEffect|}}
<li class="item flexrow" data-item-id="{{effect.id}}">
<div class="item-image roll-weapon"><img src="{{effect.img}}" title="{{effect.name}}"/></div>
<h4 class="item-name flex2"><a class="item-edit">{{effect.name}}</a></h4>
</li>
{{/each}}
</ol>
{{/if}}
</div> </div>
<div class="main flex1"> <div class="main flex1">