More gang rebalancing. Removed penalty for committing crimes through Singularity functions

This commit is contained in:
danielyxie 2018-10-24 13:20:51 -05:00
parent e37f7852e6
commit 910fa6d0a6
4 changed files with 32 additions and 22 deletions

@ -253,7 +253,6 @@ let CONSTANTS = {
ClassLeadershipBaseCost: 320, ClassLeadershipBaseCost: 320,
ClassGymBaseCost: 120, ClassGymBaseCost: 120,
CrimeSingFnDivider: 2, //Factor by which exp/profit is reduced when commiting crime through Sing Fn
CrimeShoplift: "shoplift", CrimeShoplift: "shoplift",
CrimeRobStore: "rob a store", CrimeRobStore: "rob a store",
CrimeMug: "mug someone", 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 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 * 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 * 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-) * 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: 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 * Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes

@ -287,7 +287,7 @@ Gang.prototype.processTerritoryAndPowerGains = function(numCycles=1) {
} else if (this.territoryClashChance > 0) { } else if (this.territoryClashChance > 0) {
// Engagement turned off, but still a positive clash chance. So there's // Engagement turned off, but still a positive clash chance. So there's
// still a chance of clashing but it slowly goes down over time // 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 // Then process territory
@ -393,19 +393,22 @@ Gang.prototype.calculatePower = function() {
memberTotal += gain; memberTotal += gain;
} }
} }
return (0.001 * memberTotal); return (0.015 * this.getTerritory() * memberTotal);
} }
Gang.prototype.clash = function(won=false) { Gang.prototype.clash = function(won=false) {
// Determine if a gang member should die // Determine if a gang member should die
let baseDeathChance; let baseDeathChance = 0.01;
won ? baseDeathChance = 0.03 : baseDeathChance = 0.06; if (won) { baseDeathChance /= 2; }
// If the clash was lost, the player loses a small percentage of power // If the clash was lost, the player loses a small percentage of power
if (!won) { 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) { for (let i = this.members.length - 1; i >= 0; --i) {
const member = this.members[i]; const member = this.members[i];
@ -413,7 +416,7 @@ Gang.prototype.clash = function(won=false) {
if (member.task !== "Territory Warfare") { continue; } if (member.task !== "Territory Warfare") { continue; }
// Chance to die is decreased based on defense // 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) { if (Math.random() < modifiedDeathChance) {
this.killMember(member); this.killMember(member);
} }
@ -678,7 +681,7 @@ GangMember.prototype.calculateMoneyGain = function(gang) {
GangMember.prototype.gainExperience = function(numCycles=1) { GangMember.prototype.gainExperience = function(numCycles=1) {
const task = this.getTask(); const task = this.getTask();
if (task == null || !(task instanceof GangMemberTask) || task === GangMemberTasks["Unassigned"]) {return;} 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 difficultyPerCycles = difficultyMult * numCycles;
const weightDivisor = 1500; const weightDivisor = 1500;
this.hack_exp += (task.hackWeight / weightDivisor) * difficultyPerCycles; this.hack_exp += (task.hackWeight / weightDivisor) * difficultyPerCycles;

@ -3332,7 +3332,7 @@ function NetscriptFunctions(workerScript) {
if(workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) { if(workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) {
workerScript.scriptRef.log("Attempting to commit crime: "+crime.name+"..."); 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) { getCrimeChance : function(crimeRoughName) {
var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;
@ -3539,9 +3539,9 @@ function NetscriptFunctions(workerScript) {
gang : { gang : {
getMemberNames : function() { getMemberNames : function() {
if (workerScript.checkingRam) { 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"); nsGang.checkGangApiAccess(workerScript, "getMemberNames");
try { try {
@ -3623,9 +3623,9 @@ function NetscriptFunctions(workerScript) {
}, },
canRecruitMember : function() { canRecruitMember : function() {
if (workerScript.checkingRam) { 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"); nsGang.checkGangApiAccess(workerScript, "canRecruitMember");
try { try {
@ -3649,9 +3649,9 @@ function NetscriptFunctions(workerScript) {
}, },
getTaskNames : function() { getTaskNames : function() {
if (workerScript.checkingRam) { 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"); nsGang.checkGangApiAccess(workerScript, "getTaskNames");
try { try {
@ -3684,9 +3684,9 @@ function NetscriptFunctions(workerScript) {
}, },
getEquipmentNames : function() { getEquipmentNames : function() {
if (workerScript.checkingRam) { 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"); nsGang.checkGangApiAccess(workerScript, "getEquipmentNames");
try { try {
@ -3710,9 +3710,9 @@ function NetscriptFunctions(workerScript) {
}, },
purchaseEquipment : function(memberName, equipName) { purchaseEquipment : function(memberName, equipName) {
if (workerScript.checkingRam) { 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"); nsGang.checkGangApiAccess(workerScript, "purchaseEquipment");
try { try {
@ -3730,9 +3730,9 @@ function NetscriptFunctions(workerScript) {
}, },
ascendMember : function(name) { ascendMember : function(name) {
if (workerScript.checkingRam) { 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"); nsGang.checkGangApiAccess(workerScript, "ascendMember");
try { try {

@ -264,6 +264,13 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
name: "Train Hacking", name: "Train Hacking",
params: {hackWeight: 100, difficulty: 8}, 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.", 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, isCombat: true,
@ -271,7 +278,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
name: "Territory Warfare", name: "Territory Warfare",
params: { params: {
hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20, chaWeight: 5, hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20, chaWeight: 5,
difficulty: 3 difficulty: 5
}, },
}, },
]; ];