Tweak the way armour shows up on the sheet so that it's a bit easier to deal with
This commit is contained in:
parent
8ed6f49c8d
commit
1d13f38f81
3 changed files with 51 additions and 16 deletions
|
|
@ -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`,
|
||||
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,
|
||||
shield: false,
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -34,15 +34,26 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
<div>Defense</div>
|
||||
<div>
|
||||
Armour
|
||||
{{rc-ifOut defense.protection}}
|
||||
/
|
||||
{{defense.locations}}
|
||||
{{#if defense.shield}}
|
||||
, <span>Shield</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
<ul>
|
||||
{{#each defenses as |defense|}}
|
||||
<li
|
||||
class="defense"
|
||||
data-tooltip="{{defense.tooltip}}"
|
||||
data-ctx-menu="item"
|
||||
data-item-id="{{defense.armourUUID}}"
|
||||
>
|
||||
{{defense.name}} ({{defense.protection}}{{#if defense.shielded}},
|
||||
<rc-icon
|
||||
name="icons/shield/solid.v1"
|
||||
var:size="14px"
|
||||
var:fill="currentColor"
|
||||
data-ctx-menu="item"
|
||||
data-item-id="{{defense.shieldUUID}}"
|
||||
/>
|
||||
{{/if}})
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<div>Traits</div>
|
||||
<ul class="traits">
|
||||
{{#each traits as |trait|}}
|
||||
|
|
|
|||
|
|
@ -81,14 +81,14 @@
|
|||
grid-template-rows: repeat(3, auto);
|
||||
gap: 2px;
|
||||
|
||||
.traits {
|
||||
ul {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 8px;
|
||||
gap: 4px;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.trait {
|
||||
li {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue