Initial fix for #707

This commit is contained in:
Daniël van Noord
2021-04-04 13:52:34 +02:00
parent 5017f1c217
commit 444462ae53
6 changed files with 21 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
import InitCache from '../Cache/CacheInit';
import LoopCache from '../Cache/CacheLoop';
import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS';
@@ -29,13 +30,14 @@ import CheckMagicMeter from './CheckStates/Grimoire';
import CheckSeasonPopup from './CheckStates/Season';
import CheckTickerFortune from './CheckStates/Ticker';
import CheckWrinklerCount from './CheckStates/Wrinkler';
import { LastModCount } from './VariablesAndData';
import { DateAtBeginLoop, LastModCount } from './VariablesAndData';
/**
* Main loop of Cookie Monster
* CM.init registers it to the "logic" hook provided by the modding api
*/
export default function CMLoopHook() {
DateAtBeginLoop = Date.now();
if (LastAscendState !== Game.OnAscend) {
LastAscendState = Game.OnAscend;
UpdateAscendState();

View File

@@ -21,3 +21,8 @@ export let LastSpawnedGoldenCookieState;
export let LastMagicBarFull;
export let CurrSpawnedGoldenCookieState;
export let LastWrinklerCount;
/** Stores the date at the beginning of a Main loop
* Calculations depending on time (God Cyclius) will all use same time
*/
export let DateAtBeginLoop;

View File

@@ -1,6 +1,7 @@
/* eslint-disable no-unused-vars */
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
import { CacheCentEgg } from '../../Cache/VariablesAndData';
import { DateAtBeginLoop } from '../../Main/VariablesAndData';
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
import SimEff from '../ReplacedGameFunctions/SimEff';
import SimGetHeavenlyMultiplier from '../ReplacedGameFunctions/SimGetHeavenlyMultiplier';
@@ -92,13 +93,18 @@ export default function CalculateGains() {
godLvl = SimHasGod('ages');
if (godLvl === 1)
mult *=
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 3)) * Math.PI * 2);
1 +
0.15 * Math.sin((DateAtBeginLoop / 1000 / (60 * 60 * 3)) * Math.PI * 2);
else if (godLvl === 2)
mult *=
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 12)) * Math.PI * 2);
1 +
0.15 *
Math.sin((DateAtBeginLoop / 1000 / (60 * 60 * 12)) * Math.PI * 2);
else if (godLvl === 3)
mult *=
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 24)) * Math.PI * 2);
1 +
0.15 *
Math.sin((DateAtBeginLoop / 1000 / (60 * 60 * 24)) * Math.PI * 2);
godLvl = SimHasGod('decadence');
if (godLvl === 1) buildMult *= 0.93;
@@ -189,7 +195,7 @@ export default function CalculateGains() {
if (SimHas('Century egg')) {
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day
let day =
(Math.floor((Date.now() - Game.startDate) / 1000 / 10) * 10) /
(Math.floor((DateAtBeginLoop - Game.startDate) / 1000 / 10) * 10) /
60 /
60 /
24;