Path: blob/main/projects/cookie-clicker/minigamePantheon.js
4626 views
var M={};1M.parent=Game.Objects['Temple'];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 values1011M.gods={12'asceticism':{13name:'Holobore, Spirit of Asceticism',14icon:[21,18],15desc1:'<span class="green">+15% base CpS.</span>',16desc2:'<span class="green">+10% base CpS.</span>',17desc3:'<span class="green">+5% base CpS.</span>',18descAfter:'<span class="red">If a golden cookie is clicked, this spirit is unslotted and all worship swaps will be used up.</span>',19quote:'An immortal life spent focusing on the inner self, away from the distractions of material wealth.',20},21'decadence':{22name:'Vomitrax, Spirit of Decadence',23icon:[22,18],24desc1:'<span class="green">Golden and wrath cookie effect duration +7%,</span> <span class="red">but buildings grant -7% CpS.</span>',25desc2:'<span class="green">Golden and wrath cookie effect duration +5%,</span> <span class="red">but buildings grant -5% CpS.</span>',26desc3:'<span class="green">Golden and wrath cookie effect duration +2%,</span> <span class="red">but buildings grant -2% CpS.</span>',27quote:'This sleazy spirit revels in the lust for quick easy gain and contempt for the value of steady work.',28},29'ruin':{30name:'Godzamok, Spirit of Ruin',31icon:[23,18],32descBefore:'<span class="green">Selling buildings triggers a buff boosted by how many buildings were sold.</span>',33desc1:'<span class="green">Buff boosts clicks by +1% for every building sold for 10 seconds.</span>',34desc2:'<span class="green">Buff boosts clicks by +0.5% for every building sold for 10 seconds.</span>',35desc3:'<span class="green">Buff boosts clicks by +0.25% for every building sold for 10 seconds.</span>',36quote:'The embodiment of natural disasters. An impenetrable motive drives the devastation caused by this spirit.',37},38'ages':{39name:'Cyclius, Spirit of Ages',40icon:[24,18],41activeDescFunc:function()42{43var godLvl=Game.hasGod('ages');44var mult=1;45if (godLvl==1) mult*=0.15*Math.sin((Date.now()/1000/(60*60*3))*Math.PI*2);46else if (godLvl==2) mult*=0.15*Math.sin((Date.now()/1000/(60*60*12))*Math.PI*2);47else if (godLvl==3) mult*=0.15*Math.sin((Date.now()/1000/(60*60*24))*Math.PI*2);48return 'Current bonus : '+(mult<0?'-':'+')+Beautify(Math.abs(mult)*100,2)+'%.';49},50descBefore:'CpS bonus fluctuating between <span class="green">+15%</span> and <span class="red">-15%</span> over time.',51desc1:'Effect cycles over 3 hours.',52desc2:'Effect cycles over 12 hours.',53desc3:'Effect cycles over 24 hours.',54quote:'This spirit knows about everything you\'ll ever do, and enjoys dispensing a harsh judgement.',55},56'seasons':{57name:'Selebrak, Spirit of Festivities',58icon:[25,18],59descBefore:'<span class="green">Some seasonal effects are boosted.</span>',60desc1:'<span class="green">Large boost.</span> <span class="red">Switching seasons is 100% pricier.</span>',61desc2:'<span class="green">Medium boost.</span> <span class="red">Switching seasons is 50% pricier.</span>',62desc3:'<span class="green">Small boost.</span> <span class="red">Switching seasons is 25% pricier.</span>',63quote:'This is the spirit of merry getaways and regretful Monday mornings.',64},65'creation':{66name:'Dotjeiess, Spirit of Creation',67icon:[26,18],68desc1:'<span class="green">Buildings are 7% cheaper,</span> <span class="red">but heavenly chips have 30% less effect.</span>',69desc2:'<span class="green">Buildings are 5% cheaper,</span> <span class="red">but heavenly chips have 20% less effect.</span>',70desc3:'<span class="green">Buildings are 2% cheaper,</span> <span class="red">but heavenly chips have 10% less effect.</span>',71quote:'All things that be and ever will be were scripted long ago by this spirit\'s inscrutable tendrils.',72},73'labor':{74name:'Muridal, Spirit of Labor',75icon:[27,18],76desc1:'<span class="green">Clicks are 15% more powerful,</span> <span class="red">but buildings produce 3% less.</span>',77desc2:'<span class="green">Clicks are 10% more powerful,</span> <span class="red">but buildings produce 2% less.</span>',78desc3:'<span class="green">Clicks are 5% more powerful,</span> <span class="red">but buildings produce 1% less.</span>',79quote:'This spirit enjoys a good cheese after a day of hard work.',80},81'industry':{82name:'Jeremy, Spirit of Industry',83icon:[28,18],84desc1:'<span class="green">Buildings produce 10% more cookies,</span> <span class="red">but golden and wrath cookies appear 10% less.</span>',85desc2:'<span class="green">Buildings produce 6% more cookies,</span> <span class="red">but golden and wrath cookies appear 6% less.</span>',86desc3:'<span class="green">Buildings produce 3% more cookies,</span> <span class="red">but golden and wrath cookies appear 3% less.</span>',87quote:'While this spirit has many regrets, helping you rule the world through constant industrialization is not one of them.',88},89'mother':{90name:'Mokalsium, Mother Spirit',91icon:[29,18],92desc1:'<span class="green">Milk is 10% more powerful,</span> <span class="red">but golden and wrath cookies appear 15% less.</span>',93desc2:'<span class="green">Milk is 5% more powerful,</span> <span class="red">but golden and wrath cookies appear 10% less.</span>',94desc3:'<span class="green">Milk is 3% more powerful,</span> <span class="red">but golden and wrath cookies appear 5% less.</span>',95quote:'A caring spirit said to contain itself, inwards infinitely.',96},97'scorn':{98name:'Skruuia, Spirit of Scorn',99icon:[21,19],100descBefore:'<span class="red">All golden cookies are wrath cookies with a greater chance of a negative effect.</span>',101desc1:'<span class="green">Wrinklers appear 150% faster and digest 15% more cookies.</span>',102desc2:'<span class="green">Wrinklers appear 100% faster and digest 10% more cookies.</span>',103desc3:'<span class="green">Wrinklers appear 50% faster and digest 5% more cookies.</span>',104quote:'This spirit enjoys poking foul beasts and watching them squirm, but has no love for its own family.',105},106'order':{107name:'Rigidel, Spirit of Order',108icon:[22,19],109activeDescFunc:function()110{111if (Game.BuildingsOwned%10==0) return 'Buildings owned : '+Beautify(Game.BuildingsOwned)+'.<br>Effect is active.';112else return 'Buildings owned : '+Beautify(Game.BuildingsOwned)+'.<br>Effect is inactive.';113},114desc1:'<span class="green">Sugar lumps ripen an hour sooner.</span>',115desc2:'<span class="green">Sugar lumps ripen 40 minutes sooner.</span>',116desc3:'<span class="green">Sugar lumps ripen 20 minutes sooner.</span>',117descAfter:'<span class="red">Effect is only active when your total amount of buildings ends with 0.</span>',118quote:'You will find that life gets just a little bit sweeter if you can motivate this spirit with tidy numbers and properly-filled tax returns.',119},120};121M.godsById=[];var n=0;122for (var i in M.gods){M.gods[i].id=n;M.gods[i].slot=-1;M.godsById[n]=M.gods[i];n++;}123124125M.slot=[];126M.slot[0]=-1;//diamond socket127M.slot[1]=-1;//ruby socket128M.slot[2]=-1;//jade socket129130M.slotNames=[131'Diamond','Ruby','Jade'132];133134M.swaps=3;//swaps left135M.swapT=Date.now();//the last time we swapped136137M.lastSwapT=0;//frames since last swap138139M.godTooltip=function(id)140{141return function(){142var me=M.godsById[id];143me.icon=me.icon||[0,0];144var str='<div style="padding:8px 4px;min-width:350px;">'+145'<div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;background-position:'+(-me.icon[0]*48)+'px '+(-me.icon[1]*48)+'px;"></div>'+146'<div class="name">'+me.name+'</div>'+147'<div class="line"></div><div class="description"><div style="margin:6px 0px;font-weight:bold;">Effects :</div>'+148(me.descBefore?('<div class="templeEffect">'+me.descBefore+'</div>'):'')+149(me.desc1?('<div class="templeEffect templeEffect1"><div class="usesIcon shadowFilter templeGem templeGem1"></div>'+me.desc1+'</div>'):'')+150(me.desc2?('<div class="templeEffect templeEffect2"><div class="usesIcon shadowFilter templeGem templeGem2"></div>'+me.desc2+'</div>'):'')+151(me.desc3?('<div class="templeEffect templeEffect3"><div class="usesIcon shadowFilter templeGem templeGem3"></div>'+me.desc3+'</div>'):'')+152(me.descAfter?('<div class="templeEffect">'+me.descAfter+'</div>'):'')+153(me.quote?('<q>'+me.quote+'</q>'):'')+154'</div></div>';155return str;156};157}158159M.slotTooltip=function(id)160{161return function(){162if (M.slot[id]!=-1)163{164var me=M.godsById[M.slot[id]];165me.icon=me.icon||[0,0];166}167var str='<div style="padding:8px 4px;min-width:350px;">'+168(M.slot[id]!=-1?(169'<div class="name templeEffect" style="margin-bottom:12px;"><div class="usesIcon shadowFilter templeGem templeGem'+(parseInt(id)+1)+'"></div>'+M.slotNames[id]+' slot</div>'+170'<div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;background-position:'+(-me.icon[0]*48)+'px '+(-me.icon[1]*48)+'px;"></div>'+171'<div class="name">'+me.name+'</div>'+172'<div class="line"></div><div class="description"><div style="margin:6px 0px;font-weight:bold;">Effects :</div>'+173(me.activeDescFunc?('<div class="templeEffect templeEffectOn" style="padding:8px 4px;text-align:center;">'+me.activeDescFunc()+'</div>'):'')+174(me.descBefore?('<div class="templeEffect">'+me.descBefore+'</div>'):'')+175(me.desc1?('<div class="templeEffect templeEffect1'+(me.slot==0?' templeEffectOn':'')+'"><div class="usesIcon shadowFilter templeGem templeGem1"></div>'+me.desc1+'</div>'):'')+176(me.desc2?('<div class="templeEffect templeEffect2'+(me.slot==1?' templeEffectOn':'')+'"><div class="usesIcon shadowFilter templeGem templeGem2"></div>'+me.desc2+'</div>'):'')+177(me.desc3?('<div class="templeEffect templeEffect3'+(me.slot==2?' templeEffectOn':'')+'"><div class="usesIcon shadowFilter templeGem templeGem3"></div>'+me.desc3+'</div>'):'')+178(me.descAfter?('<div class="templeEffect">'+me.descAfter+'</div>'):'')+179(me.quote?('<q>'+me.quote+'</q>'):'')+180'</div>'181):182('<div class="name templeEffect"><div class="usesIcon shadowFilter templeGem templeGem'+(parseInt(id)+1)+'"></div>'+M.slotNames[id]+' slot (empty)</div><div class="line"></div><div class="description">'+183((M.slotHovered==id && M.dragging)?'Release to assign <b>'+M.dragging.name+'</b> to this slot.':'Drag a spirit onto this slot to assign it.')+184'</div>')185)+186'</div>';187return str;188};189}190191M.useSwap=function(n)192{193M.swapT=Date.now();194M.swaps-=n;195if (M.swaps<0) M.swaps=0;196}197198M.slotGod=function(god,slot)199{200if (slot==god.slot) return false;201if (slot!=-1 && M.slot[slot]!=-1)202{203M.godsById[M.slot[slot]].slot=god.slot;//swap204M.slot[god.slot]=M.slot[slot];205}206else if (god.slot!=-1) M.slot[god.slot]=-1;207if (slot!=-1) M.slot[slot]=god.id;208god.slot=slot;209Game.recalculateGains=true;210}211212M.dragging=false;213M.dragGod=function(what)214{215M.dragging=what;216var div=l('templeGod'+what.id);217var box=div.getBoundingClientRect();218var box2=l('templeDrag').getBoundingClientRect();219div.className='ready templeGod titleFont templeDragged';220l('templeDrag').appendChild(div);221var x=box.left-box2.left;222var y=box.top-box2.top;223div.style.transform='translate('+(x)+'px,'+(y)+'px)';224l('templeGodPlaceholder'+M.dragging.id).style.display='inline-block';225PlaySound('snd/tick.mp3');226}227M.dropGod=function()228{229if (!M.dragging) return;230var div=l('templeGod'+M.dragging.id);231div.className='ready templeGod titleFont';232div.style.transform='none';233if (M.slotHovered!=-1 && (M.swaps==0 || M.dragging.slot==M.slotHovered))//dropping on a slot but no swaps left, or slot is the same as the original234{235if (M.dragging.slot!=-1) l('templeSlot'+M.dragging.slot).appendChild(div);236else l('templeGodPlaceholder'+(M.dragging.id)).parentNode.insertBefore(div,l('templeGodPlaceholder'+(M.dragging.id)));237PlaySound('snd/sell1.mp3',0.75);238}239else if (M.slotHovered!=-1)//dropping on a slot240{241M.useSwap(1);242M.lastSwapT=0;243244var prev=M.slot[M.slotHovered];//id of the god already in the slot245if (prev!=-1)246{247prev=M.godsById[prev];248var prevDiv=l('templeGod'+prev.id);249if (M.dragging.slot!=-1)//swap with god's previous slot250{251l('templeSlot'+M.dragging.slot).appendChild(prevDiv);252}253else//swap back to roster254{255var other=l('templeGodPlaceholder'+(prev.id));256other.parentNode.insertBefore(prevDiv,other);257}258}259l('templeSlot'+M.slotHovered).appendChild(div);260M.slotGod(M.dragging,M.slotHovered);261262PlaySound('snd/tick.mp3');263PlaySound('snd/spirit.mp3',0.5);264265var rect=div.getBoundingClientRect();266Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);267}268else//dropping back to roster269{270var other=l('templeGodPlaceholder'+(M.dragging.id));271other.parentNode.insertBefore(div,other);272other.style.display='none';273M.slotGod(M.dragging,-1);274PlaySound('snd/sell1.mp3',0.75);275}276M.dragging=false;277}278279M.slotHovered=-1;280M.hoverSlot=function(what)281{282M.slotHovered=what;283if (M.dragging)284{285if (M.slotHovered==-1) l('templeGodPlaceholder'+M.dragging.id).style.display='inline-block';286else l('templeGodPlaceholder'+M.dragging.id).style.display='none';287PlaySound('snd/clickb'+Math.floor(Math.random()*7+1)+'.mp3',0.75);288}289}290291//external292Game.hasGod=function(what)293{294var god=M.gods[what];295for (var i=0;i<3;i++)296{297if (M.slot[i]==god.id) return (i+1);298}299return false;300}301Game.forceUnslotGod=function(god)302{303var god=M.gods[god];304if (god.slot==-1) return false;305var div=l('templeGod'+god.id);306var other=l('templeGodPlaceholder'+(god.id));307other.parentNode.insertBefore(div,other);308other.style.display='none';309M.slotGod(god,-1);310return true;311}312Game.useSwap=M.useSwap;313314315var str='';316str+='<style>'+317'#templeBG{background:url(img/shadedBorders.png),url(img/BGpantheon.jpg);background-size:100% 100%,auto;position:absolute;left:0px;right:0px;top:0px;bottom:16px;}'+318'#templeContent{position:relative;box-sizing:border-box;padding:4px 24px;text-align:center;}'+319'#templeGods{text-align:center;width:100%;padding:8px;box-sizing:border-box;}'+320'.templeIcon{pointer-events:none;margin:12px 6px 0px 6px;width:48px;height:48px;opacity:0.8;position:relative;}'+321'.templeSlot .templeIcon{margin:2px 6px 0px 6px;}'+322'.templeGod{box-shadow:4px 4px 4px #000;cursor:pointer;position:relative;color:#f33;opacity:0.8;text-shadow:0px 0px 4px #000,0px 0px 6px #000;font-weight:bold;font-size:12px;display:inline-block;width:60px;height:74px;background:url(img/spellBG.png);}'+323'.templeGod.ready{color:rgba(255,255,255,0.8);opacity:1;}'+324'.templeGod.ready:hover{color:#fff;}'+325'.templeGod:hover,.templeDragged{box-shadow:6px 6px 6px 2px #000;z-index:1000000001;top:-1px;}'+326'.templeGod:active{top:1px;}'+327'.templeGod.ready .templeIcon{opacity:1;}'+328'.templeGod:hover{background-position:0px -74px;} .templeGod:active{background-position:0px 74px;}'+329'.templeGod1{background-position:-60px 0px;} .templeGod1:hover{background-position:-60px -74px;} .templeGod1:active{background-position:-60px 74px;}'+330'.templeGod2{background-position:-120px 0px;} .templeGod2:hover{background-position:-120px -74px;} .templeGod2:active{background-position:-120px 74px;}'+331'.templeGod3{background-position:-180px 0px;} .templeGod3:hover{background-position:-180px -74px;} .templeGod3:active{background-position:-180px 74px;}'+332333'.templeGod:hover .templeIcon{top:-1px;}'+334'.templeGod.ready:hover .templeIcon{animation-name:bounce;animation-iteration-count:infinite;animation-duration:0.8s;}'+335'.noFancy .templeGod.ready:hover .templeIcon{animation:none;}'+336337'.templeGem{z-index:100;width:24px;height:24px;}'+338'.templeEffect{font-weight:bold;font-size:11px;position:relative;margin:0px -12px;padding:4px;padding-left:28px;}'+339'.description .templeEffect{border-top:1px solid rgba(255,255,255,0.15);background:linear-gradient(to top,rgba(255,255,255,0.1),rgba(255,255,255,0));}'+340'.templeEffect .templeGem{position:absolute;left:0px;top:0px;}'+341'.templeEffectOn{text-shadow:0px 0px 6px rgba(255,255,255,0.75);color:#fff;}'+342'.templeGod .templeGem{position:absolute;left:18px;bottom:8px;pointer-events:none;}'+343'.templeGem1{background-position:-1104px -720px;}'+344'.templeGem2{background-position:-1128px -720px;}'+345'.templeGem3{background-position:-1104px -744px;}'+346347'.templeSlot .templeGod,.templeSlot .templeGod:hover,.templeSlot .templeGod:active{background:none;}'+348349'.templeSlotDrag{position:absolute;left:0px;top:0px;right:0px;bottom:0px;background:#999;opacity:0;cursor:pointer;}'+350351'#templeDrag{position:absolute;left:0px;top:0px;z-index:1000000000000;}'+352'.templeGod{transition:transform 0.1s;}'+353'#templeDrag .templeGod{position:absolute;left:0px;top:0px;}'+354'.templeDragged{pointer-events:none;}'+355356'.templeGodPlaceholder{background:red;opacity:0;display:none;width:60px;height:74px;}'+357358'#templeSlots{margin:4px auto;text-align:center;}'+359'#templeSlot0{top:-4px;}'+360'#templeSlot1{top:0px;}'+361'#templeSlot2{top:4px;}'+362363'#templeInfo{position:relative;display:inline-block;margin:8px auto 0px auto;padding:8px 16px;padding-left:32px;text-align:center;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;}'+364'</style>';365str+='<div id="templeBG"></div>';366str+='<div id="templeContent">';367str+='<div id="templeDrag"></div>';368str+='<div id="templeSlots">';369for (var i in M.slot)370{371var me=M.slot[i];372str+='<div class="ready templeGod templeGod'+(i%4)+' templeSlot titleFont" id="templeSlot'+i+'" '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.slotTooltip('+i+')','this')+'><div class="usesIcon shadowFilter templeGem templeGem'+(parseInt(i)+1)+'"></div></div>';373}374str+='</div>';375str+='<div id="templeInfo"><div '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.refillTooltip','this')+' id="templeLumpRefill" class="usesIcon shadowFilter lumpRefill" style="left:-6px;top:-10px;background-position:'+(-29*48)+'px '+(-14*48)+'px;"></div><div id="templeSwaps" '+Game.getTooltip('<div style="padding:8px;width:350px;font-size:11px;text-align:center;">Each time you slot a spirit, you use up one worship swap.<div class="line"></div>If you have 2 swaps left, the next one will refill after 1 hour.<br>If you have 1 swap left, the next one will refill after 4 hours.<br>If you have 0 swaps left, you will get one after 16 hours.<div class="line"></div>Unslotting a spirit costs no swaps.</div>')+'>-</div></div>';376str+='<div id="templeGods">';377for (var i in M.gods)378{379var me=M.gods[i];380var icon=me.icon||[0,0];381str+='<div class="ready templeGod templeGod'+(me.id%4)+' titleFont" id="templeGod'+me.id+'" '+Game.getDynamicTooltip('Game.ObjectsById['+M.parent.id+'].minigame.godTooltip('+me.id+')','this')+'><div class="usesIcon shadowFilter templeIcon" style="background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div><div class="templeSlotDrag" id="templeGodDrag'+me.id+'"></div></div>';382str+='<div class="templeGodPlaceholder" id="templeGodPlaceholder'+me.id+'"></div>';383}//<div class="usesIcon shadowFilter templeGem templeGem'+(me.id%3+1)+'"></div>384str+='</div>';385str+='</div>';386div.innerHTML=str;387M.swapsL=l('templeSwaps');388M.lumpRefill=l('templeLumpRefill');389390for (var i in M.gods)391{392var me=M.gods[i];393AddEvent(l('templeGodDrag'+me.id),'mousedown',function(what){return function(e){if (e.button==0){M.dragGod(what);}}}(me));394AddEvent(l('templeGodDrag'+me.id),'mouseup',function(what){return function(e){if (e.button==0){M.dropGod(what);}}}(me));395}396for (var i in M.slot)397{398var me=M.slot[i];399AddEvent(l('templeSlot'+i),'mouseover',function(what){return function(){M.hoverSlot(what);}}(i));400AddEvent(l('templeSlot'+i),'mouseout',function(what){return function(e){if (e.button==0){M.hoverSlot(-1);}}}(i));401}402403AddEvent(document,'mouseup',M.dropGod);404405406M.refillTooltip=function(){407return '<div style="padding:8px;width:300px;font-size:11px;text-align:center;">Click to refill all your worship swaps for <span class="price lump">1 sugar lump</span>.'+408(Game.canRefillLump()?'<br><small>(can be done once every '+Game.sayTime(Game.getLumpRefillMax(),-1)+')</small>':('<br><small class="red">(usable again in '+Game.sayTime(Game.getLumpRefillRemaining()+Game.fps,-1)+')</small>'))+409'</div>';410};411AddEvent(M.lumpRefill,'click',function(){412if (M.swaps<3)413{Game.refillLump(1,function(){414M.swaps=3;415M.swapT=Date.now();416PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);417});}418});419420//M.parent.switchMinigame(1);421}422M.save=function()423{424//output cannot use ",", ";" or "|"425var str='';426for (var i in M.slot)427{str+=parseFloat(M.slot[i])+'/';}428str=str.slice(0,-1);429str+=' '+parseFloat(M.swaps)+' '+parseFloat(M.swapT);430str+=' '+parseInt(M.parent.onMinigame?'1':'0');431return str;432}433M.load=function(str)434{435//interpret str; called after .init436//note : not actually called in the Game's load; see "minigameSave" in main.js437if (!str) return false;438var i=0;439var spl=str.split(' ');440var bit=spl[i++].split('/')||[];441for (var ii in M.slot)442{443if (parseFloat(bit[ii])!=-1)444{445var god=M.godsById[parseFloat(bit[ii])];446M.slotGod(god,ii);447l('templeSlot'+god.slot).appendChild(l('templeGod'+god.id));448}449}450M.swaps=parseFloat(spl[i++]||3);451M.swapT=parseFloat(spl[i++]||Date.now());452var on=parseInt(spl[i++]||0);if (on && Game.ascensionMode!=1) M.parent.switchMinigame(1);453}454M.reset=function()455{456M.swaps=3;457M.swapT=Date.now();458for (var i in M.slot) {M.slot[i]=-1;}459for (var i in M.gods)460{461var me=M.gods[i];462me.slot=-1;463var other=l('templeGodPlaceholder'+(me.id));464other.parentNode.insertBefore(l('templeGod'+me.id),other);465other.style.display='none';466}467}468M.logic=function()469{470//run each frame471var t=1000*60*60;472if (M.swaps==0) t=1000*60*60*16;473else if (M.swaps==1) t=1000*60*60*4;474var t2=M.swapT+t-Date.now();475if (t2<=0 && M.swaps<3) {M.swaps++;M.swapT=Date.now();}476M.lastSwapT++;477}478M.draw=function()479{480//run each draw frame481if (M.dragging)482{483var box=l('templeDrag').getBoundingClientRect();484var x=Game.mouseX-box.left-60/2;485var y=Game.mouseY-box.top;486if (M.slotHovered!=-1)//snap to slots487{488var box2=l('templeSlot'+M.slotHovered).getBoundingClientRect();489x=box2.left-box.left;490y=box2.top-box.top;491}492l('templeGod'+M.dragging.id).style.transform='translate('+(x)+'px,'+(y)+'px)';493}494var t=1000*60*60;495if (M.swaps==0) t=1000*60*60*16;496else if (M.swaps==1) t=1000*60*60*4;497var t2=M.swapT+t-Date.now();498M.swapsL.innerHTML='Worship swaps : <span class="titleFont" style="color:'+(M.swaps>0?'#fff':'#c00')+';">'+M.swaps+'/'+(3)+'</span>'+((M.swaps<3)?' (next in '+Game.sayTime((t2/1000+1)*Game.fps,-1)+')':'');499}500M.init(l('rowSpecial'+M.parent.id));501}502var M=0;503504