This commit is contained in:
danielyxie 2019-02-11 16:23:46 -08:00
parent 00e8655ef9
commit 9137c24274
10 changed files with 101 additions and 78 deletions

File diff suppressed because one or more lines are too long

80
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -3,6 +3,28 @@
Changelog Changelog
========= =========
v0.43.1 - 2/11/2019
-------------------
* Terminal changes:
* Quoted arguments are now properly parsed. (e.g. 'run f.script "this is one argument"' will be correctly parsed)
* Errors are now shown in red text
* 'unalias' command now has a different format and no longer needs the quotations
* Bug Fix: Fixed several edge cases where autocomplete wasn't working properly
* Added two new Bladeburner skills for increasing money and experience gain
* Made some minor adjustments to Bladeburner UI
* Corporation "Smart Factories" and "Smart Storage" upgrades have slightly lower price multipliers
* Added nFormat Netscript function
* Added 6 new Coding Contract problems
* Updated documentation with list of all Coding Contract problems
* Minor improvements for 'Active Scripts' UI
* Implemented several optimizations for active scripts. The game should now use less memory and the savefile should be slightly smaller when there are many scripts running
* Bug Fix: A Stock Forecast should no longer go above 1 (i.e. 100%)
* Bug Fix: The cost of Resleeves should no longer be affected by buying Augs
* Bug Fix: Duplicate Sleeves now use their own stats to determine crime success rate, instead of the host consciousness' stats
* Bug Fix: You can now call the prompt() Netscript function from multiple scripts simultaneously
v0.43.0 - 2/4/2019 v0.43.0 - 2/4/2019
------------------ ------------------

@ -1,7 +1,7 @@
import {IMap} from "./types"; import {IMap} from "./types";
export let CONSTANTS: IMap<any> = { export let CONSTANTS: IMap<any> = {
Version: "0.43.0", Version: "0.43.1",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@ -527,6 +527,7 @@ export let CONSTANTS: IMap<any> = {
* Implemented several optimizations for active scripts. The game should now use less memory and the savefile should be slightly smaller when there are many scripts running * Implemented several optimizations for active scripts. The game should now use less memory and the savefile should be slightly smaller when there are many scripts running
* Bug Fix: A Stock Forecast should no longer go above 1 (i.e. 100%) * Bug Fix: A Stock Forecast should no longer go above 1 (i.e. 100%)
* Bug Fix: The cost of Resleeves should no longer be affected by buying Augs * Bug Fix: The cost of Resleeves should no longer be affected by buying Augs
* Bug Fix: Duplicate Sleeves now use their own stats to determine crime success rate, instead of the host consciousness' stats
* Bug Fix: You can now call the prompt() Netscript function from multiple scripts simultaneously * Bug Fix: You can now call the prompt() Netscript function from multiple scripts simultaneously
` `

@ -1,4 +1,7 @@
import { CONSTANTS } from "../Constants"; import { CONSTANTS } from "../Constants";
import { IPlayer } from "../PersonObjects/IPlayer";
import { IPlayerOrSleeve } from "../PersonObjects/IPlayerOrSleeve";
export interface IConstructorParams { export interface IConstructorParams {
hacking_success_weight?: number; hacking_success_weight?: number;
strength_success_weight?: number; strength_success_weight?: number;
@ -17,29 +20,6 @@ export interface IConstructorParams {
kills?: number; kills?: number;
} }
interface IPlayer {
startCrime(crimeType: string,
hackExp: number,
strExp: number,
defExp: number,
dexExp: number,
agiExp: number,
chaExp: number,
money: number,
time: number,
singParams: any): void;
hacking_skill: number;
strength: number;
defense: number;
dexterity: number;
agility: number;
charisma: number;
intelligence: number;
crime_success_mult: number;
}
export class Crime { export class Crime {
// Number representing the difficulty of the crime. Used for success chance calculations // Number representing the difficulty of the crime. Used for success chance calculations
difficulty: number = 0; difficulty: number = 0;
@ -129,7 +109,7 @@ export class Crime {
return this.time; return this.time;
} }
successRate(p: IPlayer): number { successRate(p: IPlayerOrSleeve): number {
let chance: number = (this.hacking_success_weight * p.hacking_skill + let chance: number = (this.hacking_success_weight * p.hacking_skill +
this.strength_success_weight * p.strength + this.strength_success_weight * p.strength +
this.defense_success_weight * p.defense + this.defense_success_weight * p.defense +

@ -0,0 +1,24 @@
// Interface that represents either the player (PlayerObject) or
// a Sleeve. Used for functions that need to take in both.
export interface IPlayerOrSleeve {
// Stats
hacking_skill: number;
strength: number;
defense: number;
dexterity: number;
agility: number;
charisma: number;
intelligence: number;
// Experience
hacking_exp: number;
strength_exp: number;
defense_exp: number;
dexterity_exp: number;
agility_exp: number;
charisma_exp: number;
// Multipliers
crime_success_mult: number;
}

@ -41,6 +41,7 @@ export abstract class Person {
dexterity: number = 1; dexterity: number = 1;
agility: number = 1; agility: number = 1;
charisma: number = 1; charisma: number = 1;
intelligence: number = 1;
hp: number = 10; hp: number = 10;
max_hp: number = 10; max_hp: number = 10;

@ -184,7 +184,7 @@ export class Sleeve extends Person {
this.resetTaskStatus(); this.resetTaskStatus();
return retValue; return retValue;
} }
if (Math.random() < crime.successRate(p)) { if (Math.random() < crime.successRate(this)) {
// Success // Success
const successGainRates: ITaskTracker = createTaskTracker(); const successGainRates: ITaskTracker = createTaskTracker();

@ -717,7 +717,7 @@ function updateSleeveTaskDescription(sleeve: Sleeve, elems: ISleeveUIElems): voi
elems.taskDescription!.innerText = `This sleeve is currently doing ${detailValue2} for ${sleeve.currentTaskLocation}.`; elems.taskDescription!.innerText = `This sleeve is currently doing ${detailValue2} for ${sleeve.currentTaskLocation}.`;
break; break;
case "Commit Crime": case "Commit Crime":
elems.taskDescription!.innerText = `This sleeve is currently attempting to ${Crimes[detailValue].type} (Success Rate: ${numeralWrapper.formatPercentage(Crimes[detailValue].successRate(playerRef))}).`; elems.taskDescription!.innerText = `This sleeve is currently attempting to ${Crimes[detailValue].type} (Success Rate: ${numeralWrapper.formatPercentage(Crimes[detailValue].successRate(sleeve))}).`;
break; break;
case "Take University Course": case "Take University Course":
elems.taskDescription!.innerText = `This sleeve is currently studying/taking a course at ${sleeve.currentTaskLocation}.`; elems.taskDescription!.innerText = `This sleeve is currently studying/taking a course at ${sleeve.currentTaskLocation}.`;

@ -613,7 +613,7 @@ let Terminal = {
break; break;
} }
} catch(e) { } catch(e) {
console.log("Exception in Terminal.modifyInput: " + e); console.error("Exception in Terminal.modifyInput: " + e);
} }
}, },
@ -659,11 +659,11 @@ let Terminal = {
terminalInput.setSelectionRange(inputLength, inputLength); terminalInput.setSelectionRange(inputLength, inputLength);
break; break;
default: default:
console.log("WARNING: Invalid loc argument in Terminal.moveTextCursor()"); console.warn("Invalid loc argument in Terminal.moveTextCursor()");
break; break;
} }
} catch(e) { } catch(e) {
console.log("Exception in Terminal.moveTextCursor: " + e); console.error("Exception in Terminal.moveTextCursor: " + e);
} }
}, },
@ -709,7 +709,6 @@ let Terminal = {
//Calculate whether hack was successful //Calculate whether hack was successful
var hackChance = calculateHackingChance(server); var hackChance = calculateHackingChance(server);
var rand = Math.random(); var rand = Math.random();
console.log("Hack success chance: " + hackChance + ", rand: " + rand);
var expGainedOnSuccess = calculateHackingExpGain(server); var expGainedOnSuccess = calculateHackingExpGain(server);
var expGainedOnFailure = (expGainedOnSuccess / 4); var expGainedOnFailure = (expGainedOnSuccess / 4);
if (rand < hackChance) { //Success! if (rand < hackChance) { //Success!
@ -913,8 +912,7 @@ let Terminal = {
args.push(arg); args.push(arg);
} }
} }
console.log("Terminal console command parsing returned:");
console.log(args);
return args; return args;
}, },
@ -1022,7 +1020,7 @@ let Terminal = {
case iTutorialSteps.TerminalRunScript: case iTutorialSteps.TerminalRunScript:
if (commandArray.length == 2 && if (commandArray.length == 2 &&
commandArray[0] == "run" && commandArray[1] == "foodnstuff.script") { commandArray[0] == "run" && commandArray[1] == "foodnstuff.script") {
Terminal.runScript("foodnstuff.script"); Terminal.runScript(commandArray);
iTutorialNextStep(); iTutorialNextStep();
} else {post("Bad command. Please follow the tutorial");} } else {post("Bad command. Please follow the tutorial");}
break; break;
@ -1613,7 +1611,6 @@ let Terminal = {
}, },
connectToServer: function(ip) { connectToServer: function(ip) {
console.log("Connect to server called");
var serv = getServer(ip); var serv = getServer(ip);
if (serv == null) { if (serv == null) {
post("Invalid server. Connection failed."); post("Invalid server. Connection failed.");
@ -2161,7 +2158,6 @@ let Terminal = {
yesBtn.innerHTML = "Travel to BitNode Nexus"; yesBtn.innerHTML = "Travel to BitNode Nexus";
noBtn.innerHTML = "Cancel"; noBtn.innerHTML = "Cancel";
yesBtn.addEventListener("click", function() { yesBtn.addEventListener("click", function() {
console.log("yesBtn event listener");
hackWorldDaemon(Player.bitNodeN, true); hackWorldDaemon(Player.bitNodeN, true);
return yesNoBoxClose(); return yesNoBoxClose();
}); });
@ -2286,7 +2282,6 @@ let Terminal = {
break; break;
} }
Terminal.contractOpen = false; Terminal.contractOpen = false;
console.log(Terminal.contractOpen);
}, },
}; };