Sanity is now specific to actor type

This commit is contained in:
jalensailin
2025-07-22 14:03:55 -04:00
parent 8f050d34d1
commit 00c8531f46
7 changed files with 55 additions and 34 deletions
+8
View File
@@ -49,7 +49,9 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) {
this.actor,
);
// Early return if this is a vehicle.
if (this.actor.type === "vehicle") return context;
// Make it easy for the sheet handlebars to understand how to sort the skills.
context.sortSkillsSetting = game.settings.get("deltagreen", "sortSkills");
@@ -173,6 +175,12 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) {
this.actor.system.sortedCustomSkills = sortedCustomSkills;
}
// Set sanity block per actor type.
context.sanityInputs = await foundry.applications.handlebars.renderTemplate(
`${DGActorSheet.TEMPLATE_PATH}/partials/sanity-${this.actor.type}.html`,
context,
);
// Set title for Physical Attributes.
context.physicalAttributesTitle = game.i18n.localize(
"DG.Sheet.BlockHeaders.Attributes",
+1
View File
@@ -11,6 +11,7 @@ export default async function preloadHandlebarsTemplates() {
"systems/deltagreen/templates/actor/npc-limited-sheet.html",
"systems/deltagreen/templates/dialog/modify-percentile-roll.html",
"systems/deltagreen/templates/actor/vehicle-sheet.html",
"systems/deltagreen/templates/actor/partials/sanity-partial.html",
"systems/deltagreen/templates/actor/partials/custom-skills-partial.html",
"systems/deltagreen/templates/actor/partials/cv-partial.html",
"systems/deltagreen/templates/actor/partials/help-and-licensing-partial.html",
@@ -0,0 +1,13 @@
<input class="centered
{{#if actor.system.sanity.breakingPointHit }}
breaking-point-hit{{/if }}"
type="text"
name="system.sanity.value"
value="{{actor.system.sanity.value }}"
data-dtype="Number"
data-tooltip="{{localize 'DG.Tooltip.CurrentSanityPartOne' }}{{actor.system.sanity.currentBreakingPoint }}{{localize 'DG.Tooltip.CurrentSanityPartTwo' }}" />
<span>/</span>
<div class="max-resource-value"
data-tooltip="{{localize 'DG.Tooltip.MaximumSanity'}}">
<div>{{numberFormat actor.system.sanity.max decimals=0 sign=false}}</div>
</div>
+11
View File
@@ -0,0 +1,11 @@
<input type="text"
name="system.sanity.value"
value="{{actor.system.sanity.value}}"
data-dtype="Number"
title="{{localize 'DG.Tooltip.CurrentSanityPartOne'}}{{actor.system.sanity.currentBreakingPoint}}{{localize 'DG.Tooltip.CurrentSanityPartTwo'}}" />
<span>{{localize 'DG.NPCSheet.BreakPointAbbreviation'}}:</span>
<input type="text"
name="system.sanity.currentBreakingPoint"
value="{{actor.system.sanity.currentBreakingPoint}}"
data-dtype="Number"
title="{{localize 'DG.Tooltip.BreakPoint'}}" />
@@ -0,0 +1,14 @@
<div class="resource-outer-grid-1col">
<label for="system.san.value"
class="resource-label rollable"
data-action="roll"
{{#if_eq actor.type 'unnatural' }}
data-rolltype="sanity-damage"
{{else }}
data-rolltype="sanity"
{{/if_eq }}
data-tooltip="{{localize 'DG.Attributes.Tooltip.SAN' }}">
{{localize 'DG.Attributes.SAN' }} <i class="fas fa-dice"></i>
</label>
<div class="resource-inner-grid-3col">{{{ sanityInputs }}}</div>
</div>
@@ -0,0 +1,7 @@
<input type="text"
name="system.sanity.successLoss"
value="{{actor.system.sanity.successLoss}}" />
<span>/</span>
<input type="text"
name="system.sanity.failedLoss"
value="{{actor.system.sanity.failedLoss}}" />
+1 -34
View File
@@ -70,40 +70,7 @@
</div>
</div>
{{!-- Sanity --}}
<div class="resource-outer-grid-1col">
<label for="system.san.value"
class="resource-label rollable"
data-action="roll"
data-rolltype="sanity"
data-tooltip="{{localize 'DG.Attributes.Tooltip.SAN'}}">
{{localize 'DG.Attributes.SAN' }} <i class="fas fa-dice"></i>
</label>
<div class="resource-inner-grid-3col">
{{#if (keepSanityPrivate) }}
<input type="text" value="??" disabled data-tooltip="" />
<span>/</span>
<div class="max-resource-value"
data-tooltip="{{localize 'DG.Tooltip.MaximumSanity'}}">
<div>{{numberFormat actor.system.sanity.max decimals=0 sign=false}}</div>
</div>
{{/if}}
{{#unless (keepSanityPrivate)}}
<input class="centered
{{#if actor.system.sanity.breakingPointHit }}
breaking-point-hit{{/if }}"
type="text"
name="system.sanity.value"
value="{{actor.system.sanity.value }}"
data-dtype="Number"
data-tooltip="{{localize 'DG.Tooltip.CurrentSanityPartOne' }}{{actor.system.sanity.currentBreakingPoint }}{{localize 'DG.Tooltip.CurrentSanityPartTwo' }}" />
<span>/</span>
<div class="max-resource-value"
data-tooltip="{{localize 'DG.Tooltip.MaximumSanity'}}">
<div>{{numberFormat actor.system.sanity.max decimals=0 sign=false}}</div>
</div>
{{/unless}}
</div>
</div>
{{> "systems/deltagreen/templates/actor/partials/sanity-partial.html" }}
</div>
</div>
</header>