Merge branch 'dev' into 4125

This commit is contained in:
Conner Tennery
2022-10-04 09:39:12 -07:00
committed by GitHub
485 changed files with 8628 additions and 9817 deletions
+17 -17
View File
@@ -1,30 +1,30 @@
import { IPlayer } from "../../PersonObjects/IPlayer";
import { Player } from "../../Player";
import { calculateSkill } from "../../PersonObjects/formulas/skill";
function calculateRawDiff(player: IPlayer, stats: number, startingDifficulty: number): number {
const difficulty = startingDifficulty - Math.pow(stats, 0.9) / 250 - player.skills.intelligence / 1600;
function calculateRawDiff(stats: number, startingDifficulty: number): number {
const difficulty = startingDifficulty - Math.pow(stats, 0.9) / 250 - Player.skills.intelligence / 1600;
if (difficulty < 0) return 0;
if (difficulty > 3) return 3;
return difficulty;
}
export function calculateDifficulty(player: IPlayer, startingSecurityLevel: number): number {
export function calculateDifficulty(startingSecurityLevel: number): number {
const totalStats =
player.skills.strength +
player.skills.defense +
player.skills.dexterity +
player.skills.agility +
player.skills.charisma;
return calculateRawDiff(player, totalStats, startingSecurityLevel);
Player.skills.strength +
Player.skills.defense +
Player.skills.dexterity +
Player.skills.agility +
Player.skills.charisma;
return calculateRawDiff(totalStats, startingSecurityLevel);
}
export function calculateReward(player: IPlayer, startingSecurityLevel: number): number {
export function calculateReward(startingSecurityLevel: number): number {
const xpMult = 10 * 60 * 15;
const total =
calculateSkill(player.mults.strength_exp * xpMult, player.mults.strength) +
calculateSkill(player.mults.defense_exp * xpMult, player.mults.defense) +
calculateSkill(player.mults.agility_exp * xpMult, player.mults.agility) +
calculateSkill(player.mults.dexterity_exp * xpMult, player.mults.dexterity) +
calculateSkill(player.mults.charisma_exp * xpMult, player.mults.charisma);
return calculateRawDiff(player, total, startingSecurityLevel);
calculateSkill(Player.mults.strength_exp * xpMult, Player.mults.strength) +
calculateSkill(Player.mults.defense_exp * xpMult, Player.mults.defense) +
calculateSkill(Player.mults.agility_exp * xpMult, Player.mults.agility) +
calculateSkill(Player.mults.dexterity_exp * xpMult, Player.mults.dexterity) +
calculateSkill(Player.mults.charisma_exp * xpMult, Player.mults.charisma);
return calculateRawDiff(total, startingSecurityLevel);
}
+7 -17
View File
@@ -1,15 +1,10 @@
import { IPlayer } from "../../PersonObjects/IPlayer";
import { Player } from "../../Player";
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
import { LocationsMetadata } from "../../Locations/data/LocationsMetadata";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { Faction } from "../../Faction/Faction";
export function calculateSellInformationCashReward(
player: IPlayer,
reward: number,
maxLevel: number,
difficulty: number,
): number {
export function calculateSellInformationCashReward(reward: number, maxLevel: number, difficulty: number): number {
const levelBonus = maxLevel * Math.pow(1.01, maxLevel);
return (
@@ -17,17 +12,12 @@ export function calculateSellInformationCashReward(
Math.pow(difficulty, 3) *
3e3 *
levelBonus *
(player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.5 : 1) *
(Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.5 : 1) *
BitNodeMultipliers.InfiltrationMoney
);
}
export function calculateTradeInformationRepReward(
player: IPlayer,
reward: number,
maxLevel: number,
difficulty: number,
): number {
export function calculateTradeInformationRepReward(reward: number, maxLevel: number, difficulty: number): number {
const levelBonus = maxLevel * Math.pow(1.01, maxLevel);
return (
@@ -35,12 +25,12 @@ export function calculateTradeInformationRepReward(
Math.pow(difficulty, 1.2) *
30 *
levelBonus *
(player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.5 : 1) *
(Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.5 : 1) *
BitNodeMultipliers.InfiltrationRep
);
}
export function calculateInfiltratorsRepReward(player: IPlayer, faction: Faction, difficulty: number): number {
export function calculateInfiltratorsRepReward(faction: Faction, difficulty: number): number {
const maxStartingSecurityLevel = LocationsMetadata.reduce((acc, data): number => {
const startingSecurityLevel = data.infiltrationData?.startingSecurityLevel || 0;
return acc > startingSecurityLevel ? acc : startingSecurityLevel;
@@ -48,6 +38,6 @@ export function calculateInfiltratorsRepReward(player: IPlayer, faction: Faction
const baseRepGain = (difficulty / maxStartingSecurityLevel) * 5000;
return (
baseRepGain * (player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 2 : 1) * (1 + faction.favor / 100)
baseRepGain * (Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 2 : 1) * (1 + faction.favor / 100)
);
}
+7 -8
View File
@@ -1,7 +1,8 @@
import { Button, Container, Paper, Typography } from "@mui/material";
import React, { useState } from "react";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { use } from "../../ui/Context";
import { Router } from "../../ui/GameRoot";
import { Player } from "../../Player";
import { BackwardGame } from "./BackwardGame";
import { BracketGame } from "./BracketGame";
import { BribeGame } from "./BribeGame";
@@ -39,8 +40,6 @@ const minigames = [
];
export function Game(props: IProps): React.ReactElement {
const player = use.Player();
const router = use.Router();
const [level, setLevel] = useState(1);
const [stage, setStage] = useState(Stage.Countdown);
const [results, setResults] = useState("");
@@ -91,17 +90,17 @@ export function Game(props: IProps): React.ReactElement {
// Kill the player immediately if they use automation, so
// it's clear they're not meant to
const damage = options?.automated
? player.hp.current
: props.StartingDifficulty * 3 * (player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 0.5 : 1);
if (player.takeDamage(damage)) {
router.toCity();
? Player.hp.current
: props.StartingDifficulty * 3 * (Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 0.5 : 1);
if (Player.takeDamage(damage)) {
Router.toCity();
return;
}
setupNextGame();
}
function cancel(): void {
router.toCity();
Router.toCity();
return;
}
+1 -2
View File
@@ -1,7 +1,7 @@
import { Paper } from "@mui/material";
import React, { useEffect, useState } from "react";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { use } from "../../ui/Context";
import { Player } from "../../Player";
import { ProgressBar } from "../../ui/React/Progress";
interface IProps {
@@ -12,7 +12,6 @@ interface IProps {
}
export function GameTimer(props: IProps): React.ReactElement {
const player = use.Player();
const [v, setV] = useState(100);
const totalMillis =
(!props.ignoreAugment_WKSharmonizer && player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.3 : 1) *
+4 -6
View File
@@ -1,6 +1,6 @@
import React, { useState } from "react";
import { Location } from "../../Locations/Location";
import { use } from "../../ui/Context";
import { Router } from "../../ui/GameRoot";
import { calculateDifficulty, calculateReward } from "../formulas/game";
import { Game } from "./Game";
import { Intro } from "./Intro";
@@ -9,17 +9,15 @@ interface IProps {
}
export function InfiltrationRoot(props: IProps): React.ReactElement {
const player = use.Player();
const router = use.Router();
const [start, setStart] = useState(false);
if (props.location.infiltrationData === undefined) throw new Error("Trying to do infiltration on invalid location.");
const startingSecurityLevel = props.location.infiltrationData.startingSecurityLevel;
const difficulty = calculateDifficulty(player, startingSecurityLevel);
const reward = calculateReward(player, startingSecurityLevel);
const difficulty = calculateDifficulty(startingSecurityLevel);
const reward = calculateReward(startingSecurityLevel);
function cancel(): void {
router.toCity();
Router.toCity();
}
return (
+9 -10
View File
@@ -3,7 +3,8 @@ import React, { useState } from "react";
import { FactionNames } from "../../Faction/data/FactionNames";
import { inviteToFaction } from "../../Faction/FactionHelpers";
import { Factions } from "../../Faction/Factions";
import { use } from "../../ui/Context";
import { Router } from "../../ui/GameRoot";
import { Player } from "../../Player";
import { Money } from "../../ui/React/Money";
import { Reputation } from "../../ui/React/Reputation";
import { formatNumber } from "../../utils/StringHelperFunctions";
@@ -21,25 +22,23 @@ interface IProps {
}
export function Victory(props: IProps): React.ReactElement {
const player = use.Player();
const router = use.Router();
const [faction, setFaction] = useState("none");
function quitInfiltration(): void {
handleInfiltrators();
router.toCity();
Router.toCity();
}
const soa = Factions[FactionNames.ShadowsOfAnarchy];
const repGain = calculateTradeInformationRepReward(player, props.Reward, props.MaxLevel, props.StartingDifficulty);
const moneyGain = calculateSellInformationCashReward(player, props.Reward, props.MaxLevel, props.StartingDifficulty);
const infiltrationRepGain = calculateInfiltratorsRepReward(player, soa, props.StartingDifficulty);
const repGain = calculateTradeInformationRepReward(props.Reward, props.MaxLevel, props.StartingDifficulty);
const moneyGain = calculateSellInformationCashReward(props.Reward, props.MaxLevel, props.StartingDifficulty);
const infiltrationRepGain = calculateInfiltratorsRepReward(soa, props.StartingDifficulty);
const isMemberOfInfiltrators = player.factions.includes(FactionNames.ShadowsOfAnarchy);
const isMemberOfInfiltrators = Player.factions.includes(FactionNames.ShadowsOfAnarchy);
function sell(): void {
handleInfiltrators();
player.gainMoney(moneyGain, "infiltration");
Player.gainMoney(moneyGain, "infiltration");
quitInfiltration();
}
@@ -81,7 +80,7 @@ export function Victory(props: IProps): React.ReactElement {
<MenuItem key={"none"} value={"none"}>
{"none"}
</MenuItem>
{player.factions
{Player.factions
.filter((f) => Factions[f].getInfo().offersWork())
.map((f) => (
<MenuItem key={f} value={f}>