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 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);
});

@ -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;

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

@ -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;