Added extra info to dragon aura selector display
This commit is contained in:
123
CookieMonster.js
123
CookieMonster.js
@@ -29,6 +29,16 @@ if (typeof CM == "undefined") {
|
|||||||
* Cache *
|
* Cache *
|
||||||
*********/
|
*********/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions caches the currently selected Dragon Auras
|
||||||
|
* It is called by CM.Sim.CopyData() and CM.Sim.InitData()
|
||||||
|
* Uncapitalized dragon follows Game-naming
|
||||||
|
*/
|
||||||
|
CM.Cache.CacheDragonAuras = function() {
|
||||||
|
CM.Cache.dragonAura = Game.dragonAura;
|
||||||
|
CM.Cache.dragonAura2 = Game.dragonAura2;
|
||||||
|
}
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Section: UNSORTED */
|
* Section: UNSORTED */
|
||||||
|
|
||||||
@@ -557,7 +567,12 @@ CM.Cache.MissingCookiesString = null;
|
|||||||
CM.Cache.seasonPopShimmer;
|
CM.Cache.seasonPopShimmer;
|
||||||
CM.Cache.goldenShimmersByID = {};
|
CM.Cache.goldenShimmersByID = {};
|
||||||
CM.Cache.spawnedGoldenShimmer = 0;
|
CM.Cache.spawnedGoldenShimmer = 0;
|
||||||
/**********
|
|
||||||
|
/**
|
||||||
|
* This variables are used by CM.Cache.CacheDragonAuras(), naming follows naming in Game
|
||||||
|
*/
|
||||||
|
CM.Cache.dragonAura = 0;
|
||||||
|
CM.Cache.dragonAura2 = 0;/**********
|
||||||
* Config *
|
* Config *
|
||||||
**********/
|
**********/
|
||||||
|
|
||||||
@@ -874,6 +889,7 @@ CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Wa
|
|||||||
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
|
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
|
||||||
CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
|
CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
|
||||||
CM.ConfigData.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
|
CM.ConfigData.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
|
||||||
|
CM.ConfigData.DragonAuraInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true};
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
CM.ConfigData.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
|
CM.ConfigData.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
|
||||||
@@ -2654,6 +2670,37 @@ CM.Disp.UpdateWrinklerTooltip = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********
|
||||||
|
* Section: Functions related to the dragon aura interface */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
||||||
|
* It is called by Game.DescribeDragonAura() after CM.ReplaceNative()
|
||||||
|
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||||
|
*/
|
||||||
|
CM.Disp.AddAuraInfo = function(aura) {
|
||||||
|
if (CM.Config.DragonAuraInfo == 1) {
|
||||||
|
var [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura);
|
||||||
|
var timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
|
||||||
|
var bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs);
|
||||||
|
bonusCPS = CM.Disp.Beautify(bonusCPS);
|
||||||
|
|
||||||
|
l('dragonAuraInfo').style.minHeight = "60px"
|
||||||
|
l('dragonAuraInfo').style.margin = "8px"
|
||||||
|
l('dragonAuraInfo').appendChild(document.createElement("div")).className = "line"
|
||||||
|
var div = document.createElement("div");
|
||||||
|
div.style.minWidth = "200px";
|
||||||
|
div.style.textAlign = "center";
|
||||||
|
div.textContent = "Picking this aura will change CPS by " + bonusCPS + " (" + bonusCPSPercentage + "% of current CPS).";
|
||||||
|
l('dragonAuraInfo').appendChild(div);
|
||||||
|
var div2 = document.createElement("div");
|
||||||
|
div2.style.minWidth = "200px";
|
||||||
|
div2.style.textAlign = "center";
|
||||||
|
div2.textContent = "It will take " + timeToRecover + " to recover the cost.";
|
||||||
|
l('dragonAuraInfo').appendChild(div2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Section: General functions related to the Options/Stats pages
|
* Section: General functions related to the Options/Stats pages
|
||||||
|
|
||||||
@@ -3608,6 +3655,18 @@ CM.ReplaceNative = function() {
|
|||||||
Game.CalculateGains();
|
Game.CalculateGains();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CM.Backup.DescribeDragonAura = Game.DescribeDragonAura;
|
||||||
|
/**
|
||||||
|
* This functions adds the function CM.Disp.AddAuraInfo() to Game.DescribeDragonAura()
|
||||||
|
* This adds information about CPS differences and costs to the aura choosing interface
|
||||||
|
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||||
|
*/
|
||||||
|
Game.DescribeDragonAura = function(aura) {
|
||||||
|
CM.Backup.DescribeDragonAura(aura);
|
||||||
|
CM.Disp.AddAuraInfo(aura);
|
||||||
|
}
|
||||||
|
|
||||||
CM.Backup.UpdateMenu = Game.UpdateMenu;
|
CM.Backup.UpdateMenu = Game.UpdateMenu;
|
||||||
Game.UpdateMenu = function() {
|
Game.UpdateMenu = function() {
|
||||||
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
|
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
|
||||||
@@ -4081,6 +4140,7 @@ CM.ConfigDefault = {
|
|||||||
TooltipGrim:1,
|
TooltipGrim:1,
|
||||||
ToolWrink: 1,
|
ToolWrink: 1,
|
||||||
TooltipLump: 1,
|
TooltipLump: 1,
|
||||||
|
DragonAuraInfo: 1,
|
||||||
Stats: 1,
|
Stats: 1,
|
||||||
MissingUpgrades: 0,
|
MissingUpgrades: 0,
|
||||||
UpStats: 1,
|
UpStats: 1,
|
||||||
@@ -4243,7 +4303,8 @@ CM.Sim.getCPSBuffMult = function() {
|
|||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Constructs an object with the static properties of a building,
|
/**
|
||||||
|
* Constructs an object with the static properties of a building,
|
||||||
* but with a 'cps' method changed to use 'CM.Sim.Has' instead of 'Game.Has'
|
* but with a 'cps' method changed to use 'CM.Sim.Has' instead of 'Game.Has'
|
||||||
* (and similar to 'hasAura', 'Objects', 'GetTieredCpsMult' and 'auraMult').
|
* (and similar to 'hasAura', 'Objects', 'GetTieredCpsMult' and 'auraMult').
|
||||||
*
|
*
|
||||||
@@ -4267,7 +4328,8 @@ CM.Sim.InitialBuildingData = function(buildingName) {
|
|||||||
return you;
|
return you;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to the previous function, but for upgrades.
|
/**
|
||||||
|
* Similar to the previous function, but for upgrades.
|
||||||
* Note: currently no static data is used by Cookie Monster,
|
* Note: currently no static data is used by Cookie Monster,
|
||||||
* so this function just returns an empty object.
|
* so this function just returns an empty object.
|
||||||
*/
|
*/
|
||||||
@@ -4279,7 +4341,8 @@ CM.Sim.InitUpgrade = function(upgradeName) {
|
|||||||
return you;
|
return you;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to the previous function, but for achievements.
|
/**
|
||||||
|
* Similar to the previous function, but for achievements.
|
||||||
* Note: currently no static data is used by Cookie Monster,
|
* Note: currently no static data is used by Cookie Monster,
|
||||||
* so this function just returns an empty object.
|
* so this function just returns an empty object.
|
||||||
*/
|
*/
|
||||||
@@ -4305,6 +4368,9 @@ CM.Sim.InitData = function() {
|
|||||||
for (var i in Game.Achievements) {
|
for (var i in Game.Achievements) {
|
||||||
CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
|
CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auras
|
||||||
|
CM.Cache.CacheDragonAuras();
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Sim.CopyData = function() {
|
CM.Sim.CopyData = function() {
|
||||||
@@ -4314,8 +4380,6 @@ CM.Sim.CopyData = function() {
|
|||||||
CM.Sim.AchievementsOwned = Game.AchievementsOwned;
|
CM.Sim.AchievementsOwned = Game.AchievementsOwned;
|
||||||
CM.Sim.heavenlyPower = Game.heavenlyPower; // Unneeded? > Might be modded
|
CM.Sim.heavenlyPower = Game.heavenlyPower; // Unneeded? > Might be modded
|
||||||
CM.Sim.prestige = Game.prestige;
|
CM.Sim.prestige = Game.prestige;
|
||||||
CM.Sim.dragonAura = Game.dragonAura;
|
|
||||||
CM.Sim.dragonAura2 = Game.dragonAura2;
|
|
||||||
|
|
||||||
// Buildings
|
// Buildings
|
||||||
for (var i in Game.Objects) {
|
for (var i in Game.Objects) {
|
||||||
@@ -4328,6 +4392,8 @@ CM.Sim.CopyData = function() {
|
|||||||
you.amount = me.amount;
|
you.amount = me.amount;
|
||||||
you.level = me.level;
|
you.level = me.level;
|
||||||
you.totalCookies = me.totalCookies;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4350,6 +4416,11 @@ CM.Sim.CopyData = function() {
|
|||||||
}
|
}
|
||||||
you.won = me.won;
|
you.won = me.won;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auras
|
||||||
|
CM.Cache.CacheDragonAuras();
|
||||||
|
CM.Sim.dragonAura = CM.Cache.dragonAura;
|
||||||
|
CM.Sim.dragonAura2 = CM.Cache.dragonAura2;
|
||||||
};
|
};
|
||||||
|
|
||||||
CM.Sim.CalculateGains = function() {
|
CM.Sim.CalculateGains = function() {
|
||||||
@@ -4718,6 +4789,46 @@ CM.Sim.BuyUpgrades = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions calculates the cps and cost of changing a Dragon Aura
|
||||||
|
* It is called by CM.Disp.AddAuraInfo()
|
||||||
|
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||||
|
* @returns {[number, number]} [CM.Sim.cookiesPs - Game.cookiesPs, price] The bonus cps and the price of the change
|
||||||
|
*/
|
||||||
|
CM.Sim.CalculateChangeAura = function(aura) {
|
||||||
|
CM.Sim.CopyData();
|
||||||
|
|
||||||
|
// Check if aura being changed is first or second aura
|
||||||
|
var auraToBeChanged = l('promptContent').children[0].innerHTML.includes("secondary")
|
||||||
|
if (auraToBeChanged) CM.Sim.dragonAura2 = aura;
|
||||||
|
else CM.Sim.dragonAura = aura;
|
||||||
|
|
||||||
|
// Sell highest building but only if aura is different
|
||||||
|
if (CM.Sim.dragonAura != CM.Cache.dragonAura || CM.Sim.dragonAura2 != CM.Cache.dragonAura2) {
|
||||||
|
for (var i = Game.ObjectsById.length; i > -1, --i;) {
|
||||||
|
if (Game.ObjectsById[i].amount > 0) {
|
||||||
|
var highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name;
|
||||||
|
CM.Sim.Objects[highestBuilding].amount -=1;
|
||||||
|
CM.Sim.buildingsOwned -= 1;
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This calculates price of highest building
|
||||||
|
var price = CM.Sim.Objects[highestBuilding].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[highestBuilding].amount - 1 -CM.Sim.Objects[highestBuilding].free));
|
||||||
|
price = Game.modifyBuildingPrice(CM.Sim.Objects[highestBuilding], price);
|
||||||
|
price = Math.ceil(price);
|
||||||
|
} else var price = 0;
|
||||||
|
|
||||||
|
var lastAchievementsOwned = CM.Sim.AchievementsOwned;
|
||||||
|
CM.Sim.CalculateGains();
|
||||||
|
|
||||||
|
CM.Sim.CheckOtherAchiev();
|
||||||
|
if (lastAchievementsOwned != CM.Sim.AchievementsOwned) {
|
||||||
|
CM.Sim.CalculateGains();
|
||||||
|
}
|
||||||
|
return [CM.Sim.cookiesPs - Game.cookiesPs, price]
|
||||||
|
}
|
||||||
|
|
||||||
CM.Sim.NoGoldSwitchCookiesPS = function() {
|
CM.Sim.NoGoldSwitchCookiesPS = function() {
|
||||||
if (Game.Has('Golden switch [off]')) {
|
if (Game.Has('Golden switch [off]')) {
|
||||||
CM.Sim.CopyData();
|
CM.Sim.CopyData();
|
||||||
|
|||||||
16
src/Cache.js
16
src/Cache.js
@@ -2,6 +2,16 @@
|
|||||||
* Cache *
|
* Cache *
|
||||||
*********/
|
*********/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions caches the currently selected Dragon Auras
|
||||||
|
* It is called by CM.Sim.CopyData() and CM.Sim.InitData()
|
||||||
|
* Uncapitalized dragon follows Game-naming
|
||||||
|
*/
|
||||||
|
CM.Cache.CacheDragonAuras = function() {
|
||||||
|
CM.Cache.dragonAura = Game.dragonAura;
|
||||||
|
CM.Cache.dragonAura2 = Game.dragonAura2;
|
||||||
|
}
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Section: UNSORTED */
|
* Section: UNSORTED */
|
||||||
|
|
||||||
@@ -530,3 +540,9 @@ CM.Cache.MissingCookiesString = null;
|
|||||||
CM.Cache.seasonPopShimmer;
|
CM.Cache.seasonPopShimmer;
|
||||||
CM.Cache.goldenShimmersByID = {};
|
CM.Cache.goldenShimmersByID = {};
|
||||||
CM.Cache.spawnedGoldenShimmer = 0;
|
CM.Cache.spawnedGoldenShimmer = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This variables are used by CM.Cache.CacheDragonAuras(), naming follows naming in Game
|
||||||
|
*/
|
||||||
|
CM.Cache.dragonAura = 0;
|
||||||
|
CM.Cache.dragonAura2 = 0;
|
||||||
@@ -162,6 +162,7 @@ CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Wa
|
|||||||
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
|
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
|
||||||
CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
|
CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
|
||||||
CM.ConfigData.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
|
CM.ConfigData.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
|
||||||
|
CM.ConfigData.DragonAuraInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true};
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
CM.ConfigData.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
|
CM.ConfigData.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
|
||||||
|
|||||||
31
src/Disp.js
31
src/Disp.js
@@ -1766,6 +1766,37 @@ CM.Disp.UpdateWrinklerTooltip = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********
|
||||||
|
* Section: Functions related to the dragon aura interface */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
||||||
|
* It is called by Game.DescribeDragonAura() after CM.ReplaceNative()
|
||||||
|
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||||
|
*/
|
||||||
|
CM.Disp.AddAuraInfo = function(aura) {
|
||||||
|
if (CM.Config.DragonAuraInfo == 1) {
|
||||||
|
var [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura);
|
||||||
|
var timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
|
||||||
|
var bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs);
|
||||||
|
bonusCPS = CM.Disp.Beautify(bonusCPS);
|
||||||
|
|
||||||
|
l('dragonAuraInfo').style.minHeight = "60px"
|
||||||
|
l('dragonAuraInfo').style.margin = "8px"
|
||||||
|
l('dragonAuraInfo').appendChild(document.createElement("div")).className = "line"
|
||||||
|
var div = document.createElement("div");
|
||||||
|
div.style.minWidth = "200px";
|
||||||
|
div.style.textAlign = "center";
|
||||||
|
div.textContent = "Picking this aura will change CPS by " + bonusCPS + " (" + bonusCPSPercentage + "% of current CPS).";
|
||||||
|
l('dragonAuraInfo').appendChild(div);
|
||||||
|
var div2 = document.createElement("div");
|
||||||
|
div2.style.minWidth = "200px";
|
||||||
|
div2.style.textAlign = "center";
|
||||||
|
div2.textContent = "It will take " + timeToRecover + " to recover the cost.";
|
||||||
|
l('dragonAuraInfo').appendChild(div2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Section: General functions related to the Options/Stats pages
|
* Section: General functions related to the Options/Stats pages
|
||||||
|
|
||||||
|
|||||||
13
src/Main.js
13
src/Main.js
@@ -58,6 +58,18 @@ CM.ReplaceNative = function() {
|
|||||||
Game.CalculateGains();
|
Game.CalculateGains();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CM.Backup.DescribeDragonAura = Game.DescribeDragonAura;
|
||||||
|
/**
|
||||||
|
* This functions adds the function CM.Disp.AddAuraInfo() to Game.DescribeDragonAura()
|
||||||
|
* This adds information about CPS differences and costs to the aura choosing interface
|
||||||
|
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||||
|
*/
|
||||||
|
Game.DescribeDragonAura = function(aura) {
|
||||||
|
CM.Backup.DescribeDragonAura(aura);
|
||||||
|
CM.Disp.AddAuraInfo(aura);
|
||||||
|
}
|
||||||
|
|
||||||
CM.Backup.UpdateMenu = Game.UpdateMenu;
|
CM.Backup.UpdateMenu = Game.UpdateMenu;
|
||||||
Game.UpdateMenu = function() {
|
Game.UpdateMenu = function() {
|
||||||
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
|
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
|
||||||
@@ -531,6 +543,7 @@ CM.ConfigDefault = {
|
|||||||
TooltipGrim:1,
|
TooltipGrim:1,
|
||||||
ToolWrink: 1,
|
ToolWrink: 1,
|
||||||
TooltipLump: 1,
|
TooltipLump: 1,
|
||||||
|
DragonAuraInfo: 1,
|
||||||
Stats: 1,
|
Stats: 1,
|
||||||
MissingUpgrades: 0,
|
MissingUpgrades: 0,
|
||||||
UpStats: 1,
|
UpStats: 1,
|
||||||
|
|||||||
61
src/Sim.js
61
src/Sim.js
@@ -142,7 +142,8 @@ CM.Sim.getCPSBuffMult = function() {
|
|||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Constructs an object with the static properties of a building,
|
/**
|
||||||
|
* Constructs an object with the static properties of a building,
|
||||||
* but with a 'cps' method changed to use 'CM.Sim.Has' instead of 'Game.Has'
|
* but with a 'cps' method changed to use 'CM.Sim.Has' instead of 'Game.Has'
|
||||||
* (and similar to 'hasAura', 'Objects', 'GetTieredCpsMult' and 'auraMult').
|
* (and similar to 'hasAura', 'Objects', 'GetTieredCpsMult' and 'auraMult').
|
||||||
*
|
*
|
||||||
@@ -166,7 +167,8 @@ CM.Sim.InitialBuildingData = function(buildingName) {
|
|||||||
return you;
|
return you;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to the previous function, but for upgrades.
|
/**
|
||||||
|
* Similar to the previous function, but for upgrades.
|
||||||
* Note: currently no static data is used by Cookie Monster,
|
* Note: currently no static data is used by Cookie Monster,
|
||||||
* so this function just returns an empty object.
|
* so this function just returns an empty object.
|
||||||
*/
|
*/
|
||||||
@@ -178,7 +180,8 @@ CM.Sim.InitUpgrade = function(upgradeName) {
|
|||||||
return you;
|
return you;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to the previous function, but for achievements.
|
/**
|
||||||
|
* Similar to the previous function, but for achievements.
|
||||||
* Note: currently no static data is used by Cookie Monster,
|
* Note: currently no static data is used by Cookie Monster,
|
||||||
* so this function just returns an empty object.
|
* so this function just returns an empty object.
|
||||||
*/
|
*/
|
||||||
@@ -204,6 +207,9 @@ CM.Sim.InitData = function() {
|
|||||||
for (var i in Game.Achievements) {
|
for (var i in Game.Achievements) {
|
||||||
CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
|
CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auras
|
||||||
|
CM.Cache.CacheDragonAuras();
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Sim.CopyData = function() {
|
CM.Sim.CopyData = function() {
|
||||||
@@ -213,8 +219,6 @@ CM.Sim.CopyData = function() {
|
|||||||
CM.Sim.AchievementsOwned = Game.AchievementsOwned;
|
CM.Sim.AchievementsOwned = Game.AchievementsOwned;
|
||||||
CM.Sim.heavenlyPower = Game.heavenlyPower; // Unneeded? > Might be modded
|
CM.Sim.heavenlyPower = Game.heavenlyPower; // Unneeded? > Might be modded
|
||||||
CM.Sim.prestige = Game.prestige;
|
CM.Sim.prestige = Game.prestige;
|
||||||
CM.Sim.dragonAura = Game.dragonAura;
|
|
||||||
CM.Sim.dragonAura2 = Game.dragonAura2;
|
|
||||||
|
|
||||||
// Buildings
|
// Buildings
|
||||||
for (var i in Game.Objects) {
|
for (var i in Game.Objects) {
|
||||||
@@ -227,6 +231,8 @@ CM.Sim.CopyData = function() {
|
|||||||
you.amount = me.amount;
|
you.amount = me.amount;
|
||||||
you.level = me.level;
|
you.level = me.level;
|
||||||
you.totalCookies = me.totalCookies;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +255,11 @@ CM.Sim.CopyData = function() {
|
|||||||
}
|
}
|
||||||
you.won = me.won;
|
you.won = me.won;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auras
|
||||||
|
CM.Cache.CacheDragonAuras();
|
||||||
|
CM.Sim.dragonAura = CM.Cache.dragonAura;
|
||||||
|
CM.Sim.dragonAura2 = CM.Cache.dragonAura2;
|
||||||
};
|
};
|
||||||
|
|
||||||
CM.Sim.CalculateGains = function() {
|
CM.Sim.CalculateGains = function() {
|
||||||
@@ -617,6 +628,46 @@ CM.Sim.BuyUpgrades = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions calculates the cps and cost of changing a Dragon Aura
|
||||||
|
* It is called by CM.Disp.AddAuraInfo()
|
||||||
|
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||||
|
* @returns {[number, number]} [CM.Sim.cookiesPs - Game.cookiesPs, price] The bonus cps and the price of the change
|
||||||
|
*/
|
||||||
|
CM.Sim.CalculateChangeAura = function(aura) {
|
||||||
|
CM.Sim.CopyData();
|
||||||
|
|
||||||
|
// Check if aura being changed is first or second aura
|
||||||
|
var auraToBeChanged = l('promptContent').children[0].innerHTML.includes("secondary")
|
||||||
|
if (auraToBeChanged) CM.Sim.dragonAura2 = aura;
|
||||||
|
else CM.Sim.dragonAura = aura;
|
||||||
|
|
||||||
|
// Sell highest building but only if aura is different
|
||||||
|
if (CM.Sim.dragonAura != CM.Cache.dragonAura || CM.Sim.dragonAura2 != CM.Cache.dragonAura2) {
|
||||||
|
for (var i = Game.ObjectsById.length; i > -1, --i;) {
|
||||||
|
if (Game.ObjectsById[i].amount > 0) {
|
||||||
|
var highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name;
|
||||||
|
CM.Sim.Objects[highestBuilding].amount -=1;
|
||||||
|
CM.Sim.buildingsOwned -= 1;
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This calculates price of highest building
|
||||||
|
var price = CM.Sim.Objects[highestBuilding].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[highestBuilding].amount - 1 -CM.Sim.Objects[highestBuilding].free));
|
||||||
|
price = Game.modifyBuildingPrice(CM.Sim.Objects[highestBuilding], price);
|
||||||
|
price = Math.ceil(price);
|
||||||
|
} else var price = 0;
|
||||||
|
|
||||||
|
var lastAchievementsOwned = CM.Sim.AchievementsOwned;
|
||||||
|
CM.Sim.CalculateGains();
|
||||||
|
|
||||||
|
CM.Sim.CheckOtherAchiev();
|
||||||
|
if (lastAchievementsOwned != CM.Sim.AchievementsOwned) {
|
||||||
|
CM.Sim.CalculateGains();
|
||||||
|
}
|
||||||
|
return [CM.Sim.cookiesPs - Game.cookiesPs, price]
|
||||||
|
}
|
||||||
|
|
||||||
CM.Sim.NoGoldSwitchCookiesPS = function() {
|
CM.Sim.NoGoldSwitchCookiesPS = function() {
|
||||||
if (Game.Has('Golden switch [off]')) {
|
if (Game.Has('Golden switch [off]')) {
|
||||||
CM.Sim.CopyData();
|
CM.Sim.CopyData();
|
||||||
|
|||||||
Reference in New Issue
Block a user