mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 10:13:52 +01:00
Formatted/linted (There are some errors, but they aren't mine afaik)
This commit is contained in:
parent
8b026f606b
commit
f8f3c099e0
@ -1577,7 +1577,8 @@ export class Bladeburner implements IBladeburner {
|
||||
this.stamina = Math.min(this.maxStamina, this.stamina + staminaGain);
|
||||
if (this.logging.general) {
|
||||
this.log(
|
||||
`${person.whoAmI()}: Rested in Hyperbolic Regeneration Chamber. Restored ${BladeburnerConstants.HrcHpGain
|
||||
`${person.whoAmI()}: Rested in Hyperbolic Regeneration Chamber. Restored ${
|
||||
BladeburnerConstants.HrcHpGain
|
||||
} HP and gained ${numeralWrapper.formatStamina(staminaGain)} stamina`,
|
||||
);
|
||||
}
|
||||
|
@ -136,20 +136,19 @@ export class Skill {
|
||||
calculateCost(currentLevel: number, count = 1): number {
|
||||
if (count == 1) {
|
||||
return Math.floor((this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost);
|
||||
}
|
||||
else if (count < 0 || isNaN(count)) {
|
||||
} else if (count < 0 || isNaN(count)) {
|
||||
throw new Error(`Attempted to find cost of ${count} BB upgrades`);
|
||||
}
|
||||
else if (count < 100) {
|
||||
const thisUpgrade = Math.floor((this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost);
|
||||
} else if (count < 100) {
|
||||
const thisUpgrade = Math.floor(
|
||||
(this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost,
|
||||
);
|
||||
return this.calculateCost(currentLevel + 1, count - 1) + thisUpgrade;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//unFloored is roughly equivalent to
|
||||
//(this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost
|
||||
//being repeated for increasing currentLevel
|
||||
const preMult = count * ((2 * this.baseCost) + this.costInc * (2 * currentLevel + count + 1)) / 2;
|
||||
const unFloored = (preMult * BitNodeMultipliers.BladeburnerSkillCost) - count / 2;
|
||||
const preMult = (count * (2 * this.baseCost + this.costInc * (2 * currentLevel + count + 1))) / 2;
|
||||
const unFloored = preMult * BitNodeMultipliers.BladeburnerSkillCost - count / 2;
|
||||
return Math.floor(unFloored);
|
||||
}
|
||||
}
|
||||
|
@ -300,8 +300,7 @@ export function NetscriptBladeburner(player: IPlayer, workerScript: WorkerScript
|
||||
try {
|
||||
if (bladeburner.upgradeSkillNetscriptFn(skillName, count, workerScript)) {
|
||||
return count;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} catch (e: any) {
|
||||
|
@ -257,7 +257,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
|
||||
function getMaterial(divisionName: string, cityName: string, materialName: string): Material {
|
||||
const warehouse = getWarehouse(divisionName, cityName);
|
||||
const matName = (materialName ).replace(/ /g, "");
|
||||
const matName = materialName.replace(/ /g, "");
|
||||
const material = warehouse.materials[matName];
|
||||
if (material === undefined) throw new Error(`Invalid material name: '${materialName}'`);
|
||||
return material;
|
||||
@ -725,9 +725,11 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
const employeeName = ctx.helper.string("employeeName", _employeeName);
|
||||
const job = ctx.helper.string("job", _job);
|
||||
const employee = getEmployee(divisionName, cityName, employeeName);
|
||||
return netscriptDelay(["Training", "Unassigned"].includes(employee.pos) ? 0 : 1000, workerScript).then(function () {
|
||||
return netscriptDelay(["Training", "Unassigned"].includes(employee.pos) ? 0 : 1000, workerScript).then(
|
||||
function () {
|
||||
return Promise.resolve(AssignJob(employee, job));
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
hireEmployee:
|
||||
(ctx: NetscriptContext) =>
|
||||
|
Loading…
Reference in New Issue
Block a user