From 0c9dfd13c846ad632893ac9cde2c86e938a17e8e Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 18 May 2022 13:26:29 +0200 Subject: [PATCH] updated diary, fixed kicked off ghosts causing noise bug, who was voted for is announced by name rather than by number, when humans win it says who they voted for / who the OG was. Other small adjustements to vote announcements --- Meilenstein V/Diary.txt | 3 +++ OgGhostWinners.txt | 1 + .../dmi/dbis/cs108/gamelogic/ClientGameInfoHandler.java | 8 ++++---- .../ch/unibas/dmi/dbis/cs108/gamelogic/VoteHandler.java | 8 ++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Meilenstein V/Diary.txt b/Meilenstein V/Diary.txt index e539ab1..1c4d0fb 100644 --- a/Meilenstein V/Diary.txt +++ b/Meilenstein V/Diary.txt @@ -366,3 +366,6 @@ Habe Highscore und Players in Lobbies auf die einfachst mögliche Art mit Textfl 16.5.2022 - Jonas Have been working on implementing all sound effects over the last couple of days + +17. & 18.5.2022 - Jonas +Working on outreach stuff and presentation. \ No newline at end of file diff --git a/OgGhostWinners.txt b/OgGhostWinners.txt index cf2700c..d463ca8 100644 --- a/OgGhostWinners.txt +++ b/OgGhostWinners.txt @@ -10,3 +10,4 @@ Jonas Jonas Jonas Jonas, the French delegate +Jonas diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/ClientGameInfoHandler.java b/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/ClientGameInfoHandler.java index 706c284..b6a3554 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/ClientGameInfoHandler.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/ClientGameInfoHandler.java @@ -29,10 +29,10 @@ public class ClientGameInfoHandler { //just messages public static final String youGotGhostyfied = "You are now a ghost!"; - public static final String youGotKickedOff = "Bye bye - you've been kicked off"; - public static final String humansVotedFor = "Humans voted for: "; - public static final String isAHuman = " but they're a human!"; - public static final String gotKickedOff = " is a Ghost and got kicked off"; + public static final String youGotKickedOff = "Bye bye - you've been kicked off."; + public static final String humansVotedFor = "Humans voted for "; + public static final String isAHuman = ", but they're a human!"; + public static final String gotKickedOff = " is a Ghost and got kicked off."; public static final String gotGhostyfied = " is now also a ghost!"; diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/VoteHandler.java b/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/VoteHandler.java index a4b95c7..0a98294 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/VoteHandler.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/VoteHandler.java @@ -89,7 +89,7 @@ public class VoteHandler { ghostification. */ int[] noiseAmount = new int[6]; for (int i = 0; i < passengers.length; i++) { - if (passengers[i].getIsGhost() && i != newGhostPosition) { + if (passengers[i].getIsGhost() && !passengers[i].getKickedOff() && i != newGhostPosition) { NoiseHandler n = new NoiseHandler(); noiseAmount = n.noiseNotifier(passengers[i], g, noiseAmount); } @@ -170,7 +170,7 @@ public class VoteHandler { .getIsGhost()) { // if player with most votes is human, notify everyone about it for (Passenger passenger : passengers) { passenger.send( - ClientGameInfoHandler.humansVotedFor + voteIndex + ClientGameInfoHandler.isAHuman, game); + ClientGameInfoHandler.humansVotedFor + passengers[voteIndex].getName() + ClientGameInfoHandler.isAHuman, game); } for (ClientHandler c: game.getLobby().getLobbyClients()) { //send human vote sound to clients @@ -184,6 +184,10 @@ public class VoteHandler { if (passengers[voteIndex].getIsGhost()) { // if player is a ghost if (passengers[voteIndex].getIsOG()) { // if ghost is OG --> end game, humans win + for (Passenger passenger : passengers) { + passenger.send( + ClientGameInfoHandler.humansVotedFor + passengers[voteIndex].getName() + ", the Original Ghost!", game); + } System.out.println(ClientGameInfoHandler.gameOverHumansWin); return ClientGameInfoHandler.gameOverHumansWin; } else {