Display effects in main sheet (left) and manage it for defense and damages
This commit is contained in:
parent
add6893864
commit
5e7dc3ad9d
@ -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",
|
||||||
|
@ -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') {
|
||||||
@ -52,7 +53,7 @@ export class BoLActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
if ( this.type == "vehicle") {
|
if (this.type == "vehicle") {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
super.prepareDerivedData()
|
super.prepareDerivedData()
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +224,7 @@ export class BoLActor extends Actor {
|
|||||||
return duplicate(this.items.filter(i => i.type === "feature" && i.system.subtype === "flaw") || []);
|
return duplicate(this.items.filter(i => i.type === "feature" && i.system.subtype === "flaw") || []);
|
||||||
}
|
}
|
||||||
get careers() {
|
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() {
|
get origins() {
|
||||||
return this.items.filter(i => i.type === "feature" && i.system.subtype === "origin");
|
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")
|
return this.items.filter(i => i.type === "item")
|
||||||
}
|
}
|
||||||
get equipmentCreature() {
|
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() {
|
get armors() {
|
||||||
return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && i.system.subtype === "armor");
|
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");
|
return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && i.system.subtype === "shield");
|
||||||
}
|
}
|
||||||
get vehicleWeapons() {
|
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() {
|
get weapons() {
|
||||||
return this.items.filter(i => i.type === "item" && i.system.category === "equipment" && i.system.subtype === "weapon")
|
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() {
|
get bonusBoons() {
|
||||||
let boons = this.items.filter(i => i.type === "feature" && i.system.subtype === "boon" && i.system.properties.isbonusdice)
|
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() {
|
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() {
|
isSorcerer() {
|
||||||
@ -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) {
|
||||||
@ -568,7 +593,7 @@ export class BoLActor extends Actor {
|
|||||||
async manageHealthState() {
|
async manageHealthState() {
|
||||||
let hpID = "lastHP" + this.id
|
let hpID = "lastHP" + this.id
|
||||||
let lastHP = await this.getFlag("world", hpID)
|
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)
|
await this.setFlag("world", hpID, this.system.resources.hp.value)
|
||||||
if (this.system.resources.hp.value <= 0) {
|
if (this.system.resources.hp.value <= 0) {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
@ -615,7 +640,7 @@ export class BoLActor extends Actor {
|
|||||||
if (!protect.system.properties.soak.formula || protect.system.properties.soak.formula == "") {
|
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 !`)
|
ui.notifications.warn(`L'armure ${protect.name} n'a pas de formule pour la protection !`)
|
||||||
} else {
|
} else {
|
||||||
formula += "+" + " max(" + protect.system.properties.soak.formula +",0)"
|
formula += "+" + " max(" + protect.system.properties.soak.formula + ",0)"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (protect.system.properties.soak.value == undefined) {
|
if (protect.system.properties.soak.value == undefined) {
|
||||||
@ -634,7 +659,7 @@ export class BoLActor extends Actor {
|
|||||||
rollProtection(itemId) {
|
rollProtection(itemId) {
|
||||||
let armor = duplicate(this.items.get(itemId))
|
let armor = duplicate(this.items.get(itemId))
|
||||||
if (armor) {
|
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)
|
let rollArmor = new Roll(armorFormula)
|
||||||
rollArmor.roll({ async: false }).toMessage()
|
rollArmor.roll({ async: false }).toMessage()
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -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",
|
||||||
|
@ -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",
|
||||||
|
@ -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">
|
||||||
|
Loading…
Reference in New Issue
Block a user