mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Added level advancement selection data
This commit is contained in:
parent
d7ebeb3b2a
commit
b131f2831d
6 changed files with 41 additions and 28 deletions
|
|
@ -45,6 +45,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
|||
acc.total += tier.selections.total;
|
||||
for (var key in tier.selections.available) {
|
||||
const availableSelections = tier.selections.available[key];
|
||||
acc.totalAvailable += availableSelections;
|
||||
|
||||
if (acc.available[key]) acc.available[key] += availableSelections;
|
||||
else acc.available[key] = availableSelections;
|
||||
|
|
@ -52,7 +53,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
|||
|
||||
return acc;
|
||||
},
|
||||
{ total: 0, available: {} }
|
||||
{ total: 0, available: {}, totalAvailable: 0 }
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -128,16 +129,20 @@ class DhLevelupTier extends foundry.abstract.DataModel {
|
|||
const allSelections = Object.keys(this.levels).reduce(
|
||||
(acc, key) => {
|
||||
const { selections, available } = this.levels[key].nrSelections;
|
||||
|
||||
if (acc.available[key]) acc.available[key] += available;
|
||||
else acc.available[key] = available;
|
||||
|
||||
acc.totalAvailable += available;
|
||||
acc.total += selections;
|
||||
|
||||
return acc;
|
||||
},
|
||||
{ available: {}, total: 0 }
|
||||
{ available: {}, totalAvailable: 0, total: 0 }
|
||||
);
|
||||
return {
|
||||
available: allSelections.available,
|
||||
totalAvailable: allSelections.totalAvailable,
|
||||
total: allSelections.total
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue