mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-08 08:37:48 +02:00
Merge pull request #4041 from Mughur/sleeve
SLEEVE: FIX #4022, #4024, #4025, #3998
This commit is contained in:
@@ -485,7 +485,7 @@ export class Sleeve extends Person {
|
||||
|
||||
this.hp.current -= amt;
|
||||
if (this.hp.current <= 0) {
|
||||
this.shock = Math.min(1, this.shock - 0.5);
|
||||
this.shock = Math.max(0, this.shock - 0.5);
|
||||
this.hp.current = this.hp.max;
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -34,16 +34,35 @@ export class SleeveBladeburnerWork extends Work {
|
||||
process(player: IPlayer, sleeve: Sleeve, cycles: number): number {
|
||||
if (!player.bladeburner) throw new Error("sleeve doing blade work without being a member");
|
||||
this.cyclesWorked += cycles;
|
||||
const actionIdent = player.bladeburner.getActionIdFromTypeAndName(this.actionType, this.actionName);
|
||||
if (!actionIdent) throw new Error(`Error getting ${this.actionName} action`);
|
||||
if (this.actionType === "Contracts") {
|
||||
const action = player.bladeburner.getActionObject(actionIdent);
|
||||
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
||||
if (action.count <= 0) {
|
||||
sleeve.stopWork(player);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
while (this.cyclesWorked > this.cyclesNeeded(player, sleeve)) {
|
||||
const actionIdent = player.bladeburner.getActionIdFromTypeAndName(this.actionType, this.actionName);
|
||||
if (!actionIdent) throw new Error(`Error getting ${this.actionName} action`);
|
||||
player.bladeburner.completeAction(player, sleeve, actionIdent, false);
|
||||
if (this.actionType === "Contracts") {
|
||||
const action = player.bladeburner.getActionObject(actionIdent);
|
||||
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
||||
if (action.count <= 0) {
|
||||
sleeve.stopWork(player);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
const retValue = player.bladeburner.completeAction(player, sleeve, actionIdent, false);
|
||||
let exp: WorkStats | undefined;
|
||||
if (this.actionType === "General") {
|
||||
exp = GeneralActions[this.actionName]?.exp;
|
||||
if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`);
|
||||
applySleeveGains(player, sleeve, exp, 1);
|
||||
}
|
||||
player.gainMoney(retValue.money, "sleeves");
|
||||
player.gainStats(retValue);
|
||||
this.cyclesWorked -= this.cyclesNeeded(player, sleeve);
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -64,6 +64,7 @@ export class SleeveCrimeWork extends Work {
|
||||
APICopy(): Record<string, unknown> {
|
||||
return {
|
||||
type: this.type,
|
||||
crimeType: this.crimeType,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
getHackingWorkRepGain,
|
||||
} from "../../../PersonObjects/formulas/reputation";
|
||||
import { scaleWorkStats, WorkStats } from "../../../Work/WorkStats";
|
||||
import { BitNodeMultipliers } from "../../../BitNode/BitNodeMultipliers";
|
||||
|
||||
interface SleeveFactionWorkParams {
|
||||
factionWorkType: FactionWorkType;
|
||||
@@ -43,7 +44,11 @@ export class SleeveFactionWork extends Work {
|
||||
[FactionWorkType.FIELD]: getFactionFieldWorkRepGain,
|
||||
[FactionWorkType.SECURITY]: getFactionSecurityWorkRepGain,
|
||||
};
|
||||
return repFormulas[this.factionWorkType](sleeve, faction.favor) * sleeve.shockBonus();
|
||||
return (
|
||||
repFormulas[this.factionWorkType](sleeve, faction.favor) *
|
||||
sleeve.shockBonus() *
|
||||
BitNodeMultipliers.FactionWorkRepGain
|
||||
);
|
||||
}
|
||||
|
||||
getFaction(): Faction {
|
||||
|
||||
@@ -16,6 +16,7 @@ import { isSleeveClassWork } from "../Work/SleeveClassWork";
|
||||
import { isSleeveFactionWork } from "../Work/SleeveFactionWork";
|
||||
import { isSleeveCompanyWork } from "../Work/SleeveCompanyWork";
|
||||
import { isSleeveCrimeWork } from "../Work/SleeveCrimeWork";
|
||||
import { BitNodeMultipliers } from "../../../BitNode/BitNodeMultipliers";
|
||||
|
||||
interface IProps {
|
||||
sleeve: Sleeve;
|
||||
@@ -101,12 +102,12 @@ export function EarningsElement(props: IProps): React.ReactElement {
|
||||
const gains = props.sleeve.currentWork.getExp();
|
||||
data = [
|
||||
[`Money:`, <Money money={5 * gains.money} />],
|
||||
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * gains.hackExp)}`],
|
||||
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * gains.strExp)}`],
|
||||
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * gains.defExp)}`],
|
||||
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * gains.dexExp)}`],
|
||||
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * gains.agiExp)}`],
|
||||
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * gains.chaExp)}`],
|
||||
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * gains.hackExp * BitNodeMultipliers.CrimeExpGain)}`],
|
||||
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * gains.strExp * BitNodeMultipliers.CrimeExpGain)}`],
|
||||
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * gains.defExp * BitNodeMultipliers.CrimeExpGain)}`],
|
||||
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * gains.dexExp * BitNodeMultipliers.CrimeExpGain)}`],
|
||||
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * gains.agiExp * BitNodeMultipliers.CrimeExpGain)}`],
|
||||
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * gains.chaExp * BitNodeMultipliers.CrimeExpGain)}`],
|
||||
];
|
||||
}
|
||||
if (isSleeveClassWork(props.sleeve.currentWork)) {
|
||||
@@ -131,14 +132,14 @@ export function EarningsElement(props: IProps): React.ReactElement {
|
||||
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`],
|
||||
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`],
|
||||
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`],
|
||||
[`Reputation:`, <ReputationRate reputation={5 * repGain} />],
|
||||
[`Reputation:`, <ReputationRate reputation={repGain} />],
|
||||
];
|
||||
}
|
||||
|
||||
if (isSleeveCompanyWork(props.sleeve.currentWork)) {
|
||||
const rates = props.sleeve.currentWork.getGainRates(player, props.sleeve);
|
||||
data = [
|
||||
[`Money:`, <MoneyRate money={5 * rates.money} />],
|
||||
[`Money:`, <MoneyRate money={5 * rates.money * BitNodeMultipliers.CompanyWorkMoney} />],
|
||||
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`],
|
||||
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`],
|
||||
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`],
|
||||
|
||||
Reference in New Issue
Block a user