mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
[Fix] companion hope levelup feature and default stress (#1839)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
* Fix issues with companions * Remove unused companion hope resource
This commit is contained in:
parent
53f77972e3
commit
047e77154a
6 changed files with 24 additions and 21 deletions
|
|
@ -80,6 +80,18 @@ class ResourcesField extends fields.TypedObjectField {
|
|||
value.isReversed = resources[key].reverse;
|
||||
value.max = typeof resource.max === 'number' ? (value.max ?? resource.max) : null;
|
||||
}
|
||||
Object.defineProperty(data, 'clamp', {
|
||||
value: function () {
|
||||
for (const key of Object.keys(this)) {
|
||||
const resource = this[key];
|
||||
if (typeof resource?.max === 'number') {
|
||||
resource.value = Math.clamp(resource.value, 0, resource.max);
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue