From 650bdf1f3fccc72e185634bc7a85330c95ae76b1 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Wed, 19 Apr 2017 00:02:40 -0500 Subject: [PATCH] Playtesting- fixed bugs --- README.md | 2 ++ css/menupages.css | 5 +++++ src/Constants.js | 3 +++ src/Faction.js | 13 +++++++------ src/Player.js | 16 ++++++++-------- src/engine.js | 9 ++++++++- utils/JSONReviver.js | 4 +++- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c8761c049..83c31ed65 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ TESTING TODO: Seems to work fine Tasks TODO: + Factions Info page isn't formatted correctly + Augmentations that decrease time to make programs New server hostname in Purchase Server Pop-up Box needs limits..don't think the ones set in HTML work diff --git a/css/menupages.css b/css/menupages.css index 40b79e675..ec12cac3b 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -157,6 +157,11 @@ width: 90%; } +#factions-list li { + padding: 6px; + margin: 6px; +} + #faction-hack-button-div, #faction-hack-text-div { display:inline-block; } diff --git a/src/Constants.js b/src/Constants.js index 3f7a5d8d4..7a906c932 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -22,6 +22,9 @@ CONSTANTS = { MillisecondsPer20Hours: 72000000, GameCyclesPer20Hours: 72000000 / 200, + MillisecondsPer10Hours: 36000000, + GameCyclesPer10Hours: 36000000 / 200, + MillisecondsPer8Hours: 28800000, GameCyclesPer8Hours: 28800000 / 200, diff --git a/src/Faction.js b/src/Faction.js index 6d54215f1..40816bbf8 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -125,11 +125,10 @@ PlayerObject.prototype.checkForFactionInvitations = function() { invitedFactions = []; //Array which will hold all Factions th eplayer should be invited to var company = Companies[this.companyName]; - if (company == null) { - return invitedFactions; + var companyRep = 0; + if (company != null) { + companyRep = company.playerReputation; } - var companyRep = company.playerReputation; - //Illuminati var illuminatiFac = Factions["Illuminati"]; @@ -352,8 +351,10 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //CyberSec var cybersecFac = Factions["CyberSec"]; + console.log(this.hacking_skill + " " + cybersecFac.isMember + " " + cybersecFac.isBanned); if (cybersecFac.isBanned == false && cybersecFac.isMember == false && - this.hacking_skill >= 50) { + this.hacking_skill >= 5) { + console.log("Qualified for CyberSec"); invitedFactions.push(cybersecFac); } @@ -446,7 +447,7 @@ displayFactionContent = function(factionName) { return false; }); - newSecurityWorkButton("click", function() { + newSecurityWorkButton.addEventListener("click", function() { Player.startFactionSecurityWork(faction); return false; }); diff --git a/src/Player.js b/src/Player.js index b4d5c94dc..0e7a17206 100644 --- a/src/Player.js +++ b/src/Player.js @@ -401,7 +401,7 @@ PlayerObject.prototype.work = function(numCycles) { //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money if (this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) { var maxCycles = CONSTANTS.GameCyclesPer8Hours; //Number of cycles in 8 hours - this.workHackExpGained = this.workhackExpGainRate * maxCycles; + this.workHackExpGained = this.workHackExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles; this.workDexExpGained = this.workDexExpGainRate * maxCycles; @@ -434,12 +434,12 @@ PlayerObject.prototype.work = function(numCycles) { /* Working for Faction */ PlayerObject.prototype.finishFactionWork = function(cancelled, faction) { - this.hacking_exp += (this.workHackExpGained); - this.strength_exp += (this.workStrExpGained); - this.defense_exp += (this.workDefExpGained); - this.dexterity_exp += (this.workDexExpGained); - this.agility_exp += (this.workAgiExpGained); - this.charisma_exp += (this.workChaExpGained); + this.gainHackingExp(this.workHackExpGained); + this.gainStrengthExp(this.workStrExpGained); + this.gainDefenseExp(this.workDefExpGained); + this.gainDexterityExp(this.workDexExpGained); + this.gainAgilityExp(this.workAgiExpGained); + this.gainCharismaExp(this.workChaExpGained); var faction = Factions[this.currentWorkFactionName]; faction.playerReputation += (this.workRepGained); @@ -563,7 +563,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) { //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours if (this.timeWorked >= CONSTANTS.MillisecondsPer20Hours) { var maxCycles = CONSTANTS.GameCyclesPer20Hours; //Number of cycles in 20 hours - this.workHackExpGained = this.workhackExpGainRate * maxCycles; + this.workHackExpGained = this.workHackExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles; this.workDexExpGained = this.workDexExpGainRate * maxCycles; diff --git a/src/engine.js b/src/engine.js index ff469efa9..66c78198b 100644 --- a/src/engine.js +++ b/src/engine.js @@ -450,6 +450,12 @@ var Engine = { displayFactionsInfo: function() { var factionsList = document.getElementById("factions-list"); + //Clear the list + while (factionsList.firstChild) { + factionsList.removeChild(factionsList.firstChild); + } + + //Re-add a link for each faction you are a member of for (var i = 0; i < Player.factions.length; ++i) { var factionName = Player.factions[i]; @@ -585,7 +591,8 @@ var Engine = { updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance updateDisplays: 5, //Update displays such as Active Scripts display and character display serverGrowth: 450, //Process server growth every minute and a half - checkFactionInvitations: 1500, //Check whether you qualify for any faction invitations every 5 minutes + //checkFactionInvitations: 1500, //Check whether you qualify for any faction invitations every 5 minutes + checkFactionInvitations: 50, }, decrementAllCounters: function(numCycles = 1) { diff --git a/utils/JSONReviver.js b/utils/JSONReviver.js index 0ac6bc72d..f83e6ffea 100644 --- a/utils/JSONReviver.js +++ b/utils/JSONReviver.js @@ -7,7 +7,9 @@ // off to that `fromJSON` fuunction, passing in the value. function Reviver(key, value) { var ctor; - //console.log("Reviver called with key: " + key + ", and value: " + value); + if (value == null) { + console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value); + } if (typeof value === "object" && typeof value.ctor === "string" && typeof value.data !== "undefined") {