From 23cad8fcc3efd8e23a094bde35f21e9691857bb4 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 28 Dec 2024 23:56:48 -0700 Subject: [PATCH] RC-36 | Abilities | Guts Input --- Apps/HeroSummaryCardV1/content.hbs | 40 ++++++++++++++++++- Apps/HeroSummaryCardV1/style.css | 6 ++- langs/en-ca.json | 10 ++++- module/Apps/ActorSheets/HeroSummaryCardV1.mjs | 23 ++++++++++- 4 files changed, 72 insertions(+), 7 deletions(-) diff --git a/Apps/HeroSummaryCardV1/content.hbs b/Apps/HeroSummaryCardV1/content.hbs index 155eec3..1a7d160 100644 --- a/Apps/HeroSummaryCardV1/content.hbs +++ b/Apps/HeroSummaryCardV1/content.hbs @@ -71,6 +71,7 @@ class="value" value="{{ability.value}}" name="system.ability.{{ability.id}}" + min=0 > {{else}} {{ability.value}} @@ -92,7 +93,44 @@ {{/each}} {{!-- Health --}} -
+
+
+ {{#if meta.editable}} + + {{else}} + + {{ guts.value }} + + {{/if}} + +
+ {{#if meta.editable}} + + {{else}} +
+ {{ rc-i18n "RipCrypt.common.guts" }} +
+ {{/if}} +
{{!-- Move & Run --}}
diff --git a/Apps/HeroSummaryCardV1/style.css b/Apps/HeroSummaryCardV1/style.css index 4559f0c..5308b86 100644 --- a/Apps/HeroSummaryCardV1/style.css +++ b/Apps/HeroSummaryCardV1/style.css @@ -115,8 +115,8 @@ &.dual { position: relative; - font-size: 1rem; - --distance-from-edge: 3px; + font-size: var(--font-size-14); + --distance-from-edge: 4px; &::after { display: block; @@ -132,11 +132,13 @@ width: 50%; position: absolute; text-align: center; + /* border-bottom: none; */ } > .value { top: var(--distance-from-edge); left: var(--distance-from-edge); + clip-path: polygon(100% 0, 100% 60%, 60% 100%, 0 100%, 0 0); } > .max { bottom: var(--distance-from-edge); diff --git a/langs/en-ca.json b/langs/en-ca.json index c24df1e..1bf3f50 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -34,7 +34,8 @@ "plural": "Weapons" }, "wear": "Wear", - "damage": "Damage" + "damage": "Damage", + "guts": "Guts" }, "setting": { "abbrAccess": { @@ -44,7 +45,12 @@ }, "Apps": { "move-run": "@RipCrypt.common.move • @RipCrypt.common.run", - "traits-range": "@RipCrypt.common.traits • @RipCrypt.common.range" + "traits-range": "@RipCrypt.common.traits • @RipCrypt.common.range", + "a11y": { + "guts-value-edit": "The current amount of guts the character has", + "guts-value-readonly": "The current amount of guts the character has", + "guts-max-readonly": "The maximum amount of guts the character can have" + } } } } diff --git a/module/Apps/ActorSheets/HeroSummaryCardV1.mjs b/module/Apps/ActorSheets/HeroSummaryCardV1.mjs index 3004dba..e47f944 100644 --- a/module/Apps/ActorSheets/HeroSummaryCardV1.mjs +++ b/module/Apps/ActorSheets/HeroSummaryCardV1.mjs @@ -45,11 +45,13 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2) ctx.meta ??= {}; ctx.meta.idp = this.document.uuid; + ctx.meta.limited = this.actor.limited; ctx.meta.editable = ctx.editable; delete ctx.editable; ctx.actor = this.document; + ctx = await HeroSummaryCardV1.prepareGuts(ctx); ctx = await HeroSummaryCardV1.prepareWeapons(ctx); ctx = await HeroSummaryCardV1.prepareFatePath(ctx); ctx = await HeroSummaryCardV1.prepareAbilityRow(ctx); @@ -84,7 +86,7 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2) `RipCrypt.common.ability.${key}`, { value: ctx.actor.system.ability[key] }, ), - value: ctx.actor.system.ability[key], + value: ctx.meta.limited ? `?` : ctx.actor.system.ability[key], readonly: !ctx.meta.editable, }); }; @@ -92,7 +94,13 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2) }; static async prepareSpeed(ctx) { - ctx.speed = ctx.actor.system.speed; + ctx.speed = foundry.utils.deepClone(ctx.actor.system.speed); + if (ctx.meta.limited) { + ctx.speed = { + move: `?`, + run: `?`, + }; + }; return ctx; }; @@ -108,6 +116,17 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2) }); }; return ctx; + }; + + static async prepareGuts(ctx) { + ctx.guts = foundry.utils.deepClone(ctx.actor.system.guts); + if (ctx.meta.limited) { + ctx.guts = { + value: `?`, + max: `?`, + }; + }; + return ctx; } // #endregion