Merge branch 'development' into 'dev/test'

Testmerge

See merge request progproj/gruppen-ht24/Gruppe-01!5
This commit was merged in pull request #5.
This commit is contained in:
Hanno Fleischer
2024-11-17 14:20:53 +00:00
119 changed files with 2349 additions and 5 deletions

View File

@@ -17,10 +17,10 @@ public Board() {
for (int i = 0; i < 40; i++) {
if (i % 10 == 0) {
infield[i] = new StartNode(
i == 0 ? Color.ARMY :
i == 10 ? Color.AIRFORCE :
i == 20 ? Color.CYBER :
Color.NAVY
i == 0 ? Color.AIRFORCE :
i == 10 ? Color.CYBER :
i == 20 ? Color.NAVY :
Color.ARMY
);
} else if (i == 4 || i == 14 || i == 24 || i == 34) {
infield[i] = new BonusNode();
@@ -47,4 +47,14 @@ public Map<Color, PlayerData> getPlayerData() {
public Node[] getInfield() {
return infield;
}
/**
* This method sets a piece on a specific Node in the infield
*
* @param index the index of the node
* @param piece the piece to be set
*/
public void setPieceOnBoard(int index, Piece piece) {
infield[index].setOccupant(piece);
}
}

View File

@@ -98,4 +98,14 @@ public Piece removePieceFromWaitingArea() {
}
return null;
}
/**
* This method sets a piece at the given index in the home area
*
* @param index the index of the node
* @param piece the piece to be set at the given index
*/
public void setPieceInHome(int index, Piece piece) {
homeNodes[index].setOccupant(piece);
}
}

View File

@@ -0,0 +1,27 @@
package pp.mdga.notification;
import java.util.UUID;
/**
* Notification that is sent when a card is acquired.
*/
public class AcquireCardNotification extends Notification{
private UUID cardId;
/**
* Constructor.
* @param cardId The id of the card that was acquired.
*/
public AcquireCardNotification(UUID cardId) {
this.cardId = cardId;
}
/**
* Get the id of the card that was acquired.
* @return The id of the card that was acquired.
*/
public UUID getCardId() {
return cardId;
}
}

View File

@@ -0,0 +1,25 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that the active player has changed
*/
public class ActivePlayerNotification extends Notification {
/**
* The color of the active player
*/
private Color color;
ActivePlayerNotification(Color color) {
this.color = color;
}
/**
* @return the color of the active player
*/
public Color getColor() {
return color;
}
}

View File

@@ -0,0 +1,12 @@
package pp.mdga.notification;
/**
* Class CeremonyNotification
*/
public class CeremonyNotification extends Notification{
/**
* Constructor
*/
CeremonyNotification() {
}
}

View File

@@ -0,0 +1,13 @@
package pp.mdga.notification;
/**
* Notification that the dice is now.
*/
public class DiceNowNotification extends Notification {
/**
* Constructor.
*/
DiceNowNotification() {
}
}

View File

@@ -0,0 +1,27 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that is sent when a player has diced.
*/
public class DicingNotification extends Notification{
private Color color;
/**
* Constructor.
* @param color The color of the player that diced.
*/
DicingNotification(Color color) {
this.color = color;
}
/**
* Get the color of the player that diced.
* @return The color of the player that diced.
*/
public Color getColor() {
return color;
}
}

View File

@@ -0,0 +1,36 @@
package pp.mdga.notification;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
/**
* Notification that a card has been drawn
*/
public class DrawCardNotification extends Notification {
private Color color;
private BonusCard card;
/**
* @param color the color of the player who drew the card
* @param card the card that was drawn
*/
DrawCardNotification(Color color, BonusCard card) {
this.color = color;
this.card = card;
}
/**
* @return the color of the player who drew the card
*/
public Color getColor() {
return color;
}
/**
* @return the card that was drawn
*/
public BonusCard getCard() {
return card;
}
}

View File

@@ -0,0 +1,12 @@
package pp.mdga.notification;
/**
* GameNotification class
*/
public class GameNotification extends Notification{
/**
* Constructor
*/
GameNotification() {
}
}

View File

@@ -0,0 +1,41 @@
package pp.mdga.notification;
import java.util.UUID;
/**
* Notification that a piece has moved to a home.
*/
public class HomeMoveNotification extends Notification {
private UUID pieceId;
private int homeIndex;
/**
* Constructor.
*
* @param pieceId the piece id
* @param homeIndex the home index
*/
HomeMoveNotification(UUID pieceId, int homeIndex) {
this.pieceId = pieceId;
this.homeIndex = homeIndex;
}
/**
* Get the piece id.
*
* @return the piece id
*/
public UUID getPieceId() {
return pieceId;
}
/**
* Get the home index.
*
* @return the home index
*/
public int getHomeIndex() {
return homeIndex;
}
}

View File

@@ -0,0 +1,25 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that a card has been drawn
*/
public class InterruptNotification extends Notification {
private Color color;
/**
* @param color the color of the player who drew the card
*/
InterruptNotification(Color color) {
this.color = color;
}
/**
* @return the color of the player who drew the card
*/
public Color getColor() {
return color;
}
}

View File

@@ -0,0 +1,12 @@
package pp.mdga.notification;
/**
* Notification that a dialog has been started
*/
public class LobbyDialogNotification extends Notification{
/**
* Constructor
*/
LobbyDialogNotification() {
}
}

View File

@@ -0,0 +1,38 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that a piece has been moved.
*/
public class MovePieceNotification extends Notification {
private Color color;
private int nodeIndex;
/**
* Constructor.
* @param color the color of the piece that has been moved.
* @param nodeIndex the index of the node the piece has been moved to.
*/
MovePieceNotification(Color color, int nodeIndex) {
this.color = color;
this.nodeIndex = nodeIndex;
}
/**
* Get the color of the piece that has been moved.
* @return the color of the piece that has been moved.
*/
public Color getColor() {
return color;
}
/**
* Get the index of the node the piece has been moved to.
* @return the index of the node the piece has been moved to.
*/
public int getNodeIndex() {
return nodeIndex;
}
}

View File

@@ -0,0 +1,64 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
import java.util.UUID;
public class MoveThrowPieceNotification extends Notification{
private UUID pieceId1;
private UUID pieceId2;
private int nodeIndex;
private Color colorPiece2;
/**
* This constructor is used to create a new MoveThrowPieceNotification
*
* @param pieceId1 the pieceId1
* @param pieceId2 the pieceId2
* @param nodeIndex the nodeIndex
* @param colorPiece2 the color
*/
public MoveThrowPieceNotification(UUID pieceId1, UUID pieceId2, int nodeIndex, Color colorPiece2) {
this.pieceId1 = pieceId1;
this.pieceId2 = pieceId2;
this.nodeIndex = nodeIndex;
this.colorPiece2 = colorPiece2;
}
/**
* This method returns the pieceId1
*
* @return the pieceId1
*/
public UUID getPieceId1() {
return pieceId1;
}
/**
* This method returns the pieceId2
*
* @return the pieceId2
*/
public UUID getPieceId2() {
return pieceId2;
}
/**
* This method returns the nodeIndex
*
* @return the nodeIndex
*/
public int getNodeIndex() {
return nodeIndex;
}
/**
* This method returns the color
*
* @return the color
*/
public Color getColor() {
return colorPiece2;
}
}

View File

@@ -0,0 +1,27 @@
package pp.mdga.notification;
import java.util.UUID;
/**
* Notification that a piece has no shield.
*/
public class NoShieldNotification extends Notification{
private UUID pieceId;
/**
* Constructor.
* @param pieceId the id of the piece that has no shield.
*/
public NoShieldNotification(UUID pieceId) {
this.pieceId = pieceId;
}
/**
* Get the id of the piece that has no shield.
* @return the id of the piece that has no shield.
*/
public UUID getPieceId() {
return pieceId;
}
}

View File

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

View File

@@ -0,0 +1,37 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
import java.util.UUID;
/**
* Notification that a piece is in the game
*/
public class PieceInGameNotification extends Notification{
private Color color;
private UUID id;
/**
* Constructor
* @param color the color of the piece
* @param id the id of the piece
*/
PieceInGameNotification(Color color, UUID id) {
this.color = color;
this.id = id;
}
/**
* @return the color of the piece
*/
public Color getColor() {
return null;
}
/**
* @return the id of the piece
*/
public UUID getId() {
return null;
}
}

View File

@@ -0,0 +1,39 @@
package pp.mdga.notification;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
/**
* Notification that a card has been played.
*/
public class PlayCardNotification extends Notification {
private Color color;
private BonusCard card;
/**
* Constructor.
* @param color the color of the player that played the card.
* @param card the card that was played.
*/
PlayCardNotification(Color color, BonusCard card) {
this.color = color;
this.card = card;
}
/**
* Get the color of the player that played the card.
* @return the color of the player that played the card.
*/
public Color getColor() {
return color;
}
/**
* Get the card that was played.
* @return the card that was played.
*/
public BonusCard getCard() {
return card;
}
}

View File

@@ -0,0 +1,38 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that a player is in the game.
*/
public class PlayerInGameNotification extends Notification {
private Color color;
private String name;
/**
* Constructor.
* @param color the color of the player that is in the game.
* @param name the name of the player that is in the game.
*/
PlayerInGameNotification(Color color, String name) {
this.color = color;
this.name = name;
}
/**
* Get the color of the player that is in the game.
* @return the color of the player that is in the game.
*/
public Color getColor() {
return color;
}
/**
* Get the name of the player that is in the game.
* @return the name of the player that is in the game.
*/
public String getName() {
return name;
}
}

View File

@@ -0,0 +1,27 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that a player is in the game.
*/
public class ResumeNotification extends Notification {
private Color color;
/**
* Constructor.
* @param color the color of the player that is in the game.
*/
ResumeNotification(Color color) {
this.color = color;
}
/**
* Get the color of the player that is in the game.
* @return the color of the player that is in the game.
*/
public Color getColor() {
return color;
}
}

View File

@@ -0,0 +1,49 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that a die has been rolled.
*/
public class RollDiceNotification extends Notification{
private Color color;
private int eyes;
private int moveNumber;
/**
* Constructor.
* @param color the color of the player that rolled the die.
* @param eyes the number of eyes that were rolled.
* @param moveNumber the number of the move that was made.
*/
RollDiceNotification(Color color, int eyes, int moveNumber) {
this.color = color;
this.eyes = eyes;
this.moveNumber = moveNumber;
}
/**
* Get the color of the player that rolled the die.
* @return the color of the player that rolled the die.
*/
public Color getColor() {
return color;
}
/**
* Get the number of eyes that were rolled.
* @return the number of eyes that were rolled.
*/
public int getEyes() {
return eyes;
}
/**
* Get the number of the move that was made.
* @return the number of the move that was made.
*/
public int getMoveNumber() {
return moveNumber;
}
}

View File

@@ -0,0 +1,28 @@
package pp.mdga.notification;
import pp.mdga.game.BonusCard;
import java.util.List;
/**
* Notification that contains a list of cards that the player can choose from.
*/
public class SelectableCardsNotification extends Notification {
private List<BonusCard> cards;
/**
* Constructor.
* @param cards The list of cards that the player can choose from.
*/
SelectableCardsNotification(List<BonusCard> cards) {
this.cards = cards;
}
/**
* Get the list of cards that the player can choose from.
* @return The list of cards that the player can choose from.
*/
public List<BonusCard> getCards() {
return cards;
}
}

View File

@@ -0,0 +1,26 @@
package pp.mdga.notification;
import java.util.List;
import java.util.UUID;
/**
* Notification to inform the client about the selectable pieces.
*/
public class SelectablePiecesNotification extends Notification{
private List<UUID> selectablePieces;
/**
* @param selectablePieces
*/
SelectablePiecesNotification(List<UUID> selectablePieces){
this.selectablePieces = selectablePieces;
}
/**
* @return List<UUID>
*/
public List<UUID> getSelectablePieces(){
return selectablePieces;
}
}

View File

@@ -0,0 +1,29 @@
package pp.mdga.notification;
import java.util.UUID;
/**
* This class will be used to hold all ShieldActiveNotification relevant data.
*/
public class ShieldActiveNotification extends Notification{
private UUID pieceId;
/**
* This constructor is used to create a new ShieldActiveNotification
*
* @param pieceId the pieceId
*/
public ShieldActiveNotification(UUID pieceId) {
this.pieceId = pieceId;
}
/**
* This method returns the pieceId
*
* @return the pieceId
*/
public UUID getPieceId() {
return pieceId;
}
}

View File

@@ -0,0 +1,29 @@
package pp.mdga.notification;
import java.util.UUID;
/**
* This class will be used to hold all ShieldSuppressedNotification relevant data.
*/
public class ShieldSuppressedNotification extends Notification {
private UUID pieceId;
/**
* This constructor is used to create a new ShieldSuppressedNotification
*
* @param pieceId the pieceId
*/
public ShieldSuppressedNotification(UUID pieceId) {
this.pieceId = pieceId;
}
/**
* This method returns the pieceId
*
* @return the pieceId
*/
public UUID getPieceId() {
return pieceId;
}
}

View File

@@ -0,0 +1,12 @@
package pp.mdga.notification;
/**
* Notification that a dialog has been started
*/
public class StartDialogNotification extends Notification{
/**
* Constructor
*/
StartDialogNotification() {
}
}

View File

@@ -0,0 +1,39 @@
package pp.mdga.notification;
import java.util.UUID;
/**
* Notification that two pieces have been swapped.
*/
public class SwapPieceNotification extends Notification {
private UUID firstPiece;
private UUID secondPiece;
/**
* Constructor.
* @param firstPiece the UUID of the first piece that has been swapped.
* @param secondPiece the UUID of the second piece that has been swapped.
*/
SwapPieceNotification(UUID firstPiece, UUID secondPiece) {
assert(!firstPiece.equals(secondPiece));
this.firstPiece = firstPiece;
this.secondPiece = secondPiece;
}
/**
* Get the UUID of the first piece that has been swapped.
* @return the UUID of the first piece that has been swapped.
*/
public UUID getFirstPiece() {
return firstPiece;
}
/**
* Get the UUID of the second piece that has been swapped.
* @return the UUID of the second piece that has been swapped.
*/
public UUID getSecondPiece() {
return secondPiece;
}
}

View File

@@ -0,0 +1,27 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Class TskSelectNotification
*/
public class TskSelectNotification extends Notification{
private Color color;
/**
* Constructor.
* @param color the color of the player that is in the game.
*/
TskSelectNotification(Color color) {
this.color = color;
}
/**
* Get the color of the player that is in the game.
* @return the color of the player that is in the game.
*/
public Color getColor() {
return color;
}
}

View File

@@ -0,0 +1,24 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
public class TskUnselectNotification extends Notification{
private Color color;
/**
* Constructor
* @param color
*/
TskUnselectNotification(Color color){
this.color = color;
}
/**
* Get the color
* @return color
*/
public Color getColor() {
return color;
}
}

View File

@@ -0,0 +1,27 @@
package pp.mdga.notification;
import java.util.UUID;
/**
* Notification to inform the player that he has to wait for the other player to move.
*/
public class WaitMoveNotification extends Notification{
private UUID pieceId;
/**
* Constructor.
* @param pieceId the id of the piece that has to move.
*/
public WaitMoveNotification(UUID pieceId) {
this.pieceId = pieceId;
}
/**
* Get the id of the piece that has to move.
* @return the id of the piece that has to move.
*/
public UUID getPieceId() {
return pieceId;
}
}