From e0df6207c121e25e65ce4596f7dc97b3a7efea19 Mon Sep 17 00:00:00 2001 From: danielyxie Date: Wed, 24 Oct 2018 20:26:53 -0500 Subject: [PATCH] Adding gang.getOtherGangInformation() function. Rebalancing --- doc/source/netscriptgangapi.rst | 27 ++++++++++++++++++++ src/BitNode.js | 8 +++--- src/Constants.js | 2 +- src/Gang.js | 44 ++++++++++++++++++--------------- src/NetscriptFunctions.js | 13 ++++++++++ src/data/gangmembertasks.ts | 20 +++++++-------- 6 files changed, 79 insertions(+), 35 deletions(-) diff --git a/doc/source/netscriptgangapi.rst b/doc/source/netscriptgangapi.rst index dfa144a0a..14c940fc6 100644 --- a/doc/source/netscriptgangapi.rst +++ b/doc/source/netscriptgangapi.rst @@ -56,6 +56,33 @@ getGangInformation wantedLevelGainRate: Wanted level gained/lost per second (negative for losses) } +getOtherGangInformation +----------------------- + +.. js:function:: getOtherGangInformation() + + Get territory and power information about all gangs + + :returns: An object with information about all gangs + + The object has the following structure:: + + { + "Slum Snakes" : { + power: Slum Snakes' power + territory: Slum Snakes' territory, in decimal form + }, + "Tetrads" : { + power: ... + territory: ... + }, + "The Syndicate" : { + power: ... + territory: ... + }, + ... (for all six gangs) + } + getMemberInformation -------------------- diff --git a/src/BitNode.js b/src/BitNode.js index 2d309becf..ffa5a0ca3 100644 --- a/src/BitNode.js +++ b/src/BitNode.js @@ -29,8 +29,8 @@ function initBitNodes() { "people quickly succumbed to the innate human impulse of evil and savagery. The organized crime " + "factions quickly rose to the top of the modern world.

" + "In this BitNode:

" + - "Your hacking level is reduced by 25%
" + - "The growth rate and maximum amount of money available on servers is significantly decreased
" + + "Your hacking level is reduced by 20%
" + + "The growth rate and maximum amount of money available on servers are significantly decreased
" + "The amount of money gained from crimes and Infiltration is tripled
" + "Certain Factions (Slum Snakes, Tetrads, The Syndicate, The Dark Army, Speakers for the Dead, " + "NiteSec, The Black Hand) give the player the ability to form and manage their own gangs. These gangs " + @@ -216,8 +216,8 @@ function initBitNodeMultipliers() { case 1: //Source Genesis (every multiplier is 1) break; case 2: //Rise of the Underworld - BitNodeMultipliers.HackingLevelMultiplier = 0.75; - BitNodeMultipliers.ServerGrowthRate = 0.75; + BitNodeMultipliers.HackingLevelMultiplier = 0.8; + BitNodeMultipliers.ServerGrowthRate = 0.8; BitNodeMultipliers.ServerMaxMoney = 0.2; BitNodeMultipliers.ServerStartingMoney = 0.4; BitNodeMultipliers.CrimeMoney = 3; diff --git a/src/Constants.js b/src/Constants.js index b461375d2..9a8f82785 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -508,7 +508,7 @@ let CONSTANTS = { *** Added a Gang Netscript API *** Added new 'ascension' mechanic for Gang Members *** The first three gang members are now 'free' (can be recruited instantly) - *** Maximum number of increased Gang Members increased from 20 to 40 + *** Maximum number of increased Gang Members increased from 20 to 30 *** Changed the formula for calculating respect needed to recruit the next gang member *** Added a new category of upgrades for Gang Members: Augmentations *** Non-Augmentation Gang member upgrades are now significantly weaker diff --git a/src/Gang.js b/src/Gang.js index a86295584..6d86257c7 100644 --- a/src/Gang.js +++ b/src/Gang.js @@ -32,7 +32,7 @@ import {yesNoBoxCreate, yesNoTxtInpBoxCreate, // Constants const GangRespectToReputationRatio = 2; // Respect is divided by this to get rep gain -const MaximumGangMembers = 40; +const MaximumGangMembers = 30; const GangRecruitCostMultiplier = 2; const CyclesPerTerritoryAndPowerUpdate = 100; const AscensionMultiplierRatio = 15 / 100; // Portion of upgrade multiplier that is kept after ascending @@ -185,9 +185,9 @@ Gang.prototype.process = function(numCycles=1, player) { } this.storedCycles += numCycles; - // Only process if there are at least 3 seconds, and at most 10 seconds - if (this.storedCycles < 3 * CyclesPerSecond); - const cycles = Math.min(this.storedCycles, 10 * CyclesPerSecond); + // Only process if there are at least 2 seconds, and at most 5 seconds + if (this.storedCycles < 2 * CyclesPerSecond) { return; } + const cycles = Math.min(this.storedCycles, 5 * CyclesPerSecond); try { this.processGains(cycles, player); @@ -271,7 +271,9 @@ Gang.prototype.processTerritoryAndPowerGains = function(numCycles=1) { const gainRoll = Math.random(); if (gainRoll < 0.5) { // Multiplicative gain (50% chance) - AllGangs[name].power *= 1.008; + // This is capped per cycle, to prevent it from getting out of control + const multiplicativeGain = AllGangs[name].power * 0.008; + AllGangs[name].power += Math.min(1, multiplicativeGain); } else { // Additive gain (50% chance) const additiveGain = 0.5 * gainRoll * AllGangs[name].territory; @@ -351,7 +353,7 @@ Gang.prototype.getRespectNeededToRecruitMember = function() { if (this.members.length < numFreeMembers) { return 0; } const i = this.members.length - (numFreeMembers - 1); - return Math.round(0.7 * Math.pow(i, 3) + 0.8 * Math.pow(i, 2)); + return Math.round(0.9 * Math.pow(i, 3) + Math.pow(i, 2)); } Gang.prototype.recruitMember = function(name) { @@ -403,11 +405,11 @@ Gang.prototype.clash = function(won=false) { // If the clash was lost, the player loses a small percentage of power if (!won) { - AllGangs[this.facName].power *= (1 / 1.01); + AllGangs[this.facName].power *= (1 / 1.008); } // Deaths can only occur during X% of clashes - if (Math.random() < 0.75) { return; } + if (Math.random() < 0.65) { return; } for (let i = this.members.length - 1; i >= 0; --i) { const member = this.members[i]; @@ -638,7 +640,7 @@ GangMember.prototype.calculateRespectGain = function(gang) { const territoryMult = Math.pow(AllGangs[gang.facName].territory * 100, task.territory.respect) / 100; if (isNaN(territoryMult) || territoryMult <= 0) { return 0; } var respectMult = gang.getWantedPenalty(); - return 12 * task.baseRespect * statWeight * territoryMult * respectMult; + return 11 * task.baseRespect * statWeight * territoryMult * respectMult; } GangMember.prototype.calculateWantedLevelGain = function(gang) { @@ -655,9 +657,9 @@ GangMember.prototype.calculateWantedLevelGain = function(gang) { const territoryMult = Math.pow(AllGangs[gang.facName].territory * 100, task.territory.wanted) / 100; if (isNaN(territoryMult) || territoryMult <= 0) { return 0; } if (task.baseWanted < 0) { - return task.baseWanted * statWeight * territoryMult; + return 0.5 * task.baseWanted * statWeight * territoryMult; } else { - return 6 * task.baseWanted / (3 * statWeight * territoryMult); + return 7 * task.baseWanted / (3 * statWeight * territoryMult); } } @@ -1010,12 +1012,12 @@ GangMember.prototype.createGangMemberUpgradePanel = function(gangObj, player) { var text = createElement("pre", { fontSize:"14px", display: "inline-block", width:"20%", innerText: - "Hack: " + this.hack + " (x" + formatNumber(this.hack_mult, 2) + ")\n" + - "Str: " + this.str + " (x" + formatNumber(this.str_mult, 2) + ")\n" + - "Def: " + this.def + " (x" + formatNumber(this.def_mult, 2) + ")\n" + - "Dex: " + this.dex + " (x" + formatNumber(this.dex_mult, 2) + ")\n" + - "Agi: " + this.agi + " (x" + formatNumber(this.agi_mult, 2) + ")\n" + - "Cha: " + this.cha + " (x" + formatNumber(this.cha_mult, 2) + ")\n", + "Hack: " + this.hack + " (x" + formatNumber(this.hack_mult * this.hack_asc_mult, 2) + ")\n" + + "Str: " + this.str + " (x" + formatNumber(this.str_mult * this.str_asc_mult, 2) + ")\n" + + "Def: " + this.def + " (x" + formatNumber(this.def_mult * this.def_asc_mult, 2) + ")\n" + + "Dex: " + this.dex + " (x" + formatNumber(this.dex_mult * this.dex_asc_mult, 2) + ")\n" + + "Agi: " + this.agi + " (x" + formatNumber(this.agi_mult * this.agi_asc_mult, 2) + ")\n" + + "Cha: " + this.cha + " (x" + formatNumber(this.cha_mult * this.cha_asc_mult, 2) + ")\n", }); //Already purchased upgrades @@ -1253,7 +1255,8 @@ Gang.prototype.displayGangContent = function(player) { "task to lower your wanted level.

" + "Installing Augmentations does NOT reset your progress with your Gang. " + "Furthermore, after installing Augmentations, you will " + - "automatically be a member of whatever Faction you created your gang with.

" + "automatically be a member of whatever Faction you created your gang with.

" + + "You can also manage your gang programmatically through Netscript using the Gang API" }); UIElems.gangManagementSubpage.appendChild(UIElems.gangDesc); @@ -1392,7 +1395,8 @@ Gang.prototype.displayGangContent = function(player) { "to win a clash depends on your gang's power, which is listed in the display below. " + "Your gang's power slowly accumulates over time. The accumulation rate is determined by the stats " + "of all Gang members you have assigned to the 'Territory Warfare' task. Gang members that are not " + - "assigned to this task do not contribute to your gang's power.

" + + "assigned to this task do not contribute to your gang's power. Your gang also loses a small amount " + + "of power whenever you lose a clash

" + "NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of whether you win " + "or lose the clash. A gang member being killed results in both respect and power loss for your gang.

" + "The amount of territory you have affects all aspects of your Gang members' production, including " + @@ -1615,7 +1619,7 @@ Gang.prototype.updateGangContent = function() { innerText: `Bonus time(s): ${this.storedCycles / CyclesPerSecond}`, display: "inline-block", tooltip: "You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the browser). " + - "Bonus time makes the Gang mechanic progress faster, up to 10x the normal speed", + "Bonus time makes the Gang mechanic progress faster, up to 5x the normal speed", })); UIElems.gangInfo.appendChild(createElement("br")); } else { diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 8b70b8c1d..54de5430e 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -3579,6 +3579,19 @@ function NetscriptFunctions(workerScript) { throw makeRuntimeRejectMsg(workerScript, nsGang.unknownGangApiExceptionMessage("getGangInformation", e)); } }, + getOtherGangInformation : function() { + if (workerScript.checkingRam) { + return updateStaticRam("getOtherGangInformation", CONSTANTS.ScriptGangApiBaseRamCost / 2); + } + updateDynamicRam("getOtherGangInformation", CONSTANTS.ScriptGangApiBaseRamCost / 2); + nsGang.checkGangApiAccess(workerScript, "getOtherGangInformation"); + + try { + return Object.assign(AllGangs); + } catch(e) { + throw makeRuntimeRejectMsg(workerScript, nsGang.unknownGangApiExceptionMessage("getOtherGangInformation", e)); + } + }, getMemberInformation : function(name) { if (workerScript.checkingRam) { return updateStaticRam("getMemberInformation", CONSTANTS.ScriptGangApiBaseRamCost / 2); diff --git a/src/data/gangmembertasks.ts b/src/data/gangmembertasks.ts index 1ad351dd1..7c2de479d 100644 --- a/src/data/gangmembertasks.ts +++ b/src/data/gangmembertasks.ts @@ -113,7 +113,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Mug People", params: { - baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1.2, + baseRespect: 0.00005, baseWanted: 0.00005, baseMoney: 1.2, strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 10, chaWeight: 15, difficulty: 1, }, @@ -124,11 +124,11 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Deal Drugs", params: { - baseRespect: 0.00006, baseWanted: 0.0015, baseMoney: 5, + baseRespect: 0.00006, baseWanted: 0.002, baseMoney: 5, agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3.5, territory: { - money: 1.25, + money: 1.2, respect: 1, wanted: 1.15, }, @@ -140,7 +140,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Strongarm Civilians", params: { - baseRespect: 0.00004, baseWanted: 0.002, baseMoney: 2.5, + baseRespect: 0.00004, baseWanted: 0.0035, baseMoney: 2.5, hackWeight: 10, strWeight: 25, defWeight: 25, dexWeight: 20, agiWeight: 10, chaWeight: 10, difficulty: 5, territory: { @@ -156,7 +156,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Run a Con", params: { - baseRespect: 0.00012, baseWanted: 0.015, baseMoney: 12.5, + baseRespect: 0.00012, baseWanted: 0.04, baseMoney: 15, strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 14, }, @@ -167,7 +167,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Armed Robbery", params: { - baseRespect: 0.00014, baseWanted: 0.075, baseMoney: 32, + baseRespect: 0.00014, baseWanted: 0.08, baseMoney: 38, hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20, difficulty: 20, }, @@ -178,7 +178,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Traffick Illegal Arms", params: { - baseRespect: 0.0002, baseWanted: 0.15, baseMoney: 50, + baseRespect: 0.0002, baseWanted: 0.18, baseMoney: 58, hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 25, difficulty: 32, territory: { @@ -194,7 +194,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Threaten & Blackmail", params: { - baseRespect: 0.0002, baseWanted: 0.075, baseMoney: 20, + baseRespect: 0.0002, baseWanted: 0.1, baseMoney: 24, hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28, }, @@ -205,7 +205,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Human Trafficking", params: { - baseRespect: 0.005, baseWanted: 0.3, baseMoney: 100, + baseRespect: 0.005, baseWanted: 0.4, baseMoney: 120, hackWeight: 30, strWeight: 5, defWeight: 5, dexWeight: 30, chaWeight: 30, difficulty: 36, territory: { @@ -221,7 +221,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Terrorism", params: { - baseRespect: 0.001, baseWanted: 1.5, + baseRespect: 0.01, baseWanted: 1.5, hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 20, difficulty: 36, territory: {