Fixed chat /dr roll

This commit is contained in:
WBHarry 2025-06-12 23:22:23 +02:00
parent 3d034cd24e
commit 0f3da99f9d
2 changed files with 71 additions and 13 deletions

View file

@ -140,16 +140,16 @@ const renderDualityButton = async event => {
if (!target) return; if (!target) return;
const config = { const config = {
event: event, event: event,
title: button.dataset.label, title: button.dataset.label,
roll: { roll: {
modifier: attributeValue ? target.system.attributes[attributeValue].data.value : null, modifier: attributeValue ? target.system.attributes[attributeValue].data.value : null,
type: button.dataset.actionType ?? null, // Need check type: button.dataset.actionType ?? null // Need check
}, },
chatMessage: { chatMessage: {
template: 'systems/daggerheart/templates/chat/attack-roll.hbs' template: 'systems/daggerheart/templates/chat/attack-roll.hbs'
} }
}; };
await target.diceRoll(config); await target.diceRoll(config);
// Delete when new roll logic test done // Delete when new roll logic test done
@ -240,8 +240,7 @@ Hooks.on('chatMessage', (_, message) => {
const hopeAndFearRoll = `1${rollCommand.hope ?? 'd12'}+1${rollCommand.fear ?? 'd12'}`; const hopeAndFearRoll = `1${rollCommand.hope ?? 'd12'}+1${rollCommand.fear ?? 'd12'}`;
const advantageRoll = `${rollCommand.advantage && !rollCommand.disadvantage ? '+d6' : rollCommand.disadvantage && !rollCommand.advantage ? '-d6' : ''}`; const advantageRoll = `${rollCommand.advantage && !rollCommand.disadvantage ? '+d6' : rollCommand.disadvantage && !rollCommand.advantage ? '-d6' : ''}`;
const attributeRoll = `${attribute?.data?.value ? `${attribute.data.value > 0 ? `+${attribute.data.value}` : `${attribute.data.value}`}` : ''}`; const attributeRoll = `${attribute?.data?.value ? `${attribute.data.value > 0 ? `+${attribute.data.value}` : `${attribute.data.value}`}` : ''}`;
const roll = new Roll(`${hopeAndFearRoll}${advantageRoll}${attributeRoll}`); const roll = await Roll.create(`${hopeAndFearRoll}${advantageRoll}${attributeRoll}`).evaluate();
await roll.evaluate();
setDiceSoNiceForDualityRoll( setDiceSoNiceForDualityRoll(
roll, roll,
@ -264,7 +263,7 @@ Hooks.on('chatMessage', (_, message) => {
const systemData = new DHDualityRoll({ const systemData = new DHDualityRoll({
title: title, title: title,
origin: target?.id, origin: target?.id,
roll: roll._formula, roll: roll,
modifiers: attribute ? [attribute] : [], modifiers: attribute ? [attribute] : [],
hope: { dice: rollCommand.hope ?? 'd12', value: roll.dice[0].total }, hope: { dice: rollCommand.hope ?? 'd12', value: roll.dice[0].total },
fear: { dice: rollCommand.fear ?? 'd12', value: roll.dice[1].total }, fear: { dice: rollCommand.fear ?? 'd12', value: roll.dice[1].total },

View file

@ -2216,6 +2216,34 @@ div.daggerheart.views.multiclass {
.daggerheart.views.action .action-category .action-category-data.open { .daggerheart.views.action .action-category .action-category-data.open {
max-height: initial; max-height: initial;
} }
.daggerheart.views.action .action-category .action-category-data .multi-display {
display: flex;
gap: 1rem;
align-items: center;
}
.daggerheart.views.action .action-category .action-category-data .multi-display .form-group {
flex: 1;
}
.daggerheart.views.action .action-category .action-category-data .form-group {
display: flex;
align-items: center;
margin-bottom: 0.5rem;
}
.daggerheart.views.action .action-category .action-category-data .form-group label {
flex: 2;
}
.daggerheart.views.action .action-category .action-category-data .form-group .form-fields {
flex: 3;
}
.daggerheart.views.action .action-category .action-category-data .form-group img {
width: 1.5rem;
height: 1.5rem;
}
.daggerheart.views.action .action-category .action-category-data .data-form-array {
border: 1px solid var(--color-fieldset-border);
padding: 0.5rem;
margin-bottom: 0.5rem;
}
.daggerheart.views.ancestry-selection .ancestry-section { .daggerheart.views.ancestry-selection .ancestry-section {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -3705,3 +3733,34 @@ div.daggerheart.views.multiclass {
cursor: pointer; cursor: pointer;
filter: drop-shadow(0 0 3px red); filter: drop-shadow(0 0 3px red);
} }
.unlist {
list-style: none;
padding-inline-start: 0;
}
.list-select {
margin: 1rem;
}
.list-select li:not(:last-child) {
border-bottom: 1px solid #bbb;
}
.list-select li label {
padding: 4px 8px;
display: flex;
align-items: center;
gap: 1rem;
cursor: pointer;
}
.list-select li label > span {
flex: 1;
font-weight: bold;
font-size: var(--font-size-16);
}
dh-icon,
dh-icon > img {
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
font-size: x-large;
}