SteamWar/FightSystem
Archiviert
13
1

AmongUS #367

Zusammengeführt
Lixfel hat 9 Commits von AmongUS nach master 2022-10-08 18:30:11 +02:00 zusammengeführt
3 geänderte Dateien mit 21 neuen und 15 gelöschten Zeilen
Nur Änderungen aus Commit 67a0d0f5e9 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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!

Datei anzeigen

@ -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.
AMONG_US_IMPOSTER_AMONG_MESSAGE = §4Es ist ein Imposter unter uns§8! §7Tötet ihn, um das Spiel zu gewinnen!

Datei anzeigen

@ -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<FightPlayer> fightPlayers) {
private FightPlayer sendMessageAndReturnImposter(Collection<FightPlayer> fightPlayers) {
List<FightPlayer> 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());
}
}
}