Playtesting - Fixed bugs and some rebalancing with foreign servers

This commit is contained in:
Daniel Xie 2017-04-20 03:29:07 -05:00
parent fd70bf259b
commit c1c37f008e
10 changed files with 41 additions and 33 deletions

@ -24,9 +24,6 @@
padding-left: 10px;
height: 100%;
margin-left: 10%;
}
#script-editor-filename-row-div {
color: #66ff33;
}

@ -120,12 +120,10 @@
<!-- Script editor -->
<div id="script-editor-container">
<div id="script-editor-filename-row-div" >
<p id="script-editor-filename-tag"> Script name (edit below): </p>
<p id="script-editor-filename-tag"> Script name: </p>
<input id="script-editor-filename" type="text" maxlength="30"> </input>
<br>
<p id="script-editor-status"> </p>
</div>
<br><br>
<textarea id="script-editor-text" style="border: none" autofocus> </textarea>
</div>

@ -34,6 +34,10 @@ CONSTANTS = {
MillisecondsPerHour: 3600000,
GameCyclesPerHour: 3600000 / 200,
FactionWorkHacking: "Faction Hacking Work",
FactionWorkField: "Faction Field Work",
FactionWorkSecurity: "Faction Security Work",
//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>" +

@ -676,13 +676,14 @@ displayFactionAugmentations = function(factionName) {
var aElem = document.createElement("a");
var pElem = document.createElement("p");
aElem.setAttribute("href", "#");
if (faction.playerReputation >= (aug.baseRepRequirement * faction.augmentationRepRequirementMult)) {
var req = aug.baseRepRequirement * faction.augmentationRepRequirementMult;
if (faction.playerReputation >= req) {
aElem.setAttribute("class", "a-link-button");
pElem.innerHTML = "UNLOCKED";
//TODO Event listener for button to purchase augmentation
} else {
aElem.setAttribute("class", "a-link-button-inactive");
pElem.innerHTML = "LOCKED";
pElem.innerHTML = "LOCKED (Requires " + req + " faction reputation)";
pElem.style.color = "red";
}
aElem.style.display = "inline-block";

@ -27,7 +27,6 @@ function evaluate(exp, workerScript) {
break;
//Can currently only assign to "var"s
case "assign":
console.log("Evaluating assign operation");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -46,13 +45,11 @@ function evaluate(exp, workerScript) {
});
p.then(function(expRight) {
console.log("Right side of assign operation resolved with value: " + expRight);
try {
env.set(exp.left.value, expRight);
} catch (e) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|" + e.toString());
}
console.log("Assign operation finished");
resolve("assignFinished");
}, function(e) {
reject(e);
@ -60,7 +57,6 @@ function evaluate(exp, workerScript) {
});
case "binary":
console.log("Binary operation called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -88,7 +84,6 @@ function evaluate(exp, workerScript) {
});
pRight.then(function(args) {
console.log("Resolving binary operation");
try {
resolve(apply_op(exp.operator, args[0], args[1]));
} catch (e) {
@ -149,7 +144,6 @@ function evaluate(exp, workerScript) {
});
break;
case "while":
console.log("Evaluating while loop");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -191,7 +185,6 @@ function evaluate(exp, workerScript) {
setTimeout(function() {
if (exp.func.value == "hack") {
console.log("Execute hack()");
if (exp.args.length != 1) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|Hack() call has incorrect number of arguments. Takes 1 argument");
}
@ -271,14 +264,12 @@ function evaluate(exp, workerScript) {
});
} else if (exp.func.value == "sleep") {
console.log("Execute sleep()");
if (exp.args.length != 1) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|Sleep() call has incorrect number of arguments. Takes 1 argument.");
}
var sleepTimePromise = evaluate(exp.args[0], workerScript);
sleepTimePromise.then(function(sleepTime) {
console.log("Sleep time: " + sleepTime);
workerScript.scriptRef.log("Sleeping for " + sleepTime + " milliseconds");
var p = new Promise(function(resolve, reject) {
setTimeout(function() {
@ -314,7 +305,6 @@ function evaluate(exp, workerScript) {
p.then(function(res) {
post(res.toString());
console.log("Print call executed");
resolve("printExecuted");
}, function(e) {
reject(e);

@ -156,7 +156,6 @@ function Parser(input) {
checkKeywordAndSkip("for");
splitExpressions = delimited("(", ")", ";", parse_expression);
console.log("Parsing code in for loop");
code = parse_expression();
if (splitExpressions.length != 3) {
@ -180,7 +179,6 @@ function Parser(input) {
* code: prog node
*/
function parse_while() {
console.log("Parsing while token");
checkKeywordAndSkip("while");
var cond = parse_expression();
@ -238,7 +236,6 @@ function Parser(input) {
}
function parse_prog() {
console.log("Parsing prog token");
var prog = delimited("{", "}", ";", parse_expression);
if (prog.length == 0) return FALSE;
if (prog.length == 1) return prog[0];

@ -387,6 +387,8 @@ PlayerObject.prototype.startWork = function() {
}
PlayerObject.prototype.work = function(numCycles) {
this.workRepGainRate = this.getWorkRepGain();
this.workHackExpGained += this.workHackExpGainRate * numCycles;
this.workStrExpGained += this.workStrExpGainRate * numCycles;
this.workDefExpGained += this.workDefExpGainRate * numCycles;
@ -512,6 +514,7 @@ PlayerObject.prototype.startFactionHackWork = function(faction) {
this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.FactionWorkHacking;
this.currentWorkFactionDescription = "carrying out hacking contracts";
this.startFactionWork(faction);
@ -527,6 +530,7 @@ PlayerObject.prototype.startFactionFieldWork = function(faction) {
this.workRepGainRate = this.getFactionFieldWorkRepGain();
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.factionWorkField;
this.currentWorkFactionDescription = "carrying out field missions"
this.startFactionWork(faction);
@ -539,9 +543,10 @@ PlayerObject.prototype.startFactionSecurityWork = function(faction) {
this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.workRepGainRate = this.getFactionFieldWorkRepGain();
this.workRepGainRate = this.getFactionSecurityWorkRepGain();
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.FactionWorkSecurity;
this.currentWorkFactionDescription = "performing security detail"
this.startFactionWork(faction);
@ -550,6 +555,21 @@ PlayerObject.prototype.startFactionSecurityWork = function(faction) {
PlayerObject.prototype.workForFaction = function(numCycles) {
var faction = Factions[this.currentWorkFactionName];
//Constantly update the rep gain rate
switch (this.factionWorkType) {
case CONSTANTS.FactionWorkHacking:
this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
break;
case CONSTANTS.FactionWorkField:
this.workRepGainRate = this.getFactionFieldWorkRepGain();
break;
case CONSTANTS.FactionWorkSecurity:
this.workRepGainRate = this.getFactionSecurityWorkRepGain();
break;
default:
break;
}
this.workHackExpGained += this.workHackExpGainRate * numCycles;
this.workStrExpGained += this.workStrExpGainRate * numCycles;
this.workDefExpGained += this.workDefExpGainRate * numCycles;

@ -23,6 +23,7 @@ purchaseServer = function(ram, cost) {
//Connect new server to home computer
var homeComputer = Player.getHomeComputer();
homeComputer.serversOnNetwork.push(newServ.ip);
newServ.serversOnNetwork.push(homeComputer.ip);
Player.money -= cost;

@ -469,31 +469,31 @@ initForeignServers = function() {
//Gyms
var CrushFitnessGymServer = new Server();
CrushFitnessGymServer.init(createRandomIp(), "crush-fitness", "Crush Fitness", true, false, false, false, 4);
CrushFitnessGymServer.setHackingParameters(250, 500000, 40, 25);
CrushFitnessGymServer.setHackingParameters(250, 300000, 40, 25);
CrushFitnessGymServer.setPortProperties(2);
AddToAllServers(CrushFitnessGymServer);
var IronGymServer = new Server();
IronGymServer.init(createRandomIp(), "iron-gym", "Iron Gym Network", true, false, false, false, 4);
IronGymServer.setHackingParameters(100, 250000, 30, 15);
IronGymServer.setHackingParameters(100, 150000, 30, 15);
IronGymServer.setPortProperties(1);
AddToAllServers(IronGymServer);
var MilleniumFitnessGymServer = new Server();
MilleniumFitnessGymServer.init(createRandomIp(), "millenium-fitness", "Millenium Fitness Network", true, false, false, false, 8);
MilleniumFitnessGymServer.setHackingParameters(500, 600000, 50, 30);
MilleniumFitnessGymServer.setHackingParameters(500, 400000, 50, 30);
MilleniumFitnessGymServer.setPortProperties(3);
AddToAllServers(MilleniumFitnessGymServer);
var PowerhouseGymServer = new Server();
PowerhouseGymServer.init(createRandomIp(), "powerhouse-fitness", "Powerhouse Fitness", true, false, false, false, 8);
PowerhouseGymServer.setHackingParameters(1000, 2000000, 60, 50);
PowerhouseGymServer.setHackingParameters(1000, 1000000, 60, 50);
PowerhouseGymServer.setPortProperties(5);
AddToAllServers(PowerhouseGymServer);
var SnapFitnessGymServer = new Server();
SnapFitnessGymServer.init(createRandomIp(), "snap-fitness", "Snap Fitness", true, false, false, false, 8);
SnapFitnessGymServer.setHackingParameters(750, 1000000, 50, 45);
SnapFitnessGymServer.setHackingParameters(750, 750000, 50, 45);
SnapFitnessGymServer.setPortProperties(4);
AddToAllServers(SnapFitnessGymServer);
@ -643,7 +643,7 @@ processServerGrowth = function(numCycles) {
var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage;
//Apply serverGrowth for the calculated number of growth cycles
var serverGrowth = Math.pow(1.0001, numServerGrowthCyclesAdjusted);
var serverGrowth = Math.pow(1.0004, numServerGrowthCyclesAdjusted);
//console.log("serverGrowth ratio: " + serverGrowth);
server.moneyAvailable *= serverGrowth;
}

@ -343,7 +343,7 @@ var Terminal = {
//Cannot edit scripts that are currently running
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
if (filename == Player.getCurrentServer().runningScripts[i].filename) {
if (filename == Player.getCurrentServer().runningScripts[i]) {
post("Cannot open/edit scripts that are currently running!"); return;
}
}