From b59cf4ddb16f5ed56497d4875d0e46bda6c27c8a Mon Sep 17 00:00:00 2001 From: danielyxie Date: Tue, 23 Oct 2018 18:57:07 -0500 Subject: [PATCH] Gang bugfixes and rebalancing --- src/Gang.js | 59 +++++++++++++++++++++---------------- src/data/gangmembertasks.ts | 24 +++++++-------- 2 files changed, 46 insertions(+), 37 deletions(-) diff --git a/src/Gang.js b/src/Gang.js index 7baabe31c..59c6419bb 100644 --- a/src/Gang.js +++ b/src/Gang.js @@ -1,6 +1,4 @@ /* -gang member upgrades - they should be cheaper as the gang gets more respect/power - Also add police clashes balance point to keep them from running out of control */ @@ -37,7 +35,7 @@ const GangRespectToReputationRatio = 2; // Respect is divided by this to get rep const MaximumGangMembers = 40; const GangRecruitCostMultiplier = 2; const CyclesPerTerritoryAndPowerUpdate = 100; -const AscensionMultiplierRatio = 10 / 100; // Portion of upgrade multiplier that is kept after ascending +const AscensionMultiplierRatio = 15 / 100; // Portion of upgrade multiplier that is kept after ascending // Switch between territory and management screen with 1 and 2 $(document).keydown(function(event) { @@ -395,13 +393,13 @@ Gang.prototype.calculatePower = function() { memberTotal += gain; } } - return (0.0005 * memberTotal); + return (0.001 * memberTotal); } Gang.prototype.clash = function(won=false) { // Determine if a gang member should die let baseDeathChance; - won ? baseDeathChance = 0.05 : baseDeathChance = 0.1; + won ? baseDeathChance = 0.03 : baseDeathChance = 0.06; // If the clash was lost, the player loses a small percentage of power if (!won) { @@ -415,7 +413,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(def, 0.25); + const modifiedDeathChance = baseDeathChance / Math.pow(member.def, 0.25); if (Math.random() < modifiedDeathChance) { this.killMember(member); } @@ -426,9 +424,9 @@ Gang.prototype.killMember = function(memberObj) { const gangName = this.facName; // Player loses a percentage of total respect, plus whatever respect that member has earned - const totalRespect = this.gang.respect; + const totalRespect = this.respect; const lostRespect = (0.05 * totalRespect) + memberObj.earnedRespect; - this.gang.respect = Math.max(0, totalRespect - lostRespect); + this.respect = Math.max(0, totalRespect - lostRespect); for (let i = 0; i < this.members.length; ++i) { if (memberObj.name === this.members[i].name) { @@ -461,14 +459,16 @@ Gang.prototype.ascendMember = function(memberObj, workerScript) { this.respect = Math.max(1, this.respect - res.respect); if (workerScript == null) { dialogBoxCreate([`You ascended ${memberObj.name}!`, + "", `Your gang lost ${numeralWrapper.format(res.respect, "0.000a")} respect`, + "", `${memberObj.name} gained the following stat multipliers for ascending:`, - `Hacking: ${res.hack}`, - `Strength: ${res.str}`, - `Defense: ${res.def}`, - `Dexterity: ${res.dex}`, - `Agility: ${res.agi}`, - `Charisma: ${res.cha}`].join("
")); + `Hacking: ${numeralWrapper.format(res.hack, "0.000%")}`, + `Strength: ${numeralWrapper.format(res.str, "0.000%")}`, + `Defense: ${numeralWrapper.format(res.def, "0.000%")}`, + `Dexterity: ${numeralWrapper.format(res.dex, "0.000%")}`, + `Agility: ${numeralWrapper.format(res.agi, "0.000%")}`, + `Charisma: ${numeralWrapper.format(res.cha, "0.000%")}`].join("
")); } else { workerScript.log(`Ascended Gang member ${memberObj.name}`); } @@ -667,7 +667,7 @@ GangMember.prototype.calculateMoneyGain = function(gang) { (task.dexWeight/100) * this.dex + (task.agiWeight/100) * this.agi + (task.chaWeight/100) * this.cha; - statWeight -= (3.5 * task.difficulty); + statWeight -= (3.2 * task.difficulty); if (statWeight <= 0) { return 0; } const territoryMult = Math.pow(AllGangs[gang.facName].territory * 100, task.territory.money) / 100; if (isNaN(territoryMult) || territoryMult <= 0) { return 0; } @@ -677,13 +677,16 @@ GangMember.prototype.calculateMoneyGain = function(gang) { GangMember.prototype.gainExperience = function(numCycles=1) { const task = this.getTask(); - if (task == null || !(task instanceof GangMemberTask)) {return;} - this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles; - this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles; - this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles; - this.dex_exp += (task.dexWeight / 1500) * task.difficulty * numCycles; - this.agi_exp += (task.agiWeight / 1500) * task.difficulty * numCycles; - this.cha_exp += (task.chaWeight / 1500) * task.difficulty * numCycles; + if (task == null || !(task instanceof GangMemberTask) || task === GangMemberTasks["Unassigned"]) {return;} + const difficultyMult = Math.pow(task.difficulty, 0.8); + const difficultyPerCycles = difficultyMult * numCycles; + const weightDivisor = 1500; + this.hack_exp += (task.hackWeight / weightDivisor) * difficultyPerCycles; + this.str_exp += (task.strWeight / weightDivisor) * difficultyPerCycles; + this.def_exp += (task.defWeight / weightDivisor) * difficultyPerCycles; + this.dex_exp += (task.dexWeight / weightDivisor) * difficultyPerCycles; + this.agi_exp += (task.agiWeight / weightDivisor) * difficultyPerCycles; + this.cha_exp += (task.chaWeight / weightDivisor) * difficultyPerCycles; } GangMember.prototype.recordEarnedRespect = function(numCycles=1, gang) { @@ -855,7 +858,6 @@ GangMemberTask.fromJSON = function(value) { Reviver.constructors.GangMemberTask = GangMemberTask; -//TODO Human trafficking and an equivalent hacking crime const GangMemberTasks = {}; function addGangMemberTask(name, desc, isHacking, isCombat, params) { @@ -1688,6 +1690,9 @@ Gang.prototype.createGangMemberDisplayElement = function(memberObj) { const txt = createElement("pre", { innerText: ["Are you sure you want to ascend this member? (S)he will lose all of", "his non-Augmentation upgrades and his/her stats will reset back to 1.", + "", + `Furthermore, your gang will lose ${numeralWrapper.format(memberObj.earnedRespect, "0.000000")} respect`, + "", "In return, (s)he will gain the following permanent boost to stat multipliers:\n", `Hacking: +${numeralWrapper.format(ascendBenefits.hack, "0.00%")}`, `Strength: +${numeralWrapper.format(ascendBenefits.str, "0.00%")}`, @@ -1720,8 +1725,12 @@ Gang.prototype.createGangMemberDisplayElement = function(memberObj) { const ascendHelpTip = createElement("div", { class: "help-tip", clickListener: () => { - dialogBoxCreate(["TODO Ascending a Gang Member resets the member's progress and stats in exchange", - "for a permanent boost to their stat multipliers. "].join(" ")); + dialogBoxCreate(["Ascending a Gang Member resets the member's progress and stats in exchange", + "for a permanent boost to their stat multipliers.", + "

