A ZPM is generated after every 2 picked up ZPMs.

This commit is contained in:
ericnerdo 2016-05-14 22:37:43 +02:00
parent 97622f7298
commit 68253e7a5b
4 changed files with 34 additions and 0 deletions

View File

@ -22,4 +22,9 @@ public class Field extends cicaprojekt.Tile {
@Override
public void onExit(PlayerBase playerBase) {}
@Override
public boolean canHazZPM() {
return true;
}
}

View File

@ -195,4 +195,28 @@ public class Game {
stopGame(GameoverCause.JAFFAWON);
}
}
public void generateZPM() {
int temp = jaffa.getZPMCount() + oneill.getZPMCount();
System.out.println(temp);
if(((jaffa.getZPMCount() + oneill.getZPMCount()) % 2) == 0) {
System.out.println("cica");
Tile source = oneill.getCurrentTile();
Tile compare;
for (int i = 0; i < dungeon.getMapHeight() * dungeon.getMapWidth(); i++) {
compare = source.getAdjacentTile(Direction.getRandom());
if (compare != null)
source = compare;
}
while (!source.canHazZPM() && !source.hasZPM() && (source.playerBaseOnTile != null)) {
compare = source.getAdjacentTile(Direction.getRandom());
if (compare != null)
source = compare;
}
System.out.println(source.getX() + " " + source.getY());
source.setZPMOnTile(new ZPM());
}
}
}

View File

@ -42,6 +42,7 @@ public class Player extends PlayerBase {
@Override
public void pickZPM(Tile tile) {
zpmContainer.add(tile.getZPMFromTile());
Game.instance.generateZPM();
}
public void shootStargate(Stargate stargate) {

View File

@ -97,4 +97,8 @@ public abstract class Tile {
public boolean boxPermission() {
return true;
}
public boolean canHazZPM() {
return false;
}
}