This commit is contained in:
Dapoolp 2025-07-31 15:24:35 +02:00
parent faa32c1fba
commit 56e11943b7
9 changed files with 72 additions and 79 deletions

View file

@ -1874,6 +1874,7 @@
"multiclass": "Multiclass",
"newCategory": "New Category",
"none": "None",
"noTarget": "No current target",
"partner": "Partner",
"proficiency": "Proficiency",
"quantity": "Quantity",

View file

@ -7,7 +7,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
this.roll = roll;
this.config = config;
this.config.experiences = [];
this.reactionOverride = config.roll.type === 'reaction';
this.reactionOverride = config.roll?.type === 'reaction';
if (config.source?.action) {
this.item = config.data.parent.items.get(config.source.item) ?? config.data.parent;
@ -149,16 +149,16 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
static toggleReaction() {
if (this.config.roll) {
this.reactionOverride = !this.reactionOverride;
this.config.roll.type = this.reactionOverride
? CONFIG.DH.ITEM.actionTypes.reaction.id
: this.config.roll.type === CONFIG.DH.ITEM.actionTypes.reaction.id
? null
: this.config.roll.type;
this.render();
}
}
static async submitRoll() {
this.config.roll.type = this.reactionOverride
? CONFIG.DH.ITEM.actionTypes.reaction.id
: this.config.roll.type === CONFIG.DH.ITEM.actionTypes.reaction.id
? null
: this.config.roll.type;
await this.close({ submitted: true });
}

View file

@ -142,6 +142,7 @@ export default class D20Roll extends DHRoll {
static postEvaluate(roll, config = {}) {
const data = super.postEvaluate(roll, config);
data.type = config.roll?.type;
if (config.targets?.length) {
config.targetSelection = true;
config.targets.forEach(target => {

View file

@ -16,11 +16,7 @@ export default class DamageRoll extends DHRoll {
for (const roll of config.roll) await roll.roll.evaluate();
}
roll._evaluated = true;
const parts = [];
for (let r of config.roll) {
const part = this.postEvaluate(r);
parts.push(part);
}
const parts = config.roll.map(r => this.postEvaluate(r));
config.roll = this.unifyDamageRoll(parts);
}

View file

@ -74,9 +74,7 @@ export default class DHRoll extends Roll {
}
static postEvaluate(roll, config = {}) {
console.log(roll, config)
return {
type: config.roll.type,
total: roll.total,
formula: roll.formula,
dice: roll.dice.map(d => ({
@ -188,7 +186,7 @@ export default class DHRoll extends Roll {
export const registerRollDiceHooks = () => {
Hooks.on(`${CONFIG.DH.id}.postRollDuality`, async (config, message) => {
const hopeFearAutomation = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).hopeFear;
const hopeFearAutomation = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).hopeFear;
if (
!config.source?.actor ||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||

View file

@ -182,6 +182,10 @@
}
}
}
i {
text-align: center;
}
.roll-target {
display: flex;

View file

@ -2,70 +2,59 @@
<div class="roll-part-header"><div><span>Damage</span></div></div>
<div class="roll-part-extra on-reduced">
<div class="wrapper">
<div class="roll-formula">Hit Points: 10</div>
<div class="roll-formula">Stress: 10</div>
{{#each damage.roll as | roll index | }}
<div class="roll-formula">{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')}}: {{total}}</div>
{{/each}}
</div>
</div>
<div class="roll-part-content dice-result">
<div class="dice-tooltip">
<div class="wrapper">
<fieldset>
<legend>
Hit Points <div class="roll-formula">Total: 10</div>
</legend>
<label class="roll-part-header"><span>Physical <div class="roll-formula">10</div></span></label>
<div class="roll-dice">
<div class="roll-die">
<div>4 <img class="dice-icon" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt=""></div>
</div>
<div class="roll-die">
<div>+</div>
</div>
<div class="roll-die">
<div>6</div>
</div>
</div>
<label class="roll-part-header"><span>Magical <div class="roll-formula">10</div></span></label>
<div class="roll-dice">
<div class="roll-die">
<div>4 <img class="dice-icon" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt=""></div>
</div>
<div class="roll-die">
<div>+</div>
</div>
<div class="roll-die">
<div>6</div>
</div>
</div>
<label class="roll-part-header"><span>Phy/Mag <div class="roll-formula">10</div></span></label>
<div class="roll-dice">
<div class="roll-die">
<div>4 <img class="dice-icon" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt=""></div>
</div>
<div class="roll-die">
<div>+</div>
</div>
<div class="roll-die">
<div>6</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>
Stress <div class="roll-formula">Total: 10</div>
</legend>
<div class="roll-dice">
<div class="roll-die">
<div>4 <img class="dice-icon" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt=""></div>
</div>
<div class="roll-die">
<div>+</div>
</div>
<div class="roll-die">
<div>6</div>
</div>
</div>
</fieldset>
{{#each damage.roll as | roll index | }}
<fieldset>
<legend>
{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')}} <div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>
</legend>
{{#each roll.parts}}
{{#if damageTypes.length}}
<label class="roll-part-header"><span>
{{#each damageTypes}}
{{localize (concat 'DAGGERHEART.CONFIG.ArmorFeature.' this '.name')}}
{{#unless @last}}/{{/unless}}
{{/each}}
<div class="roll-formula">{{total}}</div></span></label>
{{/if}}
<div class="roll-dice">
{{#each dice}}
<div class="roll-die">
{{!-- <div>{{total}} <img class="dice-icon" src="systems/daggerheart/assets/icons/dice/default/{{dice}}.svg" alt=""></div> --}}
<div>{{total}} <li class="roll die {{dice}} min"></li></div>
</div>
{{#unless @last}}
<div class="roll-die">
<div>+</div>
</div>
{{/unless}}
{{/each}}
{{#if modifierTotal}}
{{#if (gt modifierTotal 0)}}
<div class="roll-die">
<div>+</div>
</div>
{{/if}}
<div class="roll-die">
<div>{{modifierTotal}}</div>
</div>
{{/if}}
{{#unless dice.length}}
<div class="roll-die">
<div>{{total}}</div>
</div>
{{/unless}}
</div>
{{/each}}
</fieldset>
{{/each}}
</div>
</div>
</div>

View file

@ -11,11 +11,13 @@
<div class="roll-part-content dice-result">
<div class="dice-tooltip">
<div class="wrapper">
<div class="target-selector">
<div class="roll-part-header"><div></div></div>
<div class="target-choice"><div {{#if targetSelection}}class="target-selected"{{/if}} data-target-hit="true">{{localize "DAGGERHEART.UI.Chat.damageRoll.hitTarget"}}</div><div {{#unless targetSelection}}class="target-selected"{{/unless}}>{{localize "DAGGERHEART.UI.Chat.damageRoll.currentTarget"}}</div></div>
<div class="roll-part-header"><div></div></div>
</div>
{{#if targets.length}}
<div class="target-selector">
<div class="roll-part-header"><div></div></div>
<div class="target-choice"><div {{#if targetSelection}}class="target-selected"{{/if}} data-target-hit="true">{{localize "DAGGERHEART.UI.Chat.damageRoll.hitTarget"}}</div><div {{#unless targetSelection}}class="target-selected"{{/unless}}>{{localize "DAGGERHEART.UI.Chat.damageRoll.currentTarget"}}</div></div>
<div class="roll-part-header"><div></div></div>
</div>
{{/if}}
{{#if roll.hasSave}}<div class="roll-part-extra">Reaction Roll All Targets<i class="fa-solid fa-shield fa-lg"></i></div>{{/if}}
{{#each currentTargets}}
<div class="roll-target" data-token="{{id}}">
@ -34,6 +36,8 @@
</div>
{{#if ../roll.hasSave}}<i class="fa-solid fa-shield fa-lg"></i>{{/if}}
</div>
{{else}}
<i>{{localize "DAGGERHEART.GENERAL.noTarget"}}</i>
{{/each}}
</div>
</div>

View file

@ -1,6 +1,6 @@
<div class="chat-roll">{{log this}}
{{#if hasRoll}}{{> 'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs'}}{{/if}}
{{#if (or hasDamage hasHealing)}}{{> 'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs'}}{{/if}}
{{#if (and damage.roll (or hasDamage hasHealing))}}{{> 'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs'}}{{/if}}
{{> 'systems/daggerheart/templates/ui/chat/parts/target-part.hbs'}}
<div class="roll-part-header"><div></div></div>
</div>