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
=========
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
------------------

@ -1,7 +1,7 @@
import {IMap} from "./types";
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
//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
* 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
`

@ -1,4 +1,7 @@
import { CONSTANTS } from "../Constants";
import { IPlayer } from "../PersonObjects/IPlayer";
import { IPlayerOrSleeve } from "../PersonObjects/IPlayerOrSleeve";
export interface IConstructorParams {
hacking_success_weight?: number;
strength_success_weight?: number;
@ -17,29 +20,6 @@ export interface IConstructorParams {
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 {
// Number representing the difficulty of the crime. Used for success chance calculations
difficulty: number = 0;
@ -129,7 +109,7 @@ export class Crime {
return this.time;
}
successRate(p: IPlayer): number {
successRate(p: IPlayerOrSleeve): number {
let chance: number = (this.hacking_success_weight * p.hacking_skill +
this.strength_success_weight * p.strength +
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;
agility: number = 1;
charisma: number = 1;
intelligence: number = 1;
hp: number = 10;
max_hp: number = 10;

@ -184,7 +184,7 @@ export class Sleeve extends Person {
this.resetTaskStatus();
return retValue;
}
if (Math.random() < crime.successRate(p)) {
if (Math.random() < crime.successRate(this)) {
// Success
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}.`;
break;
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;
case "Take University Course":
elems.taskDescription!.innerText = `This sleeve is currently studying/taking a course at ${sleeve.currentTaskLocation}.`;

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