From b3007aeecb28ca09b9ee5b3cb7467ed70594a21a Mon Sep 17 00:00:00 2001 From: supervj <64861570+supervj@users.noreply.github.com> Date: Sat, 22 May 2021 01:05:50 -0400 Subject: [PATCH] More work on starship sizes as "classes" getting there, this seems to be droppable, but doesn't show on sheet yet. --- lang/en.json | 16 ++++++----- module/actor/entity.js | 23 +++++++++++++++ module/actor/sheets/newSheet/starship.js | 3 +- module/config.js | 3 +- packs/packs/starships.db | 6 ++++ system.json | 36 ++++++++++++++++++++++++ template.json | 21 ++++++++++++-- 7 files changed, 95 insertions(+), 13 deletions(-) create mode 100644 packs/packs/starships.db diff --git a/lang/en.json b/lang/en.json index 8ca8fdec..10b13d7a 100644 --- a/lang/en.json +++ b/lang/en.json @@ -19,10 +19,11 @@ "ITEM.TypeLoot": "Loot", "ITEM.TypePower": "Power", "ITEM.TypeSpecies": "Species", - "ITEM.TypeStarshipfeature": "Starship Feature", - "ITEM.TypeStarshipfeaturePl": "Starship Features", - "ITEM.TypeStarshipmod": "Starship Modification", - "ITEM.TypeStarshipmodPl": "Starship Modifications", + "ITEM.TypeStarship": "Starship", + "ITEM.TypeStarshipfeature": "Starship Feature", + "ITEM.TypeStarshipfeaturePl": "Starship Features", + "ITEM.TypeStarshipmod": "Starship Modification", + "ITEM.TypeStarshipmodPl": "Starship Modifications", "ITEM.TypeTool": "Tool", "ITEM.TypeVenture": "Venture", "ITEM.TypeWeapon": "Weapon", @@ -621,8 +622,9 @@ "SW5E.ItemTypePowerPl": "Powers", "SW5E.ItemTypeSpecies": "Species", "SW5E.ItemTypeSpeciesPl": "Species", - "SW5E.ItemTypeStarshipMod": "Starship Modification", - "SW5E.ItemTypeStarshipModPl": "Starship Modifications", + "SW5E.ItemTypeStarship": "Starship", + "SW5E.ItemTypeStarshipMod": "Starship Modification", + "SW5E.ItemTypeStarshipModPl": "Starship Modifications", "SW5E.ItemTypeTool": "Tool", "SW5E.ItemTypeToolPl": "Tools", "SW5E.ItemTypeVenture": "Venture", @@ -1061,7 +1063,7 @@ "SW5E.StarshipSkillDat": "Data", "SW5E.StarshipSkillHid": "Hide", "SW5E.StarshipSkillImp": "Impress", - "SW5E.StarshipSkillInt": "Interfere", + "SW5E.StarshipSkillInf": "Interfere", "SW5E.StarshipSkillMan": "Maneuvering", "SW5E.StarshipSkillMen": "Menace", "SW5E.StarshipSkillPat": "Patch", diff --git a/module/actor/entity.js b/module/actor/entity.js index 85b2fd06..0e669c27 100644 --- a/module/actor/entity.js +++ b/module/actor/entity.js @@ -362,6 +362,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; diff --git a/module/actor/sheets/newSheet/starship.js b/module/actor/sheets/newSheet/starship.js index 8f26c3c7..b9218b36 100644 --- a/module/actor/sheets/newSheet/starship.js +++ b/module/actor/sheets/newSheet/starship.js @@ -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}); } -} diff --git a/module/config.js b/module/config.js index d0991cb5..c62ebb6a 100644 --- a/module/config.js +++ b/module/config.js @@ -642,7 +642,6 @@ SW5E.healingTypes = { "temphp": "SW5E.HealingTemp" }; - /* -------------------------------------------- */ @@ -822,7 +821,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", diff --git a/packs/packs/starships.db b/packs/packs/starships.db new file mode 100644 index 00000000..d4a2feda --- /dev/null +++ b/packs/packs/starships.db @@ -0,0 +1,6 @@ +{"name":"Small Starship","permission":{"default":0,"yXqD5rPwgjXHtqeZ":3},"type":"starship","data":{"description":{"value":""},"size":"Small","tier":0,"hullDice":"d6","hullDiceStart":3,"hullDiceRolled":[6],"hullDiceUsed":0,"shldDice":"d6","shldDiceStart":3,"shldDiceRolled":[6],"shldDiceUsed":0,"modMaxSuitesBase":1,"modBaseCap":20,"modSizeCostMult":1,"modMinWorkforce":2,"suiteCap":1,"equipCostMult":1,"equipMinWorkforce":1,"cargoCap":2,"fuelCost":50,"fuelCap":10,"foodCap":10,"baseTurnSpeed":250,"hardpointSizeMod":2,"minCrew":1,"pwrDice":"1","source":"SotG"},"flags":{},"img":"systems/sw5e/packs/Icons/Starship%20Features/Small.webp","effects":[],"_id":"6BN8l5E8QtYt103T"} +{"name":"Medium Starship","permission":{"default":0,"yXqD5rPwgjXHtqeZ":3},"type":"starship","data":{"description":{"value":""},"size":"Medium","tier":0,"hullDice":"d8","hullDiceStart":5,"hullDiceRolled":[8],"hullDiceUsed":0,"shldDice":"d8","shldDiceStart":5,"shldDiceRolled":[8],"shldDiceUsed":0,"modMaxSuitesBase":1,"modBaseCap":30,"modSizeCostMult":2,"modMinWorkforce":4,"suiteCap":4,"equipCostMult":2,"equipMinWorkforce":2,"cargoCap":25,"fuelCost":100,"fuelCap":30,"foodCap":120,"baseTurnSpeed":200,"hardpointSizeMod":3,"minCrew":1,"pwrDice":"1","source":"SotG"},"flags":{},"img":"systems/sw5e/packs/Icons/Starship%20Features/Medium.webp","effects":[],"_id":"6liD1m4hqKSeS5sp"} +{"_id":"FH8iBT4uujRUR0j7","name":"Gargantuan Starship","permission":{"default":0,"yXqD5rPwgjXHtqeZ":3},"type":"starship","data":{"description":{"value":null},"size":"Gargantuan","tier":0,"hullDice":"d20","hullDiceStart":11,"hullDiceRolled":[20],"hullDiceUsed":0,"shldDice":"d20","shldDiceStart":11,"shldDiceRolled":[20],"shldDiceUsed":0,"modMaxSuitesBase":4,"modBaseCap":70,"modSizeCostMult":500,"modMinWorkforce":1000,"suiteCap":40000,"equipCostMult":500,"equipMinWorkforce":500,"cargoCap":200000,"fuelCost":100000,"fuelCap":1800,"foodCap":576000000,"baseTurnSpeed":50,"hardpointSizeMod":3,"minCrew":80000,"pwrDice":"1","source":"SotG"},"flags":{},"img":"systems/sw5e/packs/Icons/Starship%20Features/Gargantuan.webp","effects":[]} +{"name":"Large Starship","permission":{"default":0,"yXqD5rPwgjXHtqeZ":3},"type":"starship","data":{"description":{"value":""},"size":"Large","tier":0,"hullDice":"d10","hullDiceStart":7,"hullDiceRolled":[10],"hullDiceUsed":0,"shldDice":"d10","shldDiceStart":7,"shldDiceRolled":[10],"shldDiceUsed":0,"modMaxSuitesBase":2,"modBaseCap":50,"modSizeCostMult":5,"modMinWorkforce":10,"suiteCap":400,"equipCostMult":5,"equipMinWorkforce":5,"cargoCap":500,"fuelCost":1000,"fuelCap":300,"foodCap":240000,"baseTurnSpeed":150,"hardpointSizeMod":4,"minCrew":200,"pwrDice":"1","source":"SotG"},"flags":{},"img":"systems/sw5e/packs/Icons/Starship%20Features/Large.webp","effects":[],"_id":"RFKvLuqE13INBxqd"} +{"name":"Huge Starship","permission":{"default":0,"yXqD5rPwgjXHtqeZ":3},"type":"starship","data":{"description":{"value":null},"size":"Huge","tier":0,"hullDice":"d12","hullDiceStart":9,"hullDiceRolled":[12],"hullDiceUsed":0,"shldDice":"d12","shldDiceStart":9,"shldDiceRolled":[12],"shldDiceUsed":0,"modMaxSuitesBase":3,"modBaseCap":60,"modSizeCostMult":50,"modMinWorkforce":100,"suiteCap":4000,"equipCostMult":50,"equipMinWorkforce":50,"cargoCap":10000,"fuelCost":10000,"fuelCap":600,"foodCap":9600000,"baseTurnSpeed":100,"hardpointSizeMod":2,"minCrew":4000,"pwrDice":"1","source":"SotG"},"flags":{},"img":"systems/sw5e/packs/Icons/Starship%20Features/Huge.webp","effects":[],"_id":"pgmf0rMYLt4LQtfN"} +{"name":"Tiny Starship","permission":{"default":0,"yXqD5rPwgjXHtqeZ":3},"type":"starship","data":{"description":{"value":""},"size":"Tiny","tier":0,"hullDice":"d4","hullDiceStart":1,"hullDiceRolled":[4],"hullDiceUsed":0,"shldDice":"d4","shldDiceStart":1,"shldDiceRolled":[4],"shldDiceUsed":0,"modMaxSuitesBase":0,"modBaseCap":10,"modSizeCostMult":0.5,"modMinWorkforce":1,"suiteCap":0,"equipCostMult":0.5,"equipMinWorkforce":1,"cargoCap":0,"fuelCost":25,"fuelCap":5,"foodCap":0,"baseTurnSpeed":300,"hardpointSizeMod":1,"minCrew":0,"pwrDice":"1","source":"SotG"},"flags":{},"img":"systems/sw5e/packs/Icons/Starship%20Features/Tiny.webp","effects":[],"_id":"zC4qM8JMmMzCjMJK"} diff --git a/system.json b/system.json index 3a0a82ca..ca98cd25 100644 --- a/system.json +++ b/system.json @@ -109,6 +109,42 @@ "label": "Species Traits", "path": "./packs/packs/speciestraits.db", "entity": "Item" + }, + { + "name": "starshiparmor", + "label": "Starship Armor", + "path": "./packs/packs/starshiparmor.db", + "entity": "Item" + }, + { + "name": "starshipequipment", + "label": "Starship Equipment", + "path": "./packs/packs/starshipequipment.db", + "entity": "Item" + }, + { + "name": "starshipfeatures", + "label": "Starship Features", + "path": "./packs/packs/starshipfeatures.db", + "entity": "Item" + }, + { + "name": "starshipmodifications", + "label": "Starship Modifications", + "path": "./packs/packs/starshipmodifications.db", + "entity": "Item" + }, + { + "name": "starships", + "label": "Starship Types", + "path": "./packs/packs/starships.db", + "entity": "Item" + }, + { + "name": "starshipweapons", + "label": "Starship Weapons", + "path": "./packs/packs/starshipweapons.db", + "entity": "Item" }, { "name": "tables", diff --git a/template.json b/template.json index d8b2fccf..b12af658 100644 --- a/template.json +++ b/template.json @@ -1045,11 +1045,28 @@ "size": "", "tier": 0, "hullDice": "d6", - "hullDiceStart": 1, + "hullDiceStart": 3, + "hullDiceRolled":[6], "hullDiceUsed": 0, "shldDice": "d6", - "shldDiceStart": 1, + "shldDiceStart": 3, + "shldDiceRolled":[6], "shldDiceUsed": 0, + "modMaxSuitesBase": 0, + "modMaxSuitesMult": 1, + "modBaseCap": 20, + "modSizeCostMult": 1, + "modMinWorkforce": 2, + "suiteCap": 1, + "equipCostMult": 1, + "equipMinWorkforce": 1, + "cargoCap": 2, + "fuelCost": 50, + "fuelCap": 10, + "foodCap": 10, + "baseTurnSpeed": 250, + "hardpointSizeMod": 2, + "minCrew": 1, "pwrDice": "1", "source": "SotG" },