v0.44.1 Minor Update - Added Augs to Duplicate Sleeves and updated documentation

This commit is contained in:
danielyxie
2019-03-02 19:08:54 -08:00
committed by danielyxie
parent 9879d07d7c
commit 18d8b2ecd4
213 changed files with 4024 additions and 3405 deletions
+1
View File
@@ -394,6 +394,7 @@ export class Sleeve extends Person {
this.agility_exp = 0;
this.charisma_exp = 0;
this.applyAugmentation(aug);
this.augmentations.push({ name: aug.name, level: 1 });
this.updateStatLevels();
}
@@ -8,6 +8,7 @@ import { IPlayer } from "../IPlayer";
import { Augmentation } from "../../Augmentation/Augmentation";
import { Augmentations } from "../../Augmentation/Augmentations";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { Faction } from "../../Faction/Faction";
import { Factions } from "../../Faction/Factions";
@@ -19,18 +20,25 @@ import { dialogBoxCreate } from "../../../utils/DialogBox";
import { createElement } from "../../../utils/uiHelpers/createElement";
import { createPopup } from "../../../utils/uiHelpers/createPopup";
import { createPopupCloseButton } from "../../../utils/uiHelpers/createPopupCloseButton";
import { removeElementById } from "../../../utils/uiHelpers/removeElementById";
export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer) {
// Array of all owned Augmentations. Names only
const ownedAugNames: string[] = sleeve.augmentations.map((e) => {return e.name});
// You can only purchase Augmentations that are actually available from
// your factions. I.e. you must be in a faction that has the Augmentation
// and you must also have enough rep in that faction in order to purchase it.
const availableAugs: Augmentation[] = [];
for (const facName of p.factions) {
if (facName === "Bladeburners") { continue; }
const fac: Faction | null = Factions[facName];
if (fac == null) { continue; }
for (const augName of fac.augmentations) {
if (augName === AugmentationNames.NeuroFluxGovernor) { continue; }
if (ownedAugNames.includes(augName)) { continue; }
const aug: Augmentation | null = Augmentations[augName];
if (fac.playerReputation > aug.baseRepRequirement && !availableAugs.includes(aug)) {
@@ -42,6 +50,36 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer) {
// Create popup
const popupId = "purchase-sleeve-augs-popup";
// Close popup button
const closeBtn = createPopupCloseButton(popupId, { innerText: "Cancel" });
// General info about owned Augmentations
const ownedAugsInfo = createElement("p", {
display: "block",
innerHTML: "Owned Augmentations:",
});
const popupElems: HTMLElement[] = [closeBtn, ownedAugsInfo];
// Show owned augmentations
// First we'll make a div with a reduced width, so the tooltips don't go off
// the edge of the popup
const ownedAugsDiv = createElement("div", { width: "70%" });
for (const ownedAug of ownedAugNames) {
const aug: Augmentation | null = Augmentations[ownedAug];
if (aug == null) {
console.warn(`Invalid Augmentation: ${ownedAug}`);
continue;
}
ownedAugsDiv.appendChild(createElement("div", {
class: "gang-owned-upgrade", // Reusing a class from the Gang UI
innerText: ownedAug,
tooltip: aug.info,
}))
}
popupElems.push(ownedAugsDiv);
// General info about buying Augmentations
const info = createElement("p", {
innerHTML:
@@ -55,10 +93,7 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer) {
].join(" "),
});
// Close popup
const closeBtn = createPopupCloseButton(popupId, { innerText: "Cancel" });
const popupElems: HTMLElement[] = [closeBtn, info];
popupElems.push(info);
for (const aug of availableAugs) {
const div = createElement("div", {
@@ -66,17 +101,21 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer) {
});
div.appendChild(createElement("p", {
fontSize: "12px",
innerHTML:
[
`<h2>${aug.name}</h2><br>`,
`Cost: ${numeralWrapper.formatMoney(aug.baseCost)}<br><br>`,
`${aug.info}`
].join(" "),
padding: "2px",
clickListener: () => {
if (p.canAfford(aug.baseCost)) {
p.loseMoney(aug.baseCost);
sleeve.installAugmentation(aug);
dialogBoxCreate(`Installed ${aug.name} on Duplicate Sleeve!`, false)
removeElementById(popupId);
createSleevePurchaseAugsPopup(sleeve, p);
} else {
dialogBoxCreate(`You cannot afford ${aug.name}`, false);
}
+1 -3
View File
@@ -11,8 +11,6 @@ import { IPlayer } from "../IPlayer";
import { CONSTANTS } from "../../Constants";
import { Locations } from "../../Locations";
import { Augmentations } from "../../Augmentation/Augmentations";
import { Faction } from "../../Faction/Faction";
import { Factions } from "../../Faction/Factions";
import { FactionWorkType } from "../../Faction/FactionWorkTypeEnum";
@@ -276,7 +274,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
elems.purchaseAugsButton = createElement("button", {
class: "std-button",
display: "block",
innerText: "Purchase Augmentations",
innerText: "Manage Augmentations",
clickListener: () => {
createSleevePurchaseAugsPopup(sleeve, playerRef!);
}
+15 -2
View File
@@ -1,7 +1,7 @@
export const SleeveFaq: string =
[
"<strong><u>How do sleeves work?</strong></u><br>",
"Sleeves are essentially clones. You can use them to perform any work type",
"<strong><u>How do Duplicate Sleeves work?</strong></u><br>",
"Duplicate Sleeves are essentially clones. You can use them to perform any work type",
"action, such as working for a company/faction or committing a crime.",
"Having sleeves perform these tasks earns you money, experience, and reputation.<br><br>",
"Sleeves are their own individuals, which means they each have their own",
@@ -31,6 +31,19 @@ export const SleeveFaq: string =
"To clarify further, if you have two sleeves they can work for two different",
"companies, but they cannot both work for the same company.<br><br>",
"<strong><u>Why did my Sleeve stop working?</u></strong><br>",
"Sleeves are subject to the same time restrictions as you. This means that",
"they automatically stop working at a company after 8 hours, and stop working",
"for a faction after 20 hours.<br><br>",
"<strong><u>How do I buy Augmentations for my Sleeves?</u></strong><br>",
"Your Sleeve needs to have a Shock of 0 in order for you to buy Augmentations",
"for it.<br><br>",
"<strong><u>Why can't I buy the X Augmentation for my sleeve?</u></strong><br>",
"Certain Augmentations, like Bladeburner-specific ones and NeuroFlux Governor,",
"are not available for sleeves.<br><br>",
"<strong><u>Do sleeves get reset when installing Augmentations or switching BitNodes?</u></strong><br>",
"Sleeves are reset when switching BitNodes, but not when installing Augmentations."
].join(" ");