Gang bugfixes and rebalancing

This commit is contained in:
danielyxie 2018-10-23 18:57:07 -05:00
parent 61150f5823
commit e37f7852e6
2 changed files with 46 additions and 37 deletions

@ -1,6 +1,4 @@
/* /*
gang member upgrades - they should be cheaper as the gang gets more respect/power
Also add police clashes Also add police clashes
balance point to keep them from running out of control 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 MaximumGangMembers = 40;
const GangRecruitCostMultiplier = 2; const GangRecruitCostMultiplier = 2;
const CyclesPerTerritoryAndPowerUpdate = 100; 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 // Switch between territory and management screen with 1 and 2
$(document).keydown(function(event) { $(document).keydown(function(event) {
@ -395,13 +393,13 @@ Gang.prototype.calculatePower = function() {
memberTotal += gain; memberTotal += gain;
} }
} }
return (0.0005 * memberTotal); return (0.001 * 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;
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 the clash was lost, the player loses a small percentage of power
if (!won) { if (!won) {
@ -415,7 +413,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(def, 0.25); const modifiedDeathChance = baseDeathChance / Math.pow(member.def, 0.25);
if (Math.random() < modifiedDeathChance) { if (Math.random() < modifiedDeathChance) {
this.killMember(member); this.killMember(member);
} }
@ -426,9 +424,9 @@ Gang.prototype.killMember = function(memberObj) {
const gangName = this.facName; const gangName = this.facName;
// Player loses a percentage of total respect, plus whatever respect that member has earned // 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; 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) { for (let i = 0; i < this.members.length; ++i) {
if (memberObj.name === this.members[i].name) { 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); this.respect = Math.max(1, this.respect - res.respect);
if (workerScript == null) { if (workerScript == null) {
dialogBoxCreate([`You ascended ${memberObj.name}!`, dialogBoxCreate([`You ascended ${memberObj.name}!`,
"",
`Your gang lost ${numeralWrapper.format(res.respect, "0.000a")} respect`, `Your gang lost ${numeralWrapper.format(res.respect, "0.000a")} respect`,
"",
`${memberObj.name} gained the following stat multipliers for ascending:`, `${memberObj.name} gained the following stat multipliers for ascending:`,
`Hacking: ${res.hack}`, `Hacking: ${numeralWrapper.format(res.hack, "0.000%")}`,
`Strength: ${res.str}`, `Strength: ${numeralWrapper.format(res.str, "0.000%")}`,
`Defense: ${res.def}`, `Defense: ${numeralWrapper.format(res.def, "0.000%")}`,
`Dexterity: ${res.dex}`, `Dexterity: ${numeralWrapper.format(res.dex, "0.000%")}`,
`Agility: ${res.agi}`, `Agility: ${numeralWrapper.format(res.agi, "0.000%")}`,
`Charisma: ${res.cha}`].join("<br>")); `Charisma: ${numeralWrapper.format(res.cha, "0.000%")}`].join("<br>"));
} else { } else {
workerScript.log(`Ascended Gang member ${memberObj.name}`); workerScript.log(`Ascended Gang member ${memberObj.name}`);
} }
@ -667,7 +667,7 @@ GangMember.prototype.calculateMoneyGain = function(gang) {
(task.dexWeight/100) * this.dex + (task.dexWeight/100) * this.dex +
(task.agiWeight/100) * this.agi + (task.agiWeight/100) * this.agi +
(task.chaWeight/100) * this.cha; (task.chaWeight/100) * this.cha;
statWeight -= (3.5 * task.difficulty); statWeight -= (3.2 * task.difficulty);
if (statWeight <= 0) { return 0; } if (statWeight <= 0) { return 0; }
const territoryMult = Math.pow(AllGangs[gang.facName].territory * 100, task.territory.money) / 100; const territoryMult = Math.pow(AllGangs[gang.facName].territory * 100, task.territory.money) / 100;
if (isNaN(territoryMult) || territoryMult <= 0) { return 0; } if (isNaN(territoryMult) || territoryMult <= 0) { return 0; }
@ -677,13 +677,16 @@ 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)) {return;} if (task == null || !(task instanceof GangMemberTask) || task === GangMemberTasks["Unassigned"]) {return;}
this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles; const difficultyMult = Math.pow(task.difficulty, 0.8);
this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles; const difficultyPerCycles = difficultyMult * numCycles;
this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles; const weightDivisor = 1500;
this.dex_exp += (task.dexWeight / 1500) * task.difficulty * numCycles; this.hack_exp += (task.hackWeight / weightDivisor) * difficultyPerCycles;
this.agi_exp += (task.agiWeight / 1500) * task.difficulty * numCycles; this.str_exp += (task.strWeight / weightDivisor) * difficultyPerCycles;
this.cha_exp += (task.chaWeight / 1500) * task.difficulty * numCycles; 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) { GangMember.prototype.recordEarnedRespect = function(numCycles=1, gang) {
@ -855,7 +858,6 @@ GangMemberTask.fromJSON = function(value) {
Reviver.constructors.GangMemberTask = GangMemberTask; Reviver.constructors.GangMemberTask = GangMemberTask;
//TODO Human trafficking and an equivalent hacking crime
const GangMemberTasks = {}; const GangMemberTasks = {};
function addGangMemberTask(name, desc, isHacking, isCombat, params) { function addGangMemberTask(name, desc, isHacking, isCombat, params) {
@ -1688,6 +1690,9 @@ Gang.prototype.createGangMemberDisplayElement = function(memberObj) {
const txt = createElement("pre", { const txt = createElement("pre", {
innerText: ["Are you sure you want to ascend this member? (S)he will lose all of", 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.", "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", "In return, (s)he will gain the following permanent boost to stat multipliers:\n",
`Hacking: +${numeralWrapper.format(ascendBenefits.hack, "0.00%")}`, `Hacking: +${numeralWrapper.format(ascendBenefits.hack, "0.00%")}`,
`Strength: +${numeralWrapper.format(ascendBenefits.str, "0.00%")}`, `Strength: +${numeralWrapper.format(ascendBenefits.str, "0.00%")}`,
@ -1720,8 +1725,12 @@ Gang.prototype.createGangMemberDisplayElement = function(memberObj) {
const ascendHelpTip = createElement("div", { const ascendHelpTip = createElement("div", {
class: "help-tip", class: "help-tip",
clickListener: () => { clickListener: () => {
dialogBoxCreate(["TODO Ascending a Gang Member resets the member's progress and stats in exchange", dialogBoxCreate(["Ascending a Gang Member resets the member's progress and stats in exchange",
"for a permanent boost to their stat multipliers. "].join(" ")); "for a permanent boost to their stat multipliers.",
"<br><br>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.",
"<br><br>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: "?", innerText: "?",
marginTop: "5px", marginTop: "5px",

@ -124,11 +124,11 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Deal Drugs", name: "Deal Drugs",
params: { params: {
baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 5, baseRespect: 0.00006, baseWanted: 0.0015, baseMoney: 5,
agiWeight: 20, dexWeight: 20, chaWeight: 60, agiWeight: 20, dexWeight: 20, chaWeight: 60,
difficulty: 3.5, difficulty: 3.5,
territory: { territory: {
money: 1.1, money: 1.25,
respect: 1, respect: 1,
wanted: 1.15, wanted: 1.15,
}, },
@ -140,11 +140,11 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Strongarm Civilians", name: "Strongarm Civilians",
params: { 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, hackWeight: 10, strWeight: 25, defWeight: 25, dexWeight: 20, agiWeight: 10, chaWeight: 10,
difficulty: 5, difficulty: 5,
territory: { territory: {
money: 2, money: 1.6,
respect: 1.1, respect: 1.1,
wanted: 1.5 wanted: 1.5
} }
@ -156,7 +156,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Run a Con", name: "Run a Con",
params: { 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, strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40,
difficulty: 14, difficulty: 14,
}, },
@ -167,7 +167,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Armed Robbery", name: "Armed Robbery",
params: { 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, hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20,
difficulty: 20, difficulty: 20,
}, },
@ -178,11 +178,11 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Traffick Illegal Arms", name: "Traffick Illegal Arms",
params: { 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, hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 25,
difficulty: 28, difficulty: 32,
territory: { territory: {
money: 1.2, money: 1.4,
respect: 1.3, respect: 1.3,
wanted: 1.25, wanted: 1.25,
}, },
@ -194,7 +194,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Threaten & Blackmail", name: "Threaten & Blackmail",
params: { 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, hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25,
difficulty: 28, difficulty: 28,
}, },
@ -205,7 +205,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Human Trafficking", name: "Human Trafficking",
params: { 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, hackWeight: 30, strWeight: 5, defWeight: 5, dexWeight: 30, chaWeight: 30,
difficulty: 36, difficulty: 36,
territory: { territory: {
@ -221,7 +221,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
isHacking: false, isHacking: false,
name: "Terrorism", name: "Terrorism",
params: { params: {
baseRespect: 0.001, baseWanted: 1, baseRespect: 0.001, baseWanted: 1.5,
hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 20, hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 20,
difficulty: 36, difficulty: 36,
territory: { territory: {