More work on starship sizes as "classes"

getting there, this seems to be droppable, but doesn't show on sheet yet.
This commit is contained in:
supervj 2021-05-22 01:05:50 -04:00
parent b3344ba8b9
commit 0be98ab20c
7 changed files with 59 additions and 7 deletions

View file

@ -323,6 +323,29 @@ export default class Actor5e extends Actor {
// Proficiency
data.attributes.prof = Math.floor((Math.max(data.details.tier, 1) + 7) / 4);
// Determine Starship Tier and available Hull/Shield dice based on owned starship items
const size = actorData.items.filter(i => i.type === "starship");
if (size.length === 0) return;
const sizeData = size[0].data;
const tiers = parseInt(sizeData.tier) || 0;
data.details.tier = tiers;
data.traits.size = sizeData.size;
data.attributes.cargcap = (parseInt(sizeData.cargoCap) || 0);
data.attributes.crewcap = (parseInt(sizeData.minCrew) || 1);
data.attributes.fuel.cap = (parseInt(sizeData.fuelCap) || 5);
data.attributes.fuel.cost = sizeData.fuelCost;
data.attributes.hsm = sizeData.hardpointSizeMod;
data.attributes.hull.die = sizeData.hullDice;
data.attributes.hull.dicemax = sizeData.hullDiceStart + tiers;
data.attributes.hull.dice = sizeData.hullDiceStart + tiers - (parseInt(sizeData.hullDiceUsed) || 0);
// if hull.value .max = null then calculate them out
data.attributes.shld.die = sizeData.shldDice;
data.attributes.shld.dicemax = sizeData.shldDiceStart + tiers;
data.attributes.shld.dice = sizeData.shldDiceStart + tiers - (parseInt(sizeData.shldDiceUsed) || 0);
// if shld.value .max = null then calculate them out
data.attributes.mods.max = sizeData.modBaseCap;
data.attributes.pwrdice.die = SW5E.powerDieTypes[tiers];
// Link hull to hp and shields to temp hp
//data.attributes.hull.value = data.attributes.hp.value;
//data.attributes.hull.max = data.attributes.hp.max;

View file

@ -169,7 +169,7 @@ export default class ActorSheet5eStarship extends ActorSheet5e {
const refuel = this.actor.data.effect.changes[fuelcappos].value;
this.actor.update({"data.attributes.fuel.value": refuel});
}
}
function engineSliderUpdate(num) {
var symbol;
var coefficient;
@ -232,4 +232,3 @@ export default class ActorSheet5eStarship extends ActorSheet5e {
document.querySelector('#weaponslideroutput').value = slideroutput;
this.actor.update({"data.attributes.weaponpow": coefficient});
}
}

View file

@ -468,7 +468,6 @@ SW5E.healingTypes = {
"temphp": "SW5E.HealingTemp"
};
/* -------------------------------------------- */
@ -648,7 +647,7 @@ SW5E.starshipSkills = {
"dat": "SW5E.StarshipSkillDat",
"hid": "SW5E.StarshipSkillHid",
"imp": "SW5E.StarshipSkillImp",
"int": "SW5E.StarshipSkillInt",
"inf": "SW5E.StarshipSkillInf",
"man": "SW5E.StarshipSkillMan",
"men": "SW5E.StarshipSkillMen",
"pat": "SW5E.StarshipSkillPat",