BB action rewards now tied to who does the action

This commit is contained in:
Mughur 2022-08-28 13:11:59 +03:00
parent ce5d777f59
commit cf09057836
4 changed files with 9 additions and 8 deletions

@ -994,7 +994,7 @@ export class Bladeburner implements IBladeburner {
* @param action(Action obj) - Derived action class * @param action(Action obj) - Derived action class
* @param success(bool) - Whether action was successful * @param success(bool) - Whether action was successful
*/ */
getActionStats(action: IAction, success: boolean): ITaskTracker { getActionStats(action: IAction, person: IPerson, success: boolean): ITaskTracker {
const difficulty = action.getDifficulty(); const difficulty = action.getDifficulty();
/** /**
@ -1005,7 +1005,7 @@ export class Bladeburner implements IBladeburner {
Math.pow(difficulty, BladeburnerConstants.DiffMultExponentialFactor) + Math.pow(difficulty, BladeburnerConstants.DiffMultExponentialFactor) +
difficulty / BladeburnerConstants.DiffMultLinearFactor; difficulty / BladeburnerConstants.DiffMultLinearFactor;
const time = this.actionTimeToComplete; const time = action.getActionTime(this, person);
const successMult = success ? 1 : 0.5; const successMult = success ? 1 : 0.5;
const unweightedGain = time * BladeburnerConstants.BaseStatGain * successMult * difficultyMult; const unweightedGain = time * BladeburnerConstants.BaseStatGain * successMult * difficultyMult;
@ -1283,7 +1283,7 @@ export class Bladeburner implements IBladeburner {
// Process Contract/Operation success/failure // Process Contract/Operation success/failure
if (action.attempt(this, person)) { if (action.attempt(this, person)) {
retValue = this.getActionStats(action, true); retValue = this.getActionStats(action, person, true);
++action.successes; ++action.successes;
--action.count; --action.count;
@ -1323,7 +1323,7 @@ export class Bladeburner implements IBladeburner {
} }
isOperation ? this.completeOperation(true, player) : this.completeContract(true, actionIdent); isOperation ? this.completeOperation(true, player) : this.completeContract(true, actionIdent);
} else { } else {
retValue = this.getActionStats(action, false); retValue = this.getActionStats(action, person, false);
++action.failures; ++action.failures;
let loss = 0, let loss = 0,
damage = 0; damage = 0;
@ -1386,7 +1386,7 @@ export class Bladeburner implements IBladeburner {
let teamLossMax; let teamLossMax;
if (action.attempt(this, person)) { if (action.attempt(this, person)) {
retValue = this.getActionStats(action, true); retValue = this.getActionStats(action, person, true);
action.count = 0; action.count = 0;
this.blackops[action.name] = true; this.blackops[action.name] = true;
let rankGain = 0; let rankGain = 0;

@ -116,6 +116,6 @@ export interface IBladeburner {
calculateMaxStamina(player: IPlayer): void; calculateMaxStamina(player: IPlayer): void;
create(): void; create(): void;
process(router: IRouter, player: IPlayer): void; process(router: IRouter, player: IPlayer): void;
getActionStats(action: IAction, success: boolean): ITaskTracker; getActionStats(action: IAction, person: IPerson, success: boolean): ITaskTracker;
sleeveSupport(joining: boolean): void; sleeveSupport(joining: boolean): void;
} }

@ -61,7 +61,8 @@ export class SleeveBladeburnerWork extends Work {
if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`); if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`);
applySleeveGains(player, sleeve, exp, 1); applySleeveGains(player, sleeve, exp, 1);
} }
if (retValue.money > 0) player.gainMoney(retValue.money, "sleeves"); player.gainMoney(retValue.money, "sleeves");
player.gainStats(retValue);
this.cyclesWorked -= this.cyclesNeeded(player, sleeve); this.cyclesWorked -= this.cyclesNeeded(player, sleeve);
} }
return 0; return 0;