Merge branch 'Develop-VJ' into cyr-power-point-ui

This commit is contained in:
TJ 2021-02-11 16:01:45 -06:00
commit b56e652192
3 changed files with 35 additions and 15 deletions

View file

@ -526,12 +526,12 @@ export default class Item5e extends Item {
if ( canConsume === false ) return false;
}
// Consume Power Slots
// Consume Power Slots and Force/Tech Points
if ( consumePowerSlot ) {
const level = this.actor?.data.data.powers[consumePowerSlot];
const fp = this.actor.data.data.attributes.force.points;
const tp = this.actor.data.data.attributes.tech.points;
const powerCost = level + 1;
const powerCost = id.level + 1;
switch (id.school){
case "lgt":
case "uni":
@ -560,10 +560,10 @@ export default class Item5e extends Item {
}
actorUpdates[`data.powers.${consumePowerSlot}.tvalue`] = Math.max(powers - 1, 0);
if (tp.temp >= powerCost) {
actorUpdates["data.attributes.force.points.temp"] = tp.temp - powerCost;
actorUpdates["data.attributes.tech.points.temp"] = tp.temp - powerCost;
}else{
actorUpdates["data.attributes.force.points.value"] = tp.value + tp.temp - powerCost;
actorUpdates["data.attributes.force.points.temp"] = 0;
actorUpdates["data.attributes.tech.points.value"] = tp.value + tp.temp - powerCost;
actorUpdates["data.attributes.tech.points.temp"] = 0;
}
break;
}