From da5d6dbdff399dbaebd363f0c0b75e85204f379c Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Mon, 1 May 2023 15:08:42 +1000 Subject: [PATCH] game: Added custom message for no villages left --- src/comp1110/ass2/gui/Game.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/comp1110/ass2/gui/Game.java b/src/comp1110/ass2/gui/Game.java index d4315a1..ee2557c 100644 --- a/src/comp1110/ass2/gui/Game.java +++ b/src/comp1110/ass2/gui/Game.java @@ -105,7 +105,14 @@ public class Game extends Application { char typeC = 'S'; if (type == 1){ typeC = 'T'; + if (currentGame.getCurrentPlayer().getVillages().length >= 5){ + sendMessage("You have placed all your villages"); + return; + } } + + + if (currentGame.isMoveValid(selectedTile,typeC)){ currentGame.placePiece(selectedTile,typeC); Player player = currentGame.getCurrentPlayer();