From 94aafba04b755c42638eab053e506241c73df4b6 Mon Sep 17 00:00:00 2001
From: Daniel Xie
Date: Mon, 8 May 2017 11:00:34 -0500
Subject: [PATCH] Added 3 more crimes..home computer no longer reset on
prestige
---
index.html | 33 +++++++++++++++++++++-----
src/Augmentations.js | 3 ++-
src/Constants.js | 3 +++
src/Crimes.js | 56 ++++++++++++++++++++++++++++++++++++++++++--
src/Location.js | 34 ++++++++++++++++++++++++++-
src/Player.js | 25 ++++++++++++++++++--
src/Prestige.js | 24 +++++++++++++------
src/Server.js | 1 -
src/Terminal.js | 4 +++-
src/engine.js | 2 +-
10 files changed, 163 insertions(+), 22 deletions(-)
diff --git a/index.html b/index.html
index 81737cb14..34e9775b3 100644
--- a/index.html
+++ b/index.html
@@ -582,13 +582,34 @@
In the Slums you can commit crimes to earn money and experience. Crime attempts are not always
successful. Your chance at successfully committing a crime is determined by your stats.
- Shoplift
- Mug someone
- Deal Drugs
- Traffick Illegal Arms
- Homicide
- Kidnap and Ransom
+ Shoplift
+ Attempt to shoplift from a low-end retailers
+
+ Mug someone
+ Attempt to mug a random person on the street
+
+ Deal Drugs
+ Attempt to deal drugs
+
+ Traffick Illegal Arms
+ Attempt to smuggle illegal arms into the city and sell them to gangs and criminal organizations
+
+ Homicide
+ Attempt to murder a random person on the street
+
+ Grand Theft Auto
+ Attempt to commit grand theft auto
+
+ Kidnap and Ransom
+ Attempt to kidnap and ransom a high-profile target
+
+ Assassinate
+ Attempt to assassinate a high-profile target
+
+ Heist
+ Attempt to pull off the ultimate heist
+
diff --git a/src/Augmentations.js b/src/Augmentations.js
index 2350ce7b8..baa32b6f8 100644
--- a/src/Augmentations.js
+++ b/src/Augmentations.js
@@ -11,7 +11,7 @@ function Augmentation(name) {
//Level - Only applicable for some augmentations
// NeuroFlux Governor
- this.level = 0;
+ this.level = 1;
}
Augmentation.prototype.setInfo = function(inf) {
@@ -781,6 +781,7 @@ initAugmentations = function() {
delete Augmentations[AugmentationNames.NeuroFluxGovernor];
} else {
NeuroFluxGovernor.setRequirements(1000, 1000000);
+ NeuroFluxGovernor.level = 1;
}
NeuroFluxGovernor.setInfo("A device that is embedded in the back of the neck. The NeuroFlux Governor " +
"monitors and regulates nervous impulses coming to and from the spinal column, " +
diff --git a/src/Constants.js b/src/Constants.js
index 443a605ca..9df58e26d 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -94,7 +94,10 @@ CONSTANTS = {
CrimeDrugs: "deal drugs",
CrimeTraffickArms: "traffick illegal arms",
CrimeHomicide: "commit homicide",
+ CrimeGrandTheftAuto: "commit grand theft auto",
CrimeKidnap: "kidnap someone for ransom",
+ CrimeAssassination: "assassinate a high-profile target",
+ CrimeHeist: "pull off the ultimate heist",
//Text that is displayed when the 'help' command is ran in Terminal
HelpText: "analyze Get statistics and information about current machine
" +
diff --git a/src/Crimes.js b/src/Crimes.js
index 457b77803..ac5f776fe 100644
--- a/src/Crimes.js
+++ b/src/Crimes.js
@@ -24,9 +24,24 @@ function commitHomicideCrime() {
Player.startCrime(0, 2, 2, 2, 2, 0, 1000, 3000); //$333.3/s, 0.66 combat exp/s
}
+function commitGrandTheftAutoCrime() {
+ Player.crimeType = CONSTANTS.CrimeGrandTheftAuto;
+ Player.startCrime(8, 8, 8, 40, 20, 150000, 80000); //$1875/2, .1 exp/s, .5 exp/s, .25 exp/s
+}
+
function commitKidnapCrime() {
Player.crimeType = CONSTANTS.CrimeKidnap;
- Player.startCrime(0, 20, 20, 20, 20, 20, 200000, 120000); //$1666.666/s. .167 exp/s
+ Player.startCrime(0, 20, 20, 20, 20, 20, 300000, 120000); //$2500/s. .167 exp/s
+}
+
+function commitAssassinationCrime() {
+ Player.crimeType = CONSTANTS.CrimeAssassination;
+ Player.startCrime(0, 75, 75, 75, 75, 0, 1000000, 300000); //$3333.33/s, .25 exp/s
+}
+
+function commitHeistCrime() {
+ Player.crimeType = CONSTANTS.CrimeHeist;
+ Player.startCrime(90, 90, 90, 90, 90, 90, 25000000, 600000); //$41,666.67/s, .15exp/s
}
function determineCrimeSuccess(crime, moneyGained) {
@@ -47,9 +62,18 @@ function determineCrimeSuccess(crime, moneyGained) {
case CONSTANTS.CrimeHomicide:
chance = determineCrimeChanceHomicide();
break;
+ case CONSTANTS.CrimeGrandTheftAuto:
+ chance = determineCrimeChanceGrandTheftAuto();
+ break;
case CONSTANTS.CrimeKidnap:
chance = determineCrimeChanceKidnap();
break;
+ case CONSTANTS.CrimeAssassination:
+ chance = determineCrimeChanceAssassination();
+ break;
+ case CONSTANTS.CrimeHeist:
+ chance = determineCrimeChanceHeist();
+ break;
default:
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
return;
@@ -107,11 +131,39 @@ function determineCrimeChanceHomicide() {
return Math.min(chance, 1);
}
+function determineCrimeChanceGrandTheftAuto() {
+ var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel +
+ Player.strength / CONSTANTS.MaxSkillLevel +
+ Player.defense / CONSTANTS.MaxSkillLevel +
+ 4 * Player.dexterity / CONSTANTS.MaxSkillLevel +
+ Player.agility / CONSTANTS.MaxSkillLevel +
+ 2 * Player.charisma / CONSTANTS.MaxSkillLevel)) / 8;
+ return Math.min(chance, 1);
+}
+
function determineCrimeChanceKidnap() {
return ((Player.charisma / CONSTANTS.MaxSkillLevel +
Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
- Player.agility / CONSTANTS.MaxSkillLevel)) / 4;
+ Player.agility / CONSTANTS.MaxSkillLevel)) / 6;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceAssassination() {
+ var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
+ Player.defense / CONSTANTS.MaxSkillLevel +
+ Player.dexterity / CONSTANTS.MaxSkillLevel +
+ Player.agility / CONSTANTS.MaxSkillLevel)) / 8;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceHeist() {
+ var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel +
+ Player.strength / CONSTANTS.MaxSkillLevel +
+ Player.defense / CONSTANTS.MaxSkillLevel +
+ Player.dexterity / CONSTANTS.MaxSkillLevel +
+ Player.agility / CONSTANTS.MaxSkillLevel +
+ Player.charisma / CONSTANTS.MaxSkillLevel)) / 18;
return Math.min(chance, 1);
}
diff --git a/src/Location.js b/src/Location.js
index ef7842675..32178a95c 100644
--- a/src/Location.js
+++ b/src/Location.js
@@ -148,7 +148,10 @@ displayLocationContent = function() {
var slumsDealDrugs = document.getElementById("location-slums-deal-drugs");
var slumsTrafficArms = document.getElementById("location-slums-traffic-arms");
var slumsHomicide = document.getElementById("location-slums-homicide");
+ var slumsGta = document.getElementById("location-slums-gta");
var slumsKidnap = document.getElementById("location-slums-kidnap");
+ var slumsAssassinate = document.getElementById("location-slums-assassinate");
+ var slumsHeist = document.getElementById("location-slums-heist");
var loc = Player.location;
@@ -223,7 +226,10 @@ displayLocationContent = function() {
slumsDealDrugs.style.display = "none";
slumsTrafficArms.style.display = "none";
slumsHomicide.style.display = "none";
+ slumsGta.style.display = "none";
slumsKidnap.style.display = "none";
+ slumsAssassinate.style.display = "none";
+ slumsHeist.style.display = "none";
//Check if the player is employed at this Location. If he is, display the "Work" button,
//update the job title, etc.
@@ -819,7 +825,10 @@ displayLocationContent = function() {
var drugsChance = determineCrimeChanceDealDrugs();
var armsChance = determineCrimeChanceTraffickArms();
var homicideChance = determineCrimeChanceHomicide();
+ var gtaChance = determineCrimeChanceGrandTheftAuto();
var kidnapChance = determineCrimeChanceKidnap();
+ var assassinateChance = determineCrimeChanceAssassination();
+ var heistChance = determineCrimeChanceHeist();
slumsDescText.style.display = "block";
slumsShoplift.style.display = "block";
@@ -832,9 +841,14 @@ displayLocationContent = function() {
slumsTrafficArms.innerHTML = "Traffick Illegal Arms (" + (armsChance*100).toFixed(3) + "% chance of success)";
slumsHomicide.style.display = "block";
slumsHomicide.innerHTML = "Homicide (" + (homicideChance*100).toFixed(3) + "% chance of success)";
+ slumsGta.style.display = "block";
+ slumsGta.innerHTML = "Grand Theft Auto (" + (gtaChance*100).toFixed(3) + "% chance of success)";
slumsKidnap.style.display = "block";
slumsKidnap.innerHTML = "Kidnap and Ransom (" + (kidnapChance*100).toFixed(3) + "% chance of success)";
-
+ slumsAssassinate.style.display = "block";
+ slumsAssassinate.innerHTML = "Assassinate (" + (assassinateChance*100).toFixed(3) + "% chance of success)";
+ slumsHeist.style.display = "block";
+ slumsHeist.innerHTML = "Heist (" + (heistChance*100).toFixed(3) + "% chance of success)";
break;
default:
console.log("ERROR: INVALID LOCATION");
@@ -1307,7 +1321,10 @@ initLocationButtons = function() {
var slumsDealDrugs = document.getElementById("location-slums-deal-drugs");
var slumsTrafficArms = document.getElementById("location-slums-traffic-arms");
var slumsHomicide = document.getElementById("location-slums-homicide");
+ var slumsGta = document.getElementById("location-slums-gta");
var slumsKidnap = document.getElementById("location-slums-kidnap");
+ var slumsAssassinate = document.getElementById("location-slums-assassinate");
+ var slumsHeist = document.getElementById("location-slums-heist");
softwareJob.addEventListener("click", function() {
Player.applyForSoftwareJob();
@@ -1474,10 +1491,25 @@ initLocationButtons = function() {
return false;
});
+ slumsGta.addEventListener("click", function() {
+ commitGrandTheftAutoCrime();
+ return false;
+ });
+
slumsKidnap.addEventListener("click", function() {
commitKidnapCrime();
return false;
});
+
+ slumsAssassinate.addEventListener("click", function() {
+ commitAssassinationCrime();
+ return false;
+ });
+
+ slumsHeist.addEventListener("click", function() {
+ commitHeistCrime();
+ return false;
+ });
}
travelToCity = function(destCityName, cost) {
diff --git a/src/Player.js b/src/Player.js
index 6f70893c7..f01fc352d 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -104,9 +104,15 @@ function PlayerObject() {
this.numPeopleKilled = 0;
this.numPeopleKilledTotal = 0;
this.numPeopleKilledLifetime = 0;
+ this.numTimesGrandTheftAuto = 0;
+ this.numTimesGrandTheftAutoTotal = 0;
+ this.numTimesGrandTheftAutoLifetime = 0;
this.numTimesKidnapped = 0;
this.numTimesKidnappedTotal = 0;
this.numTimesKidnappedLifetime = 0;
+ this.numTimesHeist = 0;
+ this.numTimesHeistTotal = 0;
+ this.numTimesHeistLifetime = 0;
//Achievements and achievement progress
@@ -960,6 +966,7 @@ PlayerObject.prototype.commitCrime = function (numCycles) {
PlayerObject.prototype.finishCrime = function(cancelled) {
//Determine crime success/failure
if (!cancelled) {
+ var statusText = ""; //TODO, unique message for each crime when you succeed
if (determineCrimeSuccess(this.crimeType, this.workMoneyGained)) {
//Handle Karma and crime statistics
switch(this.crimeType) {
@@ -983,9 +990,21 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
++this.numPeopleKilled;
this.karma -= 3;
break;
+ case CONSTANTS.CrimeGrandTheftAuto:
+ ++this.numTimesGrandTheftAuto;
+ this.karma -= 5;
+ break;
case CONSTANTS.CrimeKidnap:
++this.numTimesKidnapped;
- this.karma -= 3;
+ this.karma -= 6;
+ break;
+ case CONSTANTS.CrimeAssassination:
+ ++this.numPeopleKilled;
+ this.karma -= 10;
+ break;
+ case CONSTANTS.CrimeHeist:
+ ++this.numTimesHeist;
+ this.karma -= 15;
break;
default:
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
@@ -1019,9 +1038,11 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
formatNumber(this.workAgiExpGained, 4) + " agility experience
" +
formatNumber(this.workChaExpGained, 4) + " charisma experience");
}
+
+ this.gainWorkExp();
}
- this.gainWorkExp();
+
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
diff --git a/src/Prestige.js b/src/Prestige.js
index a52e19b39..c6e37e56c 100644
--- a/src/Prestige.js
+++ b/src/Prestige.js
@@ -32,9 +32,17 @@ function prestigeAugmentation() {
Player.numPeopleKilledTotal += Player.numPeopleKilled;
Player.numPeopleKilledLifetime += Player.numPeopleKilled;
Player.numPeopleKilled = 0;
+ Player.numTimesGrandTheftAutoTotal += Player.numTimesGrandTheftAuto;
+ Player.numTimesGrandTheftAutoLifetime += Player.numTimesGrandTheftAuto;
+ Player.numTimesGrandTheftAuto = 0;
Player.numTimesKidnappedTotal += Player.numTimesKidnapped;
Player.numTimesKidnappedLifetime += Player.numTimesKidnapped;
Player.numTimesKidnapped = 0;
+ Player.numTimesHeistTotal += Player.numTimesHeist;
+ Player.numTimesHeistLifetime += Player.numTimesHeist;
+ Player.numTimesHeist = 0;
+
+ Player.karma = 0;
//Reset stats
Player.hacking_skill = 1;
@@ -99,22 +107,24 @@ function prestigeAugmentation() {
Player.lastUpdate = new Date().getTime();
- var homeComp = null;
+ var homeComp = Player.getHomeComputer();
//Delete all servers except home computer
for (var member in AllServers) {
- //Don't delete home computer
- if (member == Player.homeComputer) {
- homeComp = AllServers[member];
- continue;
- }
delete AllServers[member];
}
AllServers = {};
//Reset home computer (only the programs) and add to AllServers
homeComp.programs.length = 0;
+ homeComp.runningScripts = [];
+ homeComp.serversOnNetwork = [];
+ homeComp.isConnectedTo = true;
+ homeComp.isOnline = true;
+ homeComp.ramUsed = 0;
homeComp.programs.push(Programs.NukeProgram);
- addToAllServers(homeComp);
+ Player.currentServer = homeComp.ip;
+ Player.homeComputer = homeComp.ip;
+ AddToAllServers(homeComp);
//Delete all running scripts objects
for (var i = 0; i < workerScripts.length; ++i) {
diff --git a/src/Server.js b/src/Server.js
index e7a3363b9..b8686484b 100644
--- a/src/Server.js
+++ b/src/Server.js
@@ -121,7 +121,6 @@ Reviver.constructors.Server = Server;
//world_daemon: new Server(), //Final server for 2nd tier prestige. Discover that the world is a simulation
-/* Initialization. Called only when loading a new game( no save file) */
initForeignServers = function() {
//MegaCorporations
var ECorpServer = new Server();
diff --git a/src/Terminal.js b/src/Terminal.js
index fe76f7139..ffc96b44d 100644
--- a/src/Terminal.js
+++ b/src/Terminal.js
@@ -765,7 +765,9 @@ var Terminal = {
post("Hostname IP Root Access");
for (var i = 0; i < Player.getCurrentServer().serversOnNetwork.length; i++) {
//Add hostname
- var entry = Player.getCurrentServer().getServerOnNetwork(i).hostname;
+ var entry = Player.getCurrentServer().getServerOnNetwork(i);
+ if (entry == null) {continue;}
+ entry = entry.hostname;
//Calculate padding and add IP
var numSpaces = 21 - entry.length;
diff --git a/src/engine.js b/src/engine.js
index 3771f1dbe..ed600d685 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -458,7 +458,7 @@ var Engine = {
item.setAttribute("class", "installed-augmentation");
hElem.innerHTML = augName;
if (augName == AugmentationNames.NeuroFluxGovernor) {
- hElem += " - Level " + (aug.level);
+ hElem.innerHTML += " - Level " + (aug.level);
}
pElem.innerHTML = aug.info;