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
});
}