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

View file

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

View file

@ -597,7 +597,7 @@ export default class DhpActor extends Actor {
async modifyResource(resources) {
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 = {
actor: { target: this, resources: {} },
armor: { target: this.system.armor, resources: {} },
@ -664,14 +664,14 @@ export default class DhpActor extends Actor {
}
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;
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++;
else
resources.push({
type: 'hitPoints',
key: 'hitPoints',
value: 1
});
}

View file

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

View file

@ -14,6 +14,9 @@
.adversary-sidebar-sheet {
grid-row: 1 / span 2;
grid-column: 1;
overflow: hidden;
display: flex;
flex-direction: column;
}
.adversary-header-sheet {
@ -24,6 +27,11 @@
.tab {
grid-row: 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 {
.title {
display: flex;

View file

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

View file

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

View file

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

View file

@ -71,49 +71,51 @@
</div>
</div>
</div>
<div class="attack-section">
<div class="title">
<side-line-div class="invert"></side-line-div>
<h3>{{localize "DAGGERHEART.GENERAL.attack"}}</h3>
<side-line-div></side-line-div>
<div class="shortcut-items-section">
<div class="attack-section">
<div class="title">
<side-line-div class="invert"></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>
<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 class="experience-section">
<div class="title">
<side-line-div class="invert"></side-line-div>
<h3>{{localize "DAGGERHEART.GENERAL.experience.plural"}}</h3>
<side-line-div></side-line-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 class="experience-section">
<div class="title">
<side-line-div class="invert"></side-line-div>
<h3>{{localize "DAGGERHEART.GENERAL.experience.plural"}}</h3>
<side-line-div></side-line-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>
<span class="experience-name">{{experience.name}}</span>
<div class="controls">
<a data-action="sendExpToChat" data-id="{{id}}">
<i class="fa-regular fa-message"></i>
</a>
</div>
</div>
<span class="experience-name">{{experience.name}}</span>
<div class="controls">
<a data-action="sendExpToChat" data-id="{{id}}">
<i class="fa-regular fa-message"></i>
</a>
</div>
</div>
{{/each}}
{{/each}}
</div>
</div>
<line-div></line-div>
<div class="reaction-section">
<button type="button" data-action="reactionRoll">{{localize "DAGGERHEART.GENERAL.Roll.reaction"}}</button>
</div>
</div>
<line-div></line-div>
<div class="reaction-section">
<button type="button" data-action="reactionRoll">{{localize "DAGGERHEART.GENERAL.Roll.reaction"}}</button>
</div>
</aside>

View file

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

View file

@ -12,7 +12,15 @@
{{/if}}
</span>
</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 class="dice-roll" data-action="expandRoll">
<div class="roll-part-header"><div><span>{{localize "DAGGERHEART.GENERAL.formula"}}</span></div></div>
@ -28,11 +36,7 @@
{{roll.hope.value}}
</div>
</div>
<div class="roll-die">
<label></label>
<div class="font-20">+</div>
</div>
<div class="roll-die">
<div class="roll-die has-plus">
<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")}}">
{{#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>
{{#if roll.advantage.type}}
<div class="roll-die">
<label></label>
<div class="font-20">+</div>
</div>
<div class="roll-die">
<div class="roll-die has-plus">
{{#if (eq roll.advantage.type 1)}}
<label>{{localize "DAGGERHEART.GENERAL.Advantage.short"}}</label>
<div class="dice {{roll.advantage.dice}} color-adv">{{roll.advantage.value}}</div>
@ -55,48 +55,30 @@
</div>
{{/if}}
{{#if roll.rally.dice}}
<div class="roll-die">
<label></label>
<div class="font-20">+</div>
</div>
<div class="roll-die">
<div class="roll-die has-plus">
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
<div class="dice {{roll.rally.dice}}">{{roll.rally.value}}</div>
</div>
{{/if}}
{{#each roll.extra}}
<div class="roll-die">
<label></label>
<div class="font-20">+</div>
</div>
<div class="roll-die">
<label></label>
<div class="dice {{dice}}">{{value}}</div>
</div>
{{#unless @last}}
<div class="roll-die">
<label></label>
<div class="font-20">+</div>
</div>
{{/unless}}
{{#each results}}
{{#unless discarded}}
<div class="roll-die has-plus">
<label></label>
<div class="dice {{../dice}}">{{result}}</div>
</div>
{{/unless}}
{{/each}}
{{/each}}
{{else}}
{{#each roll.dice}}
{{#each results}}
<div class="roll-die">
<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>
{{#unless (or @last (not discarded))}}
<div class="roll-die">
<div class="font-20">+</div>
<div class="roll-die {{#unless (or @../first discarded)}} has-plus{{/unless}}">
<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}}">
{{result}}
</div>
{{/unless}}
{{/each}}
{{#unless @last}}
<div class="roll-die">
<div class="font-20">+</div>
</div>
{{/unless}}
{{/each}}
{{/each}}
{{/if}}
</div>