RC-36 | Abilities | Guts Input
This commit is contained in:
parent
9c967aa354
commit
23cad8fcc3
4 changed files with 72 additions and 7 deletions
|
|
@ -71,6 +71,7 @@
|
||||||
class="value"
|
class="value"
|
||||||
value="{{ability.value}}"
|
value="{{ability.value}}"
|
||||||
name="system.ability.{{ability.id}}"
|
name="system.ability.{{ability.id}}"
|
||||||
|
min=0
|
||||||
>
|
>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span>{{ability.value}}</span>
|
<span>{{ability.value}}</span>
|
||||||
|
|
@ -92,7 +93,44 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{!-- Health --}}
|
{{!-- Health --}}
|
||||||
<div></div>
|
<div class="ability">
|
||||||
|
<div class="compass dual">
|
||||||
|
{{#if meta.editable}}
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="{{meta.idp}}-guts-value"
|
||||||
|
class="value"
|
||||||
|
name="system.guts.value"
|
||||||
|
value="{{guts.value}}"
|
||||||
|
min="0"
|
||||||
|
>
|
||||||
|
{{else}}
|
||||||
|
<span
|
||||||
|
class="value"
|
||||||
|
aria-describedby="{{meta.idp}}-guts-value-label"
|
||||||
|
{{!-- TODO: aria-label="{{ rc-i18n "RipCrypt.Apps.a11y.guts-value-readonly" }}" --}}
|
||||||
|
>
|
||||||
|
{{ guts.value }}
|
||||||
|
</span>
|
||||||
|
{{/if}}
|
||||||
|
<span
|
||||||
|
class="max"
|
||||||
|
aria-hidden="true"
|
||||||
|
{{!-- TODO: aria-label="{{ rc-i18n "RipCrypt.Apps.a11y.guts-max-readonly" }}" --}}
|
||||||
|
>
|
||||||
|
{{ guts.max }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{{#if meta.editable}}
|
||||||
|
<label class="col-header" for="{{meta.idp}}-guts-value">
|
||||||
|
{{ rc-i18n "RipCrypt.common.guts" }}
|
||||||
|
</label>
|
||||||
|
{{else}}
|
||||||
|
<div class="col-header label" id="{{meta.idp}}-guts-value-label">
|
||||||
|
{{ rc-i18n "RipCrypt.common.guts" }}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
{{!-- Move & Run --}}
|
{{!-- Move & Run --}}
|
||||||
<div class="ability">
|
<div class="ability">
|
||||||
|
|
|
||||||
|
|
@ -115,8 +115,8 @@
|
||||||
|
|
||||||
&.dual {
|
&.dual {
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1rem;
|
font-size: var(--font-size-14);
|
||||||
--distance-from-edge: 3px;
|
--distance-from-edge: 4px;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
@ -132,11 +132,13 @@
|
||||||
width: 50%;
|
width: 50%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
/* border-bottom: none; */
|
||||||
}
|
}
|
||||||
|
|
||||||
> .value {
|
> .value {
|
||||||
top: var(--distance-from-edge);
|
top: var(--distance-from-edge);
|
||||||
left: var(--distance-from-edge);
|
left: var(--distance-from-edge);
|
||||||
|
clip-path: polygon(100% 0, 100% 60%, 60% 100%, 0 100%, 0 0);
|
||||||
}
|
}
|
||||||
> .max {
|
> .max {
|
||||||
bottom: var(--distance-from-edge);
|
bottom: var(--distance-from-edge);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@
|
||||||
"plural": "Weapons"
|
"plural": "Weapons"
|
||||||
},
|
},
|
||||||
"wear": "Wear",
|
"wear": "Wear",
|
||||||
"damage": "Damage"
|
"damage": "Damage",
|
||||||
|
"guts": "Guts"
|
||||||
},
|
},
|
||||||
"setting": {
|
"setting": {
|
||||||
"abbrAccess": {
|
"abbrAccess": {
|
||||||
|
|
@ -44,7 +45,12 @@
|
||||||
},
|
},
|
||||||
"Apps": {
|
"Apps": {
|
||||||
"move-run": "@RipCrypt.common.move • @RipCrypt.common.run",
|
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,13 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2)
|
||||||
|
|
||||||
ctx.meta ??= {};
|
ctx.meta ??= {};
|
||||||
ctx.meta.idp = this.document.uuid;
|
ctx.meta.idp = this.document.uuid;
|
||||||
|
ctx.meta.limited = this.actor.limited;
|
||||||
ctx.meta.editable = ctx.editable;
|
ctx.meta.editable = ctx.editable;
|
||||||
delete ctx.editable;
|
delete ctx.editable;
|
||||||
|
|
||||||
ctx.actor = this.document;
|
ctx.actor = this.document;
|
||||||
|
|
||||||
|
ctx = await HeroSummaryCardV1.prepareGuts(ctx);
|
||||||
ctx = await HeroSummaryCardV1.prepareWeapons(ctx);
|
ctx = await HeroSummaryCardV1.prepareWeapons(ctx);
|
||||||
ctx = await HeroSummaryCardV1.prepareFatePath(ctx);
|
ctx = await HeroSummaryCardV1.prepareFatePath(ctx);
|
||||||
ctx = await HeroSummaryCardV1.prepareAbilityRow(ctx);
|
ctx = await HeroSummaryCardV1.prepareAbilityRow(ctx);
|
||||||
|
|
@ -84,7 +86,7 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2)
|
||||||
`RipCrypt.common.ability.${key}`,
|
`RipCrypt.common.ability.${key}`,
|
||||||
{ value: ctx.actor.system.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,
|
readonly: !ctx.meta.editable,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -92,7 +94,13 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2)
|
||||||
};
|
};
|
||||||
|
|
||||||
static async prepareSpeed(ctx) {
|
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;
|
return ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -108,6 +116,17 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return ctx;
|
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
|
// #endregion
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue