bitburner-src/src/Gang/GangMemberTask.ts

66 lines
2.2 KiB
TypeScript
Raw Normal View History

import { ITaskParams, ITerritory } from "./ITaskParams";
2021-06-14 21:42:38 +02:00
export class GangMemberTask {
2021-09-05 01:09:30 +02:00
name: string;
desc: string;
isHacking: boolean;
isCombat: boolean;
baseRespect: number;
baseWanted: number;
baseMoney: number;
hackWeight: number;
strWeight: number;
defWeight: number;
dexWeight: number;
agiWeight: number;
chaWeight: number;
difficulty: number;
territory: ITerritory;
// Defines tasks that Gang Members can work on
2021-09-09 05:47:34 +02:00
constructor(name: string, desc: string, isHacking: boolean, isCombat: boolean, params: ITaskParams) {
2021-09-05 01:09:30 +02:00
this.name = name;
this.desc = desc;
// Flags that describe whether this Task is applicable for Hacking/Combat gangs
this.isHacking = isHacking;
this.isCombat = isCombat;
// Base gain rates for respect/wanted/money
this.baseRespect = params.baseRespect ? params.baseRespect : 0;
this.baseWanted = params.baseWanted ? params.baseWanted : 0;
this.baseMoney = params.baseMoney ? params.baseMoney : 0;
// Weighting for the effect that each stat has on the tasks effectiveness.
// Weights must add up to 100
this.hackWeight = params.hackWeight ? params.hackWeight : 0;
this.strWeight = params.strWeight ? params.strWeight : 0;
this.defWeight = params.defWeight ? params.defWeight : 0;
this.dexWeight = params.dexWeight ? params.dexWeight : 0;
this.agiWeight = params.agiWeight ? params.agiWeight : 0;
this.chaWeight = params.chaWeight ? params.chaWeight : 0;
if (
Math.round(
2021-09-09 05:47:34 +02:00
this.hackWeight + this.strWeight + this.defWeight + this.dexWeight + this.agiWeight + this.chaWeight,
2021-09-05 01:09:30 +02:00
) != 100
) {
console.error(`GangMemberTask ${this.name} weights do not add up to 100`);
2021-06-14 21:42:38 +02:00
}
2021-09-05 01:09:30 +02:00
// 1 - 100
this.difficulty = params.difficulty ? params.difficulty : 1;
// Territory Factors. Exponential factors that dictate how territory affects gains
// Formula: Territory Mutiplier = (Territory * 100) ^ factor / 100
// So factor should be > 1 if something should scale exponentially with territory
// and should be < 1 if it should have diminshing returns
2021-09-09 05:47:34 +02:00
this.territory = params.territory ? params.territory : { money: 1, respect: 1, wanted: 1 };
2021-09-05 01:09:30 +02:00
}
2021-06-14 21:42:38 +02:00
}