Moved the roll total to bottom right. A bunch of label fixes

This commit is contained in:
WBHarry 2025-05-26 18:58:56 +02:00
parent 307af1fd77
commit 233a3a5407
9 changed files with 102 additions and 115 deletions

View file

@ -218,7 +218,7 @@ Hooks.on('chatMessage', (_, message) => {
attribute: attribute attribute: attribute
? { ? {
value: attribute.data.value, 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, : undefined,
title title

View file

@ -218,11 +218,12 @@ export const registerDHPSettings = () => {
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor, { game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor, {
name: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Name'), name: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Name'),
hint: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Hint'), hint: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Hint'),
scope: 'world', scope: 'client',
config: true, config: true,
type: Number, type: Number,
choices: Object.values(DualityRollColor), choices: Object.values(DualityRollColor),
default: DualityRollColor.colorful.value default: DualityRollColor.colorful.value,
requiresReload: true
}); });
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.Automation.Name, { game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.Automation.Name, {

View file

@ -489,7 +489,7 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
static async rollAttribute(event, button) { static async rollAttribute(event, button) {
const { roll, hope, fear, advantage, disadvantage, modifiers } = await this.document.dualityRoll( 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 event.shiftKey
); );

View file

@ -81,7 +81,7 @@ export default class DhpDualityRoll extends foundry.abstract.TypeDataModel {
const total = this.modifiers.reduce((acc, x) => acc + x.value, 0); const total = this.modifiers.reduce((acc, x) => acc + x.value, 0);
return { return {
value: total, value: total,
label: total > 0 ? `+${total}` : total < 0 ? `-${total}` : '' label: total > 0 ? `+${total}` : total < 0 ? `${total}` : ''
}; };
} }

View file

@ -116,16 +116,19 @@ export default class DhpActor extends Actor {
disadvantageDice = null, disadvantageDice = null,
bonusDamageString = ''; bonusDamageString = '';
const modifiers = [ const modifiers =
modifier.value !== null
? [
{ {
value: modifier.value ? Number.parseInt(modifier.value) : 0, value: modifier.value ? Number.parseInt(modifier.value) : 0,
label: label:
modifier.value >= 0 modifier.value >= 0
? `${modifier.title} +${modifier.value}` ? `${modifier.title} +${modifier.value}`
: `${modifier.title} -${modifier.value}`, : `${modifier.title} ${modifier.value}`,
title: modifier.title title: modifier.title
} }
]; ]
: [];
if (!shiftKey) { if (!shiftKey) {
const dialogClosed = new Promise((resolve, _) => { const dialogClosed = new Promise((resolve, _) => {
new RollSelectionDialog( new RollSelectionDialog(

View file

@ -21,15 +21,6 @@
align-items: end; align-items: end;
justify-content: space-between; justify-content: space-between;
padding: 0 8px; 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 { .duality-modifiers {
@ -211,7 +202,7 @@
text-shadow: 0 0 1px black; text-shadow: 0 0 1px black;
font-weight: bold; font-weight: bold;
background: var(--color-dark-1); background: var(--color-dark-1);
padding: 4px; padding: 4px 4px 0 4px;
border-radius: 6px 0 0 0; border-radius: 6px 0 0 0;
} }

View file

@ -1369,14 +1369,6 @@
justify-content: space-between; justify-content: space-between;
padding: 0 8px; 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 { .chat-message.duality .duality-data .duality-modifiers {
display: flex; display: flex;
gap: 2px; gap: 2px;
@ -1504,7 +1496,7 @@
text-shadow: 0 0 1px black; text-shadow: 0 0 1px black;
font-weight: bold; font-weight: bold;
background: var(--color-dark-1); background: var(--color-dark-1);
padding: 4px; padding: 4px 4px 0 4px;
border-radius: 6px 0 0 0; border-radius: 6px 0 0 0;
} }
.chat-message.duality .duality-actions { .chat-message.duality .duality-actions {

View file

@ -1,9 +1,8 @@
<div class="daggerheart chat roll" data-action="expandRoll"> {{#if this.colorful}}
{{#if this.colorful}} <div class="daggerheart chat roll" data-action="expandRoll">
<div class="duality-data"> <div class="duality-data">
<div class="duality-title"> <div class="duality-title">
<div>{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}</div> <div>{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}</div>
<div class="duality-result-value">{{this.total}}</div>
</div> </div>
<div class="duality-modifiers"> <div class="duality-modifiers">
{{#each this.modifiers}} {{#each this.modifiers}}
@ -62,7 +61,7 @@
</div> </div>
{{#if (not this.damage.value)}} {{#if (not this.damage.value)}}
<div class="duality-result"> <div class="duality-result">
<div>{{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div> <div>{{this.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div>
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -83,11 +82,12 @@
<div class="duality-actions"> <div class="duality-actions">
<button class="duality-action" data-value="{{this.total}}" data-damage="{{this.damage.value}}" data-damage-type="{{this.damage.type}}" {{#if this.damage.disabled}}disabled{{/if}}><span>Roll Damage</span></button> <button class="duality-action" data-value="{{this.total}}" data-damage="{{this.damage.value}}" data-damage-type="{{this.damage.type}}" {{#if this.damage.disabled}}disabled{{/if}}><span>Roll Damage</span></button>
<div class="duality-result"> <div class="duality-result">
<div>{{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div> <div>{{this.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div>
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{else}} </div>
{{else}}
<div class="dice-roll daggerheart chat roll" data-action="expandRoll"> <div class="dice-roll daggerheart chat roll" data-action="expandRoll">
<div class="dice-flavor">{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}</div> <div class="dice-flavor">{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}</div>
<div class="dice-result"> <div class="dice-result">
@ -168,5 +168,4 @@
</div> </div>
</div> </div>
</div> </div>
{{/if}} {{/if}}
</div>

View file

@ -1,9 +1,8 @@
<div class="daggerheart chat roll" data-action="expandRoll"> {{#if this.colorful}}
{{#if this.colorful}} <div class="daggerheart chat roll" data-action="expandRoll">
<div class="duality-data"> <div class="duality-data">
<div class="duality-title"> <div class="duality-title">
<div>{{this.title}}</div> <div>{{this.title}}</div>
<div class="duality-result-value">{{this.total}}</div>
</div> </div>
<div class="duality-modifiers"> <div class="duality-modifiers">
{{#each this.modifiers}} {{#each this.modifiers}}
@ -62,7 +61,7 @@
</div> </div>
{{#if (not this.damage.value)}} {{#if (not this.damage.value)}}
<div class="duality-result"> <div class="duality-result">
<div>{{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div> <div>{{this.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div>
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -75,7 +74,9 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{else}} </div>
{{else}}
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
<div class="dice-flavor">{{this.title}}</div> <div class="dice-flavor">{{this.title}}</div>
<div class="dice-result"> <div class="dice-result">
<div class="dice-formula">{{roll}}</div> <div class="dice-formula">{{roll}}</div>
@ -138,5 +139,5 @@
</div> </div>
</div> </div>
</div> </div>
{{/if}} </div>
</div> {{/if}}