From 00e8655ef9a5367c2d85e600d67dd7599772c55b Mon Sep 17 00:00:00 2001 From: danielyxie Date: Mon, 11 Feb 2019 00:21:14 -0800 Subject: [PATCH] Fixed bug with new Bladeburner skills. Added faction reputation increaser in Dev Menu --- src/Bladeburner.js | 10 +++- src/DevMenu.js | 21 ++++++++ src/PersonObjects/IPlayer.ts | 1 + .../Sleeve/SleeveCovenantPurchases.ts | 48 +++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/PersonObjects/Sleeve/SleeveCovenantPurchases.ts diff --git a/src/Bladeburner.js b/src/Bladeburner.js index 9f6544389..8376b13d2 100644 --- a/src/Bladeburner.js +++ b/src/Bladeburner.js @@ -2199,6 +2199,12 @@ Bladeburner.prototype.createSkillsContent = function() { case "stamina": DomElems.actionsAndSkillsDesc.innerHTML += "Stamina: x" + mult + "
"; break; + case "money": + DomElems.actionsAndSkillsDesc.innerHTML += "Contract Money: x" + mult + "
"; + break; + case "expGain": + DomElems.actionsAndSkillsDesc.innerHTML += "Exp Gain: x" + mult + "
"; + break; case "weaponAbility": //DomElems.actionsAndSkillsDesc.innerHTML += break; @@ -3852,11 +3858,11 @@ function initBladeburner() { name: SkillNames.HandsOfMidas, desc: "Each level of this skill increases the amount of money you receive from Contracts by 5%", baseCost: 2, costInc: 2.5, - money: 2, + money: 5, }); Skills[SkillNames.Hyperdrive] = new Skill({ name: SkillNames.Hyperdrive, - esc: "Each level of this skill increases the experience earned from Contracts, Operations, and BlackOps by 4%", + desc: "Each level of this skill increases the experience earned from Contracts, Operations, and BlackOps by 4%", baseCost: 1, costInc: 3, expGain: 4, }); diff --git a/src/DevMenu.js b/src/DevMenu.js index 0d0553782..148972533 100644 --- a/src/DevMenu.js +++ b/src/DevMenu.js @@ -229,6 +229,24 @@ export function createDevMenu() { innerText: "Receive Invite to Faction", }); + const factionsReputationInput = createElement("input", { + placeholder: "Rep to add to faction", + type: "number", + }); + + const factionsReputationButton = createElement("button", { + class: "std-button", + innerText: "Add rep to faction", + clickListener: () => { + const facName = getSelectText(factionsDropdown); + const fac = Factions[facName]; + const rep = parseFloat(factionsReputationInput.value); + if (fac != null && !isNaN(rep)) { + fac.playerReputation += rep; + } + }, + }); + // Augmentations const augmentationsHeader = createElement("h2", {innerText: "Augmentations"}); @@ -563,6 +581,9 @@ export function createDevMenu() { devMenuContainer.appendChild(factionsHeader); devMenuContainer.appendChild(factionsDropdown); devMenuContainer.appendChild(factionsAddButton); + devMenuContainer.appendChild(createElement("br")); + devMenuContainer.appendChild(factionsReputationInput); + devMenuContainer.appendChild(factionsReputationButton); devMenuContainer.appendChild(augmentationsHeader); devMenuContainer.appendChild(augmentationsDropdown); devMenuContainer.appendChild(augmentationsQueueButton); diff --git a/src/PersonObjects/IPlayer.ts b/src/PersonObjects/IPlayer.ts index 1be9ab5b0..80b842a28 100644 --- a/src/PersonObjects/IPlayer.ts +++ b/src/PersonObjects/IPlayer.ts @@ -24,6 +24,7 @@ export interface IPlayer { queuedAugmentations: IPlayerOwnedAugmentation[]; resleeves: Resleeve[]; sleeves: Sleeve[]; + sleevesFromCovenant: number; sourceFiles: IPlayerOwnedSourceFile[]; // Stats diff --git a/src/PersonObjects/Sleeve/SleeveCovenantPurchases.ts b/src/PersonObjects/Sleeve/SleeveCovenantPurchases.ts new file mode 100644 index 000000000..b05eb80bf --- /dev/null +++ b/src/PersonObjects/Sleeve/SleeveCovenantPurchases.ts @@ -0,0 +1,48 @@ +/** + * Implements the purchasing of extra Duplicate Sleeves from The Covenant + */ +import { Sleeve } from "./Sleeve"; +import { IPlayer } from "../IPlayer"; + +import { numeralWrapper } from "../../ui/numeralFormat"; + +import { dialogBoxCreate } from "../../../utils/DialogBox"; +import { yesNoBoxCreate, + yesNoBoxClose, + yesNoBoxGetYesButton, + yesNoBoxGetNoButton } from "../../../utils/YesNoBox"; + +export const MaxSleevesFromCovenant: number = 5; + +export function createPurchaseSleevesFromCovenantPopup(p: IPlayer) { + if (p.sleevesFromCovenant >= MaxSleevesFromCovenant) { return; } + + // First sleeve purchased costs the base amount. Then, the price of + // each successive one increases by the same amount + const baseCostPerExtraSleeve: number = 10e12; + const cost: number = (p.sleevesFromCovenant + 1) * baseCostPerExtraSleeve; + + const yesBtn = yesNoBoxGetYesButton(); + const noBtn = yesNoBoxGetNoButton(); + + yesBtn!.addEventListener("click", () => { + if (p.canAfford(cost)) { + p.loseMoney(cost); + p.sleevesFromCovenant += 1; + p.sleeves.push(new Sleeve()); + yesNoBoxClose(); + } else { + dialogBoxCreate("You cannot afford to purchase a Duplicate Sleeve", false); + } + }); + + noBtn!.addEventListener("click", () => { + yesNoBoxClose(); + }); + + const txt = `Would you like to purchase an additional Duplicate Sleeve from The Covenant for ` + + `${numeralWrapper.formatMoney(cost)}?

` + + `These Duplicate Sleeves are permanent. You can purchase a total of 5 Duplicate ` + + `Sleeves from The Covenant`; + yesNoBoxCreate(txt); +}