Add prettier to pre-commit and run it

This commit is contained in:
Daniël van Noord
2022-06-19 20:57:42 +02:00
parent 8cfc980546
commit ab73a78a01
22 changed files with 18468 additions and 102 deletions

View File

@@ -15,8 +15,11 @@ export default function CacheDragonCost() {
Game.dragonLevel < 25 &&
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
) {
const objectMatch = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/);
let target = objectMatch !== null ? objectMatch[1] : Game.ObjectsById[Game.dragonLevel-5].name;
const objectMatch = Game.dragonLevels[Game.dragonLevel].buy
.toString()
.match(/Objects\[(.*)\]/);
let target =
objectMatch !== null ? objectMatch[1] : Game.ObjectsById[Game.dragonLevel - 5].name;
const amount = Game.dragonLevels[Game.dragonLevel].buy
.toString()
.match(/sacrifice\((.*?)\)/)[1];

View File

@@ -19,10 +19,7 @@ export default function FormatTime(time, longFormat) {
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat === 0) {
if (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
str +=
y > 0
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `
: '';
str += y > 0 ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` : '';
if (str.length > 0 || d > 0)
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, `;
if (str.length > 0 || h > 0)

View File

@@ -13,7 +13,8 @@ export default function AddMenu() {
title.textContent = 'Cookie Monster Statistics';
AddMenuStats(title);
}
} else if (Game.onMenu === 'prefs') { // Added because Framework is broken
} else if (Game.onMenu === 'prefs') {
// Added because Framework is broken
l('menu').childNodes[2].insertBefore(
createMenuOptions(),
l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],

View File

@@ -1,4 +1,3 @@
import Beautify from '../../BeautifyAndFormatting/Beautify';
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
@@ -56,13 +55,7 @@ export default function Grimoire() {
const reward = document.createElement('span');
reward.style.color = '#33FF00';
reward.textContent = Beautify(
Math.max(
Math.min(
Game.cookies * 0.15,
Game.cookiesPs * 60 * 30
),
7
),
Math.max(Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 30), 7),
2,
);
conjure.appendChild(reward);
@@ -72,14 +65,8 @@ export default function Grimoire() {
const loss = document.createElement('span');
loss.style.color = 'red';
loss.textContent = Beautify(
Math.min(
Game.cookies,
Math.min(
Game.cookies * 0.15,
Game.cookiesPs * 60 * 15
) + 13
),
2
Math.min(Game.cookies, Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 15) + 13),
2,
);
conjure.appendChild(loss);
}

View File

@@ -26,7 +26,7 @@ function ReplaceNativeGrimoireDraw() {
minigame.magicBarTextL.innerHTML += ` (${FormatTime(
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM),
)})`;
minigame.magicBarL.style.width = "75%" // TODO: Fix this after Orteil pushes fix to main game;
minigame.magicBarL.style.width = '75%'; // TODO: Fix this after Orteil pushes fix to main game;
}
};
HasReplaceNativeGrimoireDraw = true;

View File

@@ -67,7 +67,7 @@ export default function ReplaceNative() {
l('bigCookie').addEventListener(
'click',
(event) => {
FixMouseY(()=> Game.ClickCookie(event,0));
FixMouseY(() => Game.ClickCookie(event, 0));
},
false,
);

View File

@@ -134,7 +134,8 @@ export default function CalculateGains() {
if (SimHas('Kitten specialists')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten experts')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten consultants')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten assistants to the regional manager')) catMult *= 1 + milkProgress * 0.175 * milkMult;
if (SimHas('Kitten assistants to the regional manager'))
catMult *= 1 + milkProgress * 0.175 * milkMult;
if (SimHas('Kitten marketeers')) catMult *= 1 + milkProgress * 0.15 * milkMult;
if (SimHas('Kitten analysts')) catMult *= 1 + milkProgress * 0.125 * milkMult;
if (SimHas('Kitten executives')) catMult *= 1 + milkProgress * 0.115 * milkMult;

View File

@@ -12,8 +12,8 @@ export default function SimAuraMult(what) {
n = 1;
if (
Game.dragonAuras[SimDragonAura].name === 'Reality Bending' ||
Game.dragonAuras[SimDragonAura2].name === 'Reality Bending' &&
Game.dragonLevel >= Game.dragonAurasBN[what].id + 4
(Game.dragonAuras[SimDragonAura2].name === 'Reality Bending' &&
Game.dragonLevel >= Game.dragonAurasBN[what].id + 4)
)
n += 0.1;
return n;

View File

@@ -5,15 +5,19 @@ import SimHas from './SimHas';
* This functions creates functions similarly to Game.GetTieredCpsMult but checks Sim Data instead of Game Data
*/
export default function SimGetTieredCpsMult(me) {
let mult = 1;
Object.keys(me.tieredUpgrades).forEach((i) => {
if (!Game.Tiers[me.tieredUpgrades[i].tier].special && SimHas(me.tieredUpgrades[i].name)){
let tierMult=2;
// unshackled multipliers
if (Game.ascensionMode!==1 && SimHas(me.unshackleUpgrade) && SimHas(Game.Tiers[me.tieredUpgrades[i].tier].unshackleUpgrade)) tierMult+=me.id===1?0.5:(20-me.id)*0.1;
mult*=tierMult;
};
if (!Game.Tiers[me.tieredUpgrades[i].tier].special && SimHas(me.tieredUpgrades[i].name)) {
let tierMult = 2;
// unshackled multipliers
if (
Game.ascensionMode !== 1 &&
SimHas(me.unshackleUpgrade) &&
SimHas(Game.Tiers[me.tieredUpgrades[i].tier].unshackleUpgrade)
)
tierMult += me.id === 1 ? 0.5 : (20 - me.id) * 0.1;
mult *= tierMult;
}
});
Object.keys(me.synergies).forEach((i) => {
if (SimHas(me.synergies[i].name)) {

View File

@@ -1,5 +1,5 @@
import { SimGod1, SimGod2, SimGod3, SimObjects } from '../VariablesAndData';
import SimHasAura from './SimHasAura'
import SimHasAura from './SimHasAura';
/**
* This function checks for the current God level in the sim data
@@ -16,13 +16,13 @@ export default function SimHasGod(what) {
return 1;
}
if (SimGod2 === god.id) {
if (SimHasAura('Supreme Intellect')){
if (SimHasAura('Supreme Intellect')) {
return 1;
}
return 2;
}
if (SimGod3 === god.id) {
if (SimHasAura('Supreme Intellect')){
if (SimHasAura('Supreme Intellect')) {
return 2;
}
return 3;

View File

@@ -33,7 +33,7 @@ function MouseCps() {
if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20;
if (SimHas('Decillion fingers')) add *= 20;
if (SimHas('Unshackled cursors')) add*= 25;
if (SimHas('Unshackled cursors')) add *= 25;
let num = 0;
Object.keys(SimObjects).forEach((i) => {
num += SimObjects[i].amount;