From 910fa6d0a66aabe76b06384a847736f7bba91ade Mon Sep 17 00:00:00 2001 From: danielyxie Date: Wed, 24 Oct 2018 13:20:51 -0500 Subject: [PATCH] More gang rebalancing. Removed penalty for committing crimes through Singularity functions --- src/Constants.js | 2 +- src/Gang.js | 17 ++++++++++------- src/NetscriptFunctions.js | 26 +++++++++++++------------- src/data/gangmembertasks.ts | 9 ++++++++- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/Constants.js b/src/Constants.js index 881204966..b461375d2 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -253,7 +253,6 @@ let CONSTANTS = { ClassLeadershipBaseCost: 320, ClassGymBaseCost: 120, - CrimeSingFnDivider: 2, //Factor by which exp/profit is reduced when commiting crime through Sing Fn CrimeShoplift: "shoplift", CrimeRobStore: "rob a store", CrimeMug: "mug someone", @@ -522,6 +521,7 @@ let CONSTANTS = { * RAM Cost of accessing the global document object lowered from 100 GB to 25 GB * RAM Cost to use Singularity Functions outside of BitNode-4 lowered by 75%. They now only cost twice as much as they do in BitNode-4 * b1t_flum3.exe now takes significantly less time to create + * Crimes commited through Singularity function no longer give half money/exp * Improved number formatting for Player 'work' actions (including crimes, etc.). These numbers should also adhere to locale settings now (by Kline-) * Bug Fix: Calling print() in NetscriptJS no longer brings up the print dialog * Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes diff --git a/src/Gang.js b/src/Gang.js index 59c6419bb..a86295584 100644 --- a/src/Gang.js +++ b/src/Gang.js @@ -287,7 +287,7 @@ Gang.prototype.processTerritoryAndPowerGains = function(numCycles=1) { } else if (this.territoryClashChance > 0) { // Engagement turned off, but still a positive clash chance. So there's // still a chance of clashing but it slowly goes down over time - this.territoryClashChance = Math.max(0, this.territoryClashChance - 0.005); + this.territoryClashChance = Math.max(0, this.territoryClashChance - 0.01); } // Then process territory @@ -393,19 +393,22 @@ Gang.prototype.calculatePower = function() { memberTotal += gain; } } - return (0.001 * memberTotal); + return (0.015 * this.getTerritory() * memberTotal); } Gang.prototype.clash = function(won=false) { // Determine if a gang member should die - let baseDeathChance; - won ? baseDeathChance = 0.03 : baseDeathChance = 0.06; + let baseDeathChance = 0.01; + if (won) { baseDeathChance /= 2; } // If the clash was lost, the player loses a small percentage of power if (!won) { - AllGangs[this.facName].power *= 0.98; + AllGangs[this.facName].power *= (1 / 1.01); } + // Deaths can only occur during X% of clashes + if (Math.random() < 0.75) { return; } + for (let i = this.members.length - 1; i >= 0; --i) { const member = this.members[i]; @@ -413,7 +416,7 @@ Gang.prototype.clash = function(won=false) { if (member.task !== "Territory Warfare") { continue; } // Chance to die is decreased based on defense - const modifiedDeathChance = baseDeathChance / Math.pow(member.def, 0.25); + const modifiedDeathChance = baseDeathChance / Math.pow(member.def, 0.6); if (Math.random() < modifiedDeathChance) { this.killMember(member); } @@ -678,7 +681,7 @@ GangMember.prototype.calculateMoneyGain = function(gang) { GangMember.prototype.gainExperience = function(numCycles=1) { const task = this.getTask(); if (task == null || !(task instanceof GangMemberTask) || task === GangMemberTasks["Unassigned"]) {return;} - const difficultyMult = Math.pow(task.difficulty, 0.8); + const difficultyMult = Math.pow(task.difficulty, 0.9); const difficultyPerCycles = difficultyMult * numCycles; const weightDivisor = 1500; this.hack_exp += (task.hackWeight / weightDivisor) * difficultyPerCycles; diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index fa427d84a..8b70b8c1d 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -3332,7 +3332,7 @@ function NetscriptFunctions(workerScript) { if(workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) { workerScript.scriptRef.log("Attempting to commit crime: "+crime.name+"..."); } - return crime.commit(CONSTANTS.CrimeSingFnDivider, {workerscript: workerScript}); + return crime.commit(1, {workerscript: workerScript}); }, getCrimeChance : function(crimeRoughName) { var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; @@ -3539,9 +3539,9 @@ function NetscriptFunctions(workerScript) { gang : { getMemberNames : function() { if (workerScript.checkingRam) { - return updateStaticRam("getMemberNames", CONSTANTS.ScriptGangApiBaseRamCost / 2); + return updateStaticRam("getMemberNames", CONSTANTS.ScriptGangApiBaseRamCost / 4); } - updateDynamicRam("getMemberNames", CONSTANTS.ScriptGangApiBaseRamCost / 2); + updateDynamicRam("getMemberNames", CONSTANTS.ScriptGangApiBaseRamCost / 4); nsGang.checkGangApiAccess(workerScript, "getMemberNames"); try { @@ -3623,9 +3623,9 @@ function NetscriptFunctions(workerScript) { }, canRecruitMember : function() { if (workerScript.checkingRam) { - return updateStaticRam("canRecruitMember", CONSTANTS.ScriptGangApiBaseRamCost / 2); + return updateStaticRam("canRecruitMember", CONSTANTS.ScriptGangApiBaseRamCost / 4); } - updateDynamicRam("canRecruitMember", CONSTANTS.ScriptGangApiBaseRamCost / 2); + updateDynamicRam("canRecruitMember", CONSTANTS.ScriptGangApiBaseRamCost / 4); nsGang.checkGangApiAccess(workerScript, "canRecruitMember"); try { @@ -3649,9 +3649,9 @@ function NetscriptFunctions(workerScript) { }, getTaskNames : function() { if (workerScript.checkingRam) { - return updateStaticRam("getTaskNames", CONSTANTS.ScriptGangApiBaseRamCost / 2); + return updateStaticRam("getTaskNames", CONSTANTS.ScriptGangApiBaseRamCost / 4); } - updateDynamicRam("getTaskNames", CONSTANTS.ScriptGangApiBaseRamCost / 2); + updateDynamicRam("getTaskNames", CONSTANTS.ScriptGangApiBaseRamCost / 4); nsGang.checkGangApiAccess(workerScript, "getTaskNames"); try { @@ -3684,9 +3684,9 @@ function NetscriptFunctions(workerScript) { }, getEquipmentNames : function() { if (workerScript.checkingRam) { - return updateStaticRam("getEquipmentNames", CONSTANTS.ScriptGangApiBaseRamCost / 2); + return updateStaticRam("getEquipmentNames", CONSTANTS.ScriptGangApiBaseRamCost / 4); } - updateDynamicRam("getEquipmentNames", CONSTANTS.ScriptGangApiBaseRamCost / 2); + updateDynamicRam("getEquipmentNames", CONSTANTS.ScriptGangApiBaseRamCost / 4); nsGang.checkGangApiAccess(workerScript, "getEquipmentNames"); try { @@ -3710,9 +3710,9 @@ function NetscriptFunctions(workerScript) { }, purchaseEquipment : function(memberName, equipName) { if (workerScript.checkingRam) { - return updateStaticRam("purchaseEquipment", CONSTANTS.ScriptGangApiBaseRamCost / 2); + return updateStaticRam("purchaseEquipment", CONSTANTS.ScriptGangApiBaseRamCost); } - updateDynamicRam("purchaseEquipment", CONSTANTS.ScriptGangApiBaseRamCost / 2); + updateDynamicRam("purchaseEquipment", CONSTANTS.ScriptGangApiBaseRamCost); nsGang.checkGangApiAccess(workerScript, "purchaseEquipment"); try { @@ -3730,9 +3730,9 @@ function NetscriptFunctions(workerScript) { }, ascendMember : function(name) { if (workerScript.checkingRam) { - return updateStaticRam("ascendMember", CONSTANTS.ScriptGangApiBaseRamCost / 2); + return updateStaticRam("ascendMember", CONSTANTS.ScriptGangApiBaseRamCost); } - updateDynamicRam("ascendMember", CONSTANTS.ScriptGangApiBaseRamCost / 2); + updateDynamicRam("ascendMember", CONSTANTS.ScriptGangApiBaseRamCost); nsGang.checkGangApiAccess(workerScript, "ascendMember"); try { diff --git a/src/data/gangmembertasks.ts b/src/data/gangmembertasks.ts index 8a3c6e98c..1ad351dd1 100644 --- a/src/data/gangmembertasks.ts +++ b/src/data/gangmembertasks.ts @@ -264,6 +264,13 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ name: "Train Hacking", params: {hackWeight: 100, difficulty: 8}, }, + { + desc: "Assign this gang member to train their charisma", + isCombat: true, + isHacking: true, + name: "Train Charisma", + params: {chaWeight: 100, difficulty: 8}, + }, { desc: "Assign this gang member to engage in territorial warfare with other gangs. Members assigned to this task will help increase your gang's territory and will defend your territory from being taken.", isCombat: true, @@ -271,7 +278,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ name: "Territory Warfare", params: { hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20, chaWeight: 5, - difficulty: 3 + difficulty: 5 }, }, ];