Merge pull request #969 from danielyxie/dev

Hotfix Vigilante Justice reducing wanted by a percentage.
This commit is contained in:
hydroflame 2021-05-29 12:50:53 -04:00 committed by GitHub
commit e611ab7bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 45 additions and 80 deletions

File diff suppressed because one or more lines are too long

20
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -193,9 +193,6 @@ export class Blackjack extends Game<Props, State> {
const dealerHandValue = this.getTrueHandValue(newDealerHand);
const playerHandValue = this.getTrueHandValue(this.state.playerHand);
console.log(`dealerHandValue: ${dealerHandValue}`);
console.log(`playerHandValue: ${playerHandValue}`);
// We expect nobody to have busted. If someone busted, there is an error
// in our game logic
if (dealerHandValue > 21 || playerHandValue > 21) {

@ -175,7 +175,7 @@ export class CodingContract {
async prompt(): Promise<CodingContractResult> {
const popupId = `coding-contract-prompt-popup-${this.fn}`;
return new Promise<CodingContractResult>((resolve, reject) => {
let popup = new CodingContractPopup({
const popup = new CodingContractPopup({
c: this,
popupId: popupId,
onClose: () => {
@ -183,14 +183,13 @@ export class CodingContract {
removePopup(popupId);
},
onAttempt: (val: string) => {
console.log(`top; ${val}`);
if (this.isSolution(val)) {
resolve(CodingContractResult.Success);
} else {
resolve(CodingContractResult.Failure);
}
removePopup(popupId);
}
},
});
createPopup(popupId, CodingContractPopup, popup.props);
});

@ -231,47 +231,7 @@ export const CONSTANTS: IMap<any> = {
v0.51.9 - 2021-05-17 offline progress and exports!
-------
Alias
* several commands can be included in 1 alias. Recursive alias now work to
a depth of 10. (@Dawe)
Offline
* Offline money gain has been reworked (it is more generous)
* If you're not working anywhere and go offline the game will work for you
at all your factions evenly.
Export
* Exporting now gives +1 favor to all joined factions every 24h.
Corp
* Self-fund with an invalid name no longer takes away 150b anyway.
* Can no longer export negative amount
Bladeburner
* No longer waste overflowing time.
Text Editors
* All settings will now be saved and loaded correctly.
Terminal
* 'scan' now works for servers that are more than 21 character long.
Misc.
* ls now correctly lists all files.
* importing auto save+reloads (@Dawe)
* Fix a bug where .fconf could not be created
* Fix formatting inconsistencies for some logs of netscript functions.
* Fix a bug where Cashroot starter kit would appear as [object Object] in
confirmation dialog.
* Fix some ram not displayed as 0.00GB
* Fix error message throw undefined variable error
* City hall now has some generic text if you can't create a corp yet.
* Deleting a file without extension now returns an appropriate error message.
* Fixed an issue where bladeburner would miscalculate the cost of hospitalization.
* It is now possible to suppress bladeburner "action stopped" popup.
* Updated several dependencies (big who cares, I know)
* ls no longer prints lingering newline.
* Money earned/spent by sleeves is now tracked under Character>Money
SF -1
* Added a new SF -1: Bypass
`,
}

@ -14,6 +14,7 @@ export enum Exploit {
UndocumentedFunctionCall = 'UndocumentedFunctionCall',
Unclickable = 'Unclickable',
PrototypeTampering = 'PrototypeTampering',
Bypass = 'Bypass',
// To the players reading this. Yes you're supposed to add EditSaveFile by
// editing your save file, yes you could add them all, no we don't care
// that's not the point.
@ -27,6 +28,7 @@ const names: {
'EditSaveFile': 'by editing your save file.',
'PrototypeTampering': 'by tampering with Numbers prototype.',
'Unclickable': 'by clicking the unclickable.',
'Bypass': 'by circumventing the ram cost of document.',
}

@ -1,14 +1,11 @@
import { Factions } from "./Faction/Factions";
import { IPlayer } from "./PersonObjects/IPlayer";
export let LastExportBonus: number = 0;
export let LastExportBonus = 0;
const bonusTimer = 24*60*60*1000; // 24h
export function canGetBonus(): boolean {
const now = (new Date()).getTime()
console.log(now);
console.log(LastExportBonus);
console.log(now - LastExportBonus);
if(now - LastExportBonus > bonusTimer) return true;
return false;
}

@ -223,11 +223,14 @@ Gang.prototype.process = function(numCycles=1, player) {
Gang.prototype.processGains = function(numCycles=1, player) {
// Get gains per cycle
var moneyGains = 0, respectGains = 0, wantedLevelGains = 0;
for (var i = 0; i < this.members.length; ++i) {
let moneyGains = 0, respectGains = 0, wantedLevelGains = 0;
let justice = 0;
for (let i = 0; i < this.members.length; ++i) {
respectGains += (this.members[i].calculateRespectGain(this));
wantedLevelGains += (this.members[i].calculateWantedLevelGain(this));
moneyGains += (this.members[i].calculateMoneyGain(this));
const wantedLevelGain = this.members[i].calculateWantedLevelGain(this);
wantedLevelGains += wantedLevelGain;
if(wantedLevelGain < 0) justice++; // this member is lowering wanted.
}
this.respectGainRate = respectGains;
this.wantedGainRate = wantedLevelGains;
@ -241,7 +244,7 @@ Gang.prototype.processGains = function(numCycles=1, player) {
if (!(fac instanceof Faction)) {
dialogBoxCreate("ERROR: Could not get Faction associates with your gang. This is a bug, please report to game dev");
} else {
var favorMult = 1 + (fac.favor / 100);
let favorMult = 1 + (fac.favor / 100);
fac.playerReputation += ((player.faction_rep_mult * gain * favorMult) / GangRespectToReputationRatio);
}
@ -258,7 +261,7 @@ Gang.prototype.processGains = function(numCycles=1, player) {
} else {
const oldWanted = this.wanted;
let newWanted = oldWanted + (wantedLevelGains * numCycles);
newWanted = newWanted * (1 - justice * 0.001); // safeguard
// Prevent overflow
if (wantedLevelGains <= 0 && newWanted > oldWanted) {
newWanted = 1;

@ -42,7 +42,6 @@ export class GymLocation extends React.Component<IProps, any> {
calculateCost(): number {
const ip = SpecialServerIps.getIp(this.props.loc.name);
console.log(`ip: ${ip}`);
const server = getServer(ip);
if(server == null || !server.hasOwnProperty('backdoorInstalled')) return this.props.loc.costMult;
const discount = (server as Server).backdoorInstalled? 0.9 : 1;

@ -45,7 +45,6 @@ export class UniversityLocation extends React.Component<IProps, any> {
calculateCost(): number {
const ip = SpecialServerIps.getIp(this.props.loc.name);
console.log(`ip: ${ip}`);
const server = getServer(ip);
if(server == null || !server.hasOwnProperty('backdoorInstalled')) return this.props.loc.costMult;
const discount = (server as Server).backdoorInstalled? 0.9 : 1;

@ -4442,6 +4442,18 @@ function NetscriptFunctions(workerScript) {
exploit: function() {
Player.giveExploit(Exploit.UndocumentedFunctionCall);
},
bypass: function(doc) {
// reset both fields first
doc.completely_unused_field = undefined;
document.completely_unused_field = undefined;
// set one to true and check that it affected the other.
document.completely_unused_field = true;
if(doc.completely_unused_field && workerScript.ramUsage === 1.6) {
Player.giveExploit(Exploit.Bypass);
}
doc.completely_unused_field = undefined;
document.completely_unused_field = undefined;
},
flags: function(data) {
data = toNative(data);
// We always want the help flag.

@ -250,8 +250,6 @@ function loadGame(saveString) {
try {
ExportBonus.LastExportBonus = JSON.parse(saveObj.LastExportBonus);
} catch(err) {
console.log(saveObj.LastExportBonus);
console.log(ExportBonus.LastExportBonus);
ExportBonus.LastExportBonus = (new Date()).getTime();
console.error("ERROR: Failed to parse .fconf Settings "+ err);
}

@ -181,7 +181,6 @@ export class BaseServer {
* @returns {IReturnStatus} Return status object indicating whether or not file was deleted
*/
removeFile(fn: string): IReturnStatus {
console.log(`removing ${fn}`);
if (fn.endsWith(".exe") || fn.match(/^.+\.exe-\d+(?:\.\d*)?%-INC$/) != null) {
for (let i = 0; i < this.programs.length; ++i) {
if (this.programs[i] === fn) {

@ -1320,7 +1320,7 @@ let Terminal = {
} catch(err) {
status = {
res: false,
msg: 'No such file exists'
msg: 'No such file exists',
};
}
@ -1886,7 +1886,7 @@ let Terminal = {
return {
hostname: server.hostname,
ip: server.ip,
hasRoot: server.hasAdminRights ? "Y" : "N"
hasRoot: server.hasAdminRights ? "Y" : "N",
}
});
servers.unshift({

@ -40,7 +40,7 @@ export class CodingContractPopup extends React.Component<IProps, IState>{
render(): React.ReactNode {
const contractType: CodingContractType = CodingContractTypes[this.props.c.type];
let description = [];
const description = [];
for (const [i, value] of contractType.desc(this.props.c.data).split('\n').entries())
description.push(<span key={i} dangerouslySetInnerHTML={{__html: value+'<br />'}}></span>);
return (

@ -17,7 +17,7 @@ type IState = {
export class CopyableText extends React.Component<IProps, IState> {
public static defaultProps = {
//Default span to prevent destroying current clickables
tag: ClickableTag.Tag_span
tag: ClickableTag.Tag_span,
};
constructor(props: IProps) {

@ -39,8 +39,8 @@ function gameOptionsBoxOpen() {
box.style.display = "flex";
// special exception for bladeburner popup because it's only visible later.
document.getElementById("settingsSuppressBladeburnerPopup").
closest('fieldset').style.display =
document.getElementById("settingsSuppressBladeburnerPopup")
.closest('fieldset').style.display =
Player.canAccessBladeburner() ? 'block' : 'none';
setTimeout(function() {
gameOptionsOpened = true;