forked from GitHub-Mirrors/foundry-sw5e
Calculate Powers Known
added ability to calculate how many force/tech powers are known
This commit is contained in:
parent
aff4dda77f
commit
c82a4331a5
1 changed files with 22 additions and 4 deletions
|
@ -544,10 +544,28 @@ export default class Actor5e extends Actor {
|
|||
actorData.data.attributes.tech.level = techProgression.levels;
|
||||
}
|
||||
|
||||
/**
|
||||
* ? should I tally number of powers known here?
|
||||
*/
|
||||
|
||||
// Tally Powers Known
|
||||
const knownPowers = this.data.items.filter(i => i.type === "power");
|
||||
let knownForcePowers = 0;
|
||||
let knownTechPowers = 0;
|
||||
for ( let knownPower of knownPowers ) {
|
||||
const d = knownPower.data;
|
||||
switch (knownPower.data.school){
|
||||
case "lgt":
|
||||
case "uni":
|
||||
case "drk":{
|
||||
knownForcePowers++;
|
||||
break;
|
||||
}
|
||||
case "tec":{
|
||||
knownTechPowers++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
actorData.data.attributes.force.known.value = knownForcePowers;
|
||||
actorData.data.attributes.tech.known.value = knownTechPowers;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue