mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
Began implementing Crimes mechanic...plus karma and statistics for it. Readjusted the ciriminal factions requirements acordingly
This commit is contained in:
parent
3eccf23a41
commit
86900c0879
32
index.html
32
index.html
@ -50,6 +50,7 @@
|
||||
<script src="src/Augmentations.js"></script>
|
||||
<script src="src/Perk.js"></script>
|
||||
<script src="src/HacknetNode.js"></script>
|
||||
<script src="src/Crimes.js"></script>
|
||||
|
||||
<script src="src/engine.js"></script>
|
||||
|
||||
@ -212,6 +213,9 @@
|
||||
<li id="aevum-snapfitnessgym-li">
|
||||
<a href="#" id="aevum-snapfitnessgym" class="a-link-button">Snap Fitness Gym</a>
|
||||
</li>
|
||||
<li id="aevum-slums-li">
|
||||
<a href="#" id="aevum-slums" class="a-link-button">The Slums</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="chongqing-locations-list">
|
||||
@ -224,6 +228,9 @@
|
||||
<li id="chongqing-solarisspacesystems-li">
|
||||
<a href="#" id="chongqing-solarisspacesystems" class="a-link-button">Solaris Space Systems</a>
|
||||
</li>
|
||||
<li id="chongqing-slums-li">
|
||||
<a href="#" id="chongqing-slums" class="a-link-button">The Slums</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="sector12-locations-list">
|
||||
@ -275,6 +282,9 @@
|
||||
<li id="sector12-powerhousegym-li">
|
||||
<a href="#" id="sector12-powerhousegym" class="a-link-button">Powerhouse Gym</a>
|
||||
</li>
|
||||
<li id="sector12-slums-li">
|
||||
<a href="#" id="sector12-slums" class="a-link-button">The Slums</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="newtokyo-locations-list">
|
||||
@ -293,6 +303,9 @@
|
||||
<li id="newtokyo-noodlebar-li">
|
||||
<a href="#" id="newtokyo-noodlebar" class="a-link-button">Noodle Bar </a>
|
||||
</li>
|
||||
<li id="newtokyo-slums-li">
|
||||
<a href="#" id="newtokyo-slums" class="a-link-button">The Slums</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="ishima-locations-list">
|
||||
@ -308,6 +321,9 @@
|
||||
<li id="ishima-omegasoftware-li">
|
||||
<a href="#" id="ishima-omegasoftware" class="a-link-button">Omega Software </a>
|
||||
</li>
|
||||
<li id="ishima-slums-li">
|
||||
<a href="#" id="ishima-slums" class="a-link-button">The Slums</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="volhaven-locations-list">
|
||||
@ -341,6 +357,9 @@
|
||||
<li id="volhaven-milleniumfitnessgym-li">
|
||||
<a href="#" id="volhaven-milleniumfitnessgym" class="a-link-button">Millenium Fitness Gym</a>
|
||||
</li>
|
||||
<li id="volhaven-slums-li">
|
||||
<a href="#" id="volhaven-slums" class="a-link-button">The Slums</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -529,6 +548,19 @@
|
||||
<a href="#" id="location-travel-to-newtokyo" class="a-link-button"> Travel to New Tokyo</a>
|
||||
<a href="#" id="location-travel-to-ishima" class="a-link-button"> Travel to Ishima</a>
|
||||
<a href="#" id="location-travel-to-volhaven" class="a-link-button"> Travel to Volhaven</a>
|
||||
|
||||
<!-- Slums -->
|
||||
<p id="location-slums-description">
|
||||
You have entered the Slums, a poverty-ridden district filled with gangs, criminals, and
|
||||
other shadowy entities. The city's government and police have neglected this area for years...
|
||||
</p>
|
||||
<a href="3" id="location-slums-shoplift" class="a-link-button"> Shoplift </a>
|
||||
<a href="#" id="location-slums-mug" class="a-link-button"> Mug someone </a>
|
||||
<a href="#" id="location-slums-deal-drugs" class="a-link-button"> Deal drugs </a>
|
||||
<a href="#" id="location-slums-traffic-arms" class="a-link-button"> Traffick illegal arms </a>
|
||||
<a href="#" id="location-slums-homicide" class="a-link-button"> Homicide </a>
|
||||
<a href="#" id="location-slums-kidnap" class="a-link-button"> Kidnap and ransom </a>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Dialog Box, displays status text only -->
|
||||
|
@ -63,6 +63,7 @@ CONSTANTS = {
|
||||
WorkTypeFaction: "Working for Faction",
|
||||
WorkTypeCreateProgram: "Working on Create a Program",
|
||||
WorkTypeStudyClass: "Studying or Taking a class at university",
|
||||
WorkTypeCrime: "Committing a crime",
|
||||
|
||||
ClassStudyComputerScience: "studying Computer Science",
|
||||
ClassDataStructures: "taking a Data Structures course",
|
||||
@ -71,6 +72,13 @@ CONSTANTS = {
|
||||
ClassManagement: "taking a Management course",
|
||||
ClassLeadership: "taking a Leadership course",
|
||||
|
||||
CrimeShoplift: "shoplift",
|
||||
CrimeMug: "mug someone",
|
||||
CrimeDrugs: "deal drugs",
|
||||
CrimeTraffickArms: "traffick illegal arms",
|
||||
CrimeHomicide: "commit homicide",
|
||||
CrimeKidnap: "kidnap someone for ransom",
|
||||
|
||||
//Text that is displayed when the 'help' command is ran in Terminal
|
||||
HelpText: "analyze Get statistics and information about current machine <br>" +
|
||||
"clear Clear all text on the terminal <br>" +
|
||||
|
8
src/Crimes.js
Normal file
8
src/Crimes.js
Normal file
@ -0,0 +1,8 @@
|
||||
/* Crimes.js */
|
||||
|
||||
Shoplift
|
||||
Mug someone
|
||||
Deal Drugs
|
||||
Traffick illegal arms
|
||||
Homicide
|
||||
Kidnap and ransom
|
@ -347,7 +347,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
if (speakersforthedeadFac.isBanned == false && speakersforthedeadFac.isMember == false &&
|
||||
this.hacking_skill >= 100 && this.strength >= 300 && this.defense >= 300 &&
|
||||
this.dexterity >= 300 && this.agility >= 300 && this.numPeopleKilled >= 10 &&
|
||||
this.numPeopleKilledTotal >= 100 && this.companyName != Locations.Sector12CIA &&
|
||||
this.numPeopleKilledTotal >= 100 && this.karma <= -50 && this.companyName != Locations.Sector12CIA &&
|
||||
this.companyName != Locations.Sector12NSA) {
|
||||
invitedFactions.push(speakersforthedeadFac);
|
||||
}
|
||||
@ -357,7 +357,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
if (thedarkarmyFac.isBanned == false && thedarkarmyFac.isMember == false &&
|
||||
this.hacking_skill >= 300 && this.strength >= 300 && this.defense >= 300 &&
|
||||
this.dexterity >= 300 && this.agility >= 300 && this.location == Locations.Chongqing &&
|
||||
this.numPeopleKilled >= 5 && this.companyName != Locations.Sector12CIA &&
|
||||
this.numPeopleKilled >= 5 && this.karma <= -50 && this.companyName != Locations.Sector12CIA &&
|
||||
this.companyName != Locations.Sector12NSA) {
|
||||
invitedFactions.push(thedarkarmyFac);
|
||||
}
|
||||
@ -368,8 +368,8 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
this.hacking_skill >= 200 && this.strength >= 200 && this.defense >= 200 &&
|
||||
this.dexterity >= 200 && this.agility >= 200 &&
|
||||
(this.location == Locations.Aevum || this.location == Locations.Sector12) &&
|
||||
this.money >= 10000000 && this.companyName != Locations.Sector12CIA &&
|
||||
this.companyName != Locations.Sector12NSA) {
|
||||
this.money >= 10000000 && this.karma <= -100 &&
|
||||
this.companyName != Locations.Sector12CIA && this.companyName != Locations.Sector12NSA) {
|
||||
invitedFactions.push(thesyndicateFac);
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
(this.companyPosition.positionName == CompanyPositions.CTO.positionName ||
|
||||
this.companyPosition.positionName == CompanyPositions.CFO.positionName ||
|
||||
this.companyPosition.positionName == CompanyPositions.CEO.positionName) &&
|
||||
this.money >= 15000000) {
|
||||
this.money >= 15000000 && this.karma <= -25) {
|
||||
invitedFactions.push(silhouetteFac);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ Locations = {
|
||||
Ishima: "Ishima",
|
||||
Volhaven: "Volhaven",
|
||||
|
||||
|
||||
//Aevum Locations
|
||||
AevumTravelAgency: "Aevum Travel Agency",
|
||||
AevumSummitUniversity: "Summit University",
|
||||
@ -26,11 +25,13 @@ Locations = {
|
||||
AevumNetLinkTechnologies: "NetLink Technologies",
|
||||
AevumCrushFitnessGym: "Crush Fitness Gym",
|
||||
AevumSnapFitnessGym: "Snap Fitness Gym",
|
||||
AevumSlums: "Aevum Slums",
|
||||
|
||||
//Chongqing locations
|
||||
ChongqingTravelAgency: "Chongqing Travel Agency",
|
||||
ChongqingKuaiGongInternational: "KuaiGong International",
|
||||
ChongqingSolarisSpaceSystems: "Solaris Space Systems",
|
||||
ChongqingSlums: "Chongqing Slums",
|
||||
|
||||
//Sector 12
|
||||
Sector12TravelAgency: "Sector-12 Travel Agency",
|
||||
@ -49,6 +50,7 @@ Locations = {
|
||||
Sector12JoesGuns: "Joe's Guns",
|
||||
Sector12IronGym: "Iron Gym",
|
||||
Sector12PowerhouseGym: "Powerhouse Gym",
|
||||
Sector12Slums: "Sector12 Slums",
|
||||
|
||||
//New Tokyo
|
||||
NewTokyoTravelAgency: "New Tokyo Travel Agency",
|
||||
@ -56,12 +58,14 @@ Locations = {
|
||||
NewTokyoVitaLife: "VitaLife",
|
||||
NewTokyoGlobalPharmaceuticals: "Global Pharmaceuticals",
|
||||
NewTokyoNoodleBar: "Noodle Bar",
|
||||
NewTokyoSlums: "New Tokyo Slums"
|
||||
|
||||
//Ishima
|
||||
IshimaTravelAgency: "Ishima Travel Agency",
|
||||
IshimaStormTechnologies: "Storm Technologies",
|
||||
IshimaNovaMedical: "Nova Medical",
|
||||
IshimaOmegaSoftware: "Omega Software",
|
||||
IshimaSlums: "Ishima Slums",
|
||||
|
||||
//Volhaven
|
||||
VolhavenTravelAgency: "Volhaven Travel Agency",
|
||||
@ -74,6 +78,7 @@ Locations = {
|
||||
VolhavenSysCoreSecurities: "SysCore Securities",
|
||||
VolhavenCompuTek: "CompuTek",
|
||||
VolhavenMilleniumFitnessGym: "Millenium Fitness Gym",
|
||||
VolhavenSlums: "Volhaven Slums",
|
||||
}
|
||||
|
||||
displayLocationContent = function() {
|
||||
@ -136,6 +141,14 @@ displayLocationContent = function() {
|
||||
var travelToIshima = document.getElementById("location-travel-to-ishima");
|
||||
var travelToVolhaven = document.getElementById("location-travel-to-volhaven");
|
||||
|
||||
var slumsDescText = document.getElementById("location-slums-description");
|
||||
var slumsShoplift = document.getElementById("location-slums-shoplift");
|
||||
var slumsMug = document.getElementById("location-slums-mug");
|
||||
var slumsDealDrugs = document.getElementById("location-slums-deal-drugs");
|
||||
var slumsTrafficArms = document.getElementById("location-slums-traffic-arms");
|
||||
var slumsHomicide = document.getElementById("location-slums-homicide");
|
||||
var slumsKidnap = document.getElementById("location-slums-kidnap");
|
||||
|
||||
var loc = Player.location;
|
||||
|
||||
returnToWorld.addEventListener("click", function() {
|
||||
@ -203,6 +216,14 @@ displayLocationContent = function() {
|
||||
travelToIshima.style.display = "none";
|
||||
travelToVolhaven.style.display = "none";
|
||||
|
||||
slumsDescText.style.display = "none";
|
||||
slumsShoplift.style.display = "none";
|
||||
slumsMug.style.display = "none";
|
||||
slumsDealDrugs.style.display = "none";
|
||||
slumsTrafficArms.style.display = "none";
|
||||
slumsHomicide.style.display = "none";
|
||||
slumsKidnap.style.display = "none";
|
||||
|
||||
//Check if the player is employed at this Location. If he is, display the "Work" button,
|
||||
//update the job title, etc.
|
||||
if (loc == Player.companyName) {
|
||||
@ -785,6 +806,21 @@ displayLocationContent = function() {
|
||||
gymTrainAgi.style.display = "block";
|
||||
break;
|
||||
|
||||
//All Slums
|
||||
case Locations.AevumSlums:
|
||||
case Locations.ChongqingSlums:
|
||||
case Locations.Sector12Slums:
|
||||
case Locations.NewTokyokSlums:
|
||||
case Locations.IshimaSlums:
|
||||
case Locations.VolhavenSlums:
|
||||
slumsDescText.style.display = "block";
|
||||
slumsShoplift.style.display = "block";
|
||||
slumsMug.style.display = "block";
|
||||
slumsDealDrugs.style.display = "block";
|
||||
slumsTrafficArms.style.display = "block";
|
||||
slumsHomicide.style.display = "block";
|
||||
slumsKidnap.style.display = "block";
|
||||
|
||||
default:
|
||||
console.log("ERROR: INVALID LOCATION");
|
||||
|
||||
@ -901,6 +937,13 @@ initLocationButtons = function() {
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
aevumSlums = document.getElementById("aevum-slums");
|
||||
aevumSlums.addEventListener("click", function() {
|
||||
Player.location = Locations.AevumSlums;
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
chongqingTravelAgency = document.getElementById("chongqing-travelagency");
|
||||
chongqingTravelAgency.addEventListener("click", function() {
|
||||
@ -922,6 +965,14 @@ initLocationButtons = function() {
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
chongqingSlums = document.getElementById("chongqing-slums");
|
||||
chongqingSlums.addEventListener("click", function() {
|
||||
Player.location = Locations.ChongqingSlums;
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
sector12TravelAgency = document.getElementById("sector12-travelagency");
|
||||
sector12TravelAgency.addEventListener("click", function() {
|
||||
@ -1034,6 +1085,13 @@ initLocationButtons = function() {
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
sector12Slums = document.getElementById("sector12-slums");
|
||||
sector12Slums.addEventListener("click", function() {
|
||||
Player.location = Locations.Sector12Slums;
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
newTokyoTravelAgency = document.getElementById("newtokyo-travelagency");
|
||||
newTokyoTravelAgency.addEventListener("click", function() {
|
||||
@ -1069,6 +1127,13 @@ initLocationButtons = function() {
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
newTokyoSlums = document.getElementByID("newtokyo-slums");
|
||||
newTokyoSlums.addEventListener("click", function() {
|
||||
Player.location = Locations.NewTokyoSlums;
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
ishimaTravelAgency = document.getElementById("ishima-travelagency");
|
||||
ishimaTravelAgency.addEventListener("click", function() {
|
||||
@ -1097,6 +1162,13 @@ initLocationButtons = function() {
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
ishimaSlums = document.getElementById("ishima-slums");
|
||||
ishimaSlums.addEventListener("click", function() {
|
||||
Player.location = Locations.IshimaSlums;
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
volhavenTravelAgency = document.getElementById("volhaven-travelagency");
|
||||
volhavenTravelAgency.addEventListener("click", function() {
|
||||
@ -1168,6 +1240,13 @@ initLocationButtons = function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
volhavenSlums = document.getElementById("volhaven-slums");
|
||||
volhavenSlums.addEventListener("click", function() {
|
||||
Player.location = Locations.VolhavenSlums;
|
||||
Engine.loadLocationContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//Buttons to interact at a location (apply for job/promotion, train, purchase, etc.)
|
||||
var softwareJob = document.getElementById("location-software-job");
|
||||
@ -1208,6 +1287,13 @@ initLocationButtons = function() {
|
||||
var travelToIshima = document.getElementById("location-travel-to-ishima");
|
||||
var travelToVolhaven = document.getElementById("location-travel-to-volhaven");
|
||||
|
||||
var slumsShoplift = document.getElementById("location-slums-shoplift");
|
||||
var slumsMug = document.getElementById("location-slums-mug");
|
||||
var slumsDealDrugs = document.getElementById("location-slums-deal-drugs");
|
||||
var slumsTrafficArms = document.getElementById("location-slums-traffic-arms");
|
||||
var slumsHomicide = document.getElementById("location-slums-homicide");
|
||||
var slumsKidnap = document.getElementById("location-slums-kidnap");
|
||||
|
||||
softwareJob.addEventListener("click", function() {
|
||||
Player.applyForSoftwareJob();
|
||||
return false;
|
||||
@ -1348,6 +1434,15 @@ initLocationButtons = function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
//TODO
|
||||
/*
|
||||
var slumsShoplift = document.getElementById("location-slums-shoplift");
|
||||
var slumsMug = document.getElementById("location-slums-mug");
|
||||
var slumsDealDrugs = document.getElementById("location-slums-deal-drugs");
|
||||
var slumsTrafficArms = document.getElementById("location-slums-traffic-arms");
|
||||
var slumsHomicide = document.getElementById("location-slums-homicide");
|
||||
var slumsKidnap = document.getElementById("location-slums-kidnap");
|
||||
*/
|
||||
}
|
||||
|
||||
travelToCity = function(destCityName, cost) {
|
||||
|
251
src/Player.js
251
src/Player.js
@ -61,7 +61,7 @@ function PlayerObject() {
|
||||
|
||||
//Money
|
||||
this.money = 1000;
|
||||
this.total_money = 0; //Total money ever earned
|
||||
this.total_money = 0; //Total money ever earned in this "simulation"
|
||||
this.lifetime_money = 0; //Total money ever earned
|
||||
|
||||
//IP Address of Starting (home) computer
|
||||
@ -88,10 +88,26 @@ function PlayerObject() {
|
||||
this.augmentations = []; //Names of all installed augmentations
|
||||
this.numAugmentations = 0;
|
||||
|
||||
//Misc statistics
|
||||
this.numPeopleKilled = 0;
|
||||
this.numPeopleKilledTotal = 0;
|
||||
this.numPeopleKilledLifetime = 0;
|
||||
//Crime statistics (Total refers to this 'simulation'. Lifetime is forever)
|
||||
this.karma = 0;
|
||||
this.numTimesShoplifted = 0;
|
||||
this.numTimesShopliftedTotal = 0;
|
||||
this.numTimesShopliftedLifetime = 0;
|
||||
this.numPeopleMugged = 0;
|
||||
this.numPeopleMuggedTotal = 0;
|
||||
this.numPeopleMuggedLifetime = 0;
|
||||
this.numTimesDealtDrugs = 0;
|
||||
this.numTimesDealtDrugsTotal = 0;
|
||||
this.numTimesDealtDrugsLifetime = 0;
|
||||
this.numTimesTraffickArms = 0;
|
||||
this.numTimesTraffickArmsTotal = 0;
|
||||
this.numTimesTrafficksArmsLifetime = 0;
|
||||
this.numPeopleKilled = 0;
|
||||
this.numPeopleKilledTotal = 0;
|
||||
this.numPeopleKilledLifetime = 0;
|
||||
this.numTimesKidnapped = 0;
|
||||
this.numTimesKidnappedTotal = 0;
|
||||
this.numTimesKidnappedLifetime = 0;
|
||||
|
||||
//Achievements and achievement progress
|
||||
|
||||
@ -130,6 +146,8 @@ function PlayerObject() {
|
||||
|
||||
this.className = "";
|
||||
|
||||
this.crimeType = "";
|
||||
|
||||
this.timeWorked = 0; //in ms
|
||||
this.timeNeededToCompleteWork = 0;
|
||||
|
||||
@ -303,6 +321,43 @@ PlayerObject.prototype.gainCharismaExp = function(exp) {
|
||||
console.log("ERR: NaN passed into Player.gainCharismaExp()"); return;
|
||||
}
|
||||
this.charisma_exp += exp;
|
||||
}
|
||||
|
||||
/******* Working functions *******/
|
||||
PlayerObject.prototype.resetWorkStatus = function() {
|
||||
this.workHackExpGainRate = 0;
|
||||
this.workStrExpGainRate = 0;
|
||||
this.workDefExpGainRate = 0;
|
||||
this.workDexExpGainRate = 0;
|
||||
this.workAgiExpGainRate = 0;
|
||||
this.workChaExpGainRate = 0;
|
||||
this.workRepGainRate = 0;
|
||||
this.workMoneyGainRate = 0;
|
||||
|
||||
this.workHackExpGained = 0;
|
||||
this.workStrExpGained = 0;
|
||||
this.workDefExpGained = 0;
|
||||
this.workDexExpGained = 0;
|
||||
this.workAgiExpGained = 0;
|
||||
this.workChaExpGained = 0;
|
||||
this.workRepGained = 0;
|
||||
this.workMoneyGained = 0;
|
||||
|
||||
this.timeWorked = 0;
|
||||
|
||||
this.currentWorkFactionName = "";
|
||||
this.currentWorkFactionDescription = "";
|
||||
this.createProgramName = "";
|
||||
this.className = "";
|
||||
}
|
||||
|
||||
PlayerObject.prototype.gainWorkExp = function(divMult = 1) {
|
||||
this.gainHackingExp(this.workHackExpGained / divMult);
|
||||
this.gainStrengthExp(this.workStrExpGained / divMult);
|
||||
this.gainDefenseExp(this.workDefExpGained / divMult);
|
||||
this.gainDexterityExp(this.workDexExpGained / divMult);
|
||||
this.gainAgilityExp(this.workAgiExpGained / divMult);
|
||||
this.gainCharismaExp(this.workChaExpGained / divMult);
|
||||
}
|
||||
|
||||
/* Working for Company */
|
||||
@ -314,12 +369,8 @@ PlayerObject.prototype.finishWork = function(cancelled) {
|
||||
if (Engine.Debug) {
|
||||
console.log("Player finishWork() called with " + this.workMoneyGained / cancMult + " $ gained");
|
||||
}
|
||||
this.gainHackingExp(this.workHackExpGained / cancMult);
|
||||
this.gainStrengthExp(this.workStrExpGained / cancMult);
|
||||
this.gainDefenseExp(this.workDefExpGained / cancMult);
|
||||
this.gainDexterityExp(this.workDexExpGained / cancMult);
|
||||
this.gainAgilityExp(this.workAgiExpGained / cancMult);
|
||||
this.gainCharismaExp(this.workChaExpGained / cancMult);
|
||||
|
||||
this.gainWorkExp(cancMult);
|
||||
|
||||
var company = Companies[this.companyName];
|
||||
company.playerReputation += (this.workRepGained / cancMult);
|
||||
@ -365,11 +416,9 @@ PlayerObject.prototype.finishWork = function(cancelled) {
|
||||
}
|
||||
|
||||
PlayerObject.prototype.startWork = function() {
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeCompany;
|
||||
this.currentWorkFactionName = "";
|
||||
this.currentWorkFactionDescription = "";
|
||||
this.createProgramName = "";
|
||||
|
||||
this.workHackExpGainRate = this.getWorkHackExpGain();
|
||||
this.workStrExpGainRate = this.getWorkStrExpGain();
|
||||
@ -380,16 +429,6 @@ PlayerObject.prototype.startWork = function() {
|
||||
this.workRepGainRate = this.getWorkRepGain();
|
||||
this.workMoneyGainRate = this.getWorkMoneyGain();
|
||||
|
||||
this.workHackExpGained = 0;
|
||||
this.workStrExpGained = 0;
|
||||
this.workDefExpGained = 0;
|
||||
this.workDexExpGained = 0;
|
||||
this.workAgiExpGained = 0;
|
||||
this.workChaExpGained = 0;
|
||||
this.workRepGained = 0;
|
||||
this.workMoneyGained = 0;
|
||||
|
||||
this.timeWorked = 0;
|
||||
this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours;
|
||||
|
||||
var cancelButton = document.getElementById("work-in-progress-cancel-button");
|
||||
@ -459,12 +498,7 @@ PlayerObject.prototype.work = function(numCycles) {
|
||||
|
||||
/* Working for Faction */
|
||||
PlayerObject.prototype.finishFactionWork = function(cancelled, faction) {
|
||||
this.gainHackingExp(this.workHackExpGained);
|
||||
this.gainStrengthExp(this.workStrExpGained);
|
||||
this.gainDefenseExp(this.workDefExpGained);
|
||||
this.gainDexterityExp(this.workDexExpGained);
|
||||
this.gainAgilityExp(this.workAgiExpGained);
|
||||
this.gainCharismaExp(this.workChaExpGained);
|
||||
this.gainWorkExp();
|
||||
|
||||
var faction = Factions[this.currentWorkFactionName];
|
||||
faction.playerReputation += (this.workRepGained);
|
||||
@ -497,18 +531,7 @@ PlayerObject.prototype.startFactionWork = function(faction) {
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeFaction;
|
||||
this.currentWorkFactionName = faction.name;
|
||||
this.createProgramName = "";
|
||||
|
||||
this.workHackExpGained = 0;
|
||||
this.workStrExpGained = 0;
|
||||
this.workDefExpGained = 0;
|
||||
this.workDexExpGained = 0;
|
||||
this.workAgiExpGained = 0;
|
||||
this.workChaExpGained = 0;
|
||||
this.workRepGained = 0;
|
||||
this.workMoneyGained = 0;
|
||||
|
||||
this.timeWorked = 0;
|
||||
this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer20Hours;
|
||||
|
||||
var cancelButton = document.getElementById("work-in-progress-cancel-button");
|
||||
@ -527,14 +550,10 @@ PlayerObject.prototype.startFactionWork = function(faction) {
|
||||
}
|
||||
|
||||
PlayerObject.prototype.startFactionHackWork = function(faction) {
|
||||
this.resetWorkStatus();
|
||||
|
||||
this.workHackExpGainRate = .02 * this.hacking_exp_mult;
|
||||
this.workStrExpGainRate = 0;
|
||||
this.workDefExpGainRate = 0;
|
||||
this.workDexExpGainRate = 0;
|
||||
this.workAgiExpGainRate = 0;
|
||||
this.workChaExpGainRate = 0;
|
||||
this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
|
||||
this.workMoneyGainRate = 0;
|
||||
|
||||
this.factionWorkType = CONSTANTS.FactionWorkHacking;
|
||||
this.currentWorkFactionDescription = "carrying out hacking contracts";
|
||||
@ -543,6 +562,8 @@ PlayerObject.prototype.startFactionHackWork = function(faction) {
|
||||
}
|
||||
|
||||
PlayerObject.prototype.startFactionFieldWork = function(faction) {
|
||||
this.resetWorkStatus();
|
||||
|
||||
this.workHackExpGainRate = .05 * this.hacking_exp_mult;
|
||||
this.workStrExpGainRate = .05 * this.strength_exp_mult;
|
||||
this.workDefExpGainRate = .05 * this.defense_exp_mult;
|
||||
@ -550,7 +571,6 @@ PlayerObject.prototype.startFactionFieldWork = function(faction) {
|
||||
this.workAgiExpGainRate = .05 * this.agility_exp_mult;
|
||||
this.workChaExpGainRate = .05 * this.charisma_exp_mult;
|
||||
this.workRepGainRate = this.getFactionFieldWorkRepGain();
|
||||
this.workMoneyGainRate = 0;
|
||||
|
||||
this.factionWorkType = CONSTANTS.factionWorkField;
|
||||
this.currentWorkFactionDescription = "carrying out field missions"
|
||||
@ -559,14 +579,15 @@ PlayerObject.prototype.startFactionFieldWork = function(faction) {
|
||||
}
|
||||
|
||||
PlayerObject.prototype.startFactionSecurityWork = function(faction) {
|
||||
this.workHackExpGainRate = .1 * this.hacking_exp_mult;
|
||||
this.workStrExpGainRate = 0;
|
||||
this.workDefExpGainRate = 0;
|
||||
this.workDexExpGainRate = 0;
|
||||
this.workAgiExpGainRate = 0;
|
||||
this.workChaExpGainRate = 0;
|
||||
this.resetWorkStatus();
|
||||
|
||||
this.workHackExpGainRate = 0.01 * this.hacking_exp_mult;
|
||||
this.workStrExpGainRate = 0.01 * this.strength_exp_mult;
|
||||
this.workDefExpGainRate = 0.01 * this.defense_exp_mult;
|
||||
this.workDexExpGainRate = 0.01 * this.dexterity_exp_mult;
|
||||
this.workAgiExpGainRate = 0.01 * this.agility_exp_mult;
|
||||
this.workChaExpGainRate = 0.01 * this.charisma_exp_mult;
|
||||
this.workRepGainRate = this.getFactionSecurityWorkRepGain();
|
||||
this.workMoneyGainRate = 0;
|
||||
|
||||
this.factionWorkType = CONSTANTS.FactionWorkSecurity;
|
||||
this.currentWorkFactionDescription = "performing security detail"
|
||||
@ -709,14 +730,12 @@ PlayerObject.prototype.getFactionFieldWorkRepGain = function() {
|
||||
|
||||
/* Creating a Program */
|
||||
PlayerObject.prototype.startCreateProgramWork = function(programName, time) {
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeCreateProgram;
|
||||
|
||||
this.timeWorked = 0;
|
||||
this.timeNeededToCompleteWork = time;
|
||||
|
||||
this.currentWorkFactionName = "";
|
||||
this.currentWorkFactionDescription = "";
|
||||
this.createProgramName = programName;
|
||||
|
||||
var cancelButton = document.getElementById("work-in-progress-cancel-button");
|
||||
@ -767,28 +786,12 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName
|
||||
|
||||
/* Studying/Taking Classes */
|
||||
PlayerObject.prototype.startClass = function(costMult, expMult, className) {
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeStudyClass;
|
||||
this.timeWorked = 0;
|
||||
|
||||
this.className = className;
|
||||
|
||||
this.workStrExpGainRate = 0;
|
||||
this.workDefExpGainRate = 0;
|
||||
this.workDexExpGainRate = 0;
|
||||
this.workAgiExpGainRate = 0;
|
||||
this.workRepGainRate = 0;
|
||||
this.workMoneyGainRate = 0;
|
||||
|
||||
this.workHackExpGained = 0;
|
||||
this.workStrExpGained = 0;
|
||||
this.workDefExpGained = 0;
|
||||
this.workDexExpGained = 0;
|
||||
this.workAgiExpGained = 0;
|
||||
this.workChaExpGained = 0;
|
||||
this.workRepGained = 0;
|
||||
this.workMoneyGained = 0;
|
||||
|
||||
var gameCPS = 1000 / Engine._idleSpeed;
|
||||
//Base costs/exp (per second)
|
||||
var baseDataStructuresCost = 1;
|
||||
@ -871,9 +874,7 @@ PlayerObject.prototype.takeClass = function(numCycles) {
|
||||
this.workMoneyGained -= this.workMoneyLossRate * numCycles;
|
||||
|
||||
var cyclesPerSec = 1000 / Engine._idleSpeed;
|
||||
|
||||
//TODO Account for running out of money when numCycles is very big
|
||||
|
||||
|
||||
var txt = document.getElementById("work-in-progress-text");
|
||||
txt.innerHTML = "You have been " + className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ".<br><br>" +
|
||||
"This has cost you: <br>" +
|
||||
@ -885,17 +886,11 @@ PlayerObject.prototype.takeClass = function(numCycles) {
|
||||
this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" +
|
||||
this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br>" +
|
||||
this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp <br>" +
|
||||
"You may cancel at any time";
|
||||
|
||||
"You may cancel at any time";
|
||||
}
|
||||
|
||||
PlayerObject.prototype.finishClass = function() {
|
||||
this.gainHackingExp(this.workHackExpGained);
|
||||
this.gainStrengthExp(this.workStrExpGained);
|
||||
this.gainDefenseExp(this.workDefExpGained);
|
||||
this.gainDexterityExp(this.workDexExpGained);
|
||||
this.gainAgilityExp(this.workAgiExpGained);
|
||||
this.gainCharismaExp(this.workChaExpGained);
|
||||
this.gainWorkExp();
|
||||
|
||||
if (this.workMoneyGained > 0) {
|
||||
throw new Error("ERR: Somehow gained money while taking class");
|
||||
@ -923,6 +918,90 @@ PlayerObject.prototype.finishClass = function() {
|
||||
Engine.loadTerminalContent();
|
||||
}
|
||||
|
||||
//The EXP and $ gains are hardcoded. Time is in ms
|
||||
PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, agiExp, chaExp, money, time) {
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeCrime;
|
||||
|
||||
this.workHackExpGained = hackExp;
|
||||
this.workStrExpGained = strExp;
|
||||
this.workDefExpGained = defExp;
|
||||
this.workDexExpGained = dexExp;
|
||||
this.workAgiExpGained = agiExp;
|
||||
this.workChaExpGained = chaExp;
|
||||
this.workMoneyGained = money;
|
||||
|
||||
this.timeNeededToCompleteWork = time;
|
||||
|
||||
var cancelButton = document.getElementById("work-in-progress-cancel-button");
|
||||
|
||||
//Remove all old event listeners from Cancel button
|
||||
var newCancelButton = cancelButton.cloneNode(true);
|
||||
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
|
||||
|
||||
newCancelButton.addEventListener("click", function() {
|
||||
Player.finishCrime(true);
|
||||
return false;
|
||||
});
|
||||
|
||||
//Display Work In Progress Screen
|
||||
Engine.loadWorkInProgressContent();
|
||||
}
|
||||
|
||||
PlayerObject.prototype.commitCrime = function () {
|
||||
this.timeWorked += Engine._idleSpeed * numCycles;
|
||||
|
||||
var txt = document.getElementById("work-in-progress-text");
|
||||
txt.innerHTML = "You are attempting to " + Player.crimeType + ".<br>" +
|
||||
"Time remaining: " + convertTimeMsToTimeElapsedString(this.timeNeededToCompleteWork - this.timeWorked);
|
||||
}
|
||||
|
||||
PlayerObject.prototype.finishCrime = function(cancelled) {
|
||||
if (cancelled) {
|
||||
//Do nothing
|
||||
} else {
|
||||
this.gainWorkExp();
|
||||
this.gainMoney(this.workMoneyGained);
|
||||
|
||||
//Handle Karma and crime statistics
|
||||
switch(this.crimeType) {
|
||||
case CONSTANTS.CrimeShoplift:
|
||||
this.karma -= 0.1;
|
||||
++this.numTimesShoplifted;
|
||||
break;
|
||||
case CONSTANTS.CrimeMug:
|
||||
this.karma -= 0.2;
|
||||
++this.numPeopleMugged;
|
||||
break;
|
||||
case CONSTANTS.CrimeDrugs:
|
||||
++this.numTimesDealtDrugs;
|
||||
this.karma -= 0.5;
|
||||
break;
|
||||
case CONSTANTS.CrimeTraffickArms:
|
||||
++this.numTimesTraffickArms;
|
||||
this.karma -= 1;
|
||||
break;
|
||||
case CONSTANTS.CrimeHomicide:
|
||||
++this.numPeopleKilled;
|
||||
this.karma -= 3;
|
||||
break;
|
||||
case CONSTANTS.CrimeKidnap:
|
||||
++this.numTimesKidnapped;
|
||||
this.karma -= 3;
|
||||
break;
|
||||
default:
|
||||
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var mainMenu = document.getElementById("mainmenu-container");
|
||||
mainMenu.style.visibility = "visible";
|
||||
this.isWorking = false;
|
||||
Engine.loadTerminalContent();
|
||||
}
|
||||
|
||||
/* Functions for saving and loading the Player data */
|
||||
PlayerObject.prototype.toJSON = function() {
|
||||
return Generic_toJSON("PlayerObject", this);
|
||||
|
@ -32,6 +32,7 @@ $(document).keydown(function(event) {
|
||||
//Terminal
|
||||
if (Engine.currentPage == Engine.Page.Terminal) {
|
||||
var terminalInput = document.getElementById("terminal-input-text-box");
|
||||
if (terminalInput != null && !event.ctrlKey) {terminalInput.focus();}
|
||||
|
||||
//Enter
|
||||
if (event.keyCode == 13) {
|
||||
|
Loading…
Reference in New Issue
Block a user