CCT: Generate more frequent and lower-reward coding contracts (#2603)

This commit is contained in:
Michael Ficocelli
2026-03-31 13:28:39 -07:00
committed by GitHub
parent e3ae5478d5
commit 3e44f08a0f
3 changed files with 12 additions and 10 deletions

View File

@@ -74,7 +74,7 @@ export const getCCTReward = (difficulty: number, server: DarknetServer): string
return getMoneyReward(difficulty);
}
for (let i = 0; i < contractCount; i++) {
generateContract({ server: server.hostname, rewardScaling: 1 / 5 });
generateContract({ server: server.hostname, rewardScaling: 1 / 2 });
}
return `New coding contracts are now available on the network!`;
};

View File

@@ -505,25 +505,27 @@ export function gainCodingContractReward(
if (!reward) {
return `No reward for this contract`;
}
// The new standard is smaller, more frequent rewards - a third of the reward size of the previous
const adjustedScaling = rewardScaling / 3;
switch (reward.type) {
case CodingContractRewardType.FactionReputation: {
const factionsThatAllowHacking = Player.factions.filter((fac) => Factions[fac].getInfo().offerHackingWork);
if (factionsThatAllowHacking.length === 0) {
return this.gainCodingContractReward({ type: CodingContractRewardType.Money }, difficulty, rewardScaling);
return this.gainCodingContractReward({ type: CodingContractRewardType.Money }, difficulty, adjustedScaling);
}
const randomFaction = factionsThatAllowHacking[getRandomIntInclusive(0, factionsThatAllowHacking.length - 1)];
const repGain = CONSTANTS.CodingContractBaseFactionRepGain * difficulty * rewardScaling;
const repGain = CONSTANTS.CodingContractBaseFactionRepGain * difficulty * adjustedScaling;
Factions[randomFaction].playerReputation += repGain;
return `Gained ${repGain} faction reputation for ${randomFaction}`;
}
case CodingContractRewardType.FactionReputationAll: {
const factionsThatAllowHacking = Player.factions.filter((fac) => Factions[fac].getInfo().offerHackingWork);
if (factionsThatAllowHacking.length === 0) {
return this.gainCodingContractReward({ type: CodingContractRewardType.Money }, difficulty, rewardScaling);
return this.gainCodingContractReward({ type: CodingContractRewardType.Money }, difficulty, adjustedScaling);
}
const totalGain = CONSTANTS.CodingContractBaseFactionRepGain * difficulty * rewardScaling;
const totalGain = CONSTANTS.CodingContractBaseFactionRepGain * difficulty * adjustedScaling;
const gainPerFaction = Math.floor(totalGain / factionsThatAllowHacking.length);
for (const facName of factionsThatAllowHacking) {
Factions[facName].playerReputation += gainPerFaction;
@@ -543,17 +545,17 @@ export function gainCodingContractReward(
: CodingContractRewardType.FactionReputationAll,
},
difficulty,
rewardScaling,
adjustedScaling,
);
}
const randomCompany = companies[getRandomIntInclusive(0, companies.length - 1)];
const repGain = CONSTANTS.CodingContractBaseCompanyRepGain * difficulty * rewardScaling;
const repGain = CONSTANTS.CodingContractBaseCompanyRepGain * difficulty * adjustedScaling;
Companies[randomCompany].playerReputation += repGain;
return `Gained ${repGain} company reputation for ${randomCompany}`;
}
case CodingContractRewardType.Money: {
const moneyGain =
CONSTANTS.CodingContractBaseMoneyGain * difficulty * currentNodeMults.CodingContractMoney * rewardScaling;
CONSTANTS.CodingContractBaseMoneyGain * difficulty * currentNodeMults.CodingContractMoney * adjustedScaling;
this.gainMoney(moneyGain, "codingcontract");
return `Gained ${formatMoney(moneyGain)}`;
}

View File

@@ -209,7 +209,7 @@ const Engine = {
}
if (Engine.Counters.contractGeneration <= 0) {
tryGeneratingRandomContract(1);
tryGeneratingRandomContract(3);
Engine.Counters.contractGeneration = 3000;
}
@@ -265,7 +265,7 @@ const Engine = {
const numCyclesOffline = Math.floor(timeOffline / CONSTANTS.MilliPerCycle);
// Generate bonus CCTs
tryGeneratingRandomContract(timeOffline / CONSTANTS.MillisecondsPerTenMinutes);
tryGeneratingRandomContract((timeOffline * 3) / CONSTANTS.MillisecondsPerTenMinutes);
let offlineReputation = 0;
let offlineHackingIncome =