public void WildPokemonSpawnerTick() { ++currentTick; if (currentTick == 250) { //MAGNEMITES float probMags = (0.005f * this.powerBuildingCount) / (Mathf.Pow(spawnedMagnemites, spawnedMagnemites)); float rollMags = Rand.Value; if (rollMags < probMags) { Pawn mag = PawnGenerator.GeneratePawn(PawnKindDef.Named("Pokemon_Magnemite")); IntVec3 loc; RCellFinder.TryFindRandomPawnEntryCell(out loc, this.map, CellFinder.EdgeRoadChance_Animal, true, null); IntVec3 loc2 = CellFinder.RandomClosewalkCellNear(loc, this.map, 8, null); GenSpawn.Spawn(mag, loc2, this.map); ++spawnedMagnemites; } currentTick = 0; //MAGNEMITES_END //GRIMERS if (!map.listerFilthInHomeArea.FilthInHomeArea.NullOrEmpty()) { float probGrimer = ((float)map.listerFilthInHomeArea.FilthInHomeArea.Count / 120f); float rollGrimer = Rand.Value; if (rollGrimer < probGrimer) { Pokemon_Grimer grimer = (Pokemon_Grimer )PawnGenerator.GeneratePawn(PawnKindDef.Named("Pokemon_Grimer")); IntVec3 loc2 = CellFinder.RandomClosewalkCellNear(map.areaManager.Home.ActiveCells.RandomElement(), this.map, 8, null); List <Thing> filth = map.listerFilthInHomeArea.FilthInHomeArea; for (int k = 0; k < filth.Count; k++) { grimer.IncrementFilth(); filth [k].DeSpawn(); } map.listerFilthInHomeArea.FilthInHomeArea.Clear(); GenSpawn.Spawn(grimer, loc2, this.map); } } //GRIMERS_END } }