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
? {
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

View file

@ -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, {

View file

@ -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
);

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);
return {
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,
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(

View file

@ -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;
}

View file

@ -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 {

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-title">
<div>{{localize "DAGGERHEART.Chat.AttackRoll.Title" attack=this.title}}</div>
<div class="duality-result-value">{{this.total}}</div>
</div>
<div class="duality-modifiers">
{{#each this.modifiers}}
@ -62,7 +61,7 @@
</div>
{{#if (not this.damage.value)}}
<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>
{{/if}}
</div>
@ -83,90 +82,90 @@
<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>
<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}}
{{else}}
<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-result">
<div class="dice-formula">{{roll}}</div>
</div>
{{else}}
<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-result">
<div class="dice-formula">{{roll}}</div>
<div class="dice-tooltip">
<div class="wrapper">
<section class="tooltip-part">
<div class="dice-tooltip">
<div class="wrapper">
<section class="tooltip-part">
<div class="dice">
<header class="part-header flexrow">
<span class="part-formula">
<span>1{{hope.dice}}</span>
|
<span>1{{fear.dice}}</span>
</span>
<span class="part-total">{{this.diceTotal}}</span>
</header>
<div class="flexrow">
<ol class="dice-rolls duality">
<li class="roll die {{hope.dice}} {{#if hope.discarded}}discarded{{/if}} hope min" title="{{localize "DAGGERHEART.General.Hope"}}">{{hope.value}}</li>
<li class="roll die {{fear.dice}} {{#if fear.discarded}}discarded{{/if}} fear min" title="{{localize "DAGGERHEART.General.Fear"}}">{{fear.value}}</li>
</ol>
</div>
</div>
{{#if advantage.value}}
<div class="dice">
<header class="part-header flexrow">
<span class="part-formula">
<span>1{{hope.dice}}</span>
|
<span>1{{fear.dice}}</span>
<span>1{{advantage.dice}}</span>
</span>
<span class="part-total">{{this.diceTotal}}</span>
<span class="part-total">{{advantage.value}}</span>
</header>
<div class="flexrow">
<ol class="dice-rolls duality">
<li class="roll die {{hope.dice}} {{#if hope.discarded}}discarded{{/if}} hope min" title="{{localize "DAGGERHEART.General.Hope"}}">{{hope.value}}</li>
<li class="roll die {{fear.dice}} {{#if fear.discarded}}discarded{{/if}} fear min" title="{{localize "DAGGERHEART.General.Fear"}}">{{fear.value}}</li>
<ol class="dice-rolls">
<li class="roll die {{advantage.dice}} hope min">{{advantage.value}}</li>
</ol>
</div>
</div>
{{#if advantage.value}}
<div class="dice">
<header class="part-header flexrow">
<span class="part-formula">
<span>1{{advantage.dice}}</span>
</span>
<span class="part-total">{{advantage.value}}</span>
</header>
<div class="flexrow">
<ol class="dice-rolls">
<li class="roll die {{advantage.dice}} hope min">{{advantage.value}}</li>
</ol>
</div>
</div>
{{/if}}
{{#if disadvantage.value}}
<div class="dice">
<header class="part-header flexrow">
<span class="part-formula">
<span>1{{disadvantage.dice}}</span>
</span>
<span class="part-total">{{disadvantage.value}}</span>
</header>
<div class="flexrow">
<ol class="dice-rolls">
<li class="roll die {{disadvantage.dice}} hope min">{{disadvantage.value}}</li>
</ol>
</div>
</div>
{{/if}}
</section>
</div>
</div>
<div class="dice-total duality {{#if fear.discarded}}hope{{else}}{{#if hope.discarded}}fear{{else}}critical{{/if}}{{/if}}">
<div class="dice-total-label">{{totalLabel}}</div>
<div class="dice-total-value">
{{this.total}}
</div>
</div>
{{#if (gt targets.length 0)}}
<div class="target-section">
{{#each targets as |target|}}
<div class="dice-total target-container {{#if target.hit}}hit{{else}}{{#if (not ../total.alternate)}}miss{{/if}}{{/if}}" data-token="{{target.id}}">
<img src="{{target.img}}" />
<div class="target-inner-container">
{{#if target.hit}}{{localize "Hit"}}{{else}}{{#if (not ../total.alternate)}}{{localize "Miss"}}{{else}}?{{/if}}{{/if}}
</div>
{{/if}}
{{#if disadvantage.value}}
<div class="dice">
<header class="part-header flexrow">
<span class="part-formula">
<span>1{{disadvantage.dice}}</span>
</span>
<span class="part-total">{{disadvantage.value}}</span>
</header>
<div class="flexrow">
<ol class="dice-rolls">
<li class="roll die {{disadvantage.dice}} hope min">{{disadvantage.value}}</li>
</ol>
</div>
</div>
{{/each}}
</div>
{{/if}}
<div class="flexrow">
<button class="roll-damage-button" 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>
{{/if}}
</section>
</div>
</div>
<div class="dice-total duality {{#if fear.discarded}}hope{{else}}{{#if hope.discarded}}fear{{else}}critical{{/if}}{{/if}}">
<div class="dice-total-label">{{totalLabel}}</div>
<div class="dice-total-value">
{{this.total}}
</div>
</div>
{{#if (gt targets.length 0)}}
<div class="target-section">
{{#each targets as |target|}}
<div class="dice-total target-container {{#if target.hit}}hit{{else}}{{#if (not ../total.alternate)}}miss{{/if}}{{/if}}" data-token="{{target.id}}">
<img src="{{target.img}}" />
<div class="target-inner-container">
{{#if target.hit}}{{localize "Hit"}}{{else}}{{#if (not ../total.alternate)}}{{localize "Miss"}}{{else}}?{{/if}}{{/if}}
</div>
</div>
{{/each}}
</div>
{{/if}}
<div class="flexrow">
<button class="roll-damage-button" 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>
</div>
{{/if}}
</div>
</div>
{{/if}}

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-title">
<div>{{this.title}}</div>
<div class="duality-result-value">{{this.total}}</div>
</div>
<div class="duality-modifiers">
{{#each this.modifiers}}
@ -62,7 +61,7 @@
</div>
{{#if (not this.damage.value)}}
<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>
{{/if}}
</div>
@ -75,7 +74,9 @@
</div>
</div>
{{/if}}
{{else}}
</div>
{{else}}
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
<div class="dice-flavor">{{this.title}}</div>
<div class="dice-result">
<div class="dice-formula">{{roll}}</div>
@ -138,5 +139,5 @@
</div>
</div>
</div>
{{/if}}
</div>
</div>
{{/if}}