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); | ||||
|                 setBlockForCellType(x, y, cell); | ||||
|                  | ||||
| 
 | ||||
|                 if(currentMinecleanerGame.gameover) { | ||||
|                     plugin.getManager().handleGameover(player, this, !(cell.isRevealed() && cell.isExploded())); | ||||
|                 } else { | ||||
|  | @ -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(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -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); | ||||
|             } | ||||
|  |  | |||
|  | @ -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