From 2f8c4b71681e73a14ed4629b55ca4ba11f3e9563 Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Sun, 15 May 2016 22:59:06 +0200 Subject: [PATCH] ZPM generating patched. If it won't work this time, imma look for the razors in the drawer... --- cicaprojekt/Game.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cicaprojekt/Game.java b/cicaprojekt/Game.java index 8edded1..7230f7b 100644 --- a/cicaprojekt/Game.java +++ b/cicaprojekt/Game.java @@ -228,7 +228,7 @@ public class Game { } while (!source.canHazZPM()) { - int j = 0; + int newSourceCounter = 0; for (int i = 0; i < dungeon.getMapHeight(); i++) { compare = source.getAdjacentTile(Direction.getRandom()); @@ -236,12 +236,17 @@ public class Game { source = compare; } - while(j != 20) { + while(newSourceCounter != 20) { compare = source.getAdjacentTile(Direction.getRandom()); - if (compare != null) - if (!compare.hasZPM() && (compare.playerBaseOnTile == null)) - source = compare; - j++; + if (compare != null) { + source = compare; + if (!compare.hasZPM() && (compare.playerBaseOnTile == null)) { + if (source.canHazZPM()) { + break; + } + } + } + newSourceCounter++; } }