flooded flagged cells now get substracted from flagsPlaced
This commit is contained in:
parent
c2ba644f21
commit
7355c2e0df
3 changed files with 13 additions and 4 deletions
|
|
@ -343,7 +343,7 @@ public class MinecleanerArena {
|
||||||
|
|
||||||
currentMinecleanerGame.reveal(x, y);
|
currentMinecleanerGame.reveal(x, y);
|
||||||
setBlockForCellType(x, y, cell);
|
setBlockForCellType(x, y, cell);
|
||||||
|
|
||||||
if(currentMinecleanerGame.gameover) {
|
if(currentMinecleanerGame.gameover) {
|
||||||
plugin.getManager().handleGameover(player, this, !(cell.isRevealed() && cell.isExploded()));
|
plugin.getManager().handleGameover(player, this, !(cell.isRevealed() && cell.isExploded()));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -356,6 +356,7 @@ public class MinecleanerArena {
|
||||||
Vector2i pos = floodedCells.get(i).position;
|
Vector2i pos = floodedCells.get(i).position;
|
||||||
setBlockForCellType(pos.x, pos.y, floodedCells.get(i));
|
setBlockForCellType(pos.x, pos.y, floodedCells.get(i));
|
||||||
}
|
}
|
||||||
|
flagsPlaced = flagsPlaced - currentMinecleanerGame.getFloodedFlaggedCells();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,6 @@ public class MinecleanerManager {
|
||||||
player.sendMessage(ChatColor.YELLOW + "Game Over! Du konntest das Minecleaner-Feld nicht erfolgreich lösen!");
|
player.sendMessage(ChatColor.YELLOW + "Game Over! Du konntest das Minecleaner-Feld nicht erfolgreich lösen!");
|
||||||
arena.showMines();
|
arena.showMines();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(sg != null) {
|
if(sg != null) {
|
||||||
ps.increaseScore(sg, 1);
|
ps.increaseScore(sg, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ public class Game {
|
||||||
private Tilemap tilemap;
|
private Tilemap tilemap;
|
||||||
|
|
||||||
private ArrayList<Cell> floodedCells;
|
private ArrayList<Cell> floodedCells;
|
||||||
|
private int floodedFlaggedCellsCounter;
|
||||||
private ArrayList<Cell> explodedCells;
|
private ArrayList<Cell> explodedCells;
|
||||||
|
|
||||||
public Game(MinecleanerPlugin plugin, int width, int mineCount) {
|
public Game(MinecleanerPlugin plugin, int width, int mineCount) {
|
||||||
|
|
@ -27,6 +28,7 @@ public class Game {
|
||||||
|
|
||||||
this.floodedCells = new ArrayList<>();
|
this.floodedCells = new ArrayList<>();
|
||||||
this.explodedCells = new ArrayList<>();
|
this.explodedCells = new ArrayList<>();
|
||||||
|
floodedFlaggedCellsCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
|
|
@ -150,9 +152,12 @@ public class Game {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Empty: {
|
case Empty: {
|
||||||
if(!floodedCells.isEmpty()) {;
|
if(!floodedCells.isEmpty()) {
|
||||||
floodedCells.clear();
|
floodedCells.clear();
|
||||||
}
|
}
|
||||||
|
if(floodedFlaggedCellsCounter != 0) {
|
||||||
|
floodedFlaggedCellsCounter = 0;
|
||||||
|
}
|
||||||
flood(cell);
|
flood(cell);
|
||||||
checkWinCondition();
|
checkWinCondition();
|
||||||
break;
|
break;
|
||||||
|
|
@ -174,6 +179,7 @@ public class Game {
|
||||||
|
|
||||||
if(cell.isFlagged()) {
|
if(cell.isFlagged()) {
|
||||||
cell.setFlaggedState(false);
|
cell.setFlaggedState(false);
|
||||||
|
floodedFlaggedCellsCounter = floodedFlaggedCellsCounter + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell.setRevealed();
|
cell.setRevealed();
|
||||||
|
|
@ -272,4 +278,8 @@ public class Game {
|
||||||
public ArrayList<Cell> getExplodedCells() {
|
public ArrayList<Cell> getExplodedCells() {
|
||||||
return explodedCells;
|
return explodedCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getFloodedFlaggedCells() {
|
||||||
|
return floodedFlaggedCellsCounter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue