A ZPM is generated after every 2 picked up ZPMs.
This commit is contained in:
parent
97622f7298
commit
68253e7a5b
@ -22,4 +22,9 @@ public class Field extends cicaprojekt.Tile {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExit(PlayerBase playerBase) {}
|
public void onExit(PlayerBase playerBase) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canHazZPM() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,4 +195,28 @@ public class Game {
|
|||||||
stopGame(GameoverCause.JAFFAWON);
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ public class Player extends PlayerBase {
|
|||||||
@Override
|
@Override
|
||||||
public void pickZPM(Tile tile) {
|
public void pickZPM(Tile tile) {
|
||||||
zpmContainer.add(tile.getZPMFromTile());
|
zpmContainer.add(tile.getZPMFromTile());
|
||||||
|
Game.instance.generateZPM();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shootStargate(Stargate stargate) {
|
public void shootStargate(Stargate stargate) {
|
||||||
|
@ -97,4 +97,8 @@ public abstract class Tile {
|
|||||||
public boolean boxPermission() {
|
public boolean boxPermission() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canHazZPM() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user