mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 07:23:37 +02:00
Refactor resources selection and data prep (#1721)
* Move resources select to scrolly text and accept actor object * Convert isReversed to prepared data and add label * Removed unused imports --------- Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
parent
a4a7b8e7ca
commit
cb0f63208e
9 changed files with 25 additions and 24 deletions
|
|
@ -15,7 +15,6 @@ export default class DhCreature extends BaseDataActor {
|
|||
resource.max,
|
||||
resource.initial,
|
||||
resource.label,
|
||||
resource.reverse,
|
||||
resource.maxLabel
|
||||
);
|
||||
} else {
|
||||
|
|
@ -54,6 +53,17 @@ export default class DhCreature extends BaseDataActor {
|
|||
return !vulnerableAppliedByOther;
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
const resources = CONFIG.DH.ACTOR[`${this.parent.type}Resources`];
|
||||
if (resources) {
|
||||
for (const [key, value] of Object.entries(this.resources)) {
|
||||
value.label = resources[key]?.label;
|
||||
value.isReversed = resources[key]?.reverse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async _preUpdate(changes, options, userId) {
|
||||
const allowed = await super._preUpdate(changes, options, userId);
|
||||
if (allowed === false) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue