flooded flagged cells now get substracted from flagsPlaced

This commit is contained in:
LunarAkai 2024-03-24 15:22:20 +01:00
commit 7355c2e0df
3 changed files with 13 additions and 4 deletions

View file

@ -356,6 +356,7 @@ public class MinecleanerArena {
Vector2i pos = floodedCells.get(i).position;
setBlockForCellType(pos.x, pos.y, floodedCells.get(i));
}
flagsPlaced = flagsPlaced - currentMinecleanerGame.getFloodedFlaggedCells();
}
}
}

View file

@ -129,8 +129,6 @@ public class MinecleanerManager {
player.sendMessage(ChatColor.YELLOW + "Game Over! Du konntest das Minecleaner-Feld nicht erfolgreich lösen!");
arena.showMines();
if(sg != null) {
ps.increaseScore(sg, 1);
}

View file

@ -17,6 +17,7 @@ public class Game {
private Tilemap tilemap;
private ArrayList<Cell> floodedCells;
private int floodedFlaggedCellsCounter;
private ArrayList<Cell> explodedCells;
public Game(MinecleanerPlugin plugin, int width, int mineCount) {
@ -27,6 +28,7 @@ public class Game {
this.floodedCells = new ArrayList<>();
this.explodedCells = new ArrayList<>();
floodedFlaggedCellsCounter = 0;
}
public void start() {
@ -150,9 +152,12 @@ public class Game {
break;
}
case Empty: {
if(!floodedCells.isEmpty()) {;
if(!floodedCells.isEmpty()) {
floodedCells.clear();
}
if(floodedFlaggedCellsCounter != 0) {
floodedFlaggedCellsCounter = 0;
}
flood(cell);
checkWinCondition();
break;
@ -174,6 +179,7 @@ public class Game {
if(cell.isFlagged()) {
cell.setFlaggedState(false);
floodedFlaggedCellsCounter = floodedFlaggedCellsCounter + 1;
}
cell.setRevealed();
@ -272,4 +278,8 @@ public class Game {
public ArrayList<Cell> getExplodedCells() {
return explodedCells;
}
public int getFloodedFlaggedCells() {
return floodedFlaggedCellsCounter;
}
}