Add Craft as it's own section item. Display the attack range

This commit is contained in:
Eldritch-Oliver 2025-10-13 21:29:56 -06:00
parent 28345bdef0
commit cd69228e68
3 changed files with 52 additions and 15 deletions

View file

@ -124,7 +124,6 @@ export class BookGeistSheet extends
};
async _prepareItemsContext(ctx) {
ctx.attacks = [];
ctx.defense = {
locations: `None`,
protection: 0,
@ -136,9 +135,15 @@ export class BookGeistSheet extends
switch (item.type) {
case `weapon`: {
if (!item.system.equipped) { continue };
ctx.attacks ??= [];
ctx.attacks.push(this._prepareWeapon(item));
break;
};
case `craft`: {
ctx.crafts ??= [];
ctx.crafts.push(this._prepareCraft(item));
break;
};
case `trait`: {
ctx.traits.push(this._prepareTrait(item));
break;
@ -148,14 +153,25 @@ export class BookGeistSheet extends
};
_prepareWeapon(weapon) {
const hasShortRange = weapon.system.range.short != null;
const hasLongRange = weapon.system.range.long != null;
const isRanged = hasShortRange || hasLongRange;
return {
uuid: weapon.uuid,
name: weapon.name,
damage: weapon.system.damage,
isRanged,
range: weapon.system.range,
};
};
_prepareCraft(craft) {
return {
uuid: craft.uuid,
name: craft.name,
};
};
_prepareTrait(trait) {
return {
uuid: trait.uuid,