prettify, sorry for the big ass commit

This commit is contained in:
Olivier Gagnon
2021-09-04 19:09:30 -04:00
parent 3d7cdb4ef9
commit a18bdd6afc
554 changed files with 91615 additions and 66138 deletions
+43 -32
View File
@@ -5,44 +5,55 @@ import { IEngine } from "../IEngine";
import * as React from "react";
import * as ReactDOM from "react-dom";
let container: HTMLElement = document.createElement('div');
let container: HTMLElement = document.createElement("div");
(function() {
function setContainer(): void {
const c = document.getElementById("infiltration-container");
if(c === null) throw new Error("huh?");
container = c;
document.removeEventListener("DOMContentLoaded", setContainer);
}
(function () {
function setContainer(): void {
const c = document.getElementById("infiltration-container");
if (c === null) throw new Error("huh?");
container = c;
document.removeEventListener("DOMContentLoaded", setContainer);
}
document.addEventListener("DOMContentLoaded", setContainer);
document.addEventListener("DOMContentLoaded", setContainer);
})();
function calcDifficulty(player: IPlayer, startingDifficulty: number): number {
const totalStats = player.strength+
player.defense+
player.dexterity+
player.agility+
player.charisma;
const difficulty = startingDifficulty-
Math.pow(totalStats, 0.9)/250-
(player.intelligence/1600);
if(difficulty < 0) return 0;
if(difficulty > 3) return 3;
return difficulty;
const totalStats =
player.strength +
player.defense +
player.dexterity +
player.agility +
player.charisma;
const difficulty =
startingDifficulty -
Math.pow(totalStats, 0.9) / 250 -
player.intelligence / 1600;
if (difficulty < 0) return 0;
if (difficulty > 3) return 3;
return difficulty;
}
export function displayInfiltrationContent(engine: IEngine, player: IPlayer, location: string, startingDifficulty: number, maxLevel: number): void {
if (!routing.isOn(Page.Infiltration)) return;
export function displayInfiltrationContent(
engine: IEngine,
player: IPlayer,
location: string,
startingDifficulty: number,
maxLevel: number,
): void {
if (!routing.isOn(Page.Infiltration)) return;
const difficulty = calcDifficulty(player, startingDifficulty);
const difficulty = calcDifficulty(player, startingDifficulty);
ReactDOM.render(<Root
Engine={engine}
Player={player}
Location={location}
StartingDifficulty={startingDifficulty}
Difficulty={difficulty}
MaxLevel={maxLevel}
/>, container);
}
ReactDOM.render(
<Root
Engine={engine}
Player={player}
Location={location}
StartingDifficulty={startingDifficulty}
Difficulty={difficulty}
MaxLevel={maxLevel}
/>,
container,
);
}