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

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