forked from mdrdatalab/PokeClicker-Helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpokeEggs.js
39 lines (36 loc) · 1.12 KB
/
pokeEggs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function addEgg(){
for( var i = 0; i<App.game.party.caughtPokemon.length; i++){
var poke = App.game.party.caughtPokemon[i]
if(App.game.breeding.hasFreeEggSlot() && BreedingController.visible(poke)()){
// bypass mom using embedded filters and custom categories
App.game.breeding.addPokemonToHatchery(poke)
console.log("addPokemonToHatchery:", poke.name, poke.level, poke.breeding, PokemonHelper.calcNativeRegion(poke.name))
}
}
}
function hatchEggs(){
for(var i = App.game.breeding._eggList.length-1; i>=0; i--){
var egg = App.game.breeding._eggList[i]();
if(egg !== null){
if( egg.canHatch()){
App.game.breeding.hatchPokemonEgg(i)
console.log("hatchPokemonEgg:", egg.pokemon)
}
}
}
}
// raise to global variable
var flagStopEggLoop = false
function loopEggs(){
// start new loop
var looper = setInterval(function() {
hatchEggs()
addEgg()
// stop egg loop
if(flagStopEggLoop) {
console.log("stop egging loop")
clearInterval(looper)
flagStopEggLoop = false
}
}, 6000)
}