Small Fixes (#540)

* Small Fixes

* Remove console.log & comments
This commit is contained in:
Dapoulp 2025-08-03 15:01:43 +02:00 committed by GitHub
parent b9b657e985
commit f7a29c0029
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 117 additions and 115 deletions

View file

@ -69,7 +69,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
} }
get hitTargets() { get hitTargets() {
return this.currentTargets.filter(t => (t.hit || !this.targetSelection)); return this.currentTargets.filter(t => (t.hit || !this.hasRoll || !this.targetSelection));
} }
async updateTargets() { async updateTargets() {
@ -120,6 +120,8 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
} }
if(this.hasSave) this.setPendingSaves(); if(this.hasSave) this.setPendingSaves();
} }
this.canViewSecret = this.parent.speakerActor?.testUserPermission(game.user, 'OBSERVER');
} }
getTargetList() { getTargetList() {

View file

@ -170,7 +170,8 @@ export default class D20Roll extends DHRoll {
.map(d => { .map(d => {
return { return {
dice: d.denomination, dice: d.denomination,
value: d.total value: d.total,
results: d.results
}; };
}); });
data.modifierTotal = this.calculateTotalModifiers(roll); data.modifierTotal = this.calculateTotalModifiers(roll);

View file

@ -597,7 +597,7 @@ export default class DhpActor extends Actor {
async modifyResource(resources) { async modifyResource(resources) {
if (!resources.length) return; if (!resources.length) return;
if (resources.find(r => r.type === 'stress')) this.convertStressDamageToHP(resources); if (resources.find(r => r.key === 'stress')) this.convertStressDamageToHP(resources);
let updates = { let updates = {
actor: { target: this, resources: {} }, actor: { target: this, resources: {} },
armor: { target: this.system.armor, resources: {} }, armor: { target: this.system.armor, resources: {} },
@ -664,14 +664,14 @@ export default class DhpActor extends Actor {
} }
convertStressDamageToHP(resources) { convertStressDamageToHP(resources) {
const stressDamage = resources.find(r => r.type === 'stress'), const stressDamage = resources.find(r => r.key === 'stress'),
newValue = this.system.resources.stress.value + stressDamage.value; newValue = this.system.resources.stress.value + stressDamage.value;
if (newValue <= this.system.resources.stress.max) return; if (newValue <= this.system.resources.stress.max) return;
const hpDamage = resources.find(r => r.type === 'hitPoints'); const hpDamage = resources.find(r => r.key === 'hitPoints');
if (hpDamage) hpDamage.value++; if (hpDamage) hpDamage.value++;
else else
resources.push({ resources.push({
type: 'hitPoints', key: 'hitPoints',
value: 1 value: 1
}); });
} }

View file

@ -11,7 +11,6 @@
mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%); mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%);
padding: 20px 0; padding: 20px 0;
padding-top: 10px; padding-top: 10px;
height: 95%;
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent; scrollbar-color: light-dark(@dark-blue, @golden) transparent;

View file

@ -14,6 +14,9 @@
.adversary-sidebar-sheet { .adversary-sidebar-sheet {
grid-row: 1 / span 2; grid-row: 1 / span 2;
grid-column: 1; grid-column: 1;
overflow: hidden;
display: flex;
flex-direction: column;
} }
.adversary-header-sheet { .adversary-header-sheet {
@ -24,6 +27,11 @@
.tab { .tab {
grid-row: 2; grid-row: 2;
grid-column: 2; grid-column: 2;
&.active {
overflow: hidden;
display: flex;
flex-direction: column;
}
} }
} }
} }

View file

@ -269,6 +269,19 @@
} }
} }
.shortcut-items-section {
overflow-y: hidden;
padding-top: 10px;
padding-bottom: 20px;
mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%);
&:hover {
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
}
.attack-section { .attack-section {
.title { .title {
display: flex; display: flex;

View file

@ -15,6 +15,8 @@
.character-sidebar-sheet { .character-sidebar-sheet {
grid-row: 1 / span 2; grid-row: 1 / span 2;
grid-column: 1; grid-column: 1;
display: flex;
flex-direction: column;
} }
.character-header-sheet { .character-header-sheet {

View file

@ -443,7 +443,6 @@
.shortcut-items-section { .shortcut-items-section {
overflow-y: hidden; overflow-y: hidden;
max-height: 56%;
padding-top: 10px; padding-top: 10px;
padding-bottom: 20px; padding-bottom: 20px;
mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%); mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%);

View file

@ -520,13 +520,16 @@
flex-wrap: wrap; flex-wrap: wrap;
.roll-die { .roll-die {
display: flex; display: grid;
flex-direction: column; grid-template-areas:
". a a"
"c b b";
gap: 3px; gap: 3px;
label { label {
text-align: center; text-align: center;
height: var(--font-size-12); height: var(--font-size-12);
grid-area: a;
} }
> div { > div {
@ -534,7 +537,17 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 5px; gap: 5px;
// font-size: var(--font-size-20); grid-area: b;
}
&.has-plus:before {
content: '+';
font-size: var(--font-size-20);
grid-area: c;
display: flex;
align-items: center;
justify-content: center;
width: 15px;
} }
} }
} }
@ -542,7 +555,6 @@
fieldset { fieldset {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
// gap: 10px;
border-color: var(--text-color); border-color: var(--text-color);
border-radius: 5px; border-radius: 5px;
@ -732,9 +744,6 @@
.dice-roll .dice-tooltip fieldset { .dice-roll .dice-tooltip fieldset {
margin-bottom: 5px; margin-bottom: 5px;
.roll-dice {
gap: 10px;
}
} }
} }
} }

View file

@ -71,49 +71,51 @@
</div> </div>
</div> </div>
</div> </div>
<div class="attack-section"> <div class="shortcut-items-section">
<div class="title"> <div class="attack-section">
<side-line-div class="invert"></side-line-div> <div class="title">
<h3>{{localize "DAGGERHEART.GENERAL.attack"}}</h3> <side-line-div class="invert"></side-line-div>
<side-line-div></side-line-div> <h3>{{localize "DAGGERHEART.GENERAL.attack"}}</h3>
<side-line-div></side-line-div>
</div>
<ul class="items-sidebar-list">
{{> 'daggerheart.inventory-item'
item=document.system.attack
type='action'
hideTags=true
hideDescription=true
hideTooltip=true
hideResources=true
noExtensible=true
noCompendiumEdit=true
}}
</ul>
</div> </div>
<ul class="items-sidebar-list"> <div class="experience-section">
{{> 'daggerheart.inventory-item' <div class="title">
item=document.system.attack <side-line-div class="invert"></side-line-div>
type='action' <h3>{{localize "DAGGERHEART.GENERAL.experience.plural"}}</h3>
hideTags=true <side-line-div></side-line-div>
hideDescription=true </div>
hideTooltip=true <div class="experience-list">
hideResources=true {{#each source.system.experiences as |experience id|}}
noExtensible=true <div class="experience-row" data-tooltip-text="{{experience.description}}">
noCompendiumEdit=true <div class="experience-value">
}} +{{experience.value}}
</ul> </div>
</div> <span class="experience-name">{{experience.name}}</span>
<div class="experience-section"> <div class="controls">
<div class="title"> <a data-action="sendExpToChat" data-id="{{id}}">
<side-line-div class="invert"></side-line-div> <i class="fa-regular fa-message"></i>
<h3>{{localize "DAGGERHEART.GENERAL.experience.plural"}}</h3> </a>
<side-line-div></side-line-div> </div>
</div>
<div class="experience-list">
{{#each source.system.experiences as |experience id|}}
<div class="experience-row" data-tooltip-text="{{experience.description}}">
<div class="experience-value">
+{{experience.value}}
</div> </div>
<span class="experience-name">{{experience.name}}</span> {{/each}}
<div class="controls"> </div>
<a data-action="sendExpToChat" data-id="{{id}}"> </div>
<i class="fa-regular fa-message"></i> <line-div></line-div>
</a> <div class="reaction-section">
</div> <button type="button" data-action="reactionRoll">{{localize "DAGGERHEART.GENERAL.Roll.reaction"}}</button>
</div>
{{/each}}
</div> </div>
</div>
<line-div></line-div>
<div class="reaction-section">
<button type="button" data-action="reactionRoll">{{localize "DAGGERHEART.GENERAL.Roll.reaction"}}</button>
</div> </div>
</aside> </aside>

View file

@ -28,29 +28,14 @@
{{#each dice}} {{#each dice}}
{{#each results}} {{#each results}}
{{#unless discarded}} {{#unless discarded}}
<div class="roll-die"> <div class="roll-die{{#unless @../first}} has-plus{{/unless}}">
<div class="dice {{../dice}}">{{result}}</div> <div class="dice {{../dice}}">{{result}}</div>
</div> </div>
{{#unless @last}}
<div class="roll-die">
<div class="font-20">+</div>
</div>
{{/unless}}
{{/unless}} {{/unless}}
{{/each}} {{/each}}
{{#unless @last}}
<div class="roll-die">
<div class="font-20">+</div>
</div>
{{/unless}}
{{/each}} {{/each}}
{{#if modifierTotal}} {{#if modifierTotal}}
{{#if (gt modifierTotal 0)}} <div class="roll-die{{#if (gt modifierTotal 0)}} has-plus{{/if}}">
<div class="roll-die">
<div class="font-20">+</div>
</div>
{{/if}}
<div class="roll-die">
<div class="font-20">{{modifierTotal}}</div> <div class="font-20">{{modifierTotal}}</div>
</div> </div>
{{/if}} {{/if}}

View file

@ -12,7 +12,15 @@
{{/if}} {{/if}}
</span> </span>
</div> </div>
{{#if roll.difficulty}}<span class="roll-difficulty{{#unless roll.success}} is-miss{{/unless}}">{{localize "DAGGERHEART.GENERAL.difficulty"}} {{roll.difficulty}}</span>{{/if}} {{#if roll.difficulty}}
<span class="roll-difficulty{{#unless roll.success}} is-miss{{/unless}}">
{{#if canViewSecret}}
difficulty {{roll.difficulty}}
{{else}}
{{localize (ifThen roll.success "DAGGERHEART.GENERAL.success" "DAGGERHEART.GENERAL.failure")}}
{{/if}}
</span>
{{/if}}
</div> </div>
<div class="dice-roll" data-action="expandRoll"> <div class="dice-roll" data-action="expandRoll">
<div class="roll-part-header"><div><span>{{localize "DAGGERHEART.GENERAL.formula"}}</span></div></div> <div class="roll-part-header"><div><span>{{localize "DAGGERHEART.GENERAL.formula"}}</span></div></div>
@ -28,11 +36,7 @@
{{roll.hope.value}} {{roll.hope.value}}
</div> </div>
</div> </div>
<div class="roll-die"> <div class="roll-die has-plus">
<label></label>
<div class="font-20">+</div>
</div>
<div class="roll-die">
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label> <label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
<div class="dice {{roll.fear.dice}} color-fear reroll-button" data-die-index="2" data-type="fear" style="--svg-folder: 'fear';" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}"> <div class="dice {{roll.fear.dice}} color-fear reroll-button" data-die-index="2" data-type="fear" style="--svg-folder: 'fear';" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}">
{{#if roll.fear.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.fear.rerolled.rerolls.length}}"></i>{{/if}} {{#if roll.fear.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.fear.rerolled.rerolls.length}}"></i>{{/if}}
@ -40,11 +44,7 @@
</div> </div>
</div> </div>
{{#if roll.advantage.type}} {{#if roll.advantage.type}}
<div class="roll-die"> <div class="roll-die has-plus">
<label></label>
<div class="font-20">+</div>
</div>
<div class="roll-die">
{{#if (eq roll.advantage.type 1)}} {{#if (eq roll.advantage.type 1)}}
<label>{{localize "DAGGERHEART.GENERAL.Advantage.short"}}</label> <label>{{localize "DAGGERHEART.GENERAL.Advantage.short"}}</label>
<div class="dice {{roll.advantage.dice}} color-adv">{{roll.advantage.value}}</div> <div class="dice {{roll.advantage.dice}} color-adv">{{roll.advantage.value}}</div>
@ -55,48 +55,30 @@
</div> </div>
{{/if}} {{/if}}
{{#if roll.rally.dice}} {{#if roll.rally.dice}}
<div class="roll-die"> <div class="roll-die has-plus">
<label></label>
<div class="font-20">+</div>
</div>
<div class="roll-die">
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label> <label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
<div class="dice {{roll.rally.dice}}">{{roll.rally.value}}</div> <div class="dice {{roll.rally.dice}}">{{roll.rally.value}}</div>
</div> </div>
{{/if}} {{/if}}
{{#each roll.extra}} {{#each roll.extra}}
<div class="roll-die"> {{#each results}}
<label></label> {{#unless discarded}}
<div class="font-20">+</div> <div class="roll-die has-plus">
</div> <label></label>
<div class="roll-die"> <div class="dice {{../dice}}">{{result}}</div>
<label></label> </div>
<div class="dice {{dice}}">{{value}}</div> {{/unless}}
</div> {{/each}}
{{#unless @last}}
<div class="roll-die">
<label></label>
<div class="font-20">+</div>
</div>
{{/unless}}
{{/each}} {{/each}}
{{else}} {{else}}
{{#each roll.dice}} {{#each roll.dice}}
{{#each results}} {{#each results}}
<div class="roll-die"> <div class="roll-die {{#unless (or @../first discarded)}} has-plus{{/unless}}">
<div class="dice {{../dice}}{{#if discarded}} discarded{{else}}{{#if (and (eq @index 0) ../../roll.advantage.type)}}{{#if (eq ../../roll.advantage.type 1)}} color-adv{{else}} color-dis{{/if}}{{/if}}{{#if success}} color-adv{{/if}}{{/if}}">{{result}}</div> <div class="dice {{../dice}}{{#if discarded}} discarded{{else}}{{#if (and @../first ../../roll.advantage.type)}}{{#if (eq ../../roll.advantage.type 1)}} color-adv{{else}} color-dis{{/if}}{{/if}}{{#if success}} color-adv{{/if}}{{/if}}">
</div> {{result}}
{{#unless (or @last (not discarded))}}
<div class="roll-die">
<div class="font-20">+</div>
</div> </div>
{{/unless}}
{{/each}}
{{#unless @last}}
<div class="roll-die">
<div class="font-20">+</div>
</div> </div>
{{/unless}} {{/each}}
{{/each}} {{/each}}
{{/if}} {{/if}}
</div> </div>