GenerateZPM fixed, now it doesn't reach infinite purrs.
This commit is contained in:
parent
4054d4a728
commit
e16aa6824a
@ -219,19 +219,32 @@ 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());
|
compare = source.getAdjacentTile(Direction.getRandom());
|
||||||
if (compare != null)
|
if (compare != null)
|
||||||
if(!compare.hasZPM() && (compare.playerBaseOnTile == null))
|
|
||||||
source = compare;
|
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());
|
source.setZPMOnTile(new ZPM());
|
||||||
dungeon.setZPMsToWin(dungeon.getZPMsToWin()+1);
|
dungeon.setZPMsToWin(dungeon.getZPMsToWin()+1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user