The additional stat multiplier that the Gang Member gains upon ascension", + "is based on the amount of multipliers the member has from non-Augmentation Equipment.", + "

Upon ascension, the member will lose all of its non-Augmentation Equipment and your", + "gang will lose respect equal to the total respect earned by the member."].join(" ")); }, innerText: "?", marginTop: "5px", diff --git a/src/data/gangmembertasks.ts b/src/data/gangmembertasks.ts index de8b8c91c..8a3c6e98c 100644 --- a/src/data/gangmembertasks.ts +++ b/src/data/gangmembertasks.ts @@ -124,11 +124,11 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Deal Drugs", params: { - baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 5, + baseRespect: 0.00006, baseWanted: 0.0015, baseMoney: 5, agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3.5, territory: { - money: 1.1, + money: 1.25, respect: 1, wanted: 1.15, }, @@ -140,11 +140,11 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Strongarm Civilians", params: { - baseRespect: 0.00004, baseWanted: 0.0001, baseMoney: 2.5, + baseRespect: 0.00004, baseWanted: 0.002, baseMoney: 2.5, hackWeight: 10, strWeight: 25, defWeight: 25, dexWeight: 20, agiWeight: 10, chaWeight: 10, difficulty: 5, territory: { - money: 2, + money: 1.6, respect: 1.1, wanted: 1.5 } @@ -156,7 +156,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Run a Con", params: { - baseRespect: 0.00015, baseWanted: 0.01, baseMoney: 12.5, + baseRespect: 0.00012, baseWanted: 0.015, baseMoney: 12.5, 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.00015, baseWanted: 0.05, baseMoney: 32, + baseRespect: 0.00014, baseWanted: 0.075, baseMoney: 32, hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20, difficulty: 20, }, @@ -178,11 +178,11 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Traffick Illegal Arms", params: { - baseRespect: 0.0003, baseWanted: 0.1, baseMoney: 50, + baseRespect: 0.0002, baseWanted: 0.15, baseMoney: 50, hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 25, - difficulty: 28, + difficulty: 32, territory: { - money: 1.2, + money: 1.4, respect: 1.3, wanted: 1.25, }, @@ -194,7 +194,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [ isHacking: false, name: "Threaten & Blackmail", params: { - baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 20, + baseRespect: 0.0002, baseWanted: 0.075, baseMoney: 20, 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.2, baseMoney: 100, + baseRespect: 0.005, baseWanted: 0.3, baseMoney: 100, 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, + baseRespect: 0.001, baseWanted: 1.5, hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 20, difficulty: 36, territory: {