Added prettier (#661)

* Added prettier

* Added prettier

* Added prettier
This commit is contained in:
Daniël van Noord
2021-03-14 18:57:07 +01:00
committed by GitHub
parent f3e7964262
commit 932509a877
132 changed files with 7143 additions and 4894 deletions

View File

@@ -1,10 +1,18 @@
/* eslint-disable no-unused-vars */
import { CacheDragonAura, CacheDragonAura2 } from '../../Cache/VariablesAndData';
import {
CacheDragonAura,
CacheDragonAura2,
} from '../../Cache/VariablesAndData';
import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import CopyData from '../SimulationData/CopyData';
import {
SimAchievementsOwned, SimBuildingsOwned, SimCookiesPs, SimDragonAura, SimDragonAura2, SimObjects,
SimAchievementsOwned,
SimBuildingsOwned,
SimCookiesPs,
SimDragonAura,
SimDragonAura2,
SimObjects,
} from '../VariablesAndData';
/**
@@ -14,35 +22,48 @@ import {
* @returns {[number, number]} [CM.Sim.cookiesPs - Game.cookiesPs, price] The bonus cps and the price of the change
*/
export default function CalculateChangeAura(aura) {
CopyData();
CopyData();
// Check if aura being changed is first or second aura
const auraToBeChanged = l('promptContent').children[0].innerHTML.includes('secondary');
if (auraToBeChanged) SimDragonAura2 = aura;
else SimDragonAura = aura;
// Check if aura being changed is first or second aura
const auraToBeChanged = l('promptContent').children[0].innerHTML.includes(
'secondary',
);
if (auraToBeChanged) SimDragonAura2 = aura;
else SimDragonAura = aura;
// Sell highest building but only if aura is different
let price = 0;
if (SimDragonAura !== CacheDragonAura || SimDragonAura2 !== CacheDragonAura2) {
for (let i = Game.ObjectsById.length - 1; i > -1; --i) {
if (Game.ObjectsById[i - 1].amount > 0) {
const highestBuilding = SimObjects[Game.ObjectsById[i].name].name;
SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1;
price = SimObjects[highestBuilding].basePrice * Game.priceIncrease ** Math.max(0, SimObjects[highestBuilding].amount - 1 - SimObjects[highestBuilding].free);
price = Game.modifyBuildingPrice(SimObjects[highestBuilding], price);
price = Math.ceil(price);
break;
}
}
}
// Sell highest building but only if aura is different
let price = 0;
if (
SimDragonAura !== CacheDragonAura ||
SimDragonAura2 !== CacheDragonAura2
) {
for (let i = Game.ObjectsById.length - 1; i > -1; --i) {
if (Game.ObjectsById[i - 1].amount > 0) {
const highestBuilding = SimObjects[Game.ObjectsById[i].name].name;
SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1;
price =
SimObjects[highestBuilding].basePrice *
Game.priceIncrease **
Math.max(
0,
SimObjects[highestBuilding].amount -
1 -
SimObjects[highestBuilding].free,
);
price = Game.modifyBuildingPrice(SimObjects[highestBuilding], price);
price = Math.ceil(price);
break;
}
}
}
const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains();
const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains();
CheckOtherAchiev();
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
return [SimCookiesPs - Game.cookiesPs, price];
CheckOtherAchiev();
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
return [SimCookiesPs - Game.cookiesPs, price];
}