ZPM generation fixed.

This commit is contained in:
ericnerdo 2016-05-14 23:18:29 +02:00
parent 74a34e61ad
commit b92f164948
2 changed files with 8 additions and 6 deletions

View File

@ -198,10 +198,7 @@ public class Game {
} }
public void generateZPM() { public void generateZPM() {
int temp = jaffa.getZPMCount() + oneill.getZPMCount();
System.out.println(temp);
if(((jaffa.getZPMCount() + oneill.getZPMCount()) % 2) == 0) { if(((jaffa.getZPMCount() + oneill.getZPMCount()) % 2) == 0) {
System.out.println("cica");
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() * dungeon.getMapWidth(); i++) {
@ -210,12 +207,12 @@ public class Game {
source = compare; source = compare;
} }
while (!source.canHazZPM() && !source.hasZPM() && (source.playerBaseOnTile != null)) { while (!source.canHazZPM()) {
compare = source.getAdjacentTile(Direction.getRandom()); compare = source.getAdjacentTile(Direction.getRandom());
if (compare != null) if (compare != null)
if(!compare.hasZPM() && (compare.playerBaseOnTile == null))
source = compare; source = compare;
} }
System.out.println(source.getX() + " " + source.getY());
source.setZPMOnTile(new ZPM()); source.setZPMOnTile(new ZPM());
} }

View File

@ -55,4 +55,9 @@ public class Scale extends Field {
else else
gateConnected.setOpen(false); gateConnected.setOpen(false);
} }
@Override
public boolean canHazZPM() {
return false;
}
} }