GenerateZPM fixed, now it doesn't reach infinite purrs.

This commit is contained in:
ericnerdo 2016-05-15 13:11:18 +02:00
parent 4054d4a728
commit e16aa6824a

View File

@ -219,17 +219,30 @@ public class Game {
if(((jaffa.getZPMCount() + oneill.getZPMCount()) % 2) == 0) { if(((jaffa.getZPMCount() + oneill.getZPMCount()) % 2) == 0) {
Tile source = oneill.getCurrentTile(); Tile source = oneill.getCurrentTile();
Tile compare; Tile compare;
for (int i = 0; i < dungeon.getMapHeight() * dungeon.getMapWidth(); i++) {
for (int i = 0; i < dungeon.getMapHeight(); i++) {
compare = source.getAdjacentTile(Direction.getRandom()); compare = source.getAdjacentTile(Direction.getRandom());
if (compare != null) if (compare != null)
source = compare; source = compare;
} }
while (!source.canHazZPM()) { while (!source.canHazZPM()) {
int j = 0;
for (int i = 0; i < dungeon.getMapHeight(); i++) {
compare = source.getAdjacentTile(Direction.getRandom());
if (compare != null)
source = compare;
}
while(j != 20) {
compare = source.getAdjacentTile(Direction.getRandom()); compare = source.getAdjacentTile(Direction.getRandom());
if (compare != null) if (compare != null)
if (!compare.hasZPM() && (compare.playerBaseOnTile == null)) if (!compare.hasZPM() && (compare.playerBaseOnTile == null))
source = compare; source = compare;
j++;
}
} }
source.setZPMOnTile(new ZPM()); source.setZPMOnTile(new ZPM());