This commit is contained in:
Felix Koppe
2024-11-30 13:10:46 +01:00
parent 6a85aca970
commit a78b3acacd
294 changed files with 2824 additions and 9323 deletions

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Animation extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class AudioSettings extends ClientState {
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class Ceremony extends ClientState {
private final CeremonyStateMachine ceremonyStateMachine = new CeremonyStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class CeremonyStateMachine extends ClientStateMachine {
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class ChoosePiece extends ClientState {
private final ChoosePieceStateMachine choosePieceStateMachine = new ChoosePieceStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class ChoosePieceStateMachine extends ClientStateMachine{
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class ChoosePowerCard extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class ClientAutomaton extends ClientStateMachine {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class ClientGameLogic {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public abstract class ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public abstract class ClientStateMachine extends ClientState {
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class DetermineStartPlayer extends ClientState {
private final DetermineStartPlayerStateMachine determineStartPlayerStateMachine = new DetermineStartPlayerStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class DetermineStartPlayerStateMachine extends ClientStateMachine{
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class Dialogs extends ClientState {
private final DialogsStateMachine dialogsStateMachine = new DialogsStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class DialogsStateMachine extends ClientStateMachine {
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class GameState extends ClientState {
private final GameStateMachine gameStateMachine = new GameStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class GameStateMachine extends ClientStateMachine {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Interrupt extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Lobby extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class MainSettings extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class MovePiece extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class NetworkDialog extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class NoPiece extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class PlayPowerCard extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Podium extends ClientState {
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class PowerCard extends ClientState {
private final PowerCardStateMachine powerCardStateMachine = new PowerCardStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class PowerCardStateMachine extends ClientStateMachine {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class RollDice extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class RollRankingDice extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class SelectPiece extends ClientState {
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class Settings extends ClientState {
private final SettingsStateMachine settingsStateMachine = new SettingsStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class SettingsStateMachine extends ClientStateMachine {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Shield extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Spectator extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class StartDialog extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class StartPiece extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Statistics extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Swap extends ClientState {
}

View File

@@ -0,0 +1,5 @@
package pp.mdga.client;
public class Turn extends ClientState {
private final TurnStateMachine turnStateMachine = new TurnStateMachine();
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class TurnStateMachine extends ClientStateMachine {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class VideoSettings extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class WaitRanking extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class Waiting extends ClientState {
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class WaitingPiece extends ClientState {
}

View File

@@ -0,0 +1,9 @@
package pp.mdga.game;
public enum Color {
ARMY,
NAVY,
CYBER,
AIRFORCE
}

View File

@@ -2,33 +2,35 @@
import java.util.*;
import pp.mdga.server.Observer;
/**
* The Game class represents the game state of the Ludo game.
* It contains all the information needed to play the game.
* The game state is updated by the game logic.
*/
public class Game {
/**
* Constants.
*/
public static final int AMOUNT_OF_TURBO_CARDS = 16;
public static final int AMOUNT_OF_SHIELD_AND_SWAP_CARDS = 12;
/**
* Attributes.
*/
private int diceModifier = 1;
private int diceEyes;
private Map<Integer, Player> players = new HashMap<>();
private Map<Color, Player> players = new HashMap<Color, Player>();
private Statistic gameStatistics;
private List<BonusCard> drawPile;
private List<BonusCard> discardPile = new ArrayList<>();
private ArrayList<BonusCard> drawPile;
private ArrayList<BonusCard> discardPile = new ArrayList<>();
private Board board;
private Color activeColor;
private final ArrayList<Observer> observers = new ArrayList<>();
private boolean allRanked = false;
private boolean movablePieces = false;
private boolean allReady = false;
private LinkedList<Color> order;
private Map<Color, Integer> playerConnectionID;
private ArrayList<Observer> observers = new ArrayList<>();
private Player startPlayer;
private Boolean gameHasStarted = false;
private Boolean playerHasDisconnected = false;
private Boolean gameIsInterrupted = false;
private Boolean allRanked = false;
private Boolean movablePieces = false;
private static final int AMOUNT_OF_TURBO_CARDS = 16;
private static final int AMOUNT_OF_SHIELD_AND_SWAP_CARDS = 12;
/**
* This constructor creates a new Game object.
@@ -46,23 +48,223 @@ public Game() {
board = new Board();
}
/**
* This method returns the dice modifier.
*
* @return the dice modifier
*/
public int getDiceModifier() {
return diceModifier;
}
/**
* This method sets the dice modifier.
*
* @param diceModifier the new dice modifier
*/
public void setDiceModifier(int diceModifier) {
this.diceModifier = diceModifier;
}
/**
* This method returns the dice eyes.
*
* @return the dice eyes
*/
public int getDiceEyes() {
return diceEyes;
}
/**
* This method sets the dice eyes.
*
* @param diceEyes the new dice eyes
*/
public void setDiceEyes(int diceEyes) {
this.diceEyes = diceEyes;
}
/**
* This method returns the players.
*
* @return the players
*/
public Map<Color, Player> getPlayers() {
return players;
}
/**
* This method sets the players.
*
* @param players the new players
*/
public void setPlayers(Map<Color, Player> players) {
this.players = players;
}
/**
* This method returns the game statistics.
*
* @return the game statistics
*/
public Statistic getGameStatistics() {
return gameStatistics;
}
/**
* This method sets the game statistics.
*
* @param gameStatistics the new game statistics
*/
public void setGameStatistics(Statistic gameStatistics) {
this.gameStatistics = gameStatistics;
}
/**
* This method returns the draw pile.
*
* @return the draw pile
*/
public ArrayList<BonusCard> getDrawPile() {
return drawPile;
}
/**
* This method sets the draw pile.
*
* @param drawPile the new draw pile
*/
public void setDrawPile(ArrayList<BonusCard> drawPile) {
this.drawPile = drawPile;
}
/**
* This method returns the discard pile.
*
* @return the discard pile
*/
public ArrayList<BonusCard> getDiscardPile() {
return discardPile;
}
/**
* This method sets the discard pile.
*
* @param discardPile the new discard pile
*/
public void setDiscardPile(ArrayList<BonusCard> discardPile) {
this.discardPile = discardPile;
}
/**
* This method returns the board.
*
* @return the board
*/
public Board getBoard() {
return board;
}
/**
* This method sets the board.
*
* @param board the new board
*/
public void setBoard(Board board) {
this.board = board;
}
/**
* This method returns the active color.
*
* @return the active color
*/
public Color getActiveColor() {
return activeColor;
}
/**
* This method sets the active color.
*
* @param activeColor the new active color
*/
public void setActiveColor(Color activeColor) {
this.activeColor = activeColor;
}
/**
* This method returns the order of the players.
*
* @return the order of the players
*/
public LinkedList<Color> getOrder() {
return order;
}
/**
* This method sets the order of the players.
*
* @param order the new order of the players
*/
public void setOrder(LinkedList<Color> order) {
this.order = order;
}
/**
* This method returns the player connection ID.
*
* @return the player connection ID
*/
public Map<Color, Integer> getPlayerConnectionID() {
return playerConnectionID;
}
/**
* This method sets the player connection ID.
*
* @param playerConnectionID the new player connection ID
*/
public void setPlayerConnectionID(Map<Color, Integer> playerConnectionID) {
this.playerConnectionID = playerConnectionID;
}
/**
* This method sets the player connection ID.
*
* @param color the color of the player
* @param connectionID the new connection ID
*/
public void setPlayerConnectionID(Color color, int connectionID) {
playerConnectionID.put(color, connectionID);
}
/**
* This method returns the player connection ID.
*
* @param color the color of the player
* @return the player connection ID
*/
public int getPlayerConnectionID(Color color) {
return playerConnectionID.get(color);
}
/**
* This method adds a player to the game.
*
* @param id the id of the player
* @param color the color of the player
* @param player the player to be added
*/
public void addPlayer(int id, Player player) {
players.put(id, player);
public void addPlayer(Color color, Player player) {
players.put(color, player);
}
/**
* This method removes a player from the game.
*
* @param id the color of the player
* @param color the color of the player
*/
public void removePlayer(int id) {
players.remove(id);
public void removePlayer(Color color) {
players.remove(color);
}
/**
@@ -84,145 +286,49 @@ public void removeObserver(Observer observer) {
}
/**
* This method returns the game has started.
*
* @param id
* @param active
* @return the game has started
*/
public void updatePlayerActiveState(int id, boolean active) {
this.players.get(id).setActive(active);
public Boolean getGameHasStarted() {
return gameHasStarted;
}
/**
* This method will be used to return the player which has the given id parameter.
* This method sets the game has started.
*
* @param id as the unique id of a player as an Integer.
* @return the player with the given id as a Player object.
* @param gameHasStarted the new game has started
*/
public Player getPlayerById(int id) {
return this.players.get(id);
public void setGameHasStarted(Boolean gameHasStarted) {
this.gameHasStarted = gameHasStarted;
}
/**
* This method will be used to the get the player depending on the given color parameter.
* This method returns the player has disconnected.
*
* @param color as the color of the player as a Color enumeration.
* @return the player with the given color as a Player object.
* @return the player has disconnected
*/
public Player getPlayerByColor(Color color) {
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
if (entry.getValue().getColor() == color) {
return entry.getValue();
}
}
return null;
public Boolean playerHasDisconnected() {
return playerHasDisconnected;
}
/**
* This method will be used to return the number of active players of this game.
* This method sets the game interruption state.
*
* @return activePlayers as an Integer.
* @param gameIsInterrupted the new game interruption state
*/
public int getNumberOfActivePlayers() {
int activePlayers = 0;
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
if (entry.getValue().isActive()) {
activePlayers++;
}
}
return activePlayers;
public void setGameIsInterrupted(Boolean gameIsInterrupted) {
this.gameIsInterrupted = gameIsInterrupted;
if (!gameIsInterrupted) notifyObservers();
}
/**
* This method will be used to return a piece based on the identifier.
* This method returns whether the game is interrupted.
*
* @return the piece specified by the identifier
* @return true if the game is interrupted, false otherwise
*/
public Piece getPieceThroughIdentifier(String identifier){
String[] parts = identifier.split("-");
return board.getPlayerData().get(Color.valueOf(parts[0])).getPieces()[Integer.parseInt(parts[1])];
}
/**
* This method notifies the observers.
*/
public void notifyObservers() {
for (Observer observer : new ArrayList<>(observers)) {
//TODO: observer.update();
}
}
/**
* This method returns the dice modifier.
*
* @return the dice modifier
*/
public int getDiceModifier() {
return diceModifier;
}
/**
* This method returns the dice eyes.
*
* @return the dice eyes
*/
public int getDiceEyes() {
return diceEyes;
}
/**
* This method returns the players.
*
* @return the players
*/
public Map<Integer, Player> getPlayers() {
return players;
}
/**
* This method returns the game statistics.
*
* @return the game statistics
*/
public Statistic getGameStatistics() {
return gameStatistics;
}
/**
* This method returns the draw pile.
*
* @return the draw pile
*/
public List<BonusCard> getDrawPile() {
return drawPile;
}
/**
* This method returns the discard pile.
*
* @return the discard pile
*/
public List<BonusCard> getDiscardPile() {
return discardPile;
}
/**
* This method returns the board.
*
* @return the board
*/
public Board getBoard() {
return board;
}
/**
* This method returns the active color.
*
* @return the active color
*/
public Color getActiveColor() {
return activeColor;
public Boolean gameIsInterrupted() {
return gameIsInterrupted;
}
/**
@@ -234,78 +340,6 @@ public Boolean getMovablePieces() {
return movablePieces;
}
/**
* This method sets the dice modifier.
*
* @param diceModifier the new dice modifier
*/
public void setDiceModifier(int diceModifier) {
this.diceModifier = diceModifier;
}
/**
* This method sets the dice eyes.
*
* @param diceEyes the new dice eyes
*/
public void setDiceEyes(int diceEyes) {
this.diceEyes = diceEyes;
}
/**
* This method sets the players.
*
* @param players the new players
*/
public void setPlayers(Map<Integer, Player> players) {
this.players = players;
}
/**
* This method sets the game statistics.
*
* @param gameStatistics the new game statistics
*/
public void setGameStatistics(Statistic gameStatistics) {
this.gameStatistics = gameStatistics;
}
/**
* This method sets the draw pile.
*
* @param drawPile the new draw pile
*/
public void setDrawPile(List<BonusCard> drawPile) {
this.drawPile = drawPile;
}
/**
* This method sets the discard pile.
*
* @param discardPile the new discard pile
*/
public void setDiscardPile(List<BonusCard> discardPile) {
this.discardPile = discardPile;
}
/**
* This method sets the board.
*
* @param board the new board
*/
public void setBoard(Board board) {
this.board = board;
}
/**
* This method sets the active color.
*
* @param activeColor the new active color
*/
public void setActiveColor(Color activeColor) {
this.activeColor = activeColor;
}
/**
* This method sets the game interruption state.
*
@@ -313,7 +347,17 @@ public void setActiveColor(Color activeColor) {
*/
public void setMovablePieces(Boolean movablePieces) {
this.movablePieces = movablePieces;
if (Boolean.FALSE.equals(movablePieces)) notifyObservers();
if (!movablePieces) notifyObservers();
}
/**
* This method sets the player has disconnected.
*
* @param playerHasDisconnected the new player has disconnected
*/
public void setPlayerHasDisconnected(Boolean playerHasDisconnected) {
this.playerHasDisconnected = playerHasDisconnected;
if (playerHasDisconnected) notifyObservers();
}
/**
@@ -332,25 +376,46 @@ public Boolean allRanked() {
*/
public void setAllRanked(Boolean allRanked) {
this.allRanked = allRanked;
if (Boolean.TRUE.equals(allRanked)) notifyObservers();
if (allRanked) notifyObservers();
}
/**
* This method returns the all ready state.
* This method returns the start player.
*
* @return the already state
* @return the start player
*/
public Boolean allReady() {
return allReady;
public Player getStartPlayer() {
return startPlayer;
}
/**
* This method sets the all ready state.
* This method sets the start player.
*
* @param allReady the new all-ready state
* @param startPlayer the new start player
*/
public void setAllReady(Boolean allReady) {
this.allReady = allReady;
if (Boolean.TRUE.equals(allReady)) notifyObservers();
public void setStartPlayer(Player startPlayer) {
this.startPlayer = startPlayer;
}
/**
* This method notifies the observers.
*/
public void notifyObservers() {
for (Observer observer : new ArrayList<>(observers)) {
observer.update();
}
}
/**
* This method returns the piece through its identifier.
*
* @param identifier the identifier of the piece
* @return the piece
*/
public Piece getPieceThroughIdentifier(String identifier) {
String[] parts = identifier.split("-");
Color color = Color.valueOf(parts[0]);
int index = Integer.parseInt(parts[1]);
return board.getPlayerData().get(color).getPieces()[index];
}
}

View File

@@ -1,7 +1,5 @@
package pp.mdga.game;
import java.util.UUID;
/**
* This class will be used to hold all Piece relevant data.
*/
@@ -10,7 +8,6 @@ public class Piece {
private PieceState state;
private final Color color;
private final int id;
private final UUID uuid = UUID.randomUUID();
/**
* This constructor is used to create a new Piece
@@ -96,13 +93,4 @@ public Color getColor() {
public String getIdentifier() {
return color.toString() + "-" + id;
}
/**
* This method is used to get the color of the piece
*
* @return the color of the piece
*/
public UUID getUuid() {
return uuid;
}
}

View File

@@ -6,31 +6,21 @@
* This class will be used to handle general PlayerData
*/
public class Player {
private String name;
private Statistic playerStatistic;
private ArrayList<BonusCard> handCards;
private Color color;
private boolean isReady;
private boolean active = true;
private final int id;
/**
* This constructor constructs a new Player object
*
* @param name the name of the player
*/
public Player(String name) {
this.name = name;
public Player(int id) {
this.id = id;
playerStatistic = new Statistic();
handCards = new ArrayList<>();
}
/**
* Constructor.
*/
public Player() {
this("");
}
/**
* This method returns the give name of the Player
*
@@ -72,7 +62,7 @@ public ArrayList<BonusCard> getHandCards() {
*
* @param card the card to be added to the players hand
*/
public void addHandCards(BonusCard card) {
public void addHandCards(BonusCard card){
handCards.add(card);
}
@@ -91,56 +81,11 @@ public BonusCard removeHandCard(BonusCard card) {
}
/**
* This method returns the color of the player
* Returns the id of the connection to the client represented by this player.
*
* @return the color of the player
* @return the id
*/
public Color getColor() {
return color;
}
/**
* This method sets the color of the player
*
* @param color the new color of the player
*/
public void setColor(Color color) {
this.color = color;
}
/**
* This method returns if the player is ready
*
* @return true if the player is ready, false otherwise
*/
public boolean isReady() {
return isReady;
}
/**
* This method will be used to return active attribute of Player class.
*
* @return active as a Boolean.
*/
public boolean isActive() {
return this.active;
}
/**
* This method sets the player to ready
*
* @param ready true if the player is ready, false otherwise
*/
public void setReady(boolean ready) {
isReady = ready;
}
/**
* This method will be used to set active attribute of Player class to the given active parameter.
*
* @param active as the new active value as a Boolean.
*/
public void setActive(boolean active) {
this.active = active;
public int getId() {
return id;
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class AnimationEnd extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,37 @@
package pp.mdga.message.client;
public interface ClientInterpreter {
void received(AnimationEnd animationEnd, int from);
void received(DeselectTSK deselectTSK , int from);
void received(ForceStartGame forceStartGame, int from);
void received(JoinServer joinServer , int from);
void received(LeaveGame leaveGame , int from);
void received(LobbyNotReady lobbyNotReady , int from);
void received(LobbyReady lobbyReady , int from);
void received(RequestBriefing requestBriefing , int from);
void received(RequestDice requestDice , int from);
void received(RequestMove requestMove , int from);
void received(RequestPlayCard requestPlayCard , int from);
void received(SelectCard selectCard , int from);
void received(SelectTSK selectTSK , int from);
void received(ForceContinueGame forceContinueGame, int from);
void received(ClientStartGame clientStartGame, int from);
void received(NoPowerCard noPowerCard, int from);
void received(SelectedPieces selectedPieces, int from);
}

View File

@@ -0,0 +1,11 @@
package pp.mdga.message.client;
import com.jme3.network.AbstractMessage;
public abstract class ClientMessage extends AbstractMessage {
protected ClientMessage() {
super(true);
}
public abstract void accept(ClientInterpreter interpreter, int from);
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class ClientStartGame extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class DeselectTSK extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class ForceContinueGame extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,17 @@
package pp.mdga.message.client;
public class ForceStartGame extends ClientMessage {
public ForceStartGame() {
}
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class JoinServer extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class LeaveGame extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class LobbyNotReady extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class LobbyReady extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class NoPowerCard extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class RequestBriefing extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.client;
public class RequestDice extends ClientMessage {
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,32 @@
package pp.mdga.message.client;
import pp.mdga.game.Color;
public class RequestMove extends ClientMessage {
private final String pieceIdentifier;
/** Constructor for RequestMove
* @param pieceIdentifier the piece identifier
*/
public RequestMove(String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/** Getter for the piece identifier
* @return the piece identifier
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
@Override
public String toString() {
return pieceIdentifier;
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,32 @@
package pp.mdga.message.client;
import pp.mdga.game.BonusCard;
public class RequestPlayCard extends ClientMessage {
private final BonusCard card;
private final String pieceIdentifier;
public RequestPlayCard(BonusCard card, String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
this.card = card;
}
public BonusCard getCard() {
return card;
}
public String getPieceIdentifier() {
return pieceIdentifier;
}
@Override
public String toString() {
return card.toString();
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,26 @@
package pp.mdga.message.client;
import pp.mdga.game.BonusCard;
public class SelectCard extends ClientMessage {
private final BonusCard card;
public SelectCard(BonusCard card) {
this.card = card;
}
public BonusCard getCard() {
return card;
}
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,26 @@
package pp.mdga.message.client;
import pp.mdga.game.Color;
public class SelectTSK extends ClientMessage {
private final Color color;
public SelectTSK(Color color) {
this.color = color;
}
public Color getColor() {
return color;
}
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,32 @@
package pp.mdga.message.client;
import pp.mdga.game.Color;
public class SelectedPieces extends ClientMessage {
private String pieceIdentifier;
/** Constructor for SelectedPieces
* @param pieceIdentifier the piece identifier
*/
public SelectedPieces(String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/** Getter for the piece identifier
* @return the piece identifier
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
@Override
public String toString() {
return "null";
}
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);
}
}

View File

@@ -0,0 +1,32 @@
package pp.mdga.message.server;
import pp.mdga.game.Color;
public class ActivePlayer extends ServerMessage {
private Color color;
/** Constructor for ActivePlayer
* @param color the color of the active player
*/
public ActivePlayer(Color color) {
this.color = color;
}
/** Getter for the color of the active player
* @return the color of the active player
*/
public Color getColor() {
return color;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,38 @@
package pp.mdga.message.server;
import java.util.ArrayList;
public class AnyPiece extends ServerMessage {
private ArrayList<String> piece;
/** Constructor for AnyPiece
*/
public AnyPiece() {
piece = new ArrayList<>();
}
/** Add a piece to the list of pieces
* @param piece the piece to add
*/
public void addPiece(String piece) {
this.piece.add(piece);
}
/** Getter for the list of pieces
* @return the list of pieces
*/
public ArrayList<String> getPiece() {
return piece;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class Briefing extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class Ceremony extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,59 @@
package pp.mdga.message.server;
import java.util.ArrayList;
public class Dice extends ServerMessage {
private final int diceEye;
private final ArrayList<String> moveablePieces;
/** Constructor for Dice
* @param diceEye the eye of the dice
* @param moveablePieces the pieces that can be moved
*/
public Dice(int diceEye, ArrayList<String> moveablePieces) {
this.diceEye = diceEye;
this.moveablePieces = moveablePieces;
}
/** Constructor for inactivePlayer
* @param diceEye the eye of the dice
* @return a new Dice object
*/
public static Dice inactivePlayer(int diceEye) {
return new Dice(diceEye, null);
}
/** Constructor for activePlayer
* @param diceEye the eye of the dice
* @param moveablePieces the pieces that can be moved
* @return a new Dice object
*/
public static Dice activePlayer(int diceEye, ArrayList<String> moveablePieces) {
return new Dice(diceEye, moveablePieces);
}
/** Getter for the eye of the dice
* @return the eye of the dice
*/
public int getDiceEye() {
return diceEye;
}
/** Getter for the pieces that can be moved
* @return the pieces that can be moved
*/
public ArrayList<String> getMoveablePieces() {
return moveablePieces;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class DiceAgain extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class DiceNow extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class EndOfTurn extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class LobbyAccept extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class LobbyDeny extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,24 @@
package pp.mdga.message.server;
public class LobbyPlayerJoin extends ServerMessage {
private final String name;
public LobbyPlayerJoin(String name) {
this.name = name;
}
public String getName() {
return name;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,31 @@
package pp.mdga.message.server;
import pp.mdga.game.Color;
public class LobbyPlayerLeave extends ServerMessage {
private final String name;
private final Color color;
public LobbyPlayerLeave(String name, Color color) {
this.name = name;
this.color = color;
}
public String getName() {
return name;
}
public Color getColor() {
return color;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,33 @@
package pp.mdga.message.server;
public class MoveMessage extends ServerMessage {
private final String pieceIdentifier;
/**
* @param identifier the identifier of the piece that should be moved
*/
public MoveMessage(String identifier) {
this.pieceIdentifier = identifier;
}
/**
* @return the identifier of the piece that should be moved
*/
public String getIdentifier() {
return pieceIdentifier;
}
/**
* @return the identifier of the piece that should be moved
*/
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class NoTurn extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class PauseGame extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,41 @@
package pp.mdga.message.server;
import pp.mdga.game.BonusCard;
public class PlayCard extends ServerMessage {
private final BonusCard card;
private final String pieceIdentifier;
/**
* @param card the card that should be played
* @param pieceIdentifier the identifier of the piece that should be moved
*/
public PlayCard(BonusCard card, String pieceIdentifier) {
this.card = card;
this.pieceIdentifier = pieceIdentifier;
}
/**
* @return the card that should be played
*/
public BonusCard getCard() {
return card;
}
/**
* @return the identifier of the piece that should be moved
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,40 @@
package pp.mdga.message.server;
import pp.mdga.game.BonusCard;
import java.util.ArrayList;
public class PossibleCard extends ServerMessage {
private ArrayList<BonusCard> possibleCards;
/** Constructor for PossibleCard
*/
public PossibleCard() {
possibleCards = new ArrayList<>();
}
/** Add a possible card to the list of possible cards
* @param card the possible card to add
*/
public void addPossibleCard(BonusCard card) {
this.possibleCards.add(card);
}
/** Getter for the list of possible cards
* @return the list of possible cards
*/
public ArrayList<BonusCard> getPossibleCards() {
return possibleCards;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,47 @@
package pp.mdga.message.server;
import java.util.ArrayList;
public class PossiblePiece extends ServerMessage {
private final ArrayList<String> possibleOwnPieces;
private final ArrayList<String> possibleEnemyPieces;
/** Constructor for PossiblePiece
*/
public PossiblePiece() {
possibleOwnPieces = new ArrayList<>();
possibleEnemyPieces = new ArrayList<>();
}
/** Add a piece to the list of possible pieces
* @param piece the piece to add
*/
public void addOwnPossiblePiece(String piece) {
this.possibleOwnPieces.add(piece);
}
/** Add a piece to the list of possible enemy pieces
* @param piece the piece to add
*/
public void addEnemyPossiblePiece(String piece) {
this.possibleEnemyPieces.add(piece);
}
/** Getter for the list of possible pieces
* @return the list of possible pieces
*/
public ArrayList<String> getPossiblePieces() {
return possibleOwnPieces;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class RankingResponce extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class RankingRollAgain extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,25 @@
package pp.mdga.message.server;
import pp.mdga.game.Game;
public class ReconnectBriefing extends ServerMessage {
private final Game game;
public ReconnectBriefing(Game game) {
this.game = game;
}
public Game getGame() {
return game;
}
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.message.server;
public class ResumeGame extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.message.server;
public interface ServerInterpreter {
}

Some files were not shown because too many files have changed in this diff Show More