@Override
	public void setEncounters(boolean useTimeOfDay,
			List<EncounterSet> encounters) {
		if (!havePatchedFleeing) {
			patchFleeing();
		}
		int offset = romEntry.getValue("WildPokemonOffset");
		Iterator<EncounterSet> areas = encounters.iterator();
		offset = writeLandEncounters(offset, areas, useTimeOfDay); // Johto
		offset = writeSeaEncounters(offset, areas); // Johto
		offset = writeLandEncounters(offset, areas, useTimeOfDay); // Kanto
		offset = writeSeaEncounters(offset, areas); // Kanto
		offset = writeLandEncounters(offset, areas, useTimeOfDay); // Specials
		offset = writeSeaEncounters(offset, areas); // Specials

		// Fishing Data
		offset = romEntry.getValue("FishingWildsOffset");
		for (int k = 0; k < 12; k++) {
			EncounterSet es = areas.next();
			Iterator<Encounter> encs = es.encounters.iterator();
			for (int i = 0; i < 11; i++) {
				offset++;
				if (rom[offset] == 0) {
					if (!useTimeOfDay) {
						// overwrite with a static encounter
						Encounter enc = encs.next();
						rom[offset++] = (byte) enc.pokemon.number;
						rom[offset++] = (byte) enc.level;
					} else {
						// else handle below
						offset += 2;
					}
				} else {
					Encounter enc = encs.next();
					rom[offset++] = (byte) enc.pokemon.number;
					rom[offset++] = (byte) enc.level;
				}
			}
		}
		if (useTimeOfDay) {
			for (int k = 0; k < 11; k++) {
				EncounterSet es = areas.next();
				Iterator<Encounter> encs = es.encounters.iterator();
				for (int i = 0; i < 4; i++) {
					Encounter enc = encs.next();
					rom[offset++] = (byte) enc.pokemon.number;
					rom[offset++] = (byte) enc.level;
				}
			}
		}

		// Headbutt Data
		offset = romEntry.getValue("HeadbuttWildsOffset");
		int limit = romEntry.getValue("HeadbuttTableSize");
		for (int i = 0; i < limit; i++) {
			EncounterSet es = areas.next();
			Iterator<Encounter> encs = es.encounters.iterator();
			while ((rom[offset] & 0xFF) != 0xFF) {
				Encounter enc = encs.next();
				offset++;
				rom[offset++] = (byte) enc.pokemon.number;
				rom[offset++] = (byte) enc.level;
			}
			offset++;
		}

		// Bug Catching Contest Data
		offset = romEntry.getValue("BCCWildsOffset");
		EncounterSet bccES = areas.next();
		Iterator<Encounter> bccEncs = bccES.encounters.iterator();
		while ((rom[offset] & 0xFF) != 0xFF) {
			offset++;
			Encounter enc = bccEncs.next();
			rom[offset++] = (byte) enc.pokemon.number;
			rom[offset++] = (byte) enc.level;
			rom[offset++] = (byte) enc.maxLevel;
		}

	}