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", "multiclass": "Multiclass",
"newCategory": "New Category", "newCategory": "New Category",
"none": "None", "none": "None",
"noTarget": "No current target",
"partner": "Partner", "partner": "Partner",
"proficiency": "Proficiency", "proficiency": "Proficiency",
"quantity": "Quantity", "quantity": "Quantity",

View file

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

View file

@ -142,6 +142,7 @@ export default class D20Roll extends DHRoll {
static postEvaluate(roll, config = {}) { static postEvaluate(roll, config = {}) {
const data = super.postEvaluate(roll, config); const data = super.postEvaluate(roll, config);
data.type = config.roll?.type;
if (config.targets?.length) { if (config.targets?.length) {
config.targetSelection = true; config.targetSelection = true;
config.targets.forEach(target => { 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(); for (const roll of config.roll) await roll.roll.evaluate();
} }
roll._evaluated = true; roll._evaluated = true;
const parts = []; const parts = config.roll.map(r => this.postEvaluate(r));
for (let r of config.roll) {
const part = this.postEvaluate(r);
parts.push(part);
}
config.roll = this.unifyDamageRoll(parts); config.roll = this.unifyDamageRoll(parts);
} }

View file

@ -74,9 +74,7 @@ export default class DHRoll extends Roll {
} }
static postEvaluate(roll, config = {}) { static postEvaluate(roll, config = {}) {
console.log(roll, config)
return { return {
type: config.roll.type,
total: roll.total, total: roll.total,
formula: roll.formula, formula: roll.formula,
dice: roll.dice.map(d => ({ dice: roll.dice.map(d => ({

View file

@ -183,6 +183,10 @@
} }
} }
i {
text-align: center;
}
.roll-target { .roll-target {
display: flex; display: flex;
width: 100%; width: 100%;

View file

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

View file

@ -11,11 +11,13 @@
<div class="roll-part-content dice-result"> <div class="roll-part-content dice-result">
<div class="dice-tooltip"> <div class="dice-tooltip">
<div class="wrapper"> <div class="wrapper">
{{#if targets.length}}
<div class="target-selector"> <div class="target-selector">
<div class="roll-part-header"><div></div></div> <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="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 class="roll-part-header"><div></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}} {{#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}} {{#each currentTargets}}
<div class="roll-target" data-token="{{id}}"> <div class="roll-target" data-token="{{id}}">
@ -34,6 +36,8 @@
</div> </div>
{{#if ../roll.hasSave}}<i class="fa-solid fa-shield fa-lg"></i>{{/if}} {{#if ../roll.hasSave}}<i class="fa-solid fa-shield fa-lg"></i>{{/if}}
</div> </div>
{{else}}
<i>{{localize "DAGGERHEART.GENERAL.noTarget"}}</i>
{{/each}} {{/each}}
</div> </div>
</div> </div>

View file

@ -1,6 +1,6 @@
<div class="chat-roll">{{log this}} <div class="chat-roll">{{log this}}
{{#if hasRoll}}{{> 'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs'}}{{/if}} {{#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'}} {{> 'systems/daggerheart/templates/ui/chat/parts/target-part.hbs'}}
<div class="roll-part-header"><div></div></div> <div class="roll-part-header"><div></div></div>
</div> </div>