Vigilante Justice now reduces wanted by a percentage to help players stuck with very high wanted level.

This commit is contained in:
Olivier Gagnon 2021-05-29 12:48:58 -04:00
parent 75b2806c93
commit 60d6d49c43
15 changed files with 29 additions and 39 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 dealerHandValue = this.getTrueHandValue(newDealerHand);
const playerHandValue = this.getTrueHandValue(this.state.playerHand); 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 // We expect nobody to have busted. If someone busted, there is an error
// in our game logic // in our game logic
if (dealerHandValue > 21 || playerHandValue > 21) { if (dealerHandValue > 21 || playerHandValue > 21) {

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

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

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

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

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

@ -4448,7 +4448,6 @@ function NetscriptFunctions(workerScript) {
document.completely_unused_field = undefined; document.completely_unused_field = undefined;
// set one to true and check that it affected the other. // set one to true and check that it affected the other.
document.completely_unused_field = true; document.completely_unused_field = true;
console.log(workerScript.ramUsage);
if(doc.completely_unused_field && workerScript.ramUsage === 1.6) { if(doc.completely_unused_field && workerScript.ramUsage === 1.6) {
Player.giveExploit(Exploit.Bypass); Player.giveExploit(Exploit.Bypass);
} }

@ -250,8 +250,6 @@ function loadGame(saveString) {
try { try {
ExportBonus.LastExportBonus = JSON.parse(saveObj.LastExportBonus); ExportBonus.LastExportBonus = JSON.parse(saveObj.LastExportBonus);
} catch(err) { } catch(err) {
console.log(saveObj.LastExportBonus);
console.log(ExportBonus.LastExportBonus);
ExportBonus.LastExportBonus = (new Date()).getTime(); ExportBonus.LastExportBonus = (new Date()).getTime();
console.error("ERROR: Failed to parse .fconf Settings "+ err); 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 * @returns {IReturnStatus} Return status object indicating whether or not file was deleted
*/ */
removeFile(fn: string): IReturnStatus { removeFile(fn: string): IReturnStatus {
console.log(`removing ${fn}`);
if (fn.endsWith(".exe") || fn.match(/^.+\.exe-\d+(?:\.\d*)?%-INC$/) != null) { if (fn.endsWith(".exe") || fn.match(/^.+\.exe-\d+(?:\.\d*)?%-INC$/) != null) {
for (let i = 0; i < this.programs.length; ++i) { for (let i = 0; i < this.programs.length; ++i) {
if (this.programs[i] === fn) { if (this.programs[i] === fn) {

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

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

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

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