This commit is contained in:
Dapoolp 2025-06-13 21:36:56 +02:00
parent a040beab13
commit ca6dc047eb
8 changed files with 71 additions and 85 deletions

View file

@ -106,7 +106,7 @@ Hooks.once('init', () => {
Hooks.on('ready', () => { Hooks.on('ready', () => {
ui.resources = new CONFIG.ui.resources(); ui.resources = new CONFIG.ui.resources();
ui.resources.render({ force: true }); ui.resources.render({ force: true });
document.body.classList.toggle('theme-colorfull', game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme === DualityRollColor.colorful.value); document.body.classList.toggle('theme-colorful', game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme === DualityRollColor.colorful.value);
}); });
Hooks.once('dicesoniceready', () => {}); Hooks.once('dicesoniceready', () => {});

View file

@ -11,9 +11,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
const html = await super.renderHTML(); const html = await super.renderHTML();
if ( if (
this.type === 'dualityRoll' && this.type === 'dualityRoll'
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
DualityRollColor.colorful.value
) { ) {
html.classList.add('duality'); html.classList.add('duality');
const dualityResult = this.system.dualityResult; const dualityResult = this.system.dualityResult;

View file

@ -67,7 +67,7 @@ export default class DHAppearanceSettings extends HandlebarsApplicationMixin(App
await game.socket.emit('reload'); await game.socket.emit('reload');
foundry.utils.debouncedReload(); foundry.utils.debouncedReload();
} */ } */
document.body.classList.toggle('theme-colorfull', game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme === DualityRollColor.colorful.value); document.body.classList.toggle('theme-colorful', game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme === DualityRollColor.colorful.value);
this.close(); this.close();
} }

View file

@ -59,8 +59,7 @@ export default class DHDualityRoll extends foundry.abstract.TypeDataModel {
}), }),
{ nullable: true, initial: null } { nullable: true, initial: null }
) )
}), })
forceDisplay: new fields.BooleanField({initial: false})
}; };
} }
@ -69,6 +68,7 @@ export default class DHDualityRoll extends foundry.abstract.TypeDataModel {
} }
get modifierTotal() { get modifierTotal() {
// return {value: 12, label: "+12"}
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,
@ -97,7 +97,7 @@ export default class DHDualityRoll extends foundry.abstract.TypeDataModel {
get colorful() { get colorful() {
return ( return (
!this.forceDisplay && game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme === game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
DualityRollColor.colorful.value DualityRollColor.colorful.value
); );
} }

View file

@ -272,17 +272,9 @@ export default class DhpActor extends Actor {
system: systemData, system: systemData,
content: config.chatMessage.template, content: config.chatMessage.template,
rolls: [roll] rolls: [roll]
}),
msg2 = new cls({
type: config.chatMessage.type ?? 'dualityRoll',
sound: config.chatMessage.mute ? null : CONFIG.sounds.dice,
system: {...systemData, forceDisplay: true },
content: config.chatMessage.template,
rolls: [roll]
}); });
await cls.create(msg.toObject()); await cls.create(msg.toObject());
await cls.create(msg2.toObject());
} }
return roll; return roll;
} }

View file

