This commit is contained in:
Daniël van Noord
2021-03-14 16:10:52 +01:00
parent 2b3b9a6f34
commit 08c2f99b21
5 changed files with 84 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import SimHas from '../ReplacedGameFunctions/SimHas';
import SimHasGod from '../ReplacedGameFunctions/SimHasGod';
import { SimObjects } from '../VariablesAndData';
/**
* This function constructs an object with the static properties of an upgrade
@@ -12,6 +13,15 @@ export default function InitUpgrade(upgradeName) {
// Some upgrades have a function for .power (notably the valentine cookies)
you.power = me.power;
if (typeof (me.power) === 'function') {
if (me.name === 'Sugar crystal cookies') {
me.power = function () {
let n = 5;
for (const i in SimObjects) {
if (SimObjects[i].level >= 10) n += 1;
}
return n;
};
}
me.power = function () {
let pow = 2;
if (SimHas('Starlove')) pow = 3;

View File

@@ -1,4 +1,8 @@
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
import SimEff from '../ReplacedGameFunctions/SimEff';
import SimGetTieredCpsMult from '../ReplacedGameFunctions/SimGetTieredCpsMult';
import SimHas from '../ReplacedGameFunctions/SimHas';
import { SimObjects } from '../VariablesAndData';
/**
* This function constructs an object with the static properties of a building,
@@ -10,15 +14,73 @@ import SimGetTieredCpsMult from '../ReplacedGameFunctions/SimGetTieredCpsMult';
export default function InitialBuildingData(buildingName) {
const me = Game.Objects[buildingName];
const you = {};
you.cps = function (it) {
let mult = 1;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS(it.name);
if (typeof it.baseCps === 'function') {
return it.baseCps(it) * mult;
}
return it.baseCPS * mult;
};
if (me.name === 'Cursor') {
you.cps = function (it) {
let add = 0;
if (SimHas('Thousand fingers')) add += 0.1;
if (SimHas('Million fingers')) add *= 5;
if (SimHas('Billion fingers')) add *= 10;
if (SimHas('Trillion fingers')) add *= 20;
if (SimHas('Quadrillion fingers')) add *= 20;
if (SimHas('Quintillion fingers')) add *= 20;
if (SimHas('Sextillion fingers')) add *= 20;
if (SimHas('Septillion fingers')) add *= 20;
if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20;
let mult = 1;
let num = 0;
for (const i in SimObjects) { if (SimObjects[i].name !== 'Cursor') num += SimObjects[i].amount; }
add *= num;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS('Cursor');
mult *= SimEff('cursorCps');
return Game.ComputeCps(0.1, SimHas('Reinforced index finger') + SimHas('Carpal tunnel prevention cream') + SimHas('Ambidextrous'), add) * mult;
};
} else if (me.name === 'Grandma') {
you.cps = function (it) {
let mult = 1;
for (const i in Game.GrandmaSynergies) {
if (SimHas(Game.GrandmaSynergies[i])) mult *= 2;
}
if (SimHas('Bingo center/Research facility')) mult *= 4;
if (SimHas('Ritual rolling pins')) mult *= 2;
if (SimHas('Naughty list')) mult *= 2;
if (SimHas('Elderwort biscuits')) mult *= 1.02;
mult *= SimEff('grandmaCps');
if (SimHas('Cat ladies')) {
for (let i = 0; i < Game.UpgradesByPool.kitten.length; i++) {
if (SimHas(Game.UpgradesByPool.kitten[i].name)) mult *= 1.29;
}
}
mult *= SimGetTieredCpsMult(it);
let add = 0;
if (SimHas('One mind')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Communal brainsweep')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05;
let num = 0;
for (const i in SimObjects) { if (SimObjects[i].name !== 'Grandma') num += SimObjects[i].amount; }
// if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
mult *= 1 + SimAuraMult('Elder Battalion') * 0.01 * num;
mult *= Game.magicCpS(me.name);
return (me.baseCps + add) * mult;
};
} else {
you.cps = function (it) {
let mult = 1;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS(it.name);
return it.baseCPS * mult;
};
}
// Below is needed for above eval, specifically for the GetTieredCpsMult function
you.baseCps = me.baseCps;
you.name = me.name;