Files
bitburner-src/src/Bladeburner/Actions/BlackOperation.ts

54 lines
1.5 KiB
TypeScript

import type { Bladeburner } from "../Bladeburner";
import type { Availability, ActionIdentifier } from "../Types";
import { BladeburnerActionType, BladeburnerBlackOpName } from "@enums";
import { ActionClass, ActionParams } from "./Action";
import { operationSkillSuccessBonus, operationTeamSuccessBonus } from "./Operation";
interface BlackOpParams {
name: BladeburnerBlackOpName;
reqdRank: number;
n: number;
}
export class BlackOperation extends ActionClass {
type: BladeburnerActionType.BlackOp = BladeburnerActionType.BlackOp;
name: BladeburnerBlackOpName;
n: number;
reqdRank: number;
teamCount = 0;
get id(): ActionIdentifier {
return { type: this.type, name: this.name };
}
constructor(params: ActionParams & BlackOpParams) {
super(params);
this.name = params.name;
this.reqdRank = params.reqdRank;
this.n = params.n;
}
getAvailability(bladeburner: Bladeburner): Availability {
if (bladeburner.numBlackOpsComplete < this.n) return { error: "Have not completed the previous Black Operation" };
if (bladeburner.numBlackOpsComplete > this.n) return { error: "Already completed" };
if (bladeburner.rank < this.reqdRank) return { error: "Insufficient rank" };
return { available: true };
}
getActionTimePenalty(): number {
return 1.5;
}
getPopulationSuccessFactor(): number {
return 1;
}
getChaosSuccessFactor(): number {
return 1;
}
getTeamSuccessBonus = operationTeamSuccessBonus;
getActionTypeSkillSuccessBonus = operationSkillSuccessBonus;
}