CCT: Fewer money coding contracts if the reward would be $0 (#918)

This commit is contained in:
Trambelus 2023-12-03 04:00:15 -05:00 committed by GitHub
parent 8b6caeb68b
commit f2baa04f45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,6 +4,7 @@ import {
CodingContractTypes, CodingContractTypes,
ICodingContractReward, ICodingContractReward,
} from "./CodingContracts"; } from "./CodingContracts";
import { currentNodeMults } from "./BitNode/BitNodeMultipliers";
import { Factions } from "./Faction/Factions"; import { Factions } from "./Faction/Factions";
import { Player } from "@player"; import { Player } from "@player";
import { GetServer, GetAllServers } from "./Server/AllServers"; import { GetServer, GetAllServers } from "./Server/AllServers";
@ -124,7 +125,10 @@ function getRandomProblemType(): string {
} }
function getRandomReward(): ICodingContractReward { function getRandomReward(): ICodingContractReward {
const rewardType = sanitizeRewardType(getRandomInt(0, CodingContractRewardType.Money)); // Don't offer money reward by default if BN multiplier is 0 (e.g. BN8)
const rewardTypeUpperBound =
currentNodeMults.CodingContractMoney === 0 ? CodingContractRewardType.Money - 1 : CodingContractRewardType.Money;
const rewardType = sanitizeRewardType(getRandomInt(0, rewardTypeUpperBound));
// Add additional information based on the reward type // Add additional information based on the reward type
const factionsThatAllowHacking = Player.factions.filter((fac) => Factions[fac].getInfo().offerHackingWork); const factionsThatAllowHacking = Player.factions.filter((fac) => Factions[fac].getInfo().offerHackingWork);