From 233a3a54076e38fa0966d1fea56cc2b4a2c8b927 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Mon, 26 May 2025 18:58:56 +0200 Subject: [PATCH] Moved the roll total to bottom right. A bunch of label fixes --- daggerheart.mjs | 2 +- module/applications/settings.mjs | 5 +- module/applications/sheets/pc.mjs | 2 +- module/data/dualityRoll.mjs | 2 +- module/documents/actor.mjs | 23 +++-- styles/chat.less | 11 +-- styles/daggerheart.css | 10 +- templates/chat/attack-roll.hbs | 147 +++++++++++++++--------------- templates/chat/duality-roll.hbs | 15 +-- 9 files changed, 102 insertions(+), 115 deletions(-) diff --git a/daggerheart.mjs b/daggerheart.mjs index d6b180d3..917feee2 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -218,7 +218,7 @@ Hooks.on('chatMessage', (_, message) => { attribute: attribute ? { value: attribute.data.value, - label: `${game.i18n.localize(abilities[attributeValue].label)} ${attribute.data.value >= 0 ? `+` : `-`}${attribute.data.value}` + label: `${game.i18n.localize(abilities[attributeValue].label)} ${attribute.data.value >= 0 ? `+` : ``}${attribute.data.value}` } : undefined, title diff --git a/module/applications/settings.mjs b/module/applications/settings.mjs index 80036bb5..d79dfe96 100644 --- a/module/applications/settings.mjs +++ b/module/applications/settings.mjs @@ -218,11 +218,12 @@ export const registerDHPSettings = () => { game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor, { name: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Name'), hint: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Hint'), - scope: 'world', + scope: 'client', config: true, type: Number, choices: Object.values(DualityRollColor), - default: DualityRollColor.colorful.value + default: DualityRollColor.colorful.value, + requiresReload: true }); game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.Automation.Name, { diff --git a/module/applications/sheets/pc.mjs b/module/applications/sheets/pc.mjs index 53ac00d4..d4eadedc 100644 --- a/module/applications/sheets/pc.mjs +++ b/module/applications/sheets/pc.mjs @@ -489,7 +489,7 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) { static async rollAttribute(event, button) { const { roll, hope, fear, advantage, disadvantage, modifiers } = await this.document.dualityRoll( - { title: 'Attribute Bonus', value: button.dataset.value }, + { title: game.i18n.localize(abilities[button.dataset.attribute].label), value: button.dataset.value }, event.shiftKey ); diff --git a/module/data/dualityRoll.mjs b/module/data/dualityRoll.mjs index 50909a46..8df93921 100644 --- a/module/data/dualityRoll.mjs +++ b/module/data/dualityRoll.mjs @@ -81,7 +81,7 @@ export default class DhpDualityRoll extends foundry.abstract.TypeDataModel { const total = this.modifiers.reduce((acc, x) => acc + x.value, 0); return { value: total, - label: total > 0 ? `+${total}` : total < 0 ? `-${total}` : '' + label: total > 0 ? `+${total}` : total < 0 ? `${total}` : '' }; } diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 6db5f18e..427369ae 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -116,16 +116,19 @@ export default class DhpActor extends Actor { disadvantageDice = null, bonusDamageString = ''; - const modifiers = [ - { - value: modifier.value ? Number.parseInt(modifier.value) : 0, - label: - modifier.value >= 0 - ? `${modifier.title} +${modifier.value}` - : `${modifier.title} -${modifier.value}`, - title: modifier.title - } - ]; + const modifiers = + modifier.value !== null + ? [ + { + value: modifier.value ? Number.parseInt(modifier.value) : 0, + label: + modifier.value >= 0 + ? `${modifier.title} +${modifier.value}` + : `${modifier.title} ${modifier.value}`, + title: modifier.title + } + ] + : []; if (!shiftKey) { const dialogClosed = new Promise((resolve, _) => { new RollSelectionDialog( diff --git a/styles/chat.less b/styles/chat.less index f54de5d2..fede0209 100644 --- a/styles/chat.less +++ b/styles/chat.less @@ -21,15 +21,6 @@ align-items: end; justify-content: space-between; padding: 0 8px; - - .duality-result-value { - border: 1px solid var(--color-dark-5); - padding: 2px; - font-weight: bold; - background: var(--color-dark-1); - margin-bottom: 4px; - font-size: 16px; - } } .duality-modifiers { @@ -211,7 +202,7 @@ text-shadow: 0 0 1px black; font-weight: bold; background: var(--color-dark-1); - padding: 4px; + padding: 4px 4px 0 4px; border-radius: 6px 0 0 0; } diff --git a/styles/daggerheart.css b/styles/daggerheart.css index eb6fed29..1b9384f0 100755 --- a/styles/daggerheart.css +++ b/styles/daggerheart.css @@ -1369,14 +1369,6 @@ justify-content: space-between; padding: 0 8px; } -.chat-message.duality .duality-data .duality-title .duality-result-value { - border: 1px solid var(--color-dark-5); - padding: 2px; - font-weight: bold; - background: var(--color-dark-1); - margin-bottom: 4px; - font-size: 16px; -} .chat-message.duality .duality-data .duality-modifiers { display: flex; gap: 2px; @@ -1504,7 +1496,7 @@ text-shadow: 0 0 1px black; font-weight: bold; background: var(--color-dark-1); - padding: 4px; + padding: 4px 4px 0 4px; border-radius: 6px 0 0 0; } .chat-message.duality .duality-actions { diff --git a/templates/chat/attack-roll.hbs b/templates/chat/attack-roll.hbs index 3daf7485..fed85da8 100644 --- a/templates/chat/attack-roll.hbs +++ b/templates/chat/attack-roll.hbs @@ -1,9 +1,8 @@ -
- {{#if this.colorful}} +{{#if this.colorful}} +
{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}
-
{{this.total}}
{{#each this.modifiers}} @@ -62,7 +61,7 @@
{{#if (not this.damage.value)}}
-
{{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}
+
{{this.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}
{{/if}}
@@ -83,90 +82,90 @@
-
{{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}
+
{{this.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}
{{/if}} - {{else}} -
-
{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}
-
-
{{roll}}
+
+{{else}} +
+
{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}
+
+
{{roll}}
-
-
-
+
+
+
+
+
+ + 1{{hope.dice}} + | + 1{{fear.dice}} + + {{this.diceTotal}} +
+
+
    +
  1. {{hope.value}}
  2. +
  3. {{fear.value}}
  4. +
+
+
+ {{#if advantage.value}}
- 1{{hope.dice}} - | - 1{{fear.dice}} + 1{{advantage.dice}} - {{this.diceTotal}} + {{advantage.value}}
-
    -
  1. {{hope.value}}
  2. -
  3. {{fear.value}}
  4. +
      +
    1. {{advantage.value}}
- {{#if advantage.value}} -
-
- - 1{{advantage.dice}} - - {{advantage.value}} -
-
-
    -
  1. {{advantage.value}}
  2. -
-
-
- {{/if}} - {{#if disadvantage.value}} -
-
- - 1{{disadvantage.dice}} - - {{disadvantage.value}} -
-
-
    -
  1. {{disadvantage.value}}
  2. -
-
-
- {{/if}} -
-
-
-
-
{{totalLabel}}
-
- {{this.total}} -
-
- {{#if (gt targets.length 0)}} -
- {{#each targets as |target|}} -
- -
- {{#if target.hit}}{{localize "Hit"}}{{else}}{{#if (not ../total.alternate)}}{{localize "Miss"}}{{else}}?{{/if}}{{/if}} -
+ {{/if}} + {{#if disadvantage.value}} +
+
+ + 1{{disadvantage.dice}} + + {{disadvantage.value}} +
+
+
    +
  1. {{disadvantage.value}}
  2. +
+
- {{/each}} -
- {{/if}} -
- + {{/if}} +
+
+
{{totalLabel}}
+
+ {{this.total}} +
+
+ {{#if (gt targets.length 0)}} +
+ {{#each targets as |target|}} +
+ +
+ {{#if target.hit}}{{localize "Hit"}}{{else}}{{#if (not ../total.alternate)}}{{localize "Miss"}}{{else}}?{{/if}}{{/if}} +
+
+ {{/each}} +
+ {{/if}} +
+ +
- {{/if}} -
\ No newline at end of file +
+{{/if}} \ No newline at end of file diff --git a/templates/chat/duality-roll.hbs b/templates/chat/duality-roll.hbs index 1e906196..047e88e7 100644 --- a/templates/chat/duality-roll.hbs +++ b/templates/chat/duality-roll.hbs @@ -1,9 +1,8 @@ -
- {{#if this.colorful}} +{{#if this.colorful}} +
{{this.title}}
-
{{this.total}}
{{#each this.modifiers}} @@ -62,7 +61,7 @@
{{#if (not this.damage.value)}}
-
{{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}
+
{{this.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}
{{/if}}
@@ -75,7 +74,9 @@
{{/if}} - {{else}} +
+{{else}} +
{{this.title}}
{{roll}}
@@ -138,5 +139,5 @@
- {{/if}} - \ No newline at end of file + +{{/if}}