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
1 changed files with 17 additions and 4 deletions

View File

@ -219,17 +219,30 @@ public class Game {
if(((jaffa.getZPMCount() + oneill.getZPMCount()) % 2) == 0) {
Tile source = oneill.getCurrentTile();
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());
if (compare != null)
source = compare;
}
while (!source.canHazZPM()) {
compare = source.getAdjacentTile(Direction.getRandom());
if (compare != null)
if(!compare.hasZPM() && (compare.playerBaseOnTile == null))
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());
if (compare != null)
if (!compare.hasZPM() && (compare.playerBaseOnTile == null))
source = compare;
j++;
}
}
source.setZPMOnTile(new ZPM());