diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties index 82662c0..0ba06f2 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties @@ -238,6 +238,8 @@ WIN_LESS_DAMAGE={0} §7less damaged WIN_POINTS={0} has more points WIN_POINTS_EQUAL=§7Equal points WIN_TECHKO={0} §7is tech K.O. -# WIN_AMONG_US={0} §7is tech K.O. +WIN_IMPOSTER_DEAD={0} §7killed the imposter +WIN_CREWMATE_DEAD={0} §7killed all creamates AMONG_US_IMPOSTER_MESSAGE = §4You are the Imposter§8! §7Kill all your teammates to win the game! +AMONG_US_IMPOSTER_AMONG_MESSAGE = §4There is an Imposter among us§8! §7Kill him to win the game! diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties index b5994e0..82036af 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties @@ -223,6 +223,8 @@ WIN_LESS_DAMAGE={0} §7weniger beschädigt WIN_POINTS={0} hat mehr Punkte WIN_POINTS_EQUAL=§7Gleicher Punktestand WIN_TECHKO={0} §7ist Tech K.O. -# WIN_AMONG_US={0} §7is tech K.O. +WIN_IMPOSTER_DEAD={0} §7 hat den Imposter getötet +WIN_CREWMATE_DEAD={0} §7 hat alle Crewmates getötet -AMONG_US_IMPOSTER_MESSAGE = §4Du bist ein Imposter§8! §7Du musst alle Teammates töten, um zu gewinnen. \ No newline at end of file +AMONG_US_IMPOSTER_MESSAGE = §4Du bist ein Imposter§8! §7Du musst alle Teammates töten, um zu gewinnen. +AMONG_US_IMPOSTER_AMONG_MESSAGE = §4Es ist ein Imposter unter uns§8! §7Tötet ihn, um das Spiel zu gewinnen! \ No newline at end of file diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java b/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java index bbc9778..7e040db 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java @@ -43,21 +43,23 @@ public class WinconditionAmongUs extends Wincondition implements Listener { public WinconditionAmongUs() { super("AmongUs"); new OneShotStateDependent(Winconditions.AMONG_US, FightState.Ingame, () -> { - FightPlayer redPlayer = getRandomPlayer(Fight.getRedTeam().getPlayers()); - FightPlayer bluePlayer = getRandomPlayer(Fight.getBlueTeam().getPlayers()); - - imposter.put(Fight.getRedTeam(), redPlayer); - imposter.put(Fight.getBlueTeam(), bluePlayer); - - FightSystem.getMessage().send("AMONG_US_IMPOSTER_MESSAGE", redPlayer.getPlayer()); - FightSystem.getMessage().send("AMONG_US_IMPOSTER_MESSAGE", bluePlayer.getPlayer()); + imposter.put(Fight.getRedTeam(), sendMessageAndReturnImposter(Fight.getRedTeam().getPlayers())); + imposter.put(Fight.getBlueTeam(), sendMessageAndReturnImposter(Fight.getBlueTeam().getPlayers())); }); new StateDependentListener(Winconditions.AMONG_US, FightState.Ingame, this); } - private FightPlayer getRandomPlayer(Collection fightPlayers) { + private FightPlayer sendMessageAndReturnImposter(Collection fightPlayers) { List fightPlayerList = new ArrayList<>(fightPlayers); - return fightPlayerList.get(random.nextInt(fightPlayerList.size())); + FightPlayer imposter = fightPlayerList.get(random.nextInt(fightPlayerList.size())); + for (FightPlayer fightPlayer : fightPlayerList) { + if (fightPlayer == imposter) { + FightSystem.getMessage().send("AMONG_US_IMPOSTER_MESSAGE", fightPlayer.getPlayer()); + } else { + FightSystem.getMessage().send("AMONG_US_IMPOSTER_AMONG_MESSAGE", fightPlayer.getPlayer()); + } + } + return imposter; } @EventHandler @@ -77,9 +79,9 @@ public class WinconditionAmongUs extends Wincondition implements Listener { FightPlayer current = team.getFightPlayer(player); if (current == imposter.get(team)) { - // TODO: Add message that the imposter is dead and the same team won! + win(team, "WIN_IMPOSTER_DEAD", team.getPrefix()); } else if (team.getPlayers().contains(current) && team.getPlayers().contains(imposter.get(team))) { - // TODO: Add message that the all except the imposter are dead and the other team won! + win(Fight.getOpposite(team), "WIN_CREWMATE_DEAD", Fight.getOpposite(team).getPrefix()); } } }