2021-03-13 21:10:55 +01:00
|
|
|
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
|
|
|
|
|
|
|
interface ISkillParams {
|
2021-09-05 01:09:30 +02:00
|
|
|
name: string;
|
|
|
|
desc: string;
|
|
|
|
|
|
|
|
baseCost?: number;
|
|
|
|
costInc?: number;
|
|
|
|
maxLvl?: number;
|
|
|
|
|
|
|
|
successChanceAll?: number;
|
|
|
|
successChanceStealth?: number;
|
|
|
|
successChanceKill?: number;
|
|
|
|
successChanceContract?: number;
|
|
|
|
successChanceOperation?: number;
|
|
|
|
successChanceEstimate?: number;
|
|
|
|
|
|
|
|
actionTime?: number;
|
|
|
|
|
|
|
|
effHack?: number;
|
|
|
|
effStr?: number;
|
|
|
|
effDef?: number;
|
|
|
|
effDex?: number;
|
|
|
|
effAgi?: number;
|
|
|
|
effCha?: number;
|
|
|
|
|
|
|
|
stamina?: number;
|
|
|
|
money?: number;
|
|
|
|
expGain?: number;
|
2021-03-13 21:10:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Skill {
|
2021-09-05 01:09:30 +02:00
|
|
|
name: string;
|
|
|
|
desc: string;
|
|
|
|
// Cost is in Skill Points
|
|
|
|
baseCost = 1;
|
|
|
|
// Additive cost increase per level
|
|
|
|
costInc = 1;
|
|
|
|
maxLvl = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* These benefits are additive. So total multiplier will be level (handled externally) times the
|
|
|
|
* effects below
|
|
|
|
*/
|
|
|
|
successChanceAll = 0;
|
|
|
|
successChanceStealth = 0;
|
|
|
|
successChanceKill = 0;
|
|
|
|
successChanceContract = 0;
|
|
|
|
successChanceOperation = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This multiplier affects everything that increases synthoid population/community estimate
|
|
|
|
* e.g. Field analysis, Investigation Op, Undercover Op
|
|
|
|
*/
|
|
|
|
successChanceEstimate = 0;
|
|
|
|
actionTime = 0;
|
|
|
|
effHack = 0;
|
|
|
|
effStr = 0;
|
|
|
|
effDef = 0;
|
|
|
|
effDex = 0;
|
|
|
|
effAgi = 0;
|
|
|
|
effCha = 0;
|
|
|
|
stamina = 0;
|
|
|
|
money = 0;
|
|
|
|
expGain = 0;
|
|
|
|
|
|
|
|
constructor(params: ISkillParams = { name: "foo", desc: "foo" }) {
|
|
|
|
if (!params.name) {
|
2021-09-09 05:47:34 +02:00
|
|
|
throw new Error("Failed to initialize Bladeburner Skill. No name was specified in ctor");
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
if (!params.desc) {
|
2021-09-09 05:47:34 +02:00
|
|
|
throw new Error("Failed to initialize Bladeburner Skills. No desc was specified in ctor");
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
this.name = params.name;
|
|
|
|
this.desc = params.desc;
|
|
|
|
this.baseCost = params.baseCost ? params.baseCost : 1;
|
|
|
|
this.costInc = params.costInc ? params.costInc : 1;
|
|
|
|
|
|
|
|
if (params.maxLvl) {
|
|
|
|
this.maxLvl = params.maxLvl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (params.successChanceAll) {
|
|
|
|
this.successChanceAll = params.successChanceAll;
|
|
|
|
}
|
|
|
|
if (params.successChanceStealth) {
|
|
|
|
this.successChanceStealth = params.successChanceStealth;
|
|
|
|
}
|
|
|
|
if (params.successChanceKill) {
|
|
|
|
this.successChanceKill = params.successChanceKill;
|
|
|
|
}
|
|
|
|
if (params.successChanceContract) {
|
|
|
|
this.successChanceContract = params.successChanceContract;
|
|
|
|
}
|
|
|
|
if (params.successChanceOperation) {
|
|
|
|
this.successChanceOperation = params.successChanceOperation;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (params.successChanceEstimate) {
|
|
|
|
this.successChanceEstimate = params.successChanceEstimate;
|
2021-08-16 07:35:05 +02:00
|
|
|
}
|
2021-03-13 21:10:55 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
if (params.actionTime) {
|
|
|
|
this.actionTime = params.actionTime;
|
|
|
|
}
|
|
|
|
if (params.effHack) {
|
|
|
|
this.effHack = params.effHack;
|
|
|
|
}
|
|
|
|
if (params.effStr) {
|
|
|
|
this.effStr = params.effStr;
|
|
|
|
}
|
|
|
|
if (params.effDef) {
|
|
|
|
this.effDef = params.effDef;
|
|
|
|
}
|
|
|
|
if (params.effDex) {
|
|
|
|
this.effDex = params.effDex;
|
|
|
|
}
|
|
|
|
if (params.effAgi) {
|
|
|
|
this.effAgi = params.effAgi;
|
|
|
|
}
|
|
|
|
if (params.effCha) {
|
|
|
|
this.effCha = params.effCha;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (params.stamina) {
|
|
|
|
this.stamina = params.stamina;
|
|
|
|
}
|
|
|
|
if (params.money) {
|
|
|
|
this.money = params.money;
|
|
|
|
}
|
|
|
|
if (params.expGain) {
|
|
|
|
this.expGain = params.expGain;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-29 03:37:33 +02:00
|
|
|
calculateCost(currentLevel: number, count = 1): number {
|
2022-05-29 04:06:25 +02:00
|
|
|
if (count == 1) {
|
|
|
|
return Math.floor((this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
return this.calculateCost(currentLevel + 1, count - 1) + thisUpgrade;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
//unFloored is roughly equivalent to
|
|
|
|
//(this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost
|
|
|
|
//being repeated for increasing currentLevel
|
2022-05-29 04:26:11 +02:00
|
|
|
const preMult = count * ((2 * this.baseCost) + this.costInc * (2 * currentLevel + count + 1)) / 2;
|
2022-05-29 04:06:25 +02:00
|
|
|
const unFloored = (preMult * BitNodeMultipliers.BladeburnerSkillCost) - count / 2;
|
|
|
|
return Math.floor(unFloored);
|
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
getMultiplier(name: string): number {
|
|
|
|
if (name === "successChanceAll") return this.successChanceAll;
|
|
|
|
if (name === "successChanceStealth") return this.successChanceStealth;
|
|
|
|
if (name === "successChanceKill") return this.successChanceKill;
|
|
|
|
if (name === "successChanceContract") return this.successChanceContract;
|
|
|
|
if (name === "successChanceOperation") return this.successChanceOperation;
|
|
|
|
if (name === "successChanceEstimate") return this.successChanceEstimate;
|
|
|
|
|
|
|
|
if (name === "actionTime") return this.actionTime;
|
|
|
|
|
|
|
|
if (name === "effHack") return this.effHack;
|
|
|
|
if (name === "effStr") return this.effStr;
|
|
|
|
if (name === "effDef") return this.effDef;
|
|
|
|
if (name === "effDex") return this.effDex;
|
|
|
|
if (name === "effAgi") return this.effAgi;
|
|
|
|
if (name === "effCha") return this.effCha;
|
|
|
|
|
|
|
|
if (name === "stamina") return this.stamina;
|
|
|
|
if (name === "money") return this.money;
|
|
|
|
if (name === "expGain") return this.expGain;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|