Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from mtarnuhal #4

Merged
merged 2 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 45 additions & 33 deletions fc_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ function setOverrides() {
Game.sayTime = function(time, detail) {
return timeDisplay(time / Game.fps);
}
Game.oldReset = Game.Reset;
Game.tooltip.oldDraw = Game.tooltip.draw;
Game.tooltip.draw = fcDraw; Game.oldReset = Game.Reset;
Game.oldWriteSave = Game.WriteSave;
Game.oldLoadSave = Game.LoadSave;
Game.Reset = fcReset;
Expand Down Expand Up @@ -299,6 +300,15 @@ function timeDisplay(seconds) {
return (days + hours + minutes + seconds).trim();
}

function fcDraw(from, text, origin) {
if (typeof(text) == "string") {
if (text.includes('Devastation')) {
text = text.replace(/\+\d+\%/,"+" + Math.round((Game.hasBuff('Devastation').multClick - 1) * 100) + "%")
}
}
Game.tooltip.oldDraw(from, text, origin);
}

function fcReset() {
Game.CollectWrinklers();
if (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')) {
Expand Down Expand Up @@ -623,7 +633,7 @@ function swapIn(godId, targetSlot) { //mostly code copied from minigamePantheon.

function autoRigidel() {
if (!T) return; //Exit if pantheon doesnt even exist
var timeToRipe = (Game.lumpRipeAge - (Date.now() - Game.lumpT))/60000; //Minutes until sugar lump ripens
var timeToRipe = (Math.ceil(Game.lumpRipeAge) - (Date.now() - Game.lumpT))/60000; //Minutes until sugar lump ripens
var orderLvl = Game.hasGod('order') ? Game.hasGod('order') : 0;
switch (orderLvl) {
case 0: //Rigidel isn't in a slot
Expand Down Expand Up @@ -2170,43 +2180,45 @@ function autoGSBuy() {

function safeBuy(bldg,count) {
// If store is in Sell mode, Game.Objects[].buy will sell the building!
if (Game.buyMode == -1)
{
document.getElementById('storeBulkBuy').click();
if (Game.buyMode == -1) {
Game.buyMode = 1;
bldg.buy(count);
document.getElementById('storeBulkSell').click();
Game.buyMode = -1
} else {
bldg.buy(count);
}
}

function autoGodzamokAction()
{
if (!T) return; //Just leave if Pantheon isn't here yet
//Now has option to not trigger until current Devastation buff expires (i.e. won't rapidly buy & sell cursors throughout Godzamok duration)
//added Farms to autoGodzamok selling. 1 farm always left to prevent garden from disappearing
if (Game.hasGod('ruin') && (!Game.hasBuff('Devastation')) && hasClickBuff())
{
if ((FrozenCookies.autoGodzamok >= 1) && Game.Objects['Cursor'].amount >= 10)
{
var count = Game.Objects['Cursor'].amount;
Game.Objects['Cursor'].sell(count);
}
if ((FrozenCookies.autoGodzamok >= 1) && Game.Objects['Farm'].amount >= 10)
{
var count2 = Game.Objects['Farm'].amount-1;
Game.Objects['Farm'].sell(count2);
function autoGodzamokAction() {
if ( T && FrozenCookies.autoGodzamok ) { // if Pantheon is here and autoGodzamok is set
if ( Game.hasGod('ruin') && ( Game.Objects['Cursor'].amount > 10 || Game.Objects['Farm'].amount > 10 ) ) {
var countC = Game.Objects['Cursor'].amount;
var countF = Game.Objects['Farm'].amount-1;

//Automatically sell all cursors and farms (except one) during Dragonflight and Click Frenzy if you worship Godzamok and prevent rapid buy/sell spam
if ( ( FrozenCookies.autoGodzamok >= 1 ) && hasClickBuff() && !Game.hasBuff('Devastation') ) {
Game.Objects['Cursor'].sell( countC );
Game.Objects['Farm'].sell( countF );

if ( FrozenCookies.autoBuy == 1 ) {
if ( ( FrozenCookies.cursorLimit ) && countC > FrozenCookies.cursorMax ) {
safeBuy( Game.Objects['Cursor'], FrozenCookies.cursorMax );
logEvent( "AutoGodzamok", "Bought " + FrozenCookies.cursorMax + " cursors" );
} else {
safeBuy( Game.Objects['Cursor'], countC );
logEvent( "AutoGodzamok", "Bought " + countC + " cursors" );
}
if ( ( FrozenCookies.farmLimit ) && countF > ( FrozenCookies.farmMax - 1 ) ) {
safeBuy( Game.Objects['Farm'], FrozenCookies.farmMax - 1 );
logEvent( "AutoGodzamok", "Bought " + ( FrozenCookies.farmMax - 1 ) + " farms" );
} else {
safeBuy( Game.Objects['Farm'], countF );
logEvent( "AutoGodzamok", "Bought " + countF + " farms" );
}
}
}
}

if ((FrozenCookies.autoGodzamok >= 1) && Game.Objects['Cursor'].amount < 10)
{
safeBuy(Game.Objects['Cursor'],count);
}
if ((FrozenCookies.autoGodzamok >= 1) && Game.Objects['Farm'].amount < 10)
{
safeBuy(Game.Objects['Farm'],count2);
}
}
}
}

function goldenCookieLife() {
Expand Down Expand Up @@ -2259,7 +2271,7 @@ function autoCookie() {
}
if (FrozenCookies.autoSL) {
var started = Game.lumpT;
var ripeAge = Game.lumpRipeAge;
var ripeAge = Math.ceil(Game.lumpRipeAge);
if ((Date.now() - started) >= ripeAge) {
Game.clickLump();
}
Expand Down
4 changes: 2 additions & 2 deletions fc_preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ FrozenCookies.preferenceValues = {
'default': 0
},
'autoGodzamok': {
'hint': 'Automatically sell all cursors and farms (except one) during Dragonflight and Click Frenzy if you worship Godzamok ("Sane" prevents rapid buy/sell spam)',
'display': ['Auto-Godzamok OFF', 'Auto-Godzamok ON', 'Auto-Godzamok ON (Sane)', 'Auto-Godzamok ON (REALLY INSANE)'],
'hint': 'Automatically sell all cursors and farms (except one farm) during Dragonflight and Click Frenzy if you worship Godzamok and prevents rapid buy/sell spam',
'display': ['Auto-Godzamok OFF', 'Auto-Godzamok ON'],
'default': 0
},
'autoSpell': {
Expand Down
2 changes: 1 addition & 1 deletion frozen_cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var baseUrl = scriptElement !== null ?
var FrozenCookies = {
'baseUrl': baseUrl,
'branch': '',
'version': '1.8.0'
'version': '1.8.1'
};

// Load external libraries
Expand Down