Add Craft as it's own section item. Display the attack range
This commit is contained in:
parent
28345bdef0
commit
cd69228e68
3 changed files with 52 additions and 15 deletions
|
|
@ -124,7 +124,6 @@ export class BookGeistSheet extends
|
||||||
};
|
};
|
||||||
|
|
||||||
async _prepareItemsContext(ctx) {
|
async _prepareItemsContext(ctx) {
|
||||||
ctx.attacks = [];
|
|
||||||
ctx.defense = {
|
ctx.defense = {
|
||||||
locations: `None`,
|
locations: `None`,
|
||||||
protection: 0,
|
protection: 0,
|
||||||
|
|
@ -136,9 +135,15 @@ export class BookGeistSheet extends
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case `weapon`: {
|
case `weapon`: {
|
||||||
if (!item.system.equipped) { continue };
|
if (!item.system.equipped) { continue };
|
||||||
|
ctx.attacks ??= [];
|
||||||
ctx.attacks.push(this._prepareWeapon(item));
|
ctx.attacks.push(this._prepareWeapon(item));
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
case `craft`: {
|
||||||
|
ctx.crafts ??= [];
|
||||||
|
ctx.crafts.push(this._prepareCraft(item));
|
||||||
|
break;
|
||||||
|
};
|
||||||
case `trait`: {
|
case `trait`: {
|
||||||
ctx.traits.push(this._prepareTrait(item));
|
ctx.traits.push(this._prepareTrait(item));
|
||||||
break;
|
break;
|
||||||
|
|
@ -148,14 +153,25 @@ export class BookGeistSheet extends
|
||||||
};
|
};
|
||||||
|
|
||||||
_prepareWeapon(weapon) {
|
_prepareWeapon(weapon) {
|
||||||
|
const hasShortRange = weapon.system.range.short != null;
|
||||||
|
const hasLongRange = weapon.system.range.long != null;
|
||||||
|
const isRanged = hasShortRange || hasLongRange;
|
||||||
return {
|
return {
|
||||||
uuid: weapon.uuid,
|
uuid: weapon.uuid,
|
||||||
name: weapon.name,
|
name: weapon.name,
|
||||||
damage: weapon.system.damage,
|
damage: weapon.system.damage,
|
||||||
|
isRanged,
|
||||||
range: weapon.system.range,
|
range: weapon.system.range,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_prepareCraft(craft) {
|
||||||
|
return {
|
||||||
|
uuid: craft.uuid,
|
||||||
|
name: craft.name,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_prepareTrait(trait) {
|
_prepareTrait(trait) {
|
||||||
return {
|
return {
|
||||||
uuid: trait.uuid,
|
uuid: trait.uuid,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<div class="items">
|
<div class="items">
|
||||||
|
{{#if attacks}}
|
||||||
<div>Attacks</div>
|
<div>Attacks</div>
|
||||||
<div>
|
<div>
|
||||||
{{#each attacks as |attack|}}
|
{{#each attacks as |attack|}}
|
||||||
|
|
@ -8,11 +9,30 @@
|
||||||
data-item-id="{{attack.uuid}}"
|
data-item-id="{{attack.uuid}}"
|
||||||
>
|
>
|
||||||
{{attack.name}}
|
{{attack.name}}
|
||||||
|
{{attack.damage}}
|
||||||
|
{{#if attack.isRanged}}
|
||||||
|
<span class="range">
|
||||||
|
({{attack.range.short}} / {{attack.range.long}})
|
||||||
|
</span>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
|
||||||
Unarmed!
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if crafts}}
|
||||||
|
<div>Craft</div>
|
||||||
|
<div>
|
||||||
|
{{#each crafts as |craft|}}
|
||||||
|
<div
|
||||||
|
class="craft"
|
||||||
|
data-ctx-menu="item"
|
||||||
|
data-item-id="{{craft.uuid}}"
|
||||||
|
>
|
||||||
|
{{craft.name}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
<div>Defense</div>
|
<div>Defense</div>
|
||||||
<div>
|
<div>
|
||||||
Armour
|
Armour
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue