Fixed #617
This commit is contained in:
@@ -43,6 +43,7 @@ CM.save = function () {
|
||||
*/
|
||||
CM.load = function (str) {
|
||||
const save = JSON.parse(str);
|
||||
CM.Sim.InitData();
|
||||
CM.Config.LoadConfig(save.settings);
|
||||
if (save.version !== `${CM.VersionMajor}.${CM.VersionMinor}`) {
|
||||
if (Game.prefs.popups) Game.Popup('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!');
|
||||
|
||||
28
src/Sim.js
28
src/Sim.js
@@ -129,10 +129,6 @@ CM.Sim.ReplaceFunction = function (funcToBeReplaced) {
|
||||
.join('CM.Sim.auraMult')
|
||||
.split('Game.hasGod')
|
||||
.join('CM.Sim.hasGod')
|
||||
.split('M.gods[what]') // Replaces code in the Pantheon minigame
|
||||
.join('CM.Sim.Objects.Temple.minigame.gods[what]')
|
||||
.split('M.slot[i]') // Replaces code in the Pantheon minigame
|
||||
.join('CM.Sim.Objects.Temple.minigame.slot[i]')
|
||||
.split('Game.effs') // Replaces code in the Pantheon minigame
|
||||
.join('CM.Sim.effs')
|
||||
.split('Game.Objects')
|
||||
@@ -158,7 +154,6 @@ CM.Sim.CreateSimFunctions = function () {
|
||||
CM.Sim.Has = new Function(`return ${CM.Sim.ReplaceFunction(Game.Has)}`)();
|
||||
CM.Sim.HasAchiev = new Function(`return ${CM.Sim.ReplaceFunction(Game.HasAchiev)}`)();
|
||||
CM.Sim.hasAura = new Function(`return ${CM.Sim.ReplaceFunction(Game.hasAura)}`)();
|
||||
if (Game.hasGod) CM.Sim.hasGod = new Function(`return ${CM.Sim.ReplaceFunction(Game.hasGod)}`)();
|
||||
CM.Sim.GetHeavenlyMultiplier = new Function(`return ${CM.Sim.ReplaceFunction(Game.GetHeavenlyMultiplier)}`)();
|
||||
CM.Sim.auraMult = new Function(`return ${CM.Sim.ReplaceFunction(Game.auraMult)}`)();
|
||||
CM.Sim.eff = new Function(`return ${CM.Sim.ReplaceFunction(Game.eff)}`)();
|
||||
@@ -180,6 +175,24 @@ CM.Sim.Win = function (what) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks for the current God level in the sim data
|
||||
* It functions similarly to Game.hasGod()
|
||||
* It is not created by CM.Sim.CreateSimFunctions() as Game.hasGod() is not always available in each save
|
||||
* @param {string} what Name of the achievement
|
||||
*/
|
||||
CM.Sim.hasGod = function (what) {
|
||||
if (Game.hasGod) {
|
||||
const god = CM.Sim.Objects.Temple.minigame.gods[what];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if (CM.Sim.Objects.Temple.minigame.slot[i] === god.id) {
|
||||
return (i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions used to create static objects of Buildings, Upgrades and Achievements */
|
||||
|
||||
@@ -296,7 +309,10 @@ CM.Sim.CopyData = function () {
|
||||
you.totalCookies = me.totalCookies;
|
||||
you.basePrice = me.basePrice;
|
||||
you.free = me.free;
|
||||
if (me.minigameLoaded) you.minigameLoaded = me.minigameLoaded; you.minigame = me.minigame;
|
||||
if (me.minigameLoaded) {
|
||||
you.minigameLoaded = me.minigameLoaded;
|
||||
you.minigame = me.minigame;
|
||||
}
|
||||
}
|
||||
|
||||
// Upgrades
|
||||
|
||||
Reference in New Issue
Block a user