Additional fixes for #707

This commit is contained in:
Daniël van Noord
2021-04-04 14:04:56 +02:00
parent 444462ae53
commit 3f08ed3e2d
7 changed files with 32 additions and 14 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

@@ -30,14 +30,13 @@ import CheckMagicMeter from './CheckStates/Grimoire';
import CheckSeasonPopup from './CheckStates/Season';
import CheckTickerFortune from './CheckStates/Ticker';
import CheckWrinklerCount from './CheckStates/Wrinkler';
import { DateAtBeginLoop, LastModCount } from './VariablesAndData';
import { 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

@@ -13,7 +13,11 @@ import UpdateTooltipLocation from '../../Disp/Tooltips/PositionLocation';
import { CMSayTime, Title } from '../../Disp/VariablesAndData';
import { SimDoSims } from '../../Sim/VariablesAndData';
import ReplaceTooltipUpgrade from '../ReplaceGameElements/TooltipUpgrades';
import { BackupFunctions } from '../VariablesAndData';
import {
BackupFunctions,
CenturyDateAtBeginLoop,
CycliusDateAtBeginLoop,
} from '../VariablesAndData';
import FixMouseY from './FixMouse';
/**
@@ -29,6 +33,8 @@ export default function ReplaceNative() {
Game.CalculateGains = function () {
BackupFunctions.CalculateGains();
SimDoSims = 1;
CycliusDateAtBeginLoop = Date.now();
CenturyDateAtBeginLoop = Date.now();
};
BackupFunctions.tooltip = {};

View File

@@ -22,7 +22,10 @@ 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
/** Stores the date at Game.CalculateGains for God Cyclius
*/
export let DateAtBeginLoop;
export let CycliusDateAtBeginLoop;
/** Stores the date at Game.CalculateGains for the Century egg
*/
export let CenturyDateAtBeginLoop;

View File

@@ -1,7 +1,10 @@
/* eslint-disable no-unused-vars */
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
import { CacheCentEgg } from '../../Cache/VariablesAndData';
import { DateAtBeginLoop } from '../../Main/VariablesAndData';
import {
CenturyDateAtBeginLoop,
CycliusDateAtBeginLoop,
} from '../../Main/VariablesAndData';
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
import SimEff from '../ReplacedGameFunctions/SimEff';
import SimGetHeavenlyMultiplier from '../ReplacedGameFunctions/SimGetHeavenlyMultiplier';
@@ -94,17 +97,24 @@ export default function CalculateGains() {
if (godLvl === 1)
mult *=
1 +
0.15 * Math.sin((DateAtBeginLoop / 1000 / (60 * 60 * 3)) * Math.PI * 2);
0.15 *
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 3)) * Math.PI * 2,
);
else if (godLvl === 2)
mult *=
1 +
0.15 *
Math.sin((DateAtBeginLoop / 1000 / (60 * 60 * 12)) * Math.PI * 2);
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 12)) * Math.PI * 2,
);
else if (godLvl === 3)
mult *=
1 +
0.15 *
Math.sin((DateAtBeginLoop / 1000 / (60 * 60 * 24)) * Math.PI * 2);
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 24)) * Math.PI * 2,
);
godLvl = SimHasGod('decadence');
if (godLvl === 1) buildMult *= 0.93;
@@ -195,7 +205,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((DateAtBeginLoop - Game.startDate) / 1000 / 10) * 10) /
(Math.floor((CenturyDateAtBeginLoop - Game.startDate) / 1000 / 10) * 10) /
60 /
60 /
24;