Skip to content

Commit

Permalink
Fix frozen production, improper reset on pre v2.0.0 savefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pseudonian committed Feb 25, 2021
1 parent 54b7e3a commit 3e64372
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/Calculate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,6 @@ export const calculateTimeAcceleration = () => {
timeMult *= (1 + 0.10 * (player.talismanRarity[2-1] - 1)) // Chronos Talisman bonus
timeMult *= G['challenge15Rewards'].globalSpeed // Challenge 15 reward
timeMult *= G['lazinessMultiplier'][player.usedCorruptions[3]]

if (player.currentChallenge.ascension === 15 && player.platonicUpgrades[15] > 0) {
timeMult *= 1000
}
Expand Down
22 changes: 22 additions & 0 deletions src/CheckVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,28 @@ import { buyResearch } from './Research';
import { c15RewardUpdate } from './Statistics';
import { LegacyShopUpgrades } from './types/LegacySynergism';

/**
* Given player data, it checks, on load if variables are undefined
* or set incorrectly, and corrects it. This should be where all new
* variable declarations for `player` should go!
* @param data
*/
export const checkVariablesOnLoad = (data: Player) => {
if (player.currentChallenge.transcension === undefined) {
player.currentChallenge = {
transcension: 0,
reincarnation: 0,
ascension: 0,
}
}
if (!Array.isArray(data.challengecompletions)) {
player.challengecompletions = Object.values(data.challengecompletions);
player.challengecompletions[0] = 0;
player.challengecompletions[11] = 0;
player.challengecompletions[12] = 0;
player.challengecompletions[13] = 0;
player.challengecompletions[14] = 0;
}
if (data.wowCubes === undefined) {
player.wowCubes = 0;
player.wowTesseracts = 0;
Expand Down Expand Up @@ -223,6 +244,7 @@ export const checkVariablesOnLoad = (data: Player) => {
}
if (data.platonicBlessings === undefined) {
const ascCount = player.ascensionCount
console.log(player.currentChallenge.ascension)
if (player.currentChallenge.ascension !== 0 && player.currentChallenge.ascension !== 15) {
resetCheck('ascensionChallenge', false, true);
}
Expand Down
15 changes: 0 additions & 15 deletions src/Synergism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1007,21 +1007,6 @@ export const loadSynergy = (): void => {
player.historyShowPerSecond = false;
player.historyCountMax = 10;
}
if (player.currentChallenge.transcension === undefined) {
player.currentChallenge = {
transcension: 0,
reincarnation: 0,
ascension: 0,
}
/*let challengeCompletionArray = [0, player.challengecompletions.one, player.challengecompletions.two, player.challengecompletions.three, player.challengecompletions.four, player.challengecompletions.five, player.challengecompletions.six, player.challengecompletions.seven, player.challengecompletions.eight, player.challengecompletions.nine, player.challengecompletions.ten, 0, 0, 0, 0, 0]
let highestChallengeCompletionArray = [0, player.highestchallengecompletions.one, player.highestchallengecompletions.two, player.highestchallengecompletions.three, player.highestchallengecompletions.four, player.highestchallengecompletions.five, player.highestchallengecompletions.six, player.highestchallengecompletions.seven, player.highestchallengecompletions.eight, player.highestchallengecompletions.nine, player.highestchallengecompletions.ten, 0, 0, 0, 0, 0]
player.challengecompletions = []
player.highestchallengecompletions = []
for (let i = 0; i <= 15; i++) {
player.challengecompletions.push(challengeCompletionArray[i])
player.highestchallengecompletions.push(highestChallengeCompletionArray[i])
}*/
}

if (!Number.isInteger(player.ascendBuilding1.cost)) {
player.ascendBuilding1.cost = 1;
Expand Down

0 comments on commit 3e64372

Please sign in to comment.