@ -332,6 +332,7 @@
> .roll { > .roll {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
gap: 4px; gap: 4px;
margin-bottom: 4px; margin-bottom: 4px;
.dice-container { .dice-container {
@ -608,19 +609,11 @@
.dice-result { .dice-result {
.roll-damage-button, .roll-damage-button,
.damage-button { .damage-button,
.duality-action {
margin-top: 5px; margin-top: 5px;
} }
} }
.dice-actions {
margin-top: 5px;
display: flex;
button {
flex: 1;
}
}
} }
&.domain-card { &.domain-card {
@ -675,7 +668,7 @@
} }
} }
.theme-colorfull { .theme-colorful {
.chat-message.duality { .chat-message.duality {
border-color: black; border-color: black;
padding: 8px 0 0 0; padding: 8px 0 0 0;
@ -752,9 +745,9 @@
gap: .25rem; gap: .25rem;
.dice { .dice {
.dice-rolls { .dice-rolls {
margin-bottom: 0;
display: flex; display: flex;
gap: 0.25rem; gap: 0.25rem;
margin-bottom: 0;
li { li {
display: flex; display: flex;
align-items: center; align-items: center;
@ -782,6 +775,10 @@
} }
.dice-actions { .dice-actions {
justify-content: space-between; justify-content: space-between;
&.duality-alone {
justify-content: end;
margin-top: -20px;
}
.duality-action { .duality-action {
color: var(--color-light-1); color: var(--color-light-1);
text-shadow: 0 0 1px black; text-shadow: 0 0 1px black;
@ -795,20 +792,20 @@
margin-left: -8px; margin-left: -8px;
flex: unset; flex: unset;
} }
} .duality-result {
.duality-result { display: flex;
display: flex; flex-direction: column;
flex-direction: column; align-items: end;
align-items: end; justify-content: center;
justify-content: center; gap: 2px;
gap: 2px; color: var(--color-light-1);
color: var(--color-light-1); 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 4px 0 4px;
padding: 4px 4px 0 4px; border-radius: 6px 0 0 0;
border-radius: 6px 0 0 0; margin-right: -8px;
margin-right: -8px; }
} }
} }
} }

View file

@ -1490,6 +1490,7 @@
.daggerheart.chat.roll .dice-tooltip .dice-rolls > .roll { .daggerheart.chat.roll .dice-tooltip .dice-rolls > .roll {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
gap: 4px; gap: 4px;
margin-bottom: 4px; margin-bottom: 4px;
} }
@ -1630,16 +1631,10 @@
flex: 1; flex: 1;
} }
.daggerheart.chat.roll .dice-result .roll-damage-button, .daggerheart.chat.roll .dice-result .roll-damage-button,
.daggerheart.chat.roll .dice-result .damage-button { .daggerheart.chat.roll .dice-result .damage-button,
.daggerheart.chat.roll .dice-result .duality-action {
margin-top: 5px; margin-top: 5px;
} }
.daggerheart.chat.roll .dice-actions {
margin-top: 5px;
display: flex;
}
.daggerheart.chat.roll .dice-actions button {
flex: 1;
}
.daggerheart.chat.domain-card { .daggerheart.chat.domain-card {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -1682,47 +1677,47 @@
.daggerheart.chat.domain-card img { .daggerheart.chat.domain-card img {
width: 80px; width: 80px;
} }
.theme-colorfull .chat-message.duality { .theme-colorful .chat-message.duality {
border-color: black; border-color: black;
padding: 8px 0 0 0; padding: 8px 0 0 0;
} }
.theme-colorfull .chat-message.duality .message-header { .theme-colorful .chat-message.duality .message-header {
color: var(--color-light-3); color: var(--color-light-3);
padding: 0 8px; padding: 0 8px;
} }
.theme-colorfull .chat-message.duality.hope { .theme-colorful .chat-message.duality.hope {
background: linear-gradient(0, rgba(165, 42, 42, 0.6) 40px, rgba(0, 0, 0, 0.6)); background: linear-gradient(0, rgba(165, 42, 42, 0.6) 40px, rgba(0, 0, 0, 0.6));
} }
.theme-colorfull .chat-message.duality.fear { .theme-colorful .chat-message.duality.fear {
background: linear-gradient(0, rgba(0, 0, 255, 0.6), rgba(15, 15, 97, 0.6)); background: linear-gradient(0, rgba(0, 0, 255, 0.6), rgba(15, 15, 97, 0.6));
} }
.theme-colorfull .chat-message.duality.critical { .theme-colorful .chat-message.duality.critical {
background: linear-gradient(0, rgba(128, 0, 128, 0.6), rgba(37, 8, 37, 0.6)); background: linear-gradient(0, rgba(128, 0, 128, 0.6), rgba(37, 8, 37, 0.6));
} }
.theme-colorfull .chat-message.duality .chat-message header { .theme-colorful .chat-message.duality .chat-message header {
color: var(--color-light-3); color: var(--color-light-3);
} }
.theme-colorfull .chat-message.duality > * { .theme-colorful .chat-message.duality > * {
padding: 0 8px; padding: 0 8px;
} }
.theme-colorfull .chat-message.duality .message-content .duality-modifiers, .theme-colorful .chat-message.duality .message-content .duality-modifiers,
.theme-colorfull .chat-message.duality .message-content .duality-result, .theme-colorful .chat-message.duality .message-content .duality-result,
.theme-colorfull .chat-message.duality .message-content .dice-title { .theme-colorful .chat-message.duality .message-content .dice-title {
display: flex; display: flex;
} }
.theme-colorfull .chat-message.duality .message-content .duality-modifiers { .theme-colorful .chat-message.duality .message-content .duality-modifiers {
display: flex; display: flex;
gap: 2px; gap: 2px;
margin-bottom: 4px; margin-bottom: 4px;
} }
.theme-colorfull .chat-message.duality .message-content .duality-modifiers .duality-modifier { .theme-colorful .chat-message.duality .message-content .duality-modifiers .duality-modifier {
padding: 2px; padding: 2px;
border-radius: 6px; border-radius: 6px;
border: 1px solid; border: 1px solid;
background: var(--color-dark-6); background: var(--color-dark-6);
font-size: 12px; font-size: 12px;
} }
.theme-colorfull .chat-message.duality .message-content .dice-flavor { .theme-colorful .chat-message.duality .message-content .dice-flavor {
color: var(--color-light-1); color: var(--color-light-1);
text-shadow: 0 0 1px black; text-shadow: 0 0 1px black;
border-bottom: 1px solid; border-bottom: 1px solid;
@ -1733,37 +1728,37 @@
margin: 0 -8px 2px; margin: 0 -8px 2px;
font-weight: unset; font-weight: unset;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .duality-modifiers { .theme-colorful .chat-message.duality .message-content .dice-result .duality-modifiers {
display: flex; display: flex;
gap: 2px; gap: 2px;
margin-bottom: 4px; margin-bottom: 4px;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .duality-modifiers .duality-modifier { .theme-colorful .chat-message.duality .message-content .dice-result .duality-modifiers .duality-modifier {
padding: 2px; padding: 2px;
border-radius: 6px; border-radius: 6px;
border: 1px solid; border: 1px solid;
background: var(--color-dark-6); background: var(--color-dark-6);
font-size: 12px; font-size: 12px;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .dice-formula, .theme-colorful .chat-message.duality .message-content .dice-result .dice-formula,
.theme-colorfull .chat-message.duality .message-content .dice-result > .dice-total, .theme-colorful .chat-message.duality .message-content .dice-result > .dice-total,
.theme-colorfull .chat-message.duality .message-content .dice-result .part-header { .theme-colorful .chat-message.duality .message-content .dice-result .part-header {
display: none; display: none;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .dice-tooltip { .theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip {
grid-template-rows: 1fr; grid-template-rows: 1fr;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part { .theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part {
display: flex; display: flex;
align-items: end; align-items: end;
gap: 0.25rem; gap: 0.25rem;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls { .theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls {
margin-bottom: 0;
display: flex; display: flex;
gap: 0.25rem; gap: 0.25rem;
margin-bottom: 0;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls li { .theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls li {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -1772,21 +1767,25 @@
line-height: unset; line-height: unset;
font-weight: unset; font-weight: unset;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .target-section { .theme-colorful .chat-message.duality .message-content .dice-result .target-section {
margin: 4px 0; margin: 4px 0;
border: 2px solid; border: 2px solid;
margin-top: 5px; margin-top: 5px;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .target-section .dice-total { .theme-colorful .chat-message.duality .message-content .dice-result .target-section .dice-total {
box-shadow: unset; box-shadow: unset;
border: unset; border: unset;
border-radius: unset; border-radius: unset;
font-size: var(--font-size-18); font-size: var(--font-size-18);
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .dice-actions { .theme-colorful .chat-message.duality .message-content .dice-result .dice-actions {
justify-content: space-between; justify-content: space-between;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .dice-actions .duality-action { .theme-colorful .chat-message.duality .message-content .dice-result .dice-actions.duality-alone {
justify-content: end;
margin-top: -20px;
}
.theme-colorful .chat-message.duality .message-content .dice-result .dice-actions .duality-action {
color: var(--color-light-1); color: var(--color-light-1);
text-shadow: 0 0 1px black; text-shadow: 0 0 1px black;
font-weight: bold; font-weight: bold;
@ -1799,7 +1798,7 @@
margin-left: -8px; margin-left: -8px;
flex: unset; flex: unset;
} }
.theme-colorfull .chat-message.duality .message-content .dice-result .duality-result { .theme-colorful .chat-message.duality .message-content .dice-result .dice-actions .duality-result {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: end; align-items: end;

View file

@ -218,14 +218,14 @@
{{/each}} {{/each}}
</div> </div>
{{/if}} {{/if}}
{{#if damage.value}} <div class="dice-actions{{#unless damage.value}} duality-alone{{/unless}}">
<div class="dice-actions"> {{#if damage.value}}
<button class="duality-action" data-value="{{roll.total}}" data-damage="{{damage.value}}" data-damage-type="{{damage.type}}" {{#if damage.disabled}}disabled{{/if}}><span>{{localize "DAGGERHEART.Chat.AttackRoll.RollDamage"}}</span></button> <button class="duality-action" data-value="{{roll.total}}" data-damage="{{damage.value}}" data-damage-type="{{damage.type}}" {{#if damage.disabled}}disabled{{/if}}><span>{{localize "DAGGERHEART.Chat.AttackRoll.RollDamage"}}</span></button>
<div class="duality-result"> {{/if}}
<div>{{roll.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div> <div class="duality-result">
</div> <div>{{roll.total}} {{#if (eq dualityResult 1)}}With Hope{{else}}{{#if (eq dualityResult 2)}}With Fear{{else}}Critical Success{{/if}}{{/if}}</div>
</div> </div>
{{/if}} </div>
</div> </div>
</div> </div>
{{!-- {{/if}} --}} {{!-- {{/if}} --}}