2019-04-14 11:08:10 +02:00
|
|
|
import { Factions } from "../../Faction/Factions";
|
2021-06-17 00:38:29 +02:00
|
|
|
import { Gang } from "../../Gang/Gang";
|
2019-04-14 11:08:10 +02:00
|
|
|
import { SourceFileFlags } from "../../SourceFile/SourceFileFlags";
|
2021-03-24 02:47:47 +01:00
|
|
|
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
2019-04-14 11:08:10 +02:00
|
|
|
|
|
|
|
// Amount of negative karma needed to manage a gang in BitNodes other than 2
|
|
|
|
const GangKarmaRequirement = -54000;
|
|
|
|
|
|
|
|
export function canAccessGang() {
|
|
|
|
if (this.bitNodeN === 2) { return true; }
|
|
|
|
if (SourceFileFlags[2] <= 0) { return false; }
|
|
|
|
|
2021-03-24 02:47:47 +01:00
|
|
|
return (this.karma <= BitNodeMultipliers.GangKarmaRequirement*GangKarmaRequirement);
|
2019-04-14 11:08:10 +02:00
|
|
|
}
|
|
|
|
|
2019-04-30 05:54:20 +02:00
|
|
|
export function getGangFaction() {
|
|
|
|
const fac = Factions[this.gang.facName];
|
|
|
|
if (fac == null) {
|
|
|
|
throw new Error(`Gang has invalid faction name: ${this.gang.facName}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
return fac;
|
|
|
|
}
|
|
|
|
|
2019-04-14 11:08:10 +02:00
|
|
|
export function getGangName() {
|
2019-05-02 00:20:14 +02:00
|
|
|
return this.inGang() ? this.gang.facName : "";
|
|
|
|
}
|
|
|
|
|
|
|
|
export function hasGangWith(facName) {
|
|
|
|
return this.inGang() && this.gang.facName === facName;
|
2019-04-14 11:08:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function inGang() {
|
|
|
|
if (this.gang == null || this.gang == undefined) { return false; }
|
|
|
|
|
|
|
|
return (this.gang instanceof Gang);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function startGang(factionName, hacking) {
|
|
|
|
this.gang = new Gang(factionName, hacking);
|
|
|
|
|
|
|
|
const fac = Factions[factionName];
|
|
|
|
if (fac == null) {
|
|
|
|
throw new Error(`Invalid faction name when creating gang: ${factionName}`);
|
|
|
|
}
|
|
|
|
fac.playerReputation = 0;
|
|
|
|
}
|