Path: blob/main/static/src/gs/public/cookie/minigameGarden.js
1344 views
var M={};1M.parent=Game.Objects['Farm'];2M.parent.minigame=M;3M.launch=function()4{5var M=this;6M.name=M.parent.minigameName;7M.init=function(div)8{9//populate div with html and initialize values1011/*12plants age from 0 to 10013at one point in its lifespan, the plant becomes mature14plants have 4 life stages once planted : bud, sprout, bloom, mature15a plant may age faster by having a higher .ageTick16if a plant has .ageTickR, a random number between 0 and that amount is added to .ageTick17a plant may mature faster by having a lower .mature18a plant's effects depend on how mature it is19a plant can only reproduce when mature20*/21M.plants={22'bakerWheat':{23name:'Baker\'s wheat',24icon:0,25cost:1,26costM:30,27ageTick:7,28ageTickR:2,29mature:35,30children:['bakerWheat','thumbcorn','cronerice','bakeberry','clover','goldenClover','chocoroot','tidygrass'],31effsStr:'<div class="green">• +1% CpS</div>',32q:'A plentiful crop whose hardy grain is used to make flour for pastries.',33onHarvest:function(x,y,age)34{35if (age>=this.mature) M.dropUpgrade('Wheat slims',0.001);36},37},38'thumbcorn':{39name:'Thumbcorn',40icon:1,41cost:5,42costM:100,43ageTick:6,44ageTickR:2,45mature:20,46children:['bakerWheat','thumbcorn','cronerice','gildmillet','glovemorel'],47effsStr:'<div class="green">• +2% cookies per click</div>',48q:'A strangely-shaped variant of corn. The amount of strands that can sprout from one seed is usually in the single digits.',49},50'cronerice':{51name:'Cronerice',52icon:2,53cost:15,54costM:250,55ageTick:0.4,56ageTickR:0.7,57mature:55,58children:['thumbcorn','gildmillet','elderwort','wardlichen'],59effsStr:'<div class="green">• +3% grandma CpS</div>',60q:'Not only does this wrinkly bulb look nothing like rice, it\'s not even related to it either; its closest extant relative is the weeping willow.',61},62'gildmillet':{63name:'Gildmillet',64icon:3,65cost:15,66costM:1500,67ageTick:2,68ageTickR:1.5,69mature:40,70children:['clover','goldenClover','shimmerlily'],71effsStr:'<div class="green">• +1% golden cookie gains</div><div class="green">• +0.1% golden cookie effect duration</div>',72q:'An ancient staple crop, famed for its golden sheen. Was once used to bake birthday cakes for kings and queens of old.',73},74'clover':{75name:'Ordinary clover',76icon:4,77cost:25,78costM:77777,79ageTick:1,80ageTickR:1.5,81mature:35,82children:['goldenClover','greenRot','shimmerlily'],83effsStr:'<div class="green">• +1% golden cookie frequency</div>',84q:'<i>Trifolium repens</i>, a fairly mundane variety of clover with a tendency to produce four leaves. Such instances are considered lucky by some.',85},86'goldenClover':{87name:'Golden clover',88icon:5,89cost:125,90costM:777777777777,91ageTick:4,92ageTickR:12,93mature:50,94children:[],95effsStr:'<div class="green">• +3% golden cookie frequency</div>',96q:'A variant of the ordinary clover that traded its chlorophyll for pure organic gold. Tragically short-lived, this herb is an evolutionary dead-end - but at least it looks pretty.',97},98'shimmerlily':{99name:'Shimmerlily',100icon:6,101cost:60,102costM:777777,103ageTick:5,104ageTickR:6,105mature:70,106children:['elderwort','whiskerbloom','chimerose','cheapcap'],107effsStr:'<div class="green">• +1% golden cookie gains</div><div class="green">• +1% golden cookie frequency</div><div class="green">• +1% random drops</div>',108q:'These little flowers are easiest to find at dawn, as the sunlight refracting in dew drops draws attention to their pure-white petals.',109},110'elderwort':{111name:'Elderwort',112icon:7,113cost:60*3,114costM:100000000,115ageTick:0.3,116ageTickR:0.5,117mature:90,118immortal:1,119noContam:true,120detailsStr:'Immortal',121children:['everdaisy','ichorpuff','shriekbulb'],122effsStr:'<div class="green">• +1% wrath cookie gains</div><div class="green">• +1% wrath cookie frequency</div><div class="green">• +1% grandma CpS</div><div class="green">• immortal</div><div class="gray">• surrounding plants (3x3) age 3% faster</div>',123q:'A very old, long-forgotten subspecies of edelweiss that emits a strange, heady scent. There is some anecdotal evidence that these do not undergo molecular aging.',124onHarvest:function(x,y,age)125{126if (age>=this.mature) M.dropUpgrade('Elderwort biscuits',0.01);127},128},129'bakeberry':{130name:'Bakeberry',131icon:8,132cost:45,133costM:100000000,134ageTick:1,135ageTickR:1,136mature:50,137children:['queenbeet'],138effsStr:'<div class="green">• +1% CpS</div><div class="green">• harvest when mature for +30 minutes of CpS (max. 3% of bank)</div>',139q:'A favorite among cooks, this large berry has a crunchy brown exterior and a creamy red center. Excellent in pies or chicken stews.',140onHarvest:function(x,y,age)141{142if (age>=this.mature)143{144var moni=Math.min(Game.cookies*0.03,Game.cookiesPs*60*30);145if (moni!=0)146{147Game.Earn(moni);148Game.Popup('(Bakeberry)<br>+'+Beautify(moni)+' cookies!',Game.mouseX,Game.mouseY);149}150M.dropUpgrade('Bakeberry cookies',0.015);151}152},153},154'chocoroot':{155name:'Chocoroot',156icon:9,157cost:15,158costM:100000,159ageTick:4,160ageTickR:0,161mature:25,162detailsStr:'Predictable growth',163children:['whiteChocoroot','drowsyfern','queenbeet'],164effsStr:'<div class="green">• +1% CpS</div><div class="green">• harvest when mature for +3 minutes of CpS (max. 3% of bank)</div><div class="green">• predictable growth</div>',165q:'A tangly bramble coated in a sticky, sweet substance. Unknown genetic ancestry. Children often pick these from fields as-is as a snack.',166onHarvest:function(x,y,age)167{168if (age>=this.mature)169{170var moni=Math.min(Game.cookies*0.03,Game.cookiesPs*60*3);171if (moni!=0)172{173Game.Earn(moni);174Game.Popup('(Chocoroot)<br>+'+Beautify(moni)+' cookies!',Game.mouseX,Game.mouseY);175}176}177},178},179'whiteChocoroot':{180name:'White chocoroot',181icon:10,182cost:15,183costM:100000,184ageTick:4,185ageTickR:0,186mature:25,187detailsStr:'Predictable growth',188children:['whiskerbloom','tidygrass'],189effsStr:'<div class="green">• +1% golden cookie gains</div><div class="green">• harvest when mature for +3 minutes of CpS (max. 3% of bank)</div><div class="green">• predictable growth</div>',190q:'A pale, even sweeter variant of the chocoroot. Often impedes travelers with its twisty branches.',191onHarvest:function(x,y,age)192{193if (age>=this.mature)194{195var moni=Math.min(Game.cookies*0.03,Game.cookiesPs*60*3);196if (moni!=0)197{198Game.Earn(moni);199Game.Popup('(White chocoroot)<br>+'+Beautify(moni)+' cookies!',Game.mouseX,Game.mouseY);200}201}202},203},204205'whiteMildew':{206name:'White mildew',207fungus:true,208icon:26,209cost:20,210costM:9999,211ageTick:8,212ageTickR:12,213mature:70,214detailsStr:'Spreads easily',215children:['brownMold','whiteChocoroot','wardlichen','greenRot'],216effsStr:'<div class="green">• +1% CpS</div><div class="gray">• may spread as brown mold</div>',217q:'A common rot that infests shady plots of earth. Grows in little creamy capsules. Smells sweet, but sadly wilts quickly.',218},219'brownMold':{220name:'Brown mold',221fungus:true,222icon:27,223cost:20,224costM:9999,225ageTick:8,226ageTickR:12,227mature:70,228detailsStr:'Spreads easily',229children:['whiteMildew','chocoroot','keenmoss','wrinklegill'],230effsStr:'<div class="red">• -1% CpS</div><div class="gray">• may spread as white mildew</div>',231q:'A common rot that infests shady plots of earth. Grows in odd reddish clumps. Smells bitter, but thankfully wilts quickly.',232},233234'meddleweed':{235name:'Meddleweed',236weed:true,237icon:29,238cost:1,239costM:10,240ageTick:10,241ageTickR:6,242mature:50,243contam:0.05,244detailsStr:'Grows in empty tiles, spreads easily',245children:['meddleweed','brownMold','crumbspore'],246effsStr:'<div class="red">• useless</div><div class="red">• may overtake nearby plants</div><div class="gray">• may sometimes drop spores when uprooted</div>',247q:'The sign of a neglected farmland, this annoying weed spawns from unused dirt and may sometimes spread to other plants, killing them in the process.',248onKill:function(x,y,age)249{250if (Math.random()<0.2*(age/100)) M.plot[y][x]=[M.plants[choose(['brownMold','crumbspore'])].id+1,0];251},252},253254'whiskerbloom':{255name:'Whiskerbloom',256icon:11,257cost:20,258costM:1000000,259ageTick:2,260ageTickR:2,261mature:60,262children:['chimerose','nursetulip'],263effsStr:'<div class="green">• +0.2% effects from milk</div>',264q:'Squeezing the translucent pods makes them excrete a milky liquid, while producing a faint squeak akin to a cat\'s meow.',265},266'chimerose':{267name:'Chimerose',268icon:12,269cost:15,270costM:242424,271ageTick:1,272ageTickR:1.5,273mature:30,274children:['chimerose'],275effsStr:'<div class="green">• +1% reindeer gains</div><div class="green">• +1% reindeer frequency</div>',276q:'Originating in the greener flanks of polar mountains, this beautiful flower with golden accents is fragrant enough to make any room feel a little bit more festive.',277},278'nursetulip':{279name:'Nursetulip',280icon:13,281cost:40,282costM:1000000000,283ageTick:0.5,284ageTickR:2,285mature:60,286children:[],287effsStr:'<div class="green">• surrounding plants (3x3) are 20% more efficient</div><div class="red">• -2% CpS</div>',288q:'This flower grows an intricate root network that distributes nutrients throughout the surrounding soil. The reason for this seemingly altruistic behavior is still unknown.',289},290'drowsyfern':{291name:'Drowsyfern',292icon:14,293cost:90,294costM:100000,295ageTick:0.05,296ageTickR:0.1,297mature:30,298children:[],299effsStr:'<div class="green">• +3% CpS</div><div class="red">• -5% cookies per click</div><div class="red">• -10% golden cookie frequency</div>',300q:'Traditionally used to brew a tea that guarantees a good night of sleep.',301onHarvest:function(x,y,age)302{303if (age>=this.mature) M.dropUpgrade('Fern tea',0.01);304},305},306'wardlichen':{307name:'Wardlichen',308icon:15,309cost:10,310costM:10000,311ageTick:5,312ageTickR:4,313mature:65,314children:['wardlichen'],315effsStr:'<div class="gray">• 2% less wrath cookies</div><div class="gray">• wrinklers spawn 15% slower</div>',316q:'The metallic stench that emanates from this organism has been known to keep insects and slugs away.',317},318'keenmoss':{319name:'Keenmoss',320icon:16,321cost:50,322costM:1000000,323ageTick:4,324ageTickR:5,325mature:65,326children:['drowsyfern','wardlichen','keenmoss'],327effsStr:'<div class="green">• +3% random drops</div>',328q:'Fuzzy to the touch and of a vibrant green. In plant symbolism, keenmoss is associated with good luck for finding lost objects.',329},330'queenbeet':{331name:'Queenbeet',332icon:17,333cost:60*1.5,334costM:1000000000,335ageTick:1,336ageTickR:0.4,337mature:80,338noContam:true,339children:['duketater','queenbeetLump','shriekbulb'],340effsStr:'<div class="green">• +0.3% golden cookie effect duration</div><div class="red">• -2% CpS</div><div class="green">• harvest when mature for +1 hour of CpS (max. 4% of bank)</div>',341q:'A delicious taproot used to prepare high-grade white sugar. Entire countries once went to war over these.',342onHarvest:function(x,y,age)343{344if (age>=this.mature)345{346var moni=Math.min(Game.cookies*0.04,Game.cookiesPs*60*60);347if (moni!=0)348{349Game.Earn(moni);350Game.Popup('(Queenbeet)<br>+'+Beautify(moni)+' cookies!',Game.mouseX,Game.mouseY);351}352}353},354},355'queenbeetLump':{356name:'Juicy queenbeet',357icon:18,358plantable:false,359cost:60*2,360costM:1000000000000,361ageTick:0.04,362ageTickR:0.08,363mature:85,364noContam:true,365children:[],366effsStr:'<div class="red">• -10% CpS</div><div class="red">• surrounding plants (3x3) are 20% less efficient</div><div class="green">• harvest when mature for a sugar lump</div>',367q:'A delicious taproot used to prepare high-grade white sugar. Entire countries once went to war over these.<br>It looks like this one has grown especially sweeter and juicier from growing in close proximity to other queenbeets.',368onHarvest:function(x,y,age)369{370if (age>=this.mature)371{372Game.gainLumps(1);373popup='(Juicy queenbeet)<br>Sweet!<div style="font-size:65%;">Found 1 sugar lump!</div>';374}375},376},377'duketater':{378name:'Duketater',379icon:19,380cost:60*8,381costM:1000000000000,382ageTick:0.4,383ageTickR:0.1,384mature:95,385noContam:true,386children:['shriekbulb'],387effsStr:'<div class="green">• harvest when mature for +2 hours of CpS (max. 8% of bank)</div>',388q:'A rare, rich-tasting tuber fit for a whole meal, as long as its strict harvesting schedule is respected. Its starch has fascinating baking properties.',389onHarvest:function(x,y,age)390{391if (age>=this.mature)392{393var moni=Math.min(Game.cookies*0.08,Game.cookiesPs*60*60*2);394if (moni!=0)395{396Game.Earn(moni);397Game.Popup('(Duketater)<br>+'+Beautify(moni)+' cookies!',Game.mouseX,Game.mouseY);398}399M.dropUpgrade('Duketater cookies',0.005);400}401},402},403'crumbspore':{404name:'Crumbspore',405fungus:true,406icon:20,407cost:10,408costM:999,409ageTick:3,410ageTickR:3,411mature:65,412contam:0.03,413noContam:true,414detailsStr:'Spreads easily',415children:['crumbspore','glovemorel','cheapcap','doughshroom','wrinklegill','ichorpuff'],416effsStr:'<div class="green">• explodes into up to 1 minute of CpS at the end of its lifecycle (max. 1% of bank)</div><div class="red">• may overtake nearby plants</div>',417q:'An archaic mold that spreads its spores to the surrounding dirt through simple pod explosion.',418onDie:function(x,y)419{420var moni=Math.min(Game.cookies*0.01,Game.cookiesPs*60)*Math.random();421if (moni!=0)422{423Game.Earn(moni);424Game.Popup('(Crumbspore)<br>+'+Beautify(moni)+' cookies!',Game.mouseX,Game.mouseY);425}426},427},428'doughshroom':{429name:'Doughshroom',430fungus:true,431icon:24,432cost:100,433costM:100000000,434ageTick:1,435ageTickR:2,436mature:85,437contam:0.03,438noContam:true,439detailsStr:'Spreads easily',440children:['crumbspore','doughshroom','foolBolete','shriekbulb'],441effsStr:'<div class="green">• explodes into up to 5 minutes of CpS at the end of its lifecycle (max. 3% of bank)</div><div class="red">• may overtake nearby plants</div>',442q:'Jammed full of warm spores; some forest walkers often describe the smell as similar to passing by a bakery.',443onDie:function(x,y)444{445var moni=Math.min(Game.cookies*0.03,Game.cookiesPs*60*5)*Math.random();446if (moni!=0)447{448Game.Earn(moni);449Game.Popup('(Doughshroom)<br>+'+Beautify(moni)+' cookies!',Game.mouseX,Game.mouseY);450}451},452},453'glovemorel':{454name:'Glovemorel',455fungus:true,456icon:21,457cost:30,458costM:10000,459ageTick:3,460ageTickR:18,461mature:80,462children:[],463effsStr:'<div class="green">• +4% cookies per click</div><div class="green">• +1% cursor CpS</div><div class="red">• -1% CpS</div>',464q:'Touching its waxy skin reveals that the interior is hollow and uncomfortably squishy.',465},466'cheapcap':{467name:'Cheapcap',468fungus:true,469icon:22,470cost:40,471costM:100000,472ageTick:6,473ageTickR:16,474mature:40,475children:[],476effsStr:'<div class="green">• buildings and upgrades are 0.2% cheaper</div><div class="red">• cannot handle cold climates; 15% chance to die when frozen</div>',477q:'Small, tough, and good in omelettes. Some historians propose that the heads of dried cheapcaps were once used as currency in some bronze age societies.',478},479'foolBolete':{480name:'Fool\'s bolete',481fungus:true,482icon:23,483cost:15,484costM:10000,485ageTick:5,486ageTickR:25,487mature:50,488children:[],489effsStr:'<div class="green">• +2% golden cookie frequency</div><div class="red">• -5% golden cookie gains</div><div class="red">• -2% golden cookie duration</div><div class="red">• -2% golden cookie effect duration</div>',490q:'Named for its ability to fool mushroom pickers. The fool\'s bolete is not actually poisonous, it\'s just extremely bland.',491},492'wrinklegill':{493name:'Wrinklegill',494fungus:true,495icon:25,496cost:20,497costM:1000000,498ageTick:1,499ageTickR:3,500mature:65,501children:['elderwort','shriekbulb'],502effsStr:'<div class="gray">• wrinklers spawn 2% faster</div><div class="gray">• wrinklers eat 1% more</div>',503q:'This mushroom\'s odor resembles that of a well-done steak, and is said to whet the appetite - making one\'s stomach start gurgling within seconds.',504},505'greenRot':{506name:'Green rot',507fungus:true,508icon:28,509cost:60,510costM:1000000,511ageTick:12,512ageTickR:13,513mature:65,514children:['keenmoss','foolBolete'],515effsStr:'<div class="green">• +0.5% golden cookie duration</div><div class="green">• +1% golden cookie frequency</div><div class="green">• +1% random drops</div>',516q:'This short-lived mold is also known as "emerald pebbles", and is considered by some as a pseudo-gem that symbolizes good fortune.',517onHarvest:function(x,y,age)518{519if (age>=this.mature) M.dropUpgrade('Green yeast digestives',0.005);520},521},522'shriekbulb':{523name:'Shriekbulb',524icon:30,525cost:60,526costM:4444444444444,527ageTick:3,528ageTickR:1,529mature:60,530noContam:true,531detailsStr:'The unfortunate result of some plant combinations',532children:['shriekbulb'],533effsStr:'<div class="red">• -2% CpS</div><div class="red">• surrounding plants (3x3) are 5% less efficient</div>',534q:'A nasty vegetable with a dreadful quirk : its flesh resonates with a high-pitched howl whenever it is hit at the right angle by sunlight, moonlight, or even a slight breeze.',535},536'tidygrass':{537name:'Tidygrass',538icon:31,539cost:90,540costM:100000000000000,541ageTick:0.5,542ageTickR:0,543mature:40,544children:['everdaisy'],545effsStr:'<div class="green">• surrounding tiles (5x5) develop no weeds or fungus</div>',546q:'The molecules this grass emits are a natural weedkiller. Its stems grow following a predictable pattern, making it an interesting -if expensive- choice for a lawn grass.',547},548'everdaisy':{549name:'Everdaisy',550icon:32,551cost:180,552costM:100000000000000000000,553ageTick:0.3,554ageTickR:0,555mature:75,556noContam:true,557immortal:1,558detailsStr:'Immortal',559children:[],560effsStr:'<div class="green">• surrounding tiles (3x3) develop no weeds or fungus</div><div class="green">• immortal</div>',561q:'While promoted by some as a superfood owing to its association with longevity and intriguing geometry, this elusive flower is actually mildly toxic.',562},563'ichorpuff':{564name:'Ichorpuff',565fungus:true,566icon:33,567cost:120,568costM:987654321,569ageTick:1,570ageTickR:1.5,571mature:35,572children:[],573effsStr:'<div class="green">• surrounding plants (3x3) age half as fast</div><div class="red">• surrounding plants (3x3) are half as efficient</div>',574q:'This puffball mushroom contains sugary spores, but it never seems to mature to bursting on its own. Surrounding plants under its influence have a very slow metabolism, reducing their effects but lengthening their lifespan.',575onHarvest:function(x,y,age)576{577if (age>=this.mature) M.dropUpgrade('Ichor syrup',0.005);578},579},580};581M.plantsById=[];var n=0;582for (var i in M.plants)583{584M.plants[i].unlocked=0;585M.plants[i].id=n;586M.plants[i].key=i;587M.plants[i].matureBase=M.plants[i].mature;588M.plantsById[n]=M.plants[i];589if (typeof M.plants[i].plantable==='undefined') {M.plants[i].plantable=true;}590n++;591}592M.plantsN=M.plantsById.length;593M.plantsUnlockedN=0;594M.getUnlockedN=function()595{596M.plantsUnlockedN=0;597for (var i in M.plants){if (M.plants[i].unlocked) M.plantsUnlockedN++;}598if (M.plantsUnlockedN>=M.plantsN)599{600Game.Win('Keeper of the conservatory');601l('gardenTool-3').classList.remove('locked');602}603else l('gardenTool-3').classList.add('locked');604605return M.plantsUnlockedN;606}607608M.dropUpgrade=function(upgrade,rate)609{610if (!Game.Has(upgrade) && Math.random()<=rate*Game.dropRateMult()*(Game.HasAchiev('Seedless to nay')?1.05:1))611{612Game.Unlock(upgrade);613}614}615616M.computeMatures=function()617{618var mult=1;619if (Game.HasAchiev('Seedless to nay')) mult=0.95;620for (var i in M.plants)621{622M.plants[i].mature=M.plants[i].matureBase*mult;623}624}625626M.plantContam={};627for (var i in M.plants)628{629if (M.plants[i].contam) M.plantContam[M.plants[i].key]=M.plants[i].contam;630}631632M.getMuts=function(neighs,neighsM)633{634//get possible mutations given a list of neighbors635//note : neighs stands for neighbors, not horsey noises636var muts=[];637638if (neighsM['bakerWheat']>=2) muts.push(['bakerWheat',0.2],['thumbcorn',0.05],['bakeberry',0.001]);639if (neighsM['bakerWheat']>=1 && neighsM['thumbcorn']>=1) muts.push(['cronerice',0.01]);640if (neighsM['thumbcorn']>=2) muts.push(['thumbcorn',0.1],['bakerWheat',0.05]);641if (neighsM['cronerice']>=1 && neighsM['thumbcorn']>=1) muts.push(['gildmillet',0.03]);642if (neighsM['cronerice']>=2) muts.push(['thumbcorn',0.02]);643if (neighsM['bakerWheat']>=1 && neighsM['gildmillet']>=1) muts.push(['clover',0.03],['goldenClover',0.0007]);644if (neighsM['clover']>=1 && neighsM['gildmillet']>=1) muts.push(['shimmerlily',0.02]);645if (neighsM['clover']>=2 && neighs['clover']<5) muts.push(['clover',0.007],['goldenClover',0.0001]);646if (neighsM['clover']>=4) muts.push(['goldenClover',0.0007]);647if (neighsM['shimmerlily']>=1 && neighsM['cronerice']>=1) muts.push(['elderwort',0.01]);648if (neighsM['wrinklegill']>=1 && neighsM['cronerice']>=1) muts.push(['elderwort',0.002]);649if (neighsM['bakerWheat']>=1 && neighs['brownMold']>=1) muts.push(['chocoroot',0.1]);650if (neighsM['chocoroot']>=1 && neighs['whiteMildew']>=1) muts.push(['whiteChocoroot',0.1]);651if (neighsM['whiteMildew']>=1 && neighs['brownMold']<=1) muts.push(['brownMold',0.5]);652if (neighsM['brownMold']>=1 && neighs['whiteMildew']<=1) muts.push(['whiteMildew',0.5]);653if (neighsM['meddleweed']>=1 && neighs['meddleweed']<=3) muts.push(['meddleweed',0.15]);654655if (neighsM['shimmerlily']>=1 && neighsM['whiteChocoroot']>=1) muts.push(['whiskerbloom',0.01]);656if (neighsM['shimmerlily']>=1 && neighsM['whiskerbloom']>=1) muts.push(['chimerose',0.05]);657if (neighsM['chimerose']>=2) muts.push(['chimerose',0.005]);658if (neighsM['whiskerbloom']>=2) muts.push(['nursetulip',0.05]);659if (neighsM['chocoroot']>=1 && neighsM['keenmoss']>=1) muts.push(['drowsyfern',0.005]);660if ((neighsM['cronerice']>=1 && neighsM['keenmoss']>=1) || (neighsM['cronerice']>=1 && neighsM['whiteMildew']>=1)) muts.push(['wardlichen',0.005]);661if (neighsM['wardlichen']>=1 && neighs['wardlichen']<2) muts.push(['wardlichen',0.05]);662if (neighsM['greenRot']>=1 && neighsM['brownMold']>=1) muts.push(['keenmoss',0.1]);663if (neighsM['keenmoss']>=1 && neighs['keenmoss']<2) muts.push(['keenmoss',0.05]);664if (neighsM['chocoroot']>=1 && neighsM['bakeberry']>=1) muts.push(['queenbeet',0.01]);665if (neighsM['queenbeet']>=8) muts.push(['queenbeetLump',0.001]);666if (neighsM['queenbeet']>=2) muts.push(['duketater',0.001]);667668if (neighsM['crumbspore']>=1 && neighs['crumbspore']<=1) muts.push(['crumbspore',0.07]);669if (neighsM['crumbspore']>=1 && neighsM['thumbcorn']>=1) muts.push(['glovemorel',0.02]);670if (neighsM['crumbspore']>=1 && neighsM['shimmerlily']>=1) muts.push(['cheapcap',0.04]);671if (neighsM['doughshroom']>=1 && neighsM['greenRot']>=1) muts.push(['foolBolete',0.04]);672if (neighsM['crumbspore']>=2) muts.push(['doughshroom',0.005]);673if (neighsM['doughshroom']>=1 && neighs['doughshroom']<=1) muts.push(['doughshroom',0.07]);674if (neighsM['doughshroom']>=2) muts.push(['crumbspore',0.005]);675if (neighsM['crumbspore']>=1 && neighsM['brownMold']>=1) muts.push(['wrinklegill',0.06]);676if (neighsM['whiteMildew']>=1 && neighsM['clover']>=1) muts.push(['greenRot',0.05]);677678if (neighsM['wrinklegill']>=1 && neighsM['elderwort']>=1) muts.push(['shriekbulb',0.001]);679if (neighsM['elderwort']>=5) muts.push(['shriekbulb',0.001]);680if (neighs['duketater']>=3) muts.push(['shriekbulb',0.005]);681if (neighs['doughshroom']>=4) muts.push(['shriekbulb',0.002]);682if (neighsM['queenbeet']>=5) muts.push(['shriekbulb',0.001]);683if (neighs['shriekbulb']>=1 && neighs['shriekbulb']<2) muts.push(['shriekbulb',0.005]);684685if (neighsM['bakerWheat']>=1 && neighsM['whiteChocoroot']>=1) muts.push(['tidygrass',0.002]);686if (neighsM['tidygrass']>=3 && neighsM['elderwort']>=3) muts.push(['everdaisy',0.002]);687if (neighsM['elderwort']>=1 && neighsM['crumbspore']>=1) muts.push(['ichorpuff',0.002]);688689return muts;690}691692M.computeBoostPlot=function()693{694//some plants apply effects to surrounding tiles695//this function computes those effects by creating a grid in which those effects stack696for (var y=0;y<6;y++)697{698for (var x=0;x<6;x++)699{700//age mult, power mult, weed mult701M.plotBoost[y][x]=[1,1,1];702}703}704705var effectOn=function(X,Y,s,mult)706{707for (var y=Math.max(0,Y-s);y<Math.min(6,Y+s+1);y++)708{709for (var x=Math.max(0,X-s);x<Math.min(6,X+s+1);x++)710{711if (X==x && Y==y) {}712else713{714for (var i=0;i<mult.length;i++)715{716M.plotBoost[y][x][i]*=mult[i];717}718}719}720}721}722for (var y=0;y<6;y++)723{724for (var x=0;x<6;x++)725{726var tile=M.plot[y][x];727if (tile[0]>0)728{729var me=M.plantsById[tile[0]-1];730var name=me.key;731var stage=0;732if (tile[1]>=me.mature) stage=4;733else if (tile[1]>=me.mature*0.666) stage=3;734else if (tile[1]>=me.mature*0.333) stage=2;735else stage=1;736737var soilMult=M.soilsById[M.soil].effMult;738var mult=soilMult;739740if (stage==1) mult*=0.1;741else if (stage==2) mult*=0.25;742else if (stage==3) mult*=0.5;743else mult*=1;744745//age mult, power mult, weed mult746/*if (name=='elderwort') effectOn(x,y,1,[1+0.03*mult,1,1]);747else if (name=='queenbeetLump') effectOn(x,y,1,[1,1-0.2*mult,1]);748else if (name=='nursetulip') effectOn(x,y,1,[1,1+0.2*mult,1]);749else if (name=='shriekbulb') effectOn(x,y,1,[1,1-0.05*mult,1]);750else if (name=='tidygrass') effectOn(x,y,2,[1,1,0]);751else if (name=='everdaisy') effectOn(x,y,1,[1,1,0]);752else if (name=='ichorpuff') effectOn(x,y,1,[1-0.5*mult,1-0.5*mult,1]);*/753754var ageMult=1;755var powerMult=1;756var weedMult=1;757var range=0;758759if (name=='elderwort') {ageMult=1.03;range=1;}760else if (name=='queenbeetLump') {powerMult=0.8;range=1;}761else if (name=='nursetulip') {powerMult=1.2;range=1;}762else if (name=='shriekbulb') {powerMult=0.95;range=1;}763else if (name=='tidygrass') {weedMult=0;range=2;}764else if (name=='everdaisy') {weedMult=0;range=1;}765else if (name=='ichorpuff') {ageMult=0.5;powerMult=0.5;range=1;}766767//by god i hope these are right768if (ageMult>=1) ageMult=(ageMult-1)*mult+1; else if (mult>=1) ageMult=1/((1/ageMult)*mult); else ageMult=1-(1-ageMult)*mult;769if (powerMult>=1) powerMult=(powerMult-1)*mult+1; else if (mult>=1) powerMult=1/((1/powerMult)*mult); else powerMult=1-(1-powerMult)*mult;770771if (range>0) effectOn(x,y,range,[ageMult,powerMult,weedMult]);772}773}774}775}776777M.computeEffs=function()778{779M.toCompute=false;780var effs={781cps:1,782click:1,783cursorCps:1,784grandmaCps:1,785goldenCookieGain:1,786goldenCookieFreq:1,787goldenCookieDur:1,788goldenCookieEffDur:1,789wrathCookieGain:1,790wrathCookieFreq:1,791wrathCookieDur:1,792wrathCookieEffDur:1,793reindeerGain:1,794reindeerFreq:1,795reindeerDur:1,796itemDrops:1,797milk:1,798wrinklerSpawn:1,799wrinklerEat:1,800upgradeCost:1,801buildingCost:1,802};803804if (!M.freeze)805{806var soilMult=M.soilsById[M.soil].effMult;807808for (var y=0;y<6;y++)809{810for (var x=0;x<6;x++)811{812var tile=M.plot[y][x];813if (tile[0]>0)814{815var me=M.plantsById[tile[0]-1];816var name=me.key;817var stage=0;818if (tile[1]>=me.mature) stage=4;819else if (tile[1]>=me.mature*0.666) stage=3;820else if (tile[1]>=me.mature*0.333) stage=2;821else stage=1;822823var mult=soilMult;824825if (stage==1) mult*=0.1;826else if (stage==2) mult*=0.25;827else if (stage==3) mult*=0.5;828else mult*=1;829830mult*=M.plotBoost[y][x][1];831832if (name=='bakerWheat') effs.cps+=0.01*mult;833else if (name=='thumbcorn') effs.click+=0.02*mult;834else if (name=='cronerice') effs.grandmaCps+=0.03*mult;835else if (name=='gildmillet') {effs.goldenCookieGain+=0.01*mult;effs.goldenCookieEffDur+=0.001*mult;}836else if (name=='clover') effs.goldenCookieFreq+=0.01*mult;837else if (name=='goldenClover') effs.goldenCookieFreq+=0.03*mult;838else if (name=='shimmerlily') {effs.goldenCookieGain+=0.01*mult;effs.goldenCookieFreq+=0.01*mult;effs.itemDrops+=0.01*mult;}839else if (name=='elderwort') {effs.wrathCookieGain+=0.01*mult;effs.wrathCookieFreq+=0.01*mult;effs.grandmaCps+=0.01*mult;}840else if (name=='bakeberry') effs.cps+=0.01*mult;841else if (name=='chocoroot') effs.cps+=0.01*mult;842else if (name=='whiteChocoroot') effs.goldenCookieGain+=0.01*mult;843844else if (name=='whiteMildew') effs.cps+=0.01*mult;845else if (name=='brownMold') effs.cps*=1-0.01*mult;846847else if (name=='meddleweed') {}848849else if (name=='whiskerbloom') effs.milk+=0.002*mult;850else if (name=='chimerose') {effs.reindeerGain+=0.01*mult;effs.reindeerFreq+=0.01*mult;}851852else if (name=='nursetulip') {effs.cps*=1-0.02*mult;}853else if (name=='drowsyfern') {effs.cps+=0.03*mult;effs.click*=1-0.05*mult;effs.goldenCookieFreq*=1-0.1*mult;}854else if (name=='wardlichen') {effs.wrinklerSpawn*=1-0.15*mult;effs.wrathCookieFreq*=1-0.02*mult;}855else if (name=='keenmoss') {effs.itemDrops+=0.03*mult;}856else if (name=='queenbeet') {effs.goldenCookieEffDur+=0.003*mult;effs.cps*=1-0.02*mult;}857else if (name=='queenbeetLump') {effs.cps*=1-0.1*mult;}858else if (name=='glovemorel') {effs.click+=0.04*mult;effs.cursorCps+=0.01*mult;effs.cps*=1-0.01*mult;}859else if (name=='cheapcap') {effs.upgradeCost*=1-0.002*mult;effs.buildingCost*=1-0.002*mult;}860else if (name=='foolBolete') {effs.goldenCookieFreq+=0.02*mult;effs.goldenCookieGain*=1-0.05*mult;effs.goldenCookieDur*=1-0.02*mult;effs.goldenCookieEffDur*=1-0.02*mult;}861else if (name=='wrinklegill') {effs.wrinklerSpawn+=0.02*mult;effs.wrinklerEat+=0.01*mult;}862else if (name=='greenRot') {effs.goldenCookieDur+=0.005*mult;effs.goldenCookieFreq+=0.01*mult;effs.itemDrops+=0.01*mult;}863else if (name=='shriekbulb') {effs.cps*=1-0.02*mult;}864}865}866}867}868M.effs=effs;869Game.recalculateGains=1;870}871872873M.soils={874'dirt':{875name:'Dirt',876icon:0,877tick:5,878effMult:1,879weedMult:1,880req:0,881effsStr:'<div class="gray">• tick every <b>5 minutes</b></div>',882q:'Simple, regular old dirt that you\'d find in nature.',883},884'fertilizer':{885name:'Fertilizer',886icon:1,887tick:3,888effMult:0.75,889weedMult:1.2,890req:50,891effsStr:'<div class="gray">• tick every <b>3 minutes</b></div><div class="red">• passive plant effects <b>-25%</b></div><div class="red">• weeds appear <b>20%</b> more</div>',892q:'Soil with a healthy helping of fresh manure. Plants grow faster but are less efficient.',893},894'clay':{895name:'Clay',896icon:2,897tick:15,898effMult:1.25,899weedMult:1,900req:100,901effsStr:'<div class="gray">• tick every <b>15 minutes</b></div><div class="green">• passive plant effects <b>+25%</b></div>',902q:'Rich soil with very good water retention. Plants grow slower but are more efficient.',903},904'pebbles':{905name:'Pebbles',906icon:3,907tick:5,908effMult:0.25,909weedMult:0.1,910req:200,911effsStr:'<div class="gray">• tick every <b>5 minutes</b></div><div class="red">• passive plant effects <b>-75%</b></div><div class="green">• <b>35% chance</b> of collecting seeds automatically when plants expire</div><div class="green">• weeds appear <b>10 times</b> less</div>',912q:'Dry soil made of small rocks tightly packed together. Not very conductive to plant health, but whatever falls off your crops will be easy to retrieve.<br>Useful if you\'re one of those farmers who just want to find new seeds without having to tend their garden too much.',913},914'woodchips':{915name:'Wood chips',916icon:4,917tick:5,918effMult:0.25,919weedMult:0.1,920req:300,921effsStr:'<div class="gray">• tick every <b>5 minutes</b></div><div class="red">• passive plant effects <b>-75%</b></div><div class="green">• plants spread and mutate <b>3 times more</b></div><div class="green">• weeds appear <b>10 times</b> less</div>',922q:'Soil made of bits and pieces of bark and sawdust. Helpful for young sprouts to develop, not so much for mature plants.',923},924};925M.soilsById=[];var n=0;for (var i in M.soils){M.soils[i].id=n;M.soils[i].key=i;M.soilsById[n]=M.soils[i];n++;}926927928M.tools={929'info':{930name:'Garden information',931icon:3,932desc:'-',933descFunc:function()934{935var str='';936if (M.freeze) str='Your garden is frozen, providing no effects.';937else938{939var effs={940cps:{n:'CpS'},941click:{n:'cookies/click'},942cursorCps:{n:'cursor CpS'},943grandmaCps:{n:'grandma CpS'},944goldenCookieGain:{n:'golden cookie gains'},945goldenCookieFreq:{n:'golden cookie frequency'},946goldenCookieDur:{n:'golden cookie duration'},947goldenCookieEffDur:{n:'golden cookie effect duration'},948wrathCookieGain:{n:'wrath cookie gains'},949wrathCookieFreq:{n:'wrath cookie frequency'},950wrathCookieDur:{n:'wrath cookie duration'},951wrathCookieEffDur:{n:'wrath cookie effect duration'},952reindeerGain:{n:'reindeer gains'},953reindeerFreq:{n:'reindeer cookie frequency'},954reindeerDur:{n:'reindeer cookie duration'},955itemDrops:{n:'random drops'},956milk:{n:'milk effects'},957wrinklerSpawn:{n:'wrinkler spawn rate'},958wrinklerEat:{n:'wrinkler appetite'},959upgradeCost:{n:'upgrade costs',rev:true},960buildingCost:{n:'building costs',rev:true},961};962963var effStr='';964for (var i in M.effs)965{966if (M.effs[i]!=1 && effs[i])967{968var amount=(M.effs[i]-1)*100;969effStr+='<div style="font-size:10px;margin-left:64px;"><b>• '+effs[i].n+' :</b> <span class="'+((amount*(effs[i].rev?-1:1))>0?'green':'red')+'">'+(amount>0?'+':'-')+Beautify(Math.abs(M.effs[i]-1)*100,2)+'%</span></div>';970}971}972if (effStr=='') effStr='<div style="font-size:10px;margin-left:64px;"><b>None.</b></div>';973str+='<div>Combined effects of all your plants :</div>'+effStr;974}975str+='<div class="line"></div>';976str+='<img src="img/gardenTip.png" style="float:right;margin:0px 0px 8px 8px;"/><small style="line-height:100%;">• You can cross-breed plants by planting them close to each other; new plants will grow in the empty tiles next to them.<br>• Unlock new seeds by harvesting mature plants.<br>• When you ascend, your garden plants are reset, but you keep all the seeds you\'ve unlocked.<br>• Your garden has no effect and does not grow while the game is closed.</small>';977return str;978},979func:function(){},980},981'harvestAll':{982name:'Harvest all',983icon:0,984descFunc:function(){return 'Instantly harvest all plants in your garden.<div class="line"></div>'+((Game.keys[16] && Game.keys[17])?'<b>You are holding shift+ctrl.</b> Only mature, mortal plants will be harvested.':'Shift+ctrl+click to harvest only mature, mortal plants.');},985func:function(){986PlaySound('snd/toneTick.mp3');987/*if (M.freeze){return false;}*/988if (Game.keys[16] && Game.keys[17]) M.harvestAll(0,1,1);//ctrl & shift, harvest only mature non-immortal plants989else M.harvestAll();990},991},992'freeze':{993name:'Freeze',994icon:1,995descFunc:function()996{997return 'Cryogenically preserve your garden.<br>Plants no longer grow, spread or die; they provide no benefits.<br>Soil cannot be changed.<div class="line"></div>Using this will effectively pause your garden.<div class="line"></div>';//<span class="red">'+((M.nextFreeze>Date.now())?'You will be able to freeze your garden again in '+Game.sayTime((M.nextFreeze-Date.now())/1000*30+30,-1)+'.':'After unfreezing your garden, you must wait 10 minutes to freeze it again.')+'</span>998},999func:function(){1000//if (!M.freeze && M.nextFreeze>Date.now()) return false;1001PlaySound('snd/toneTick.mp3');1002M.freeze=(M.freeze?0:1);1003if (M.freeze)1004{1005M.computeEffs();1006PlaySound('snd/freezeGarden.mp3');1007this.classList.add('on');1008l('gardenContent').classList.add('gardenFrozen');100910101011for (var y=0;y<6;y++)1012{1013for (var x=0;x<6;x++)1014{1015var tile=M.plot[y][x];1016if (tile[0]>0)1017{1018var me=M.plantsById[tile[0]-1];1019var age=tile[1];1020if (me.key=='cheapcap' && Math.random()<0.15)1021{1022M.plot[y][x]=[0,0];1023if (me.onKill) me.onKill(x,y,age);1024M.toRebuild=true;1025}1026}1027}1028}1029}1030else1031{1032//M.nextFreeze=Date.now()+(Game.Has('Turbo-charged soil')?1:(1000*60*10));1033M.computeEffs();1034this.classList.remove('on');1035l('gardenContent').classList.remove('gardenFrozen');1036}1037},1038isOn:function(){if (M.freeze){l('gardenContent').classList.add('gardenFrozen');}else{l('gardenContent').classList.remove('gardenFrozen');}return M.freeze;},1039},1040'convert':{1041name:'Sacrifice garden',1042icon:2,1043desc:'A swarm of sugar hornets comes down on your garden, <span class="red">destroying every plant as well as every seed you\'ve unlocked</span> - leaving only a Baker\'s wheat seed.<br>In exchange, they will grant you <span class="green"><b>10</b> sugar lumps</span>.<br>This action is only available with a complete seed log.',1044func:function(){PlaySound('snd/toneTick.mp3');M.askConvert();},1045isDisplayed:function(){if (M.plantsUnlockedN>=M.plantsN) return true; else return false;},1046},1047};1048M.toolsById=[];var n=0;for (var i in M.tools){M.tools[i].id=n;M.tools[i].key=i;M.toolsById[n]=M.tools[i];n++;}104910501051M.plot=[];1052for (var y=0;y<6;y++)1053{1054M.plot[y]=[];1055for (var x=0;x<6;x++)1056{1057M.plot[y][x]=[0,0];1058}1059}1060M.plotBoost=[];1061for (var y=0;y<6;y++)1062{1063M.plotBoost[y]=[];1064for (var x=0;x<6;x++)1065{1066//age mult, power mult, weed mult1067M.plotBoost[y][x]=[1,1,1];1068}1069}10701071M.tileSize=40;10721073M.seedSelected=-1;10741075M.soil=0;1076M.nextSoil=0;//timestamp for when soil will be ready to change again10771078M.stepT=1;//in seconds1079M.nextStep=0;//timestamp for next step tick10801081M.harvests=0;1082M.harvestsTotal=0;10831084M.loopsMult=1;10851086M.toRebuild=false;1087M.toCompute=false;10881089M.freeze=0;1090M.nextFreeze=0;//timestamp for when we can freeze again; unused, but still stored10911092M.getCost=function(me)1093{1094if (Game.Has('Turbo-charged soil')) return 0;1095return Math.max(me.costM,Game.cookiesPs*me.cost*60)*(Game.HasAchiev('Seedless to nay')?0.95:1);1096}10971098M.getPlantDesc=function(me)1099{1100var children='';1101if (me.children.length>0)1102{1103children+='<div class="shadowFilter" style="display:inline-block;">';1104for (var i in me.children)1105{1106if (!M.plants[me.children[i]]) console.log('No plant named '+me.children[i]);1107else1108{1109var it=M.plants[me.children[i]];1110if (it.unlocked) children+='<div class="gardenSeedTiny" style="background-position:'+(-0*48)+'px '+(-it.icon*48)+'px;"></div>';1111else children+='<div class="gardenSeedTiny" style="background-image:url(img/icons.png?v='+Game.version+');background-position:'+(-0*48)+'px '+(-7*48)+'px;opacity:0.35;"></div>';1112}1113}1114children+='</div>';1115}11161117return '<div class="description">'+1118(!me.immortal?('<div style="margin:6px 0px;font-size:11px;"><b>Average lifespan :</b> '+Game.sayTime(((100/(me.ageTick+me.ageTickR/2))*M.stepT)*30,-1)+' <small>('+Beautify(Math.ceil((100/((me.ageTick+me.ageTickR/2)))*(1)))+' ticks)</small></div>'):'')+1119'<div style="margin:6px 0px;font-size:11px;"><b>Average maturation :</b> '+Game.sayTime(((100/((me.ageTick+me.ageTickR/2)))*(me.mature/100)*M.stepT)*30,-1)+' <small>('+Beautify(Math.ceil((100/((me.ageTick+me.ageTickR/2)))*(me.mature/100)))+' ticks)</small></div>'+1120(me.weed?'<div style="margin:6px 0px;font-size:11px;"><b>Is a weed</b></div>':'')+1121(me.fungus?'<div style="margin:6px 0px;font-size:11px;"><b>Is a fungus</b></div>':'')+1122(me.detailsStr?('<div style="margin:6px 0px;font-size:11px;"><b>Details :</b> '+me.detailsStr+'</div>'):'')+1123(children!=''?('<div style="margin:6px 0px;font-size:11px;"><b>Possible mutations :</b> '+children+'</div>'):'')+1124'<div class="line"></div>'+1125'<div style="margin:6px 0px;"><b>Effects :</b></div>'+1126'<div style="font-size:11px;font-weight:bold;">'+me.effsStr+'</div>'+1127(me.q?('<q>'+me.q+'</q>'):'')+1128'</div>';1129}1130M.canPlant=function(me)1131{1132if (Game.cookies>=M.getCost(me)) return true; else return false;1133}11341135M.cursor=1;1136M.hideCursor=function()1137{1138M.cursor=0;1139}1140M.showCursor=function()1141{1142M.cursor=1;1143}11441145M.soilTooltip=function(id)1146{1147return function(){1148var me=M.soilsById[id];1149var str='<div style="padding:8px 4px;min-width:350px;">'+1150(M.parent.amount<me.req?(1151'<div style="text-align:center;">Soil unlocked at '+me.req+' farms.</div>'1152):('<div class="icon" style="background:url(img/gardenPlants.png?v='+Game.version+');float:left;margin-left:-8px;margin-top:-8px;background-position:'+(-me.icon*48)+'px '+(-34*48)+'px;"></div>'+1153'<div><div class="name">'+me.name+'</div><div><small>'+((M.soil==me.id)?'Your field is currently using this soil.':(M.nextSoil>Date.now())?'You will be able to change your soil again in '+Game.sayTime((M.nextSoil-Date.now())/1000*30+30,-1)+'.':'Click to use this type of soil for your whole field.')+'</small></div></div>'+1154'<div class="line"></div>'+1155'<div class="description">'+1156'<div style="margin:6px 0px;"><b>Effects :</b></div>'+1157'<div style="font-size:11px;font-weight:bold;">'+me.effsStr+'</div>'+1158(me.q?('<q>'+me.q+'</q>'):'')+1159'</div>'))+1160'</div>';1161return str;1162};1163}1164M.seedTooltip=function(id)1165{1166return function(){1167var me=M.plantsById[id];1168var str='<div style="padding:8px 4px;min-width:400px;">'+1169'<div class="icon" style="background:url(img/gardenPlants.png?v='+Game.version+');float:left;margin-left:-24px;margin-top:-4px;background-position:'+(-0*48)+'px '+(-me.icon*48)+'px;"></div>'+1170'<div class="icon" style="background:url(img/gardenPlants.png?v='+Game.version+');float:left;margin-left:-24px;margin-top:-28px;background-position:'+(-4*48)+'px '+(-me.icon*48)+'px;"></div>'+1171'<div style="background:url(img/turnInto.png);width:20px;height:22px;position:absolute;left:28px;top:24px;z-index:1000;"></div>'+1172(me.plantable?('<div style="float:right;text-align:right;width:100px;"><small>Planting cost :</small><br><span class="price'+(M.canPlant(me)?'':' disabled')+'">'+Beautify(Math.round(shortenNumber(M.getCost(me))))+'</span><br><small>'+Game.sayTime(me.cost*60*30,-1)+' of CpS,<br>minimum '+Beautify(me.costM)+' cookies</small></div>'):'')+1173'<div style="width:300px;"><div class="name">'+me.name+' seed</div><div><small>'+(me.plantable?'Click to select this seed for planting.':'<span class="red">This seed cannot be planted.</span>')+'<br>Shift+ctrl+click to harvest all mature plants of this type.</small></div></div>'+1174'<div class="line"></div>'+1175M.getPlantDesc(me)+1176'</div>';1177return str;1178};1179}1180M.toolTooltip=function(id)1181{1182return function(){1183var me=M.toolsById[id];1184var icon=[me.icon,35];1185var str='<div style="padding:8px 4px;min-width:350px;">'+1186'<div class="icon" style="background:url(img/gardenPlants.png?v='+Game.version+');float:left;margin-left:-8px;margin-top:-8px;background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>'+1187'<div><div class="name">'+me.name+'</div></div>'+1188'<div class="line"></div>'+1189'<div class="description">'+1190(me.descFunc?me.descFunc():me.desc)+1191'</div>'+1192'</div>';1193return str;1194};1195}1196M.tileTooltip=function(x,y)1197{1198return function(){1199var tile=M.plot[y][x];1200if (tile[0]==0)1201{1202var me=(M.seedSelected>=0)?M.plantsById[M.seedSelected]:0;1203var str='<div style="padding:8px 4px;min-width:350px;text-align:center;">'+1204'<div class="name">Empty tile</div>'+'<div class="line"></div><div class="description">'+1205'This tile of soil is empty.<br>Pick a seed and plant something!'+1206(me?'<div class="line"></div>Click to plant <b>'+me.name+'</b> for <span class="price'+(M.canPlant(me)?'':' disabled')+'">'+Beautify(Math.round(M.getCost(me)))+'</span>.<br><small>(Shift-click to plant multiple.)</small>':'')+1207(M.plotBoost[y][x]!=[1,1,1]?('<small>'+1208(M.plotBoost[y][x][0]!=1?'<br>Aging multiplier : '+Beautify(M.plotBoost[y][x][0]*100)+'%':'')+1209(M.plotBoost[y][x][1]!=1?'<br>Effect multiplier : '+Beautify(M.plotBoost[y][x][1]*100)+'%':'')+1210(M.plotBoost[y][x][2]!=1?'<br>Weeds/fungus repellent : '+Beautify(100-M.plotBoost[y][x][2]*100)+'%':'')+1211'</small>'1212):'')+1213'</div>'+1214'</div>';1215return str;1216}1217else1218{1219var me=M.plantsById[tile[0]-1];1220var stage=0;1221if (tile[1]>=me.mature) stage=4;1222else if (tile[1]>=me.mature*0.666) stage=3;1223else if (tile[1]>=me.mature*0.333) stage=2;1224else stage=1;1225var icon=[stage,me.icon];1226var str='<div style="padding:8px 4px;min-width:350px;">'+1227'<div class="icon" style="background:url(img/gardenPlants.png?v='+Game.version+');float:left;margin-left:-8px;margin-top:-8px;background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>'+1228'<div class="name">'+me.name+'</div><div><small>This plant is growing here.</small></div>'+1229'<div class="line"></div>'+1230'<div style="text-align:center;">'+1231'<div style="display:inline-block;position:relative;box-shadow:0px 0px 0px 1px #000,0px 0px 0px 1px rgba(255,255,255,0.5) inset,0px -2px 2px 0px rgba(255,255,255,0.5) inset;width:256px;height:6px;background:linear-gradient(to right,#fff 0%,#0f9 '+me.mature+'%,#3c0 '+(me.mature+0.1)+'%,#960 100%)">'+1232'<div class="gardenGrowthIndicator" style="left:'+Math.floor((tile[1]/100)*256)+'px;"></div>'+1233'<div style="background:url(img/gardenPlants.png?v='+Game.version+');background-position:'+(-1*48)+'px '+(-icon[1]*48)+'px;position:absolute;left:'+(0-24)+'px;top:-32px;transform:scale(0.5,0.5);width:48px;height:48px;"></div>'+1234'<div style="background:url(img/gardenPlants.png?v='+Game.version+');background-position:'+(-2*48)+'px '+(-icon[1]*48)+'px;position:absolute;left:'+((((me.mature*0.333)/100)*256)-24)+'px;top:-32px;transform:scale(0.5,0.5);width:48px;height:48px;"></div>'+1235'<div style="background:url(img/gardenPlants.png?v='+Game.version+');background-position:'+(-3*48)+'px '+(-icon[1]*48)+'px;position:absolute;left:'+((((me.mature*0.666)/100)*256)-24)+'px;top:-32px;transform:scale(0.5,0.5);width:48px;height:48px;"></div>'+1236'<div style="background:url(img/gardenPlants.png?v='+Game.version+');background-position:'+(-4*48)+'px '+(-icon[1]*48)+'px;position:absolute;left:'+((((me.mature)/100)*256)-24)+'px;top:-32px;transform:scale(0.5,0.5);width:48px;height:48px;"></div>'+1237'</div><br>'+1238'<b>Stage :</b> '+['bud','sprout','bloom','mature'][stage-1]+'<br>'+1239'<small>'+(stage==1?'Plant effects : 10%':stage==2?'Plant effects : 25%':stage==3?'Plant effects : 50%':'Plant effects : 100%; may reproduce, will drop seed when harvested')+'</small>'+1240'<br><small>'+(1241stage<4?(1242'Mature in about '+Game.sayTime(((100/(M.plotBoost[y][x][0]*(me.ageTick+me.ageTickR/2)))*((me.mature-tile[1])/100)*M.stepT)*30,-1)+' ('+Beautify(Math.ceil((100/(M.plotBoost[y][x][0]*(me.ageTick+me.ageTickR/2)))*((me.mature-tile[1])/100)))+' tick'+(Math.ceil((100/(M.plotBoost[y][x][0]*(me.ageTick+me.ageTickR/2)))*((me.mature-tile[1])/100))==1?'':'s')+')'1243):(1244!me.immortal?(1245'Decays in about '+Game.sayTime(((100/(M.plotBoost[y][x][0]*(me.ageTick+me.ageTickR/2)))*((100-tile[1])/100)*M.stepT)*30,-1)+' ('+Beautify(Math.ceil((100/(M.plotBoost[y][x][0]*(me.ageTick+me.ageTickR/2)))*((100-tile[1])/100)))+' tick'+(Math.ceil((100/(M.plotBoost[y][x][0]*(me.ageTick+me.ageTickR/2)))*((100-tile[1])/100))==1?'':'s')+')'1246):1247'Does not decay'1248)1249)+'</small>'+1250//'<small><br>'+M.plotBoost[y][x]+'</small>'+1251(M.plotBoost[y][x]!=[1,1,1]?('<small>'+1252(M.plotBoost[y][x][0]!=1?'<br>Aging multiplier : '+Beautify(M.plotBoost[y][x][0]*100)+'%':'')+1253(M.plotBoost[y][x][1]!=1?'<br>Effect multiplier : '+Beautify(M.plotBoost[y][x][1]*100)+'%':'')+1254(M.plotBoost[y][x][2]!=1?'<br>Weeds/fungus repellent : '+Beautify(100-M.plotBoost[y][x][2]*100)+'%':'')+1255'</small>'1256):'')+1257'</div>'+1258'<div class="line"></div>'+1259//'<div style="text-align:center;">Click to harvest'+(M.seedSelected>=0?', planting <b>'+M.plantsById[M.seedSelected].name+'</b><br>for <span class="price'+(M.canPlant(me)?'':' disabled')+'">'+Beautify(Math.round(M.getCost(M.plantsById[M.seedSelected])))+'</span> in its place':'')+'.</div>'+1260'<div style="text-align:center;">Click to '+(stage==4?'harvest':'unearth')+'.</div>'+1261'<div class="line"></div>'+1262M.getPlantDesc(me)+1263'</div>';1264return str;1265}1266};1267}12681269M.refillTooltip=function(){1270return '<div style="padding:8px;width:300px;font-size:11px;text-align:center;">Click to refill your soil timer and trigger <b>1</b> plant growth tick with <b>x3</b> spread and mutation rate for <span class="price lump">1 sugar lump</span>.'+1271(Game.canRefillLump()?'<br><small>(can be done once every '+Game.sayTime((Game.getLumpRefillMax()/1000)*Game.fps,-1)+')</small>':('<br><small class="red">(usable again in '+Game.sayTime((Game.getLumpRefillRemaining()/1000+1)*Game.fps,-1)+')</small>'))+1272'</div>';1273};12741275M.buildPanel=function()1276{1277if (!l('gardenSeeds')) return false;1278var str='';1279for (var i in M.plants)1280{1281var me=M.plants[i];1282var icon=[0,me.icon];1283str+='<div id="gardenSeed-'+me.id+'" class="gardenSeed'+(M.seedSelected==me.id?' on':'')+' locked" '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.seedTooltip('+me.id+')','this')+'>';1284str+='<div id="gardenSeedIcon-'+me.id+'" class="gardenSeedIcon shadowFilter" style="background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>';1285str+='</div>';1286}1287l('gardenSeeds').innerHTML=str;12881289for (var i in M.plants)1290{1291var me=M.plants[i];1292me.l=l('gardenSeed-'+me.id);1293AddEvent(me.l,'click',function(me){return function()1294{1295if (/* !M.freeze && */Game.keys[16] && Game.keys[17])//shift & ctrl1296{1297//harvest all mature of type1298M.harvestAll(me,1);1299return false;1300}1301if (!me.plantable && !Game.sesame) return false;1302if (M.seedSelected==me.id){M.seedSelected=-1;}1303else {M.seedSelected=me.id;PlaySound('snd/toneTick.mp3');}1304for (var i in M.plants)1305{1306var it=M.plants[i];1307if (it.id==M.seedSelected){it.l.classList.add('on');}1308else {it.l.classList.remove('on');}1309}1310}}(me));1311AddEvent(me.l,'mouseover',M.hideCursor);1312AddEvent(me.l,'mouseout',M.showCursor);1313if (me.unlocked) me.l.classList.remove('locked');1314}13151316var str='';1317for (var i in M.tools)1318{1319var me=M.tools[i];1320var icon=[me.icon,35];1321str+='<div id="gardenTool-'+me.id+'" style="margin:8px;" class="gardenSeed'+((me.isOn && me.isOn())?' on':'')+''+((!me.isDisplayed || me.isDisplayed())?'':' locked')+'" '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.toolTooltip('+me.id+')','this')+'>';1322str+='<div id="gardenToolIcon-'+me.id+'" class="gardenSeedIcon shadowFilter" style="background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>';1323str+='</div>';1324}1325l('gardenTools').innerHTML=str;13261327for (var i in M.tools)1328{1329var me=M.tools[i];1330AddEvent(l('gardenTool-'+me.id),'click',me.func);1331AddEvent(l('gardenTool-'+me.id),'mouseover',M.hideCursor);1332AddEvent(l('gardenTool-'+me.id),'mouseout',M.showCursor);1333}13341335var str='';1336for (var i in M.soils)1337{1338var me=M.soils[i];1339var icon=[me.icon,34];1340str+='<div id="gardenSoil-'+me.id+'" class="gardenSeed gardenSoil disabled'+(M.soil==me.id?' on':'')+'" '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.soilTooltip('+me.id+')','this')+'>';1341str+='<div id="gardenSoilIcon-'+me.id+'" class="gardenSeedIcon shadowFilter" style="background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>';1342str+='</div>';1343}1344l('gardenSoils').innerHTML=str;13451346for (var i in M.soils)1347{1348var me=M.soils[i];1349AddEvent(l('gardenSoil-'+me.id),'click',function(me){return function(){1350if (M.freeze || M.soil==me.id || M.nextSoil>Date.now() || M.parent.amount<me.req){return false;}1351PlaySound('snd/toneTick.mp3');1352M.nextSoil=Date.now()+(Game.Has('Turbo-charged soil')?1:(1000*60*10));1353M.toCompute=true;M.soil=me.id;M.computeStepT();1354for (var i in M.soils){var it=M.soils[i];if (it.id==M.soil){l('gardenSoil-'+it.id).classList.add('on');}else{l('gardenSoil-'+it.id).classList.remove('on');}}1355}}(me));1356AddEvent(l('gardenSoil-'+me.id),'mouseover',M.hideCursor);1357AddEvent(l('gardenSoil-'+me.id),'mouseout',M.showCursor);1358}13591360M.cursorL=l('gardenCursor');1361}1362M.buildPlot=function()1363{1364M.toRebuild=false;1365if (!l('gardenPlot')) return false;1366if (!l('gardenTile-0-0'))1367{1368var str='';1369for (var y=0;y<6;y++)1370{1371for (var x=0;x<6;x++)1372{1373str+='<div id="gardenTile-'+x+'-'+y+'" class="gardenTile" style="left:'+(x*M.tileSize)+'px;top:'+(y*M.tileSize)+'px;display:none;" '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.tileTooltip('+x+','+y+')','this')+'>';1374str+='<div id="gardenTileIcon-'+x+'-'+y+'" class="gardenTileIcon" style="display:none;"></div>';1375str+='</div>';1376}1377}1378l('gardenPlot').innerHTML=str;13791380for (var y=0;y<6;y++)1381{1382for (var x=0;x<6;x++)1383{1384AddEvent(l('gardenTile-'+x+'-'+y),'click',function(x,y){return function()1385{1386M.clickTile(x,y);1387}}(x,y));1388}1389}1390}1391var plants=0;1392for (var y=0;y<6;y++)1393{1394for (var x=0;x<6;x++)1395{1396var tile=M.plot[y][x];1397var tileL=l('gardenTile-'+x+'-'+y);1398var iconL=l('gardenTileIcon-'+x+'-'+y);1399var me=0;1400if (tile[0]>0)1401{1402plants++;1403me=M.plantsById[tile[0]-1];1404var stage=0;1405if (tile[1]>=me.mature) stage=4;1406else if (tile[1]>=me.mature*0.666) stage=3;1407else if (tile[1]>=me.mature*0.333) stage=2;1408else stage=1;1409var dying=((tile[1]+Math.ceil(me.ageTick+me.ageTickR))>=100?1:0);1410var icon=[stage,me.icon];1411iconL.style.opacity=(dying?0.5:1);1412iconL.style.backgroundPosition=(-icon[0]*48)+'px '+(-icon[1]*48)+'px';1413iconL.style.display='block';1414//iconL.innerHTML=M.plotBoost[y][x];1415}1416else iconL.style.display='none';1417if (M.isTileUnlocked(x,y)) tileL.style.display='block';1418else tileL.style.display='none';1419}1420}1421if (plants>=6*6) Game.Win('In the garden of Eden (baby)');1422}14231424M.clickTile=function(x,y)1425{1426//if (M.freeze) return false;1427var outcome=M.useTool(M.seedSelected,x,y);1428M.toCompute=true;1429if (outcome && !Game.keys[16])//shift1430{1431M.seedSelected=-1;1432for (var i in M.plants)1433{1434var it=M.plants[i];1435if (it.id==M.seedSelected) {l('gardenSeed-'+it.id).classList.add('on');}1436else {l('gardenSeed-'+it.id).classList.remove('on');}1437}1438}1439//PlaySound('snd/tick.mp3');1440}14411442M.useTool=function(what,x,y)1443{1444var harvested=M.harvest(x,y,1);1445if (harvested)1446{1447Game.SparkleAt(Game.mouseX,Game.mouseY);1448PlaySound('snd/harvest'+choose(['1','2','3'])+'.mp3',1,0.2);1449}1450else1451{1452if (what>=0 && M.canPlant(M.plantsById[what]))1453{1454M.plot[y][x]=[what+1,0];1455M.toRebuild=true;1456Game.Spend(M.getCost(M.plantsById[what]));1457Game.SparkleAt(Game.mouseX,Game.mouseY);1458PlaySound('snd/tillb'+choose(['1','2','3'])+'.mp3',1,0.2);1459return true;1460}1461}1462return false;1463}14641465M.getTile=function(x,y)1466{1467if (x<0 || x>5 || y<0 || y>5 || !M.isTileUnlocked(x,y)) return [0,0];1468return M.plot[y][x];1469}14701471M.plotLimits=[1472[2,2,4,4],1473[2,2,5,4],1474[2,2,5,5],1475[1,2,5,5],1476[1,1,5,5],1477[1,1,6,5],1478[1,1,6,6],1479[0,1,6,6],1480[0,0,6,6],1481];1482M.isTileUnlocked=function(x,y)1483{1484var level=M.parent.level;1485level=Math.max(1,Math.min(M.plotLimits.length,level))-1;1486var limits=M.plotLimits[level];1487if (x>=limits[0] && x<limits[2] && y>=limits[1] && y<limits[3]) return true; else return false;1488}14891490M.computeStepT=function()1491{1492if (Game.Has('Turbo-charged soil')) M.stepT=1;1493else M.stepT=M.soilsById[M.soil].tick*60;1494}14951496M.convertTimes=0;1497M.askConvert=function()1498{1499if (M.plantsUnlockedN<M.plantsN) return false;1500Game.Prompt('<h3>Sacrifice garden</h3><div class="block">Do you REALLY want to sacrifice your garden to the sugar hornets?<br><small>You will be left with an empty plot and only the Baker\'s wheat seed unlocked.<br>In return, you will gain <b>10 sugar lumps</b>.</small></div>',[['Yes!','Game.ClosePrompt();Game.ObjectsById['+M.parent.id+'].minigame.convert();'],'No']);1501}1502M.convert=function()1503{1504if (M.plantsUnlockedN<M.plantsN) return false;1505M.harvestAll();1506for (var i in M.plants){M.lockSeed(M.plants[i]);}1507M.unlockSeed(M.plants['bakerWheat']);15081509Game.gainLumps(10);1510Game.Notify('Sacrifice!','You\'ve sacrificed your garden to the sugar hornets, destroying your crops and your knowledge of seeds.<br>In the remains, you find <b>10 sugar lumps</b>.',[29,14],12);15111512Game.Win('Seedless to nay');1513M.convertTimes++;1514M.computeMatures();1515PlaySound('snd/spellFail.mp3',0.75);1516}15171518M.harvestAll=function(type,mature,mortal)1519{1520var harvested=0;1521for (var i=0;i<2;i++)//we do it twice to take care of whatever spawns on kill1522{1523for (var y=0;y<6;y++)1524{1525for (var x=0;x<6;x++)1526{1527if (M.plot[y][x][0]>=1)1528{1529var doIt=true;1530var tile=M.plot[y][x];1531var me=M.plantsById[tile[0]-1];1532if (type && me!=type) doIt=false;1533if (mortal && me.immortal) doIt=false;1534if (mature && tile[1]<me.mature) doIt=false;15351536if (doIt) harvested+=M.harvest(x,y)?1:0;1537}1538}1539}1540}1541if (harvested>0) setTimeout(function(){PlaySound('snd/harvest1.mp3',1,0.2);},50);1542if (harvested>2) setTimeout(function(){PlaySound('snd/harvest2.mp3',1,0.2);},150);1543if (harvested>6) setTimeout(function(){PlaySound('snd/harvest3.mp3',1,0.2);},250);1544}1545M.harvest=function(x,y,manual)1546{1547var tile=M.plot[y][x];1548if (tile[0]>=1)1549{1550M.toCompute=true;1551var me=M.plantsById[tile[0]-1];1552var age=tile[1];1553if (me.onHarvest) me.onHarvest(x,y,age);1554if (tile[1]>=me.mature)1555{1556if (M.unlockSeed(me)) Game.Popup('('+me.name+')<br>Unlocked '+me.name+' seed.',Game.mouseX,Game.mouseY);1557M.harvests++;1558M.harvestsTotal++;1559if (M.harvestsTotal>=100) Game.Win('Botany enthusiast');1560if (M.harvestsTotal>=1000) Game.Win('Green, aching thumb');1561}15621563M.plot[y][x]=[0,0];1564if (me.onKill) me.onKill(x,y,age);1565M.toRebuild=true;1566return true;1567}1568return false;1569}15701571M.unlockSeed=function(me)1572{1573if (me.unlocked) return false;1574me.unlocked=1;1575if (me.l) me.l.classList.remove('locked');1576M.getUnlockedN();1577return true;1578}1579M.lockSeed=function(me)1580{1581if (me.locked) return false;1582me.unlocked=0;1583if (me.l) me.l.classList.add('locked');1584M.getUnlockedN();1585return true;1586}15871588var str='';1589str+='<style>'+1590'#gardenBG{background:url(img/shadedBorders.png),url(img/BGgarden.jpg);background-size:100% 100%,auto;position:absolute;left:0px;right:0px;top:0px;bottom:16px;}'+1591'#gardenContent{position:relative;box-sizing:border-box;padding:4px 24px;height:'+(6*M.tileSize+16+48+48)+'px;}'+1592'.gardenFrozen{box-shadow:0px 0px 16px rgba(255,255,255,1) inset,0px 0px 48px 24px rgba(200,255,225,0.5) inset;}'+1593'#gardenPanel{text-align:center;margin:0px;padding:0px;position:absolute;left:4px;top:4px;bottom:4px;right:65%;overflow-y:auto;overflow-x:hidden;box-shadow:8px 0px 8px rgba(0,0,0,0.5);}'+1594'#gardenSeeds{}'+1595'#gardenField{text-align:center;position:absolute;right:0px;top:0px;bottom:0px;overflow-x:auto;overflow:hidden;}'+//width:65%;1596'#gardenPlot{position:relative;margin:8px auto;}'+1597'.gardenTile{cursor:pointer;width:'+M.tileSize+'px;height:'+M.tileSize+'px;position:absolute;}'+1598//'.gardenTile:before{transform:translate(0,0);pointer-events:none;content:\'\';display:block;position:absolute;left:0px;top:0px;right:0px;bottom:0px;margin:6px;border-radius:12px;background:rgba(0,0,0,0.1);box-shadow:0px 0px 4px rgba(255,255,255,0.2),-4px 4px 4px 2px rgba(0,0,0,0.2) inset;}'+1599//'.gardenTile:hover:before{margin:2px;animation:wobble 0.5s;}'+1600'.gardenTile:before{transform:translate(0,0);opacity:0.65;transition:opacity 0.2s;pointer-events:none;content:\'\';display:block;position:absolute;left:0px;top:0px;right:0px;bottom:0px;margin:0px;background:url(img/gardenPlots.png);}'+1601'.gardenTile:nth-child(4n+1):before{background-position:40px 0px;}'+1602'.gardenTile:nth-child(4n+2):before{background-position:80px 0px;}'+1603'.gardenTile:nth-child(4n+3):before{background-position:120px 0px;}'+1604'.gardenTile:hover:before{opacity:1;animation:wobble 0.5s;}'+1605'.noFancy .gardenTile:hover:before{opacity:1;animation:none;}'+1606'.gardenTileIcon{transform:translate(0,0);pointer-events:none;transform-origin:50% 40px;width:48px;height:48px;position:absolute;left:-'+((48-M.tileSize)/2)+'px;top:-'+((48-M.tileSize)/2+8)+'px;background:url(img/gardenPlants.png?v='+Game.version+');}'+1607'.gardenTile:hover .gardenTileIcon{animation:pucker 0.3s;}'+1608'.noFancy .gardenTile:hover .gardenTileIcon{animation:none;}'+1609'#gardenDrag{pointer-events:none;position:absolute;left:0px;top:0px;right:0px;bottom:0px;overflow:hidden;z-index:1000000001;}'+1610'#gardenCursor{transition:transform 0.1s;display:none;pointer-events:none;width:48px;height:48px;position:absolute;background:url(img/gardenPlants.png?v='+Game.version+');}'+1611'.gardenSeed{cursor:pointer;display:inline-block;width:40px;height:40px;position:relative;}'+1612'.gardenSeed.locked{display:none;}'+1613'.gardenSeedIcon{pointer-events:none;transform:translate(0,0);display:inline-block;position:absolute;left:-4px;top:-4px;width:48px;height:48px;background:url(img/gardenPlants.png?v='+Game.version+');}'+1614'.gardenSeed:hover .gardenSeedIcon{animation:bounce 0.8s;z-index:1000000001;}'+1615'.gardenSeed:active .gardenSeedIcon{animation:pucker 0.2s;}'+1616'.noFancy .gardenSeed:hover .gardenSeedIcon,.noFancy .gardenSeed:active .gardenSeedIcon{animation:none;}'+1617'.gardenPanelLabel{font-size:12px;width:100%;padding:2px;margin-top:4px;margin-bottom:-4px;}'+'.gardenSeedTiny{transform:scale(0.5,0.5);margin:-20px -16px;display:inline-block;width:48px;height:48px;background:url(img/gardenPlants.png?v='+Game.version+');}'+1618'.gardenSeed.on:before{pointer-events:none;content:\'\';display:block;position:absolute;left:0px;top:0px;right:0px;bottom:0px;margin:-2px;border-radius:12px;transform:rotate(45deg);background:rgba(0,0,0,0.2);box-shadow:0px 0px 8px rgba(255,255,255,0.75);}'+16191620'.gardenGrowthIndicator{background:#000;box-shadow:0px 0px 0px 1px #fff,0px 0px 0px 2px #000,2px 2px 2px 2px rgba(0,0,0,0.5);position:absolute;top:0px;width:1px;height:6px;z-index:100;}'+1621'.noFancy .gardenGrowthIndicator{background:#fff;border:1px solid #000;margin-top:-1px;margin-left:-1px;}'+16221623'#gardenSoils{}'+1624'.gardenSoil.disabled{filter:brightness(10%);}'+1625'.noFilters .gardenSoil.disabled{opacity:0.2;}'+16261627'#gardenInfo{position:relative;display:inline-block;margin:8px auto 0px auto;padding:8px 16px;padding-left:32px;text-align:left;font-size:11px;color:rgba(255,255,255,0.75);text-shadow:-1px 1px 0px #000;background:rgba(0,0,0,0.75);border-radius:16px;}'+16281629'</style>';1630str+='<div id="gardenBG"></div>';1631str+='<div id="gardenContent">';1632str+='<div id="gardenDrag"><div id="gardenCursor" class="shadowFilter"></div></div>';16331634str+='<div id="gardenPanel" class="framed">';1635str+='<div class="title gardenPanelLabel">Tools</div><div class="line"></div>';1636str+='<div id="gardenTools"></div>';1637str+='<div id="gardenSeedsUnlocked" class="title gardenPanelLabel">Seeds</div><div class="line"></div>';1638str+='<div id="gardenSeeds"></div>';1639str+='</div>';1640str+='<div id="gardenField">';1641str+='<div style="pointer-events:none;opacity:0.75;position:absolute;left:0px;right:0px;top:8px;" id="gardenPlotSize"></div>';1642str+='<div id="gardenPlot" class="shadowFilter" style="width:'+(6*M.tileSize)+'px;height:'+(6*M.tileSize)+'px;"></div>';1643str+='<div style="margin-top:0px;" id="gardenSoils"></div>';1644str+='<div id="gardenInfo">';1645str+='<div '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.refillTooltip','this')+' id="gardenLumpRefill" class="usesIcon shadowFilter lumpRefill" style="display:none;left:-8px;top:-6px;background-position:'+(-29*48)+'px '+(-14*48)+'px;"></div>';1646str+='<div id="gardenNextTick">Initializing...</div>';1647str+='<div id="gardenStats"></div>';1648str+='</div>';1649str+='</div>';16501651str+='</div>';1652div.innerHTML=str;1653M.buildPlot();1654M.buildPanel();16551656M.lumpRefill=l('gardenLumpRefill');1657AddEvent(M.lumpRefill,'click',function(){1658Game.refillLump(1,function(){1659M.loopsMult=3;1660M.nextSoil=Date.now();1661//M.nextFreeze=Date.now();1662M.nextStep=Date.now();1663PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);1664});1665});1666AddEvent(l('gardenSeedsUnlocked'),'click',function()1667{1668if (Game.sesame)1669{1670if (Game.keys[16] && Game.keys[17])//ctrl & shift, fill garden with random plants1671{1672for (var y=0;y<6;y++)1673{1674for (var x=0;x<6;x++)1675{1676M.plot[y][x]=[choose(M.plantsById).id+1,Math.floor(Math.random()*100)];1677}1678}1679M.toRebuild=true;1680M.toCompute=true;1681}1682else//unlock/lock all seeds1683{1684var locked=0;1685for (var i in M.plants)1686{1687if (!M.plants[i].unlocked) locked++;1688}1689if (locked>0){for (var i in M.plants){M.unlockSeed(M.plants[i]);}}1690else{for (var i in M.plants){M.lockSeed(M.plants[i]);}}1691M.unlockSeed(M.plants['bakerWheat']);1692}1693}1694});16951696M.reset();16971698//M.parent.switchMinigame(1);1699}1700M.onResize=function()1701{1702var width=l('gardenContent').offsetWidth;1703var panelW=Math.min(Math.max(width*0.40,320),width-6*M.tileSize)-8;1704var fieldW=Math.max(Math.min(width*0.60,width-panelW),6*M.tileSize)-8;1705l('gardenField').style.width=fieldW+'px';1706l('gardenPanel').style.width=panelW+'px';1707}1708M.onLevel=function(level)1709{1710M.buildPlot();1711}1712M.onRuinTheFun=function()1713{1714for (var i in M.plants){M.unlockSeed(M.plants[i]);}1715}1716M.save=function()1717{1718//output cannot use ",", ";" or "|"1719var str=''+1720parseFloat(M.nextStep)+':'+1721parseInt(M.soil)+':'+1722parseFloat(M.nextSoil)+':'+1723parseInt(M.freeze)+':'+1724parseInt(M.harvests)+':'+1725parseInt(M.harvestsTotal)+':'+1726parseInt(M.parent.onMinigame?'1':'0')+':'+1727parseFloat(M.convertTimes)+':'+1728parseFloat(M.nextFreeze)+':'+1729' ';1730for (var i in M.plants)1731{1732str+=''+(M.plants[i].unlocked?'1':'0');1733}1734str+=' ';1735for (var y=0;y<6;y++)1736{1737for (var x=0;x<6;x++)1738{1739str+=parseInt(M.plot[y][x][0])+':'+parseInt(M.plot[y][x][1])+':';1740}1741}1742return str;1743}1744M.load=function(str)1745{1746//interpret str; called after .init1747//note : not actually called in the Game's load; see "minigameSave" in main.js1748if (!str) return false;1749var i=0;1750var spl=str.split(' ');1751var spl2=spl[i++].split(':');1752var i2=0;1753M.nextStep=parseFloat(spl2[i2++]||M.nextStep);1754M.soil=parseInt(spl2[i2++]||M.soil);1755M.nextSoil=parseFloat(spl2[i2++]||M.nextSoil);1756M.freeze=parseInt(spl2[i2++]||M.freeze)?1:0;1757M.harvests=parseInt(spl2[i2++]||0);1758M.harvestsTotal=parseInt(spl2[i2++]||0);1759var on=parseInt(spl2[i2++]||0);if (on && Game.ascensionMode!=1) M.parent.switchMinigame(1);1760M.convertTimes=parseFloat(spl2[i2++]||M.convertTimes);1761M.nextFreeze=parseFloat(spl2[i2++]||M.nextFreeze);1762var seeds=spl[i++]||'';1763if (seeds)1764{1765var n=0;1766for (var ii in M.plants)1767{1768if (seeds.charAt(n)=='1') M.plants[ii].unlocked=1; else M.plants[ii].unlocked=0;1769n++;1770}1771}1772M.plants['bakerWheat'].unlocked=1;17731774var plot=spl[i++]||0;1775if (plot)1776{1777plot=plot.split(':');1778var n=0;1779for (var y=0;y<6;y++)1780{1781for (var x=0;x<6;x++)1782{1783M.plot[y][x]=[parseInt(plot[n]),parseInt(plot[n+1])];1784n+=2;1785}1786}1787}17881789M.getUnlockedN();1790M.computeStepT();17911792M.buildPlot();1793M.buildPanel();17941795M.computeBoostPlot();1796M.toCompute=true;1797}1798M.reset=function(hard)1799{1800M.soil=0;1801if (M.seedSelected>-1) M.plantsById[M.seedSelected].l.classList.remove('on');1802M.seedSelected=-1;18031804M.nextStep=Date.now();1805M.nextSoil=Date.now();1806M.nextFreeze=Date.now();1807for (var y=0;y<6;y++)1808{1809for (var x=0;x<6;x++)1810{1811M.plot[y][x]=[0,0];1812}1813}18141815M.harvests=0;1816if (hard)1817{1818M.convertTimes=0;1819M.harvestsTotal=0;1820for (var i in M.plants)1821{1822M.plants[i].unlocked=0;1823}1824}18251826M.plants['bakerWheat'].unlocked=1;18271828M.loopsMult=1;18291830M.getUnlockedN();1831M.computeStepT();18321833M.computeMatures();18341835M.buildPlot();1836M.buildPanel();1837M.toCompute=true;18381839setTimeout(function(M){return function(){M.onResize();}}(M),10);1840}1841M.logic=function()1842{1843//run each frame1844var now=Date.now();18451846if (!M.freeze)1847{1848M.nextStep=Math.min(M.nextStep,now+(M.stepT)*1000);1849if (now>=M.nextStep)1850{1851M.computeStepT();1852M.nextStep=now+M.stepT*1000;18531854M.computeBoostPlot();1855M.computeMatures();18561857var weedMult=M.soilsById[M.soil].weedMult;18581859var loops=1;1860if (M.soilsById[M.soil].key=='woodchips') loops=3;1861loops*=M.loopsMult;1862M.loopsMult=1;18631864for (var y=0;y<6;y++)1865{1866for (var x=0;x<6;x++)1867{1868if (M.isTileUnlocked(x,y))1869{1870var tile=M.plot[y][x];1871var me=M.plantsById[tile[0]-1];1872if (tile[0]>0)1873{1874//age1875tile[1]+=randomFloor((me.ageTick+me.ageTickR*Math.random())*M.plotBoost[y][x][0]);1876tile[1]=Math.max(tile[1],0);1877if (me.immortal) tile[1]=Math.min(me.mature+1,tile[1]);1878else if (tile[1]>=100)1879{1880//die of old age1881M.plot[y][x]=[0,0];1882if (me.onDie) me.onDie(x,y);1883if (M.soilsById[M.soil].key=='pebbles' && Math.random()<0.35)1884{1885if (M.unlockSeed(me)) Game.Popup('Unlocked '+me.name+' seed.',Game.mouseX,Game.mouseY);1886}1887}1888else if (!me.noContam)1889{1890//other plant contamination1891//only occurs in cardinal directions1892//immortal plants and plants with noContam are immune18931894var list=[];1895for (var i in M.plantContam)1896{1897if (Math.random()<M.plantContam[i] && (!M.plants[i].weed || Math.random()<weedMult)) list.push(i);1898}1899var contam=choose(list);19001901if (contam && me.key!=contam)1902{1903if ((!M.plants[contam].weed && !M.plants[contam].fungus) || Math.random()<M.plotBoost[y][x][2])1904{1905var any=0;1906var neighs={};//all surrounding plants1907var neighsM={};//all surrounding mature plants1908for (var i in M.plants){neighs[i]=0;}1909for (var i in M.plants){neighsM[i]=0;}1910var neigh=M.getTile(x,y-1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1911var neigh=M.getTile(x,y+1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1912var neigh=M.getTile(x-1,y);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1913var neigh=M.getTile(x+1,y);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}19141915if (neighsM[contam]>=1) M.plot[y][x]=[M.plants[contam].id+1,0];1916}1917}1918}1919}1920else1921{1922//plant spreading and mutation1923//happens on all 8 tiles around this one1924for (var loop=0;loop<loops;loop++)1925{1926var any=0;1927var neighs={};//all surrounding plants1928var neighsM={};//all surrounding mature plants1929for (var i in M.plants){neighs[i]=0;}1930for (var i in M.plants){neighsM[i]=0;}1931var neigh=M.getTile(x,y-1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1932var neigh=M.getTile(x,y+1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1933var neigh=M.getTile(x-1,y);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1934var neigh=M.getTile(x+1,y);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1935var neigh=M.getTile(x-1,y-1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1936var neigh=M.getTile(x-1,y+1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1937var neigh=M.getTile(x+1,y-1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1938var neigh=M.getTile(x+1,y+1);if (neigh[0]>0){var age=neigh[1];neigh=M.plantsById[neigh[0]-1];any++;neighs[neigh.key]++;if (age>=neigh.mature){neighsM[neigh.key]++;}}1939if (any>0)1940{1941var muts=M.getMuts(neighs,neighsM);19421943var list=[];1944for (var ii=0;ii<muts.length;ii++)1945{1946if (Math.random()<muts[ii][1] && (!M.plants[muts[ii][0]].weed || Math.random()<weedMult) && ((!M.plants[muts[ii][0]].weed && !M.plants[muts[ii][0]].fungus) || Math.random()<M.plotBoost[y][x][2])) list.push(muts[ii][0]);1947}1948if (list.length>0) M.plot[y][x]=[M.plants[choose(list)].id+1,0];1949}1950else if (loop==0)1951{1952//weeds in empty tiles (no other plants must be nearby)1953var chance=0.002*weedMult*M.plotBoost[y][x][2];1954if (Math.random()<chance) M.plot[y][x]=[M.plants['meddleweed'].id+1,0];1955}1956}1957}1958}1959}1960}1961M.toRebuild=true;1962M.toCompute=true;1963}1964}1965if (M.toRebuild) M.buildPlot();1966if (M.toCompute) M.computeEffs();19671968if (Game.keys[27])//esc1969{1970if (M.seedSelected>-1) M.plantsById[M.seedSelected].l.classList.remove('on');1971M.seedSelected=-1;1972}1973}1974M.draw=function()1975{1976//run each draw frame19771978if (M.cursorL)1979{1980if (!M.cursor || M.seedSelected<0)1981{1982M.cursorL.style.display='none';1983}1984else1985{1986var box=l('gardenDrag').getBoundingClientRect();1987var x=Game.mouseX-box.left-24;1988var y=Game.mouseY-box.top;1989var seed=M.plantsById[M.seedSelected];1990var icon=[0,seed.icon];1991M.cursorL.style.transform='translate('+(x)+'px,'+(y)+'px)';1992M.cursorL.style.backgroundPosition=(-icon[0]*48)+'px '+(-icon[1]*48)+'px';1993M.cursorL.style.display='block';1994}1995}1996if (Game.drawT%10==0)1997{1998M.lumpRefill.style.display='block';1999if (M.freeze) l('gardenNextTick').innerHTML='Garden is frozen. Unfreeze to resume.';2000else l('gardenNextTick').innerHTML='Next tick in '+Game.sayTime((M.nextStep-Date.now())/1000*30+30,-1)+'';2001l('gardenStats').innerHTML='Mature plants harvested : '+Beautify(M.harvests)+' (total : '+Beautify(M.harvestsTotal)+')';2002if (M.parent.level<M.plotLimits.length) l('gardenPlotSize').innerHTML='<small>Plot size : '+Math.max(1,Math.min(M.plotLimits.length,M.parent.level))+'/'+M.plotLimits.length+'<br>(Upgrades with farm level)</small>';2003else l('gardenPlotSize').innerHTML='';2004l('gardenSeedsUnlocked').innerHTML='Seeds<small> ('+M.plantsUnlockedN+'/'+M.plantsN+')</small>';2005for (var i in M.soils)2006{2007var me=M.soils[i];2008if (M.parent.amount<me.req) l('gardenSoil-'+me.id).classList.add('disabled');2009else l('gardenSoil-'+me.id).classList.remove('disabled');2010}2011}2012}2013M.init(l('rowSpecial'+M.parent.id));2014}2015var M=0;201620172018