diff --git a/src/Mods/SecExp/buildings/weaponsManufacturing.tw b/src/Mods/SecExp/buildings/weaponsManufacturing.tw index 6918ec4e16d60a0c362f3ec7b063c2f8f8f8fe70..d5814aa04453baf417bb1cab4952a172879a1f44 100644 --- a/src/Mods/SecExp/buildings/weaponsManufacturing.tw +++ b/src/Mods/SecExp/buildings/weaponsManufacturing.tw @@ -200,7 +200,7 @@ You own <<print num($menials)>> free menial slaves. This manufacturing complex c <<for _i = 0; _i < $SecExp.buildings.weapManu.upgrades.queue.length; _i++>> <<set _current = App.SecExp.weapManu.upgrade("current", $SecExp.buildings.weapManu.upgrades.queue[_i].ID)>> - <<if _i === 0>><br>Currently developing<<else>><br><<= ordinalSuffix(_i + 1)>> in queue<</if>>: + <br><<if _i === 0>>Currently developing<<else>><<= ordinalSuffix(_i + 1)>> in queue<</if>>: _current.dec for _current.unit. It will enhance their _current.purpose. Estimated completion time is <<= numberWithPluralOne($SecExp.buildings.weapManu.upgrades.queue[_i].time, "week")>> <</for>> diff --git a/src/Mods/SecExp/js/Unit.js b/src/Mods/SecExp/js/Unit.js index dcc0198149dd7d94e8e24418ea77dccb309eeae5..66f023ee2cedb35434f8ec3b3d8c867cee2b41d0 100644 --- a/src/Mods/SecExp/js/Unit.js +++ b/src/Mods/SecExp/js/Unit.js @@ -497,7 +497,7 @@ App.SecExp.unit = (function() { * helper function, not callable externally * @param {FC.SecExp.PlayerHumanUnitType} type * @param {string} [operation] action to perform - * @param {number} [value] amount to add/substract + * @param {number} [value] amount to add/subtract */ function unitFree(type, operation = 'print', value = 0) { switch(type) { diff --git a/src/Mods/SecExp/js/buildingsJS.js b/src/Mods/SecExp/js/buildingsJS.js index f40d623b70966ff3d7d7fd9e7ae71e7d1369ff54..d3bfe885dccd33567d5d784277126843161f23e8 100644 --- a/src/Mods/SecExp/js/buildingsJS.js +++ b/src/Mods/SecExp/js/buildingsJS.js @@ -333,90 +333,89 @@ App.SecExp.weapManu = (function() { */ function baseTime() { return 10; } - function upgrade(mode, upgradeID = null) { + function upgrade(mode, upgradeID) { if (mode === "current") { /** Checks the supplied ID value and assigns values. - * @param {number} the optional ID value to use instead of the current upgrades ID. + * @param {number} [upgradeID] passed ID * @returns {object} */ - const ID = jsDef(upgradeID) ? upgradeID : V.SecExp.buildings.weapManu.upgrades.queue[0].ID; - switch(ID) { + switch(upgradeID) { case -3: return { dec: "advanced synthetic alloys", type: "hp", purpose: "survivability", cost: 10000*V.HackingSkillMultiplier, - unit: "the security drones", ID: ID + unit: "the security drones" }; case -2: return { dec: "adaptive armored frames", type: "defense", purpose: "defensive capabilities", cost: 10000, - unit: "the security drones", ID: ID + unit: "the security drones" }; case -1: return { dec: "dynamic battle aware AI", type: "attack", purpose: "attack power", cost: 30000, - unit: "the security drones", ID: ID + unit: "the security drones" }; case 0: return { dec: "magnetic based ballistic weaponry", type: "attack", purpose: "attack power", cost: 30000, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 1: return { dec: "ceramo-metallic alloys", type: "defense", purpose: "defensive capabilities", cost: 30000, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 2: return { dec: "rapid action stimulants", type: "hp", purpose: "survivability", cost: 60000, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 3: return { dec: "fast response neural stimulant", type: "morale", purpose: "standing power", cost: 60000, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 4: return { dec: "universal cyber enhancements", type: "attack and defense", purpose: "offensive and defensive effectiveness.", cost: 120000*V.HackingSkillMultiplier, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 5: return { dec: "remote neural links", type: "hp and morale", purpose: "morale and survivability", cost: 120000*V.HackingSkillMultiplier, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 6: return { dec: "combined training regimens with the special force", type: "attack and defense", purpose: "offensive and defensive effectiveness.", cost: 0, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 7: return { dec: `a variant of the stimulant cocktail that the ${V.SF.Lower} created`, type: "hp and morale", purpose: "morale and survivability", cost: 300000, - unit: "our human troops", ID: ID + unit: "our human troops" }; case 8: return { dec: "a mesh network based off the custom network of the special force", type: "all", purpose: "offensive,defensive effectiveness in addition to morale and survivability", cost: 1000000*V.HackingSkillMultiplier, - unit: "our human troops", ID: ID + unit: "our human troops" }; } } else if (mode === "buy") { /** Prints a line that allows a user to purchase an upgrade. - * @param {number} [x] ID value to use. + * @param {number} [upgradeID] ID value to when generating. * @returns {Node} */ let el = document.createElement("div"); diff --git a/src/Mods/SecExp/js/securityReport.js b/src/Mods/SecExp/js/securityReport.js index bce45e3573f0fb7ec5d3eec59e1c28c8b29e0a22..7d3f5f63f3cf61b6252f8f51858bc3f7e5de896c 100644 --- a/src/Mods/SecExp/js/securityReport.js +++ b/src/Mods/SecExp/js/securityReport.js @@ -474,31 +474,35 @@ App.SecExp.securityReport = function() { if (App.SecExp.weapManu.upgrade("fully").all) { delete V.SecExp.buildings.weapManu.upgrades.queue; } - if (jsDef(V.SecExp.buildings.weapManu.upgrades.queue) && V.SecExp.buildings.weapManu.upgrades.queue.length > 0 && V.SecExp.buildings.weapManu.upgrades.queue[0].time > 0) { - let current = App.SecExp.weapManu.upgrade("current"); V.SecExp.buildings.weapManu.upgrades.queue[0].time--; - r.push(`<br>In the research lab, ${current.dec}`); - switch (current.dec) { - case "adaptive armored frames": - case "advanced synthetic alloys": - case "ceramo-metallic alloys": - case "rapid action stimulants": - case "universal cyber enhancements": - case "remote neural links": - case "combined training regimens with the special force": - r.push(`are`); break; - default: r.push(`is`); - } - r.push(`being developed with the aim of enhancing ${current.unit}' ${current.purpose}.`); - if (V.SecExp.buildings.weapManu.upgrades.queue[0].time <= 0) { - r.push(`Reports indicate it is ready for deployment and will be issued in the following days.`); - V.SecExp.buildings.weapManu.upgrades.completed.push(current.ID); - V.SecExp.buildings.weapManu.upgrades.queue.splice(0, 1); - } else { - r.push(`It will be finished in ${numberWithPluralOne(V.SecExp.buildings.weapManu.upgrades.queue[0].time, "week")}.`); - } - for (let i = 1; i < V.SecExp.buildings.weapManu.upgrades.queue.length; i++) { - current = App.SecExp.weapManuUpgrade.current(V.SecExp.buildings.weapManu.upgrades.queue[i].ID); - r.push(`<br>${ordinalSuffix(i + 1)} in queue: ${current.dec} for ${current.unit}. It will enhance their ${current.purpose}.`); + if (V.SecExp.buildings.weapManu.upgrades.queue) { + for (let item = 0; item < V.SecExp.buildings.weapManu.upgrades.queue.length; item++) { + const currentItem = V.SecExp.buildings.weapManu.upgrades.queue[item]; + Object.assign(currentItem, App.SecExp.weapManu.upgrade("current", currentItem.ID)); + if (item === 0) { + currentItem.time--; + r.push(`<br>In the research lab, ${currentItem.dec}`); + switch (currentItem.dec) { + case "adaptive armored frames": + case "advanced synthetic alloys": + case "ceramo-metallic alloys": + case "rapid action stimulants": + case "universal cyber enhancements": + case "remote neural links": + case "combined training regimens with the special force": + r.push(`are`); break; + default: r.push(`is`); + } + r.push(`being developed with the aim of enhancing ${currentItem.unit}' ${currentItem.purpose}.`); + if (currentItem.time <= 0) { + r.push(`Reports indicate it is ready for deployment and will be issued in the following days.`); + V.SecExp.buildings.weapManu.upgrades.completed.push(currentItem.ID); + V.SecExp.buildings.weapManu.upgrades.queue.splice(0, 1); + } else { + r.push(`It will be finished in ${numberWithPluralOne(currentItem.time, "week")}.`); + } + } else { + r.push(`<br>${ordinalSuffix(item + 1)} in queue: ${currentItem.dec} for ${currentItem.unit}. It will enhance their ${currentItem.purpose}.`); + } } } }