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
				
			
		|  | @ -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; | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue