Minor fixes to new Sleeve API

This commit is contained in:
danielyxie 2019-03-19 16:38:49 -07:00
parent d75ff5d95b
commit dfd7aa2d2e
6 changed files with 33 additions and 8 deletions

@ -366,6 +366,7 @@ export function initBitNodeMultipliers(p: IPlayer) {
BitNodeMultipliers.PurchasedServerCost = 5; BitNodeMultipliers.PurchasedServerCost = 5;
BitNodeMultipliers.PurchasedServerLimit = 0.6; BitNodeMultipliers.PurchasedServerLimit = 0.6;
BitNodeMultipliers.PurchasedServerMaxRam = 0.5; BitNodeMultipliers.PurchasedServerMaxRam = 0.5;
BitNodeMultipliers.BladeburnerRank = 0.8;
break; break;
case 11: //The Big Crash case 11: //The Big Crash
BitNodeMultipliers.ServerMaxMoney = 0.1; BitNodeMultipliers.ServerMaxMoney = 0.1;

@ -303,7 +303,8 @@ export let CONSTANTS: IMap<any> = {
** Bug Fix: An industry's products are now properly separated between different cities ** Bug Fix: An industry's products are now properly separated between different cities
* Added a Netscript API for Duplicate Sleeves (by hydroflame) * Added a Netscript API for Duplicate Sleeves (by hydroflame)
* Modified BitNode-3's BN multipliers to make it slightly harder * Modified the multipliers of BitNode-3 and BitNode-8 to make them slightly harder
* After installing Augmentations, Duplicate Sleeves will now default to Synchronize if their Shock is 0
* Bug Fix: Bladeburner's Hyperbolic Regeneration Chamber should no longer instantly refill all stamina * Bug Fix: Bladeburner's Hyperbolic Regeneration Chamber should no longer instantly refill all stamina
* Bug Fix: The cost of purchasing Augmentations for Duplicate Sleeves no longer scales with how many Augs you've purchased for yourself * Bug Fix: The cost of purchasing Augmentations for Duplicate Sleeves no longer scales with how many Augs you've purchased for yourself
` `

@ -348,7 +348,7 @@ export class CorporationEventHandler {
clickListener:()=>{ clickListener:()=>{
mat.exp.splice(i, 1); //Remove export object mat.exp.splice(i, 1); //Remove export object
removeElementById(popupId); removeElementById(popupId);
createExportPopup(); createExportMaterialPopup(mat);
} }
})); }));
})(i, mat, currExports); })(i, mat, currExports);

@ -4910,6 +4910,16 @@ function NetscriptFunctions(workerScript) {
return false; return false;
} }
// Cannot work at the same company that another sleeve is working at
for (let i = 0; i < Player.sleeves.length; ++i) {
if (i === sleeveNumber) { continue; }
const other = Player.sleeves[i];
if (other.currentTask === SleeveTaskType.Company && other.currentTaskLocation === companyName) {
workerScript.log(`ERROR: sleeve.setToCompanyWork() failed for Sleeve ${sleeveNumber} because Sleeve ${i} is doing the same task`);
return false;
}
}
return Player.sleeves[sleeveNumber].workForCompany(Player, companyName); return Player.sleeves[sleeveNumber].workForCompany(Player, companyName);
}, },
setToFactionWork : function(sleeveNumber=0, factionName="", workType="") { setToFactionWork : function(sleeveNumber=0, factionName="", workType="") {
@ -4925,6 +4935,16 @@ function NetscriptFunctions(workerScript) {
return false; return false;
} }
// Cannot work at the same faction that another sleeve is working at
for (let i = 0; i < Player.sleeves.length; ++i) {
if (i === sleeveNumber) { continue; }
const other = Player.sleeves[i];
if (other.currentTask === SleeveTaskType.Faction && other.currentTaskLocation === factionName) {
workerScript.log(`ERROR: sleeve.setToFactionWork() failed for Sleeve ${sleeveNumber} because Sleeve ${i} is doing the same task`);
return false;
}
}
return Player.sleeves[sleeveNumber].workForFaction(Player, factionName, workType); return Player.sleeves[sleeveNumber].workForFaction(Player, factionName, workType);
}, },
setToGymWorkout : function(sleeveNumber=0, gymName="", stat="") { setToGymWorkout : function(sleeveNumber=0, gymName="", stat="") {

@ -614,7 +614,6 @@ export class Sleeve extends Person {
*/ */
travel(p: IPlayer, newCity: string): boolean { travel(p: IPlayer, newCity: string): boolean {
if (Cities[newCity] == null) { if (Cities[newCity] == null) {
console.error(`Invalid city ${newCity} passed into Sleeve.travel()`);
return false; return false;
} }
@ -641,8 +640,8 @@ export class Sleeve extends Person {
const company: Company | null = Companies[companyName]; const company: Company | null = Companies[companyName];
const companyPosition: CompanyPosition | null = CompanyPositions[p.jobs[companyName]]; const companyPosition: CompanyPosition | null = CompanyPositions[p.jobs[companyName]];
if (company == null) { throw new Error(`Invalid company name specified in Sleeve.workForCompany(): ${companyName}`); } if (company == null) { return false; }
if (companyPosition == null) { throw new Error(`Invalid CompanyPosition data in Sleeve.workForCompany(): ${companyName}`); } if (companyPosition == null) { return false; }
this.gainRatesForTask.money = companyPosition.baseSalary * this.gainRatesForTask.money = companyPosition.baseSalary *
company.salaryMultiplier * company.salaryMultiplier *
this.work_money_mult * this.work_money_mult *
@ -684,8 +683,8 @@ export class Sleeve extends Person {
* Returns boolean indicating success * Returns boolean indicating success
*/ */
workForFaction(p: IPlayer, factionName: string, workType: string): boolean { workForFaction(p: IPlayer, factionName: string, workType: string): boolean {
if (factionName === "") { return false; }
if (!(Factions[factionName] instanceof Faction) || !p.factions.includes(factionName)) { if (!(Factions[factionName] instanceof Faction) || !p.factions.includes(factionName)) {
throw new Error(`Invalid Faction specified for Sleeve.workForFaction(): ${factionName}`);
return false; return false;
} }

@ -283,9 +283,13 @@ PlayerObject.prototype.prestigeAugmentation = function() {
for (let i = 0; i < this.sleeves.length; ++i) { for (let i = 0; i < this.sleeves.length; ++i) {
if (this.sleeves[i] instanceof Sleeve) { if (this.sleeves[i] instanceof Sleeve) {
if (this.sleeves[i].shock >= 100) {
this.sleeves[i].synchronize(this);
} else {
this.sleeves[i].shockRecovery(this); this.sleeves[i].shockRecovery(this);
} }
} }
}
this.isWorking = false; this.isWorking = false;
this.currentWorkFactionName = ""; this.currentWorkFactionName = "";