mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 21:25:47 +01:00
Merge pull request #4229 from borisflagell/wxsQDSSQF
SLEEVE: Fix #4194 Bladeburner Contract in Sleeve were not giving proper reward.
This commit is contained in:
commit
14914eb190
@ -13,7 +13,6 @@ import { Skill } from "./Skill";
|
||||
import { City } from "./City";
|
||||
import { Action } from "./Action";
|
||||
import { Player } from "@player";
|
||||
import { createTaskTracker, ITaskTracker } from "../PersonObjects/ITaskTracker";
|
||||
import { Person } from "../PersonObjects/Person";
|
||||
import { Router } from "../ui/GameRoot";
|
||||
import { ConsoleHelpText } from "./data/Help";
|
||||
@ -35,6 +34,7 @@ import { FactionNames } from "../Faction/data/FactionNames";
|
||||
import { KEY } from "../utils/helpers/keyCodes";
|
||||
import { isSleeveInfiltrateWork } from "../PersonObjects/Sleeve/Work/SleeveInfiltrateWork";
|
||||
import { isSleeveSupportWork } from "../PersonObjects/Sleeve/Work/SleeveSupportWork";
|
||||
import { WorkStats, newWorkStats } from "../Work/WorkStats";
|
||||
|
||||
export interface BlackOpsAttempt {
|
||||
error?: string;
|
||||
@ -983,7 +983,7 @@ export class Bladeburner {
|
||||
* @param action(Action obj) - Derived action class
|
||||
* @param success(bool) - Whether action was successful
|
||||
*/
|
||||
getActionStats(action: Action, person: Person, success: boolean): ITaskTracker {
|
||||
getActionStats(action: Action, person: Person, success: boolean): WorkStats {
|
||||
const difficulty = action.getDifficulty();
|
||||
|
||||
/**
|
||||
@ -1002,14 +1002,15 @@ export class Bladeburner {
|
||||
const skillMult = this.skillMultipliers.expGain;
|
||||
|
||||
return {
|
||||
hack: unweightedGain * action.weights.hack * skillMult,
|
||||
str: unweightedGain * action.weights.str * skillMult,
|
||||
def: unweightedGain * action.weights.def * skillMult,
|
||||
dex: unweightedGain * action.weights.dex * skillMult,
|
||||
agi: unweightedGain * action.weights.agi * skillMult,
|
||||
cha: unweightedGain * action.weights.cha * skillMult,
|
||||
int: unweightedIntGain * action.weights.int * skillMult,
|
||||
hackExp: unweightedGain * action.weights.hack * skillMult,
|
||||
strExp: unweightedGain * action.weights.str * skillMult,
|
||||
defExp: unweightedGain * action.weights.def * skillMult,
|
||||
dexExp: unweightedGain * action.weights.dex * skillMult,
|
||||
agiExp: unweightedGain * action.weights.agi * skillMult,
|
||||
chaExp: unweightedGain * action.weights.cha * skillMult,
|
||||
intExp: unweightedIntGain * action.weights.int * skillMult,
|
||||
money: 0,
|
||||
reputation: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@ -1245,8 +1246,8 @@ export class Bladeburner {
|
||||
}
|
||||
}
|
||||
|
||||
completeAction(person: Person, actionIdent: ActionIdentifier, isPlayer = true): ITaskTracker {
|
||||
let retValue = createTaskTracker();
|
||||
completeAction(person: Person, actionIdent: ActionIdentifier, isPlayer = true): WorkStats {
|
||||
let retValue = newWorkStats();
|
||||
switch (actionIdent.type) {
|
||||
case ActionTypes["Contract"]:
|
||||
case ActionTypes["Operation"]: {
|
||||
@ -1446,10 +1447,10 @@ export class Bladeburner {
|
||||
dexExpGain = 30 * person.mults.dexterity_exp,
|
||||
agiExpGain = 30 * person.mults.agility_exp,
|
||||
staminaGain = 0.04 * this.skillMultipliers.stamina;
|
||||
retValue.str = strExpGain;
|
||||
retValue.def = defExpGain;
|
||||
retValue.dex = dexExpGain;
|
||||
retValue.agi = agiExpGain;
|
||||
retValue.strExp = strExpGain;
|
||||
retValue.defExp = defExpGain;
|
||||
retValue.dexExp = dexExpGain;
|
||||
retValue.agiExp = agiExpGain;
|
||||
this.staminaBonus += staminaGain;
|
||||
if (this.logging.general) {
|
||||
this.log(
|
||||
@ -1483,9 +1484,9 @@ export class Bladeburner {
|
||||
const hackingExpGain = 20 * person.mults.hacking_exp;
|
||||
const charismaExpGain = 20 * person.mults.charisma_exp;
|
||||
const rankGain = 0.1 * BitNodeMultipliers.BladeburnerRank;
|
||||
retValue.hack = hackingExpGain;
|
||||
retValue.cha = charismaExpGain;
|
||||
retValue.int = BladeburnerConstants.BaseIntGain;
|
||||
retValue.hackExp = hackingExpGain;
|
||||
retValue.chaExp = charismaExpGain;
|
||||
retValue.intExp = BladeburnerConstants.BaseIntGain;
|
||||
this.changeRank(person, rankGain);
|
||||
this.getCurrentCity().improvePopulationEstimateByPercentage(eff * this.skillMultipliers.successChanceEstimate);
|
||||
if (this.logging.general) {
|
||||
@ -1503,7 +1504,7 @@ export class Bladeburner {
|
||||
const recruitTime = this.getRecruitmentTime(person) * 1000;
|
||||
if (Math.random() < successChance) {
|
||||
const expGain = 2 * BladeburnerConstants.BaseStatGain * recruitTime;
|
||||
retValue.cha = expGain;
|
||||
retValue.chaExp = expGain;
|
||||
++this.teamSize;
|
||||
if (this.logging.general) {
|
||||
this.log(
|
||||
@ -1515,7 +1516,7 @@ export class Bladeburner {
|
||||
}
|
||||
} else {
|
||||
const expGain = BladeburnerConstants.BaseStatGain * recruitTime;
|
||||
retValue.cha = expGain;
|
||||
retValue.chaExp = expGain;
|
||||
if (this.logging.general) {
|
||||
this.log(
|
||||
`${person.whoAmI()}: ` +
|
||||
|
@ -1,25 +0,0 @@
|
||||
// Interface that defines a generic object used to track experience/money
|
||||
// earnings for tasks
|
||||
export interface ITaskTracker {
|
||||
hack: number;
|
||||
str: number;
|
||||
def: number;
|
||||
dex: number;
|
||||
agi: number;
|
||||
cha: number;
|
||||
int: number;
|
||||
money: number;
|
||||
}
|
||||
|
||||
export function createTaskTracker(): ITaskTracker {
|
||||
return {
|
||||
hack: 0,
|
||||
str: 0,
|
||||
def: 0,
|
||||
dex: 0,
|
||||
agi: 0,
|
||||
cha: 0,
|
||||
int: 0,
|
||||
money: 0,
|
||||
};
|
||||
}
|
@ -2,7 +2,7 @@ import { Person } from "./Person";
|
||||
import { calculateSkill } from "./formulas/skill";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { Player } from "@player";
|
||||
import { ITaskTracker } from "./ITaskTracker";
|
||||
import { WorkStats } from "../ScriptEditor/NetscriptDefinitions";
|
||||
|
||||
export function gainHackingExp(this: Person, exp: number): void {
|
||||
if (isNaN(exp)) {
|
||||
@ -113,14 +113,14 @@ export function gainIntelligenceExp(this: Person, exp: number): void {
|
||||
this.skills.intelligence = Math.floor(this.calculateSkill(this.exp.intelligence, 1));
|
||||
}
|
||||
}
|
||||
export function gainStats(this: Person, retValue: ITaskTracker): void {
|
||||
this.gainHackingExp(retValue.hack * this.mults.hacking_exp);
|
||||
this.gainStrengthExp(retValue.str * this.mults.strength_exp);
|
||||
this.gainDefenseExp(retValue.def * this.mults.defense_exp);
|
||||
this.gainDexterityExp(retValue.dex * this.mults.dexterity_exp);
|
||||
this.gainAgilityExp(retValue.agi * this.mults.agility_exp);
|
||||
this.gainCharismaExp(retValue.cha * this.mults.charisma_exp);
|
||||
this.gainIntelligenceExp(retValue.int);
|
||||
export function gainStats(this: Person, retValue: WorkStats): void {
|
||||
this.gainHackingExp(retValue.hackExp * this.mults.hacking_exp);
|
||||
this.gainStrengthExp(retValue.strExp * this.mults.strength_exp);
|
||||
this.gainDefenseExp(retValue.defExp * this.mults.defense_exp);
|
||||
this.gainDexterityExp(retValue.dexExp * this.mults.dexterity_exp);
|
||||
this.gainAgilityExp(retValue.agiExp * this.mults.agility_exp);
|
||||
this.gainCharismaExp(retValue.chaExp * this.mults.charisma_exp);
|
||||
this.gainIntelligenceExp(retValue.intExp);
|
||||
}
|
||||
|
||||
//Given a string expression like "str" or "strength", returns the given stat
|
||||
|
@ -61,8 +61,10 @@ export class SleeveBladeburnerWork extends Work {
|
||||
if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`);
|
||||
applySleeveGains(sleeve, exp, 1);
|
||||
}
|
||||
Player.gainMoney(retValue.money, "sleeves");
|
||||
Player.gainStats(retValue);
|
||||
|
||||
if (this.actionType === "Contracts") {
|
||||
applySleeveGains(sleeve, retValue, 1);
|
||||
}
|
||||
this.cyclesWorked -= this.cyclesNeeded(sleeve);
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user