Addition to previous commit
This commit is contained in:
78
src/Cache.js
Normal file
78
src/Cache.js
Normal file
@@ -0,0 +1,78 @@
|
||||
/*********
|
||||
* Cache *
|
||||
*********/
|
||||
|
||||
CM.Cache.RemakeIncome = function() {
|
||||
// Simulate Building Buys
|
||||
CM.Sim.BuyBuildings();
|
||||
|
||||
// Simulate Upgrade Buys
|
||||
CM.Sim.BuyUpgrades();
|
||||
}
|
||||
|
||||
CM.Cache.RemakeBuildingsBCI = function() {
|
||||
CM.Disp.min = -1;
|
||||
CM.Disp.max = -1;
|
||||
CM.Disp.mid = -1;
|
||||
for (var i in CM.Cache.Objects) {
|
||||
CM.Cache.Objects[i].bci = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
||||
if (CM.Disp.min == -1 || CM.Cache.Objects[i].bci < CM.Disp.min) CM.Disp.min = CM.Cache.Objects[i].bci;
|
||||
if (CM.Disp.max == -1 || CM.Cache.Objects[i].bci > CM.Disp.max) CM.Disp.max = CM.Cache.Objects[i].bci;
|
||||
}
|
||||
CM.Disp.mid = ((CM.Disp.max - CM.Disp.min) / 2) + CM.Disp.min;
|
||||
for (var i in CM.Cache.Objects) {
|
||||
var color = '';
|
||||
if (CM.Cache.Objects[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
||||
else if (CM.Cache.Objects[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
||||
else if (CM.Cache.Objects[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
||||
else color = CM.Disp.colorYellow;
|
||||
CM.Cache.Objects[i].color = color;
|
||||
}
|
||||
}
|
||||
|
||||
CM.Cache.RemakeUpgradeBCI = function() {
|
||||
for (var i in CM.Cache.Upgrades) {
|
||||
CM.Cache.Upgrades[i].bci = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
|
||||
var color = '';
|
||||
if (CM.Cache.Upgrades[i].bci <= 0 || CM.Cache.Upgrades[i].bci == 'Infinity') color = CM.Disp.colorGray;
|
||||
else if (CM.Cache.Upgrades[i].bci < CM.Disp.min) color = CM.Disp.colorBlue;
|
||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.max) color = CM.Disp.colorPurple;
|
||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
||||
else color = CM.Disp.colorYellow;
|
||||
CM.Cache.Upgrades[i].color = color;
|
||||
}
|
||||
}
|
||||
|
||||
CM.Cache.RemakeBCI = function() {
|
||||
// Buildings
|
||||
CM.Cache.RemakeBuildingsBCI();
|
||||
|
||||
// Upgrades
|
||||
CM.Cache.RemakeUpgradeBCI();
|
||||
}
|
||||
|
||||
CM.Cache.RemakeLucky = function() {
|
||||
CM.Cache.Lucky = (Game.cookiesPs * 60 * 20) / 0.1;
|
||||
if (Game.frenzy > 0) {
|
||||
CM.Cache.Lucky /= Game.frenzyPower;
|
||||
}
|
||||
CM.Cache.LuckyReward = (CM.Cache.Lucky * 0.1) + 13;
|
||||
CM.Cache.LuckyFrenzy = CM.Cache.Lucky * 7;
|
||||
CM.Cache.LuckyRewardFrenzy = (CM.Cache.LuckyFrenzy * 0.1) + 13;
|
||||
}
|
||||
|
||||
CM.Cache.RemakeSeaSpec = function() {
|
||||
if (Game.season == 'christmas') {
|
||||
CM.Cache.SeaSpec = Math.max(25, Game.cookiesPs * 60 * 1);
|
||||
if (Game.Has('Ho ho ho-flavored frosting')) CM.Cache.SeaSpec *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CM.Cache.Lucky = 0;
|
||||
CM.Cache.LuckyReward = 0;
|
||||
CM.Cache.LuckyFrenzy = 0;
|
||||
CM.Cache.LuckyRewardFrenzy = 0;
|
||||
CM.Cache.SeaSpec = 0;
|
||||
|
||||
84
src/Config.js
Normal file
84
src/Config.js
Normal file
@@ -0,0 +1,84 @@
|
||||
/**********
|
||||
* Config *
|
||||
**********/
|
||||
|
||||
CM.SaveConfig = function(config) {
|
||||
localStorage.setItem(CM.ConfigPrefix, JSON.stringify(config));
|
||||
}
|
||||
|
||||
CM.LoadConfig = function() {
|
||||
if (localStorage.getItem(CM.ConfigPrefix) != null) {
|
||||
CM.Config = JSON.parse(localStorage.getItem(CM.ConfigPrefix));
|
||||
|
||||
// Check values
|
||||
var mod = false;
|
||||
for (var i in CM.ConfigDefault) {
|
||||
if (CM.Config[i] == undefined || !(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) {
|
||||
mod = true;
|
||||
CM.Config[i] = CM.ConfigDefault[i];
|
||||
}
|
||||
}
|
||||
if (mod) CM.SaveConfig(CM.Config);
|
||||
CM.Loop(); // Do loop once
|
||||
for (var i in CM.ConfigDefault) {
|
||||
if (CM.ConfigData[i].func != undefined) {
|
||||
CM.ConfigData[i].func();
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // Default values
|
||||
CM.RestoreDefault();
|
||||
}
|
||||
}
|
||||
|
||||
CM.RestoreDefault = function() {
|
||||
CM.Config = {};
|
||||
CM.SaveConfig(CM.ConfigDefault);
|
||||
CM.LoadConfig();
|
||||
Game.UpdateMenu();
|
||||
}
|
||||
|
||||
CM.ToggleConfigUp = function(config) {
|
||||
CM.Config[config]++;
|
||||
if (CM.Config[config] == CM.ConfigData[config].label.length) {
|
||||
CM.Config[config] = 0;
|
||||
}
|
||||
if (CM.ConfigData[config].func != undefined) {
|
||||
CM.ConfigData[config].func();
|
||||
}
|
||||
l(CM.ConfigPrefix + config).innerHTML = CM.Disp.GetConfigDisplay(config);
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
|
||||
CM.ToggleConfigDown = function(config) {
|
||||
CM.Config[config]--;
|
||||
if (CM.Config[config] < 0) {
|
||||
CM.Config[config] = CM.ConfigData[config].label.length - 1;
|
||||
}
|
||||
if (CM.ConfigData[config].func != undefined) {
|
||||
CM.ConfigData[config].func();
|
||||
}
|
||||
l(CM.ConfigPrefix + config).innerHTML = CM.Disp.GetConfigDisplay(config);
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
|
||||
CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', func: function() {CM.Disp.ToggleBotBar();}};
|
||||
CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', func: function() {CM.Disp.ToggleTimerBar();}};
|
||||
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}};
|
||||
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'};
|
||||
CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup'};
|
||||
CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.Volume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when has been spawned', func: function() {CM.Disp.ToggleGCTimer();}};
|
||||
CM.ConfigData.Title = {label: ['Title OFF', 'Title ON'], desc: 'Update title with Golden Cookie/Season Popup timers'};
|
||||
CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades'};
|
||||
CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}};
|
||||
CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}};
|
||||
CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'};
|
||||
CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 3 seconds'};
|
||||
CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', func: function() {CM.Disp.ToggleSayTime();}};
|
||||
CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation'], desc: 'Change how long numbers are handled', func: function() {CM.Disp.RefreshScale();}};
|
||||
|
||||
8
src/Data.js
Normal file
8
src/Data.js
Normal file
@@ -0,0 +1,8 @@
|
||||
/********
|
||||
* Data *
|
||||
********/
|
||||
|
||||
CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies'];
|
||||
CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits'];
|
||||
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits'];
|
||||
|
||||
1124
src/Disp.js
Normal file
1124
src/Disp.js
Normal file
File diff suppressed because it is too large
Load Diff
5
src/Footer.js
Normal file
5
src/Footer.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/**********
|
||||
* Footer *
|
||||
**********/
|
||||
|
||||
CM.Init();
|
||||
20
src/Header.js
Normal file
20
src/Header.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**********
|
||||
* Header *
|
||||
**********/
|
||||
|
||||
CM = {};
|
||||
|
||||
CM.Backup = {};
|
||||
|
||||
CM.Cache = {};
|
||||
|
||||
CM.Config = {};
|
||||
|
||||
CM.ConfigData = {};
|
||||
|
||||
CM.Data = {};
|
||||
|
||||
CM.Disp = {};
|
||||
|
||||
CM.Sim = {};
|
||||
|
||||
124
src/Main.js
Normal file
124
src/Main.js
Normal file
@@ -0,0 +1,124 @@
|
||||
/********
|
||||
* Main *
|
||||
********/
|
||||
|
||||
CM.ReplaceNative = function() {
|
||||
CM.Backup.Beautify = Beautify;
|
||||
Beautify = CM.Disp.Beautify;
|
||||
|
||||
CM.Backup.CalculateGains = Game.CalculateGains;
|
||||
Game.CalculateGains = function() {
|
||||
CM.Backup.CalculateGains();
|
||||
CM.Sim.DoSims = 1;
|
||||
CM.Sim.Date = new Date().getTime();
|
||||
}
|
||||
|
||||
CM.Backup.seasonPopup = {};
|
||||
CM.Backup.seasonPopup.spawn = Game.seasonPopup.spawn;
|
||||
eval('CM.Backup.seasonPopup.spawnMod = ' + Game.seasonPopup.spawn.toString().split('this').join('Game.seasonPopup'));
|
||||
Game.seasonPopup.spawn = function() {
|
||||
CM.Backup.seasonPopup.spawnMod();
|
||||
CM.Disp.EmphSeasonPopup();
|
||||
}
|
||||
|
||||
CM.Backup.tooltip = {};
|
||||
CM.Backup.tooltip.draw = Game.tooltip.draw;
|
||||
eval('CM.Backup.tooltip.drawMod = ' + Game.tooltip.draw.toString().split('this').join('Game.tooltip'));
|
||||
Game.tooltip.draw = function(from, text, origin) {
|
||||
CM.Backup.tooltip.drawMod(from, text, origin);
|
||||
CM.Disp.DrawTooltipWarnCaut();
|
||||
}
|
||||
|
||||
CM.Backup.tooltip.update = Game.tooltip.update;
|
||||
eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip'));
|
||||
Game.tooltip.update = function() {
|
||||
CM.Backup.tooltip.updateMod();
|
||||
CM.Disp.UpdateTooltipWarnCaut();
|
||||
}
|
||||
|
||||
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
|
||||
Game.RebuildUpgrades = function() {
|
||||
CM.Backup.RebuildUpgrades();
|
||||
CM.Disp.AddTooltipUpgrade();
|
||||
}
|
||||
|
||||
CM.Backup.UpdateMenu = Game.UpdateMenu;
|
||||
Game.UpdateMenu = function() {
|
||||
CM.Backup.UpdateMenu();
|
||||
CM.Disp.AddMenu();
|
||||
}
|
||||
|
||||
CM.Backup.sayTime = Game.sayTime;
|
||||
CM.Disp.sayTime = function(time, detail) {
|
||||
if (isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail);
|
||||
else return CM.Disp.FormatTime(time / Game.fps, 1);
|
||||
}
|
||||
|
||||
CM.Backup.Loop = Game.Loop;
|
||||
Game.Loop = function() {
|
||||
CM.Backup.Loop();
|
||||
CM.Loop();
|
||||
}
|
||||
}
|
||||
|
||||
CM.Loop = function() {
|
||||
if (CM.Sim.DoSims) {
|
||||
CM.Cache.RemakeIncome();
|
||||
CM.Cache.RemakeBCI();
|
||||
CM.Cache.RemakeLucky();
|
||||
CM.Cache.RemakeSeaSpec();
|
||||
|
||||
CM.Disp.UpdateBotBarOther();
|
||||
CM.Disp.UpdateBuildings();
|
||||
CM.Disp.UpdateUpgrades();
|
||||
|
||||
CM.Sim.DoSims = 0;
|
||||
}
|
||||
|
||||
// Redraw timers
|
||||
CM.Disp.UpdateBotBarTime();
|
||||
CM.Disp.UpdateTimerBar();
|
||||
|
||||
// Update Tooltip
|
||||
CM.Disp.UpdateTooltip();
|
||||
|
||||
// Check Golden Cookies
|
||||
CM.Disp.CheckGoldenCookie();
|
||||
|
||||
// Update Title
|
||||
CM.Disp.UpdateTitle();
|
||||
|
||||
// Change menu refresh interval
|
||||
CM.Disp.RefreshMenu();
|
||||
}
|
||||
|
||||
CM.Init = function() {
|
||||
var proceed = true;
|
||||
if (Game.version != CM.VersionMajor) {
|
||||
proceed = confirm('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' is meant for Game version ' + CM.VersionMajor + '. Loading a different version may cause errors. Do you still want to load Cookie Monster?');
|
||||
}
|
||||
if (proceed) {
|
||||
CM.Disp.CreateBotBar();
|
||||
CM.Disp.CreateTimerBar();
|
||||
CM.Disp.CreateUpgradeBar();
|
||||
CM.Disp.CreateWhiteScreen();
|
||||
CM.Disp.CreateGCTimer();
|
||||
CM.Disp.CreateTooltipWarnCaut();
|
||||
CM.Disp.AddTooltipBuild();
|
||||
CM.ReplaceNative();
|
||||
Game.CalculateGains();
|
||||
CM.LoadConfig(); // Must be after all things are created!
|
||||
|
||||
if (Game.prefs.popups) Game.Popup('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!');
|
||||
else Game.Notify('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!','','',1);
|
||||
|
||||
Game.Win('Third-party');
|
||||
}
|
||||
}
|
||||
|
||||
CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 0, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2};
|
||||
CM.ConfigPrefix = 'CMConfig';
|
||||
|
||||
CM.VersionMajor = '1.0465';
|
||||
CM.VersionMinor = '5';
|
||||
|
||||
352
src/Sim.js
Normal file
352
src/Sim.js
Normal file
@@ -0,0 +1,352 @@
|
||||
/*******
|
||||
* Sim *
|
||||
*******/
|
||||
|
||||
eval('CM.Sim.Has = ' + Game.Has.toString().split('Game').join('CM.Sim'));
|
||||
|
||||
CM.Sim.Win = function(what) {
|
||||
if (CM.Sim.Achievements[what]) {
|
||||
if (CM.Sim.Achievements[what].won == 0) {
|
||||
CM.Sim.Achievements[what].won = 1;
|
||||
if (Game.Achievements[what].hide != 3) CM.Sim.AchievementsOwned++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eval('CM.Sim.HasAchiev = ' + Game.HasAchiev.toString().split('Game').join('CM.Sim'));
|
||||
|
||||
CM.Sim.CookNeedPrest = function(prestige) {
|
||||
return ((Math.pow(((prestige * 2) + 1), 2) - 1) / 8) * 1000000000000;
|
||||
}
|
||||
|
||||
CM.Sim.CopyData = function() {
|
||||
// Other variables
|
||||
CM.Sim.prestige = Game.prestige['Heavenly chips'];
|
||||
CM.Sim.UpgradesOwned = Game.UpgradesOwned;
|
||||
CM.Sim.pledges = Game.pledges;
|
||||
CM.Sim.AchievementsOwned = Game.AchievementsOwned;
|
||||
|
||||
// Buildings
|
||||
CM.Sim.Objects = [];
|
||||
for (var i in Game.Objects) {
|
||||
CM.Sim.Objects[i] = {};
|
||||
var me = Game.Objects[i];
|
||||
var you = CM.Sim.Objects[i];
|
||||
you.amount = me.amount;
|
||||
eval('you.cps = ' + me.cps.toString().split('Game.Has').join('CM.Sim.Has').split('Game.Objects').join('CM.Sim.Objects'));
|
||||
you.name = me.name; // Needed for above eval!
|
||||
}
|
||||
|
||||
// Upgrades
|
||||
CM.Sim.Upgrades = [];
|
||||
for (var i in Game.Upgrades) {
|
||||
CM.Sim.Upgrades[i] = {};
|
||||
var me = Game.Upgrades[i];
|
||||
var you = CM.Sim.Upgrades[i];
|
||||
you.bought = me.bought;
|
||||
}
|
||||
|
||||
// Achievements
|
||||
CM.Sim.Achievements = [];
|
||||
for (var i in Game.Achievements) {
|
||||
CM.Sim.Achievements[i] = {};
|
||||
var me = Game.Achievements[i];
|
||||
var you = CM.Sim.Achievements[i];
|
||||
you.won = me.won;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CM.Sim.CalculateGains = function() {
|
||||
CM.Sim.cookiesPs = 0;
|
||||
var mult = 1;
|
||||
for (var i in CM.Sim.Upgrades) {
|
||||
var me = CM.Sim.Upgrades[i];
|
||||
if (me.bought > 0) {
|
||||
if (Game.Upgrades[i].type == 'cookie' && CM.Sim.Has(Game.Upgrades[i].name)) mult += Game.Upgrades[i].power * 0.01;
|
||||
}
|
||||
}
|
||||
mult += CM.Sim.Has('Specialized chocolate chips') * 0.01;
|
||||
mult += CM.Sim.Has('Designer cocoa beans') * 0.02;
|
||||
mult += CM.Sim.Has('Underworld ovens') * 0.03;
|
||||
mult += CM.Sim.Has('Exotic nuts') * 0.04;
|
||||
mult += CM.Sim.Has('Arcane sugar') * 0.05;
|
||||
|
||||
if (CM.Sim.Has('Increased merriness')) mult += 0.15;
|
||||
if (CM.Sim.Has('Improved jolliness')) mult += 0.15;
|
||||
if (CM.Sim.Has('A lump of coal')) mult += 0.01;
|
||||
if (CM.Sim.Has('An itchy sweater')) mult += 0.01;
|
||||
if (CM.Sim.Has('Santa\'s dominion')) mult += 0.5;
|
||||
|
||||
if (CM.Sim.Has('Santa\'s legacy')) mult += (Game.santaLevel + 1) * 0.1;
|
||||
|
||||
var heavenlyMult = 0;
|
||||
if (CM.Sim.Has('Heavenly chip secret')) heavenlyMult += 0.05;
|
||||
if (CM.Sim.Has('Heavenly cookie stand')) heavenlyMult += 0.20;
|
||||
if (CM.Sim.Has('Heavenly bakery')) heavenlyMult += 0.25;
|
||||
if (CM.Sim.Has('Heavenly confectionery')) heavenlyMult += 0.25;
|
||||
if (CM.Sim.Has('Heavenly key')) heavenlyMult += 0.25;
|
||||
mult += parseFloat(CM.Sim.prestige) * 0.02 * heavenlyMult;
|
||||
|
||||
for (var i in CM.Sim.Objects) {
|
||||
var me = CM.Sim.Objects[i];
|
||||
CM.Sim.cookiesPs += me.amount * (typeof(me.cps) == 'function' ? me.cps() : me.cps);
|
||||
}
|
||||
|
||||
if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9; // "egg"
|
||||
|
||||
var milkMult = CM.Sim.Has('Santa\'s milk and cookies') ? 1.05 : 1;
|
||||
if (CM.Sim.Has('Kitten helpers')) mult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.05 * milkMult);
|
||||
if (CM.Sim.Has('Kitten workers')) mult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult);
|
||||
if (CM.Sim.Has('Kitten engineers')) mult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult);
|
||||
if (CM.Sim.Has('Kitten overseers')) mult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult);
|
||||
if (CM.Sim.Has('Kitten managers')) mult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult);
|
||||
|
||||
var eggMult = 0;
|
||||
if (CM.Sim.Has('Chicken egg')) eggMult++;
|
||||
if (CM.Sim.Has('Duck egg')) eggMult++;
|
||||
if (CM.Sim.Has('Turkey egg')) eggMult++;
|
||||
if (CM.Sim.Has('Quail egg')) eggMult++;
|
||||
if (CM.Sim.Has('Robin egg')) eggMult++;
|
||||
if (CM.Sim.Has('Ostrich egg')) eggMult++;
|
||||
if (CM.Sim.Has('Cassowary egg')) eggMult++;
|
||||
if (CM.Sim.Has('Salmon roe')) eggMult++;
|
||||
if (CM.Sim.Has('Frogspawn')) eggMult++;
|
||||
if (CM.Sim.Has('Shark egg')) eggMult++;
|
||||
if (CM.Sim.Has('Turtle egg')) eggMult++;
|
||||
if (CM.Sim.Has('Ant larva')) eggMult++;
|
||||
if (CM.Sim.Has('Century egg')) {
|
||||
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day
|
||||
var day = Math.floor((CM.Sim.Date - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24;
|
||||
day = Math.min(day,100);
|
||||
eggMult += (1 - Math.pow(1 - day / 100, 3)) * 10;
|
||||
}
|
||||
mult *= (1 + 0.01 * eggMult);
|
||||
|
||||
var rawCookiesPs = CM.Sim.cookiesPs * mult;
|
||||
for (var i = 0; i < Game.cpsAchievs.length / 2; i++) {
|
||||
if (rawCookiesPs >= Game.cpsAchievs[i * 2 + 1]) CM.Sim.Win(Game.cpsAchievs[i * 2]);
|
||||
}
|
||||
|
||||
if (Game.frenzy > 0) mult *= Game.frenzyPower;
|
||||
|
||||
if (CM.Sim.Has('Elder Covenant')) mult *= 0.95;
|
||||
|
||||
CM.Sim.globalCpsMult = mult;
|
||||
CM.Sim.cookiesPs *= CM.Sim.globalCpsMult;
|
||||
};
|
||||
|
||||
CM.Sim.CheckOtherAchiev = function() {
|
||||
var grandmas=0;
|
||||
if (CM.Sim.Has('Farmer grandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Worker grandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Miner grandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Cosmic grandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Transmuted grandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Altered grandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Grandmas\' grandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Antigrandmas')) grandmas++;
|
||||
if (CM.Sim.Has('Rainbow grandmas')) grandmas++;
|
||||
if (!CM.Sim.HasAchiev('Elder') && grandmas >= 7) CM.Sim.Win('Elder');
|
||||
|
||||
var buildingsOwned = 0;
|
||||
var oneOfEach = 1;
|
||||
var mathematician = 1;
|
||||
var base10 = 1;
|
||||
var centennial = 1;
|
||||
var centennialhalf = 1;
|
||||
var bicentennial = 1;
|
||||
for (var i in CM.Sim.Objects) {
|
||||
buildingsOwned += CM.Sim.Objects[i].amount;
|
||||
if (!CM.Sim.HasAchiev('One with everything')) {
|
||||
if (CM.Sim.Objects[i].amount == 0) oneOfEach = 0;
|
||||
}
|
||||
if (!CM.Sim.HasAchiev('Mathematician')) {
|
||||
if (CM.Sim.Objects[i].amount < Math.min(128, Math.pow(2, (Game.ObjectsById.length - Game.Objects[i].id) - 1))) mathematician = 0;
|
||||
}
|
||||
if (!CM.Sim.HasAchiev('Base 10')) {
|
||||
if (CM.Sim.Objects[i].amount < (Game.ObjectsById.length - Game.Objects[i].id)*10) base10 = 0;
|
||||
}
|
||||
if (!CM.Sim.HasAchiev('Centennial')) {
|
||||
if (CM.Sim.Objects[i].amount < 100) centennial = 0;
|
||||
}
|
||||
if (!CM.Sim.HasAchiev('Centennial and a half')) {
|
||||
if (CM.Sim.Objects[i].amount < 150) centennialhalf = 0;
|
||||
}
|
||||
if (!CM.Sim.HasAchiev('Bicentennial')) {
|
||||
if (CM.Sim.Objects[i].amount < 200) bicentennial = 0;
|
||||
}
|
||||
}
|
||||
if (oneOfEach == 1) CM.Sim.Win('One with everything');
|
||||
if (mathematician == 1) CM.Sim.Win('Mathematician');
|
||||
if (base10 == 1) CM.Sim.Win('Base 10');
|
||||
if (centennial == 1) CM.Sim.Win('Centennial');
|
||||
if (centennialhalf == 1) CM.Sim.Win('Centennial and a half');
|
||||
if (bicentennial == 1) CM.Sim.Win('Bicentennial');
|
||||
|
||||
if (buildingsOwned >= 100) CM.Sim.Win('Builder');
|
||||
if (buildingsOwned >= 400) CM.Sim.Win('Architect');
|
||||
if (buildingsOwned >= 800) CM.Sim.Win('Engineer');
|
||||
if (buildingsOwned >= 1500) CM.Sim.Win('Lord of Constructs');
|
||||
|
||||
if (CM.Sim.UpgradesOwned >= 20) CM.Sim.Win('Enhancer');
|
||||
if (CM.Sim.UpgradesOwned >= 50) CM.Sim.Win('Augmenter');
|
||||
if (CM.Sim.UpgradesOwned >= 100) CM.Sim.Win('Upgrader');
|
||||
if (CM.Sim.UpgradesOwned >= 150) CM.Sim.Win('Lord of Progress');
|
||||
|
||||
var hasAllHalloCook = true;
|
||||
for (var i in CM.Data.HalloCookies) {
|
||||
if (!CM.Sim.Has(CM.Data.HalloCookies[i])) hasAllHalloCook = false;
|
||||
}
|
||||
if (hasAllHalloCook) CM.Sim.Win('Spooky cookies');
|
||||
|
||||
var hasAllChristCook = true;
|
||||
for (var i in CM.Data.ChristCookies) {
|
||||
if (!CM.Sim.Has(CM.Data.ChristCookies[i])) hasAllChristCook = false;
|
||||
}
|
||||
if (hasAllChristCook) CM.Sim.Win('Let it snow');
|
||||
}
|
||||
|
||||
CM.Sim.BuyBuildings = function() {
|
||||
CM.Cache.Objects = [];
|
||||
for (var i in Game.Objects) {
|
||||
CM.Sim.CopyData();
|
||||
var me = CM.Sim.Objects[i];
|
||||
me.amount++;
|
||||
|
||||
if (i == 'Cursor') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Click');
|
||||
if (me.amount >= 2) CM.Sim.Win('Double-click');
|
||||
if (me.amount >= 50) CM.Sim.Win('Mouse wheel');
|
||||
if (me.amount >= 100) CM.Sim.Win('Of Mice and Men');
|
||||
if (me.amount >= 200) CM.Sim.Win('The Digital');
|
||||
if (me.amount >= 300) CM.Sim.Win('Extreme polydactyly');
|
||||
if (me.amount >= 400) CM.Sim.Win('Dr. T');
|
||||
}
|
||||
else if (i == 'Grandma') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Grandma\'s cookies');
|
||||
if (me.amount >= 50) CM.Sim.Win('Sloppy kisses');
|
||||
if (me.amount >= 100) CM.Sim.Win('Retirement home');
|
||||
if (me.amount >= 150) CM.Sim.Win('Friend of the ancients');
|
||||
if (me.amount >= 200) CM.Sim.Win('Ruler of the ancients');
|
||||
if (me.amount >= 250) CM.Sim.Win('The old never bothered me anyway');
|
||||
}
|
||||
else if (i == 'Farm') {
|
||||
if (me.amount >= 1) CM.Sim.Win('My first farm');
|
||||
if (me.amount >= 50) CM.Sim.Win('Reap what you sow');
|
||||
if (me.amount >= 100) CM.Sim.Win('Farm ill');
|
||||
if (me.amount >= 150) CM.Sim.Win('Perfected agriculture');
|
||||
if (me.amount >= 200) CM.Sim.Win('Homegrown');
|
||||
}
|
||||
else if (i == 'Factory') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Production chain');
|
||||
if (me.amount >= 50) CM.Sim.Win('Industrial revolution');
|
||||
if (me.amount >= 100) CM.Sim.Win('Global warming');
|
||||
if (me.amount >= 150) CM.Sim.Win('Ultimate automation');
|
||||
if (me.amount >= 200) CM.Sim.Win('Technocracy');
|
||||
}
|
||||
else if (i == 'Mine') {
|
||||
if (me.amount >= 1) CM.Sim.Win('You know the drill');
|
||||
if (me.amount >= 50) CM.Sim.Win('Excavation site');
|
||||
if (me.amount >= 100) CM.Sim.Win('Hollow the planet');
|
||||
if (me.amount >= 150) CM.Sim.Win('Can you dig it');
|
||||
if (me.amount >= 200) CM.Sim.Win('The center of the Earth');
|
||||
}
|
||||
else if (i == 'Shipment') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Expedition');
|
||||
if (me.amount >= 50) CM.Sim.Win('Galactic highway');
|
||||
if (me.amount >= 100) CM.Sim.Win('Far far away');
|
||||
if (me.amount >= 150) CM.Sim.Win('Type II civilization');
|
||||
if (me.amount >= 200) CM.Sim.Win('We come in peace');
|
||||
}
|
||||
else if (i == 'Alchemy lab') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Transmutation');
|
||||
if (me.amount >= 50) CM.Sim.Win('Transmogrification');
|
||||
if (me.amount >= 100) CM.Sim.Win('Gold member');
|
||||
if (me.amount >= 150) CM.Sim.Win('Gild wars');
|
||||
if (me.amount >= 200) CM.Sim.Win('The secrets of the universe');
|
||||
}
|
||||
else if (i == 'Portal') {
|
||||
if (me.amount >= 1) CM.Sim.Win('A whole new world');
|
||||
if (me.amount >= 50) CM.Sim.Win('Now you\'re thinking');
|
||||
if (me.amount >= 100) CM.Sim.Win('Dimensional shift');
|
||||
if (me.amount >= 150) CM.Sim.Win('Brain-split');
|
||||
if (me.amount >= 200) CM.Sim.Win('Realm of the Mad God');
|
||||
}
|
||||
else if (i == 'Time machine') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Time warp');
|
||||
if (me.amount >= 50) CM.Sim.Win('Alternate timeline');
|
||||
if (me.amount >= 100) CM.Sim.Win('Rewriting history');
|
||||
if (me.amount >= 150) CM.Sim.Win('Time duke');
|
||||
if (me.amount >= 200) CM.Sim.Win('Forever and ever');
|
||||
}
|
||||
else if (i == 'Antimatter condenser') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Antibatter');
|
||||
if (me.amount >= 50) CM.Sim.Win('Quirky quarks');
|
||||
if (me.amount >= 100) CM.Sim.Win('It does matter!');
|
||||
if (me.amount >= 150) CM.Sim.Win('Molecular maestro');
|
||||
if (me.amount >= 200) CM.Sim.Win('Walk the planck');
|
||||
}
|
||||
else if (i == 'Prism') {
|
||||
if (me.amount >= 1) CM.Sim.Win('Lone photon');
|
||||
if (me.amount >= 50) CM.Sim.Win('Dazzling glimmer');
|
||||
if (me.amount >= 100) CM.Sim.Win('Blinding flash');
|
||||
if (me.amount >= 150) CM.Sim.Win('Unending glow');
|
||||
if (me.amount >= 200) CM.Sim.Win('Rise and shine');
|
||||
}
|
||||
|
||||
var lastAchievementsOwned = CM.Sim.AchievementsOwned;
|
||||
|
||||
CM.Sim.CalculateGains();
|
||||
|
||||
CM.Sim.CheckOtherAchiev();
|
||||
|
||||
if (lastAchievementsOwned != CM.Sim.AchievementsOwned) {
|
||||
CM.Sim.CalculateGains();
|
||||
}
|
||||
|
||||
CM.Cache.Objects[i] = {};
|
||||
CM.Cache.Objects[i].bonus = CM.Sim.cookiesPs - Game.cookiesPs;
|
||||
}
|
||||
}
|
||||
|
||||
CM.Sim.BuyUpgrades = function() {
|
||||
CM.Cache.Upgrades = [];
|
||||
for (var i in Game.Upgrades) {
|
||||
if (Game.Upgrades[i].bought == 0 && Game.Upgrades[i].unlocked) {
|
||||
CM.Sim.CopyData();
|
||||
var me = CM.Sim.Upgrades[i];
|
||||
me.bought = 1;
|
||||
if (Game.Upgrades[i].hide != 3) CM.Sim.UpgradesOwned++;
|
||||
|
||||
if (i == 'Elder Pledge') {
|
||||
CM.Sim.pledges++;
|
||||
if (CM.Sim.pledges > 0) CM.Sim.Win('Elder nap');
|
||||
if (CM.Sim.pledges >= 5) CM.Sim.Win('Elder slumber');
|
||||
}
|
||||
else if (i == 'Elder Covenant') {
|
||||
CM.Sim.Win('Elder calm')
|
||||
}
|
||||
else if (i == 'Eternal heart biscuits') {
|
||||
CM.Sim.Win('Lovely cookies');
|
||||
}
|
||||
else if (i == 'Heavenly key') {
|
||||
CM.Sim.Win('Wholesome');
|
||||
}
|
||||
|
||||
var lastAchievementsOwned = CM.Sim.AchievementsOwned;
|
||||
|
||||
CM.Sim.CalculateGains();
|
||||
|
||||
CM.Sim.CheckOtherAchiev();
|
||||
|
||||
if (lastAchievementsOwned != CM.Sim.AchievementsOwned) {
|
||||
CM.Sim.CalculateGains();
|
||||
}
|
||||
|
||||
CM.Cache.Upgrades[i] = {};
|
||||
CM.Cache.Upgrades[i].bonus = CM.Sim.cookiesPs - Game.cookiesPs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user