Streamlining GangKarmaRequirement constant

As suggested by phyzical :

The GangKarmaRequirement const was declared locally in the PlayerObjectGangMethod.ts file.

It's now part of the GangConstants object in the gang/data/constant.ts file.

Allowing it to be referenced in the FactionRoot.tsx tooltip.
This commit is contained in:
borisflagell
2022-04-23 15:55:15 +02:00
parent ff3493e184
commit 90dc8bbc3a
3 changed files with 6 additions and 4 deletions

View File

@ -130,7 +130,7 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
<Box>
<Paper sx={{ my: 1, p: 1 }}>
<Tooltip
title={!isManageGangClickable ? <Typography>Unlocked when reaching -54000 karma</Typography> : ""}
title={!isManageGangClickable ? <Typography>Unlocked when reaching {GangConstants.GangKarmaRequirement} karma</Typography> : ""}
>
<span>
<Button onClick={manageGang} disabled={!isManageGangClickable}>

View File

@ -6,6 +6,7 @@ export const GangConstants: {
CyclesPerTerritoryAndPowerUpdate: number;
AscensionMultiplierRatio: number;
Names: string[];
GangKarmaRequirement: number;
} = {
// Respect is divided by this to get rep gain
GangRespectToReputationRatio: 75,
@ -23,4 +24,5 @@ export const GangConstants: {
FactionNames.NiteSec,
FactionNames.TheBlackHand,
],
GangKarmaRequirement: -54000,
};

View File

@ -2,9 +2,9 @@ import { Factions } from "../../Faction/Factions";
import { Faction } from "../../Faction/Faction";
import { Gang } from "../../Gang/Gang";
import { IPlayer } from "../IPlayer";
import { GangConstants } from "../../Gang/data/Constants"
// Amount of negative karma needed to manage a gang in BitNodes other than 2
const GangKarmaRequirement = -54000;
export function canAccessGang(this: IPlayer): boolean {
if (this.bitNodeN === 2) {
@ -14,7 +14,7 @@ export function canAccessGang(this: IPlayer): boolean {
return false;
}
return this.karma <= GangKarmaRequirement;
return this.karma <= GangConstants.GangKarmaRequirement;
}
export function isAwareOfGang(this: IPlayer): boolean {