SteamWar/FightSystem
Archiviert
13
1

Add initial message
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-10-08 16:56:02 +02:00
Ursprung c4116cba97
Commit b750433f91
4 geänderte Dateien mit 27 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -118,6 +118,7 @@ public class FightSystem extends JavaPlugin {
new HellsBells(); new HellsBells();
new Meteor(); new Meteor();
new WinconditionAmongUs();
new NoPlayersOnlineCountdown(); new NoPlayersOnlineCountdown();
new PreSchemCountdown(); new PreSchemCountdown();

Datei anzeigen

@ -238,3 +238,6 @@ WIN_LESS_DAMAGE={0} §7less damaged
WIN_POINTS={0} has more points WIN_POINTS={0} has more points
WIN_POINTS_EQUAL=§7Equal points WIN_POINTS_EQUAL=§7Equal points
WIN_TECHKO={0} §7is tech K.O. WIN_TECHKO={0} §7is tech K.O.
# WIN_AMONG_US={0} §7is tech K.O.
AMONG_US_IMPOSTER_MESSAGE = §4You are the Imposter§8! §7Kill all your teammates to win the game!

Datei anzeigen

@ -223,3 +223,6 @@ WIN_LESS_DAMAGE={0} §7weniger beschädigt
WIN_POINTS={0} hat mehr Punkte WIN_POINTS={0} hat mehr Punkte
WIN_POINTS_EQUAL=§7Gleicher Punktestand WIN_POINTS_EQUAL=§7Gleicher Punktestand
WIN_TECHKO={0} §7ist Tech K.O. WIN_TECHKO={0} §7ist Tech K.O.
# WIN_AMONG_US={0} §7is tech K.O.
AMONG_US_IMPOSTER_MESSAGE = §4Du bist ein Imposter§8! §7Du musst alle Teammates töten, um zu gewinnen.

Datei anzeigen

@ -19,15 +19,34 @@
package de.steamwar.fightsystem.winconditions; package de.steamwar.fightsystem.winconditions;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent; import de.steamwar.fightsystem.states.OneShotStateDependent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;
public class WinconditionAmongUs extends Wincondition { public class WinconditionAmongUs extends Wincondition {
private final Random random = new Random();
public WinconditionAmongUs() { public WinconditionAmongUs() {
super("AmongUs"); super("AmongUs");
new OneShotStateDependent(Winconditions.AMONG_US, FightState.Ingame, () -> { new OneShotStateDependent(Winconditions.AMONG_US, FightState.Ingame, () -> {
// TODO: Select 1 imposter from each team FightPlayer redPlayer = getRandomPlayer(Fight.getRedTeam().getPlayers());
FightPlayer bluePlayer = getRandomPlayer(Fight.getBlueTeam().getPlayers());
FightSystem.getMessage().send("AMONG_US_IMPOSTER_MESSAGE", redPlayer.getPlayer());
FightSystem.getMessage().send("AMONG_US_IMPOSTER_MESSAGE", bluePlayer.getPlayer());
}); });
} }
private FightPlayer getRandomPlayer(Collection<FightPlayer> fightPlayers) {
List<FightPlayer> fightPlayerList = new ArrayList<>(fightPlayers);
return fightPlayerList.get(random.nextInt(fightPlayerList.size()));
}
} }