Integrate changes from the Prof

Received as-is changes from the Prof.
This commit is contained in:
supervj 2021-05-21 14:58:11 -04:00
parent cacc43740e
commit b3344ba8b9
19 changed files with 490 additions and 30 deletions

View file

@ -77,7 +77,11 @@ export default class Actor5e extends Actor {
// Inventory encumbrance
data.attributes.encumbrance = this._computeEncumbrance(actorData);
if (actorData.type === "starship") {
data.attributes.fuel = this._computeFuel(actorData);
}
// Prepare skills
this._prepareSkills(actorData, bonuses, checkBonus, originalSkills);
@ -647,8 +651,17 @@ export default class Actor5e extends Actor {
const pct = Math.clamped((weight * 100) / max, 0, 100);
return { value: weight.toNearest(0.1), max, pct, encumbered: pct > (2/3) };
}
/* -------------------------------------------- */
_computeFuel(actorData) {
let fuel = actorData.data.attributes.fuel.value;
// Compute Fuel percentage
fuel = fuel.toNearest(0.1);
const max = actorData.data.attributes.fuel.cap;
const pct = Math.clamped((fuel * 100) / max, 0, 100);
return { value: fuel.toNearest(0.1), max, pct, fueled: pct > 0 };
}
/* -------------------------------------------- */
/* Socket Listeners and Handlers
/* -------------------------------------------- */