Fixed lethality display. Improved combat tab styling. Improved edit stats modal.
This commit is contained in:
@@ -122,4 +122,24 @@ export default function registerHandlebarsHelpers() {
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("hasWeaponDamage", (damage) => {
|
||||
const trimmed = String(damage ?? "").trim();
|
||||
return trimmed !== "" && trimmed !== "0";
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("hasWeaponLethality", (lethality) => {
|
||||
const value = Number(lethality);
|
||||
return Number.isFinite(value) && value > 0;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("hasWeaponDamageAndLethality", (item) => {
|
||||
const damage = item?.system?.damage;
|
||||
const lethality = item?.system?.lethality;
|
||||
const trimmed = String(damage ?? "").trim();
|
||||
const hasDamage = trimmed !== "" && trimmed !== "0";
|
||||
const hasLethality =
|
||||
Number.isFinite(Number(lethality)) && Number(lethality) > 0;
|
||||
return hasDamage && hasLethality;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -177,6 +177,22 @@ export function appendRollTargetTooltipSection(
|
||||
return `${existingTooltip}<br><br>${appendix}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} existingTooltip
|
||||
* @param {string} [feature]
|
||||
* @returns {string}
|
||||
*/
|
||||
export function appendDistinguishingFeatureSection(existingTooltip, feature) {
|
||||
const trimmed = String(feature ?? "").trim();
|
||||
if (!trimmed) return existingTooltip;
|
||||
|
||||
const label = game.i18n.localize("DG.EditStats.DistinguishingFeature");
|
||||
const escaped = foundry.utils.escapeHTML(trimmed);
|
||||
const section = `<br><br>${foundry.utils.escapeHTML(label)}: ${escaped}`;
|
||||
if (!existingTooltip) return section;
|
||||
return `${existingTooltip}${section}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat and sanity roll-target tooltips for the agent sheet left bar (not skills).
|
||||
*
|
||||
@@ -191,8 +207,12 @@ export function prepareAgentStatSanityTooltips(actor) {
|
||||
for (const [key, stat] of Object.entries(system.statistics ?? {})) {
|
||||
const base = Number(stat.x5) || 0;
|
||||
const existing = game.i18n.localize(`DG.Attributes.Tooltip.${key}`);
|
||||
stat.tooltip = appendRollTargetTooltipSection(
|
||||
const withFeature = appendDistinguishingFeatureSection(
|
||||
existing,
|
||||
stat.distinguishing_feature,
|
||||
);
|
||||
stat.tooltip = appendRollTargetTooltipSection(
|
||||
withFeature,
|
||||
actor,
|
||||
"system.rollTarget.statistics",
|
||||
base,
|
||||
|
||||
Reference in New Issue
Block a user