diff --git a/module/Apps/ActorSheets/BookGeistSheet.mjs b/module/Apps/ActorSheets/BookGeistSheet.mjs index a1427d1..eeeffdd 100644 --- a/module/Apps/ActorSheets/BookGeistSheet.mjs +++ b/module/Apps/ActorSheets/BookGeistSheet.mjs @@ -3,6 +3,7 @@ import { GenericAppMixin } from "../mixins/GenericApp.mjs"; import { LaidOutAppMixin } from "../mixins/LaidOutAppMixin.mjs"; import { localizer } from "../../utils/Localizer.mjs"; import { editItemFromElement, deleteItemFromElement } from "../utils.mjs"; +import { gameTerms } from "../../gameTerms.mjs"; const { HandlebarsApplicationMixin } = foundry.applications.api; const { ActorSheetV2 } = foundry.applications.sheets; @@ -131,11 +132,34 @@ export class BookGeistSheet extends }; async _prepareItemsContext(ctx) { - ctx.defense = { - locations: `None`, - protection: 0, - shield: false, + const armours = this.actor.system.equippedArmour; + const shield = this.actor.system.equippedShield; + + let defenses = []; + for (const [location, armour] of Object.entries(armours)) { + if (!armour) { continue } + const defense = { + name: localizer(`RipCrypt.common.anatomy.${location}`), + tooltip: null, + protection: 0, + shielded: false, + }; + if (armour) { + defense.armourUUID = armour.uuid; + defense.tooltip = armour.name, + defense.protection = armour.system.protection; + } + if (shield?.system.location.has(location)) { + defense.shieldUUID = shield.uuid; + defense.shielded = true; + defense.protection += shield.system.protection; + }; + if (defense.protection > 0) { + defenses.push(defense); + }; }; + + ctx.defenses = defenses ctx.traits = []; // Array<{name: string}> for (const item of this.actor.items) { diff --git a/templates/Apps/BookGeistSheet/items.hbs b/templates/Apps/BookGeistSheet/items.hbs index c60ba24..dbe53b5 100644 --- a/templates/Apps/BookGeistSheet/items.hbs +++ b/templates/Apps/BookGeistSheet/items.hbs @@ -34,15 +34,26 @@ {{/if}}