diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/game/Card.java b/Projekte/mdga/model/src/main/java/pp.mdga/game/Card.java deleted file mode 100644 index a3296a3a..00000000 --- a/Projekte/mdga/model/src/main/java/pp.mdga/game/Card.java +++ /dev/null @@ -1,34 +0,0 @@ -package pp.mdga.game; -/** - * This class is used to create a card - */ -public class Card { - private BonusCard type; - - /** - * This constructor is used to create a new card - * - * @param type the type of the card - */ - public Card(BonusCard type) { - this.type = type; - } - - /** - * This method is used to get the type of the card - * - * @return the type of the card - */ - public BonusCard getType() { - return type; - } - - /** - * This method is used to set the type of the card - * - * @param type the new type of the card - */ - public void setType(BonusCard type) { - this.type = type; - } -} diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java b/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java index a038ce4b..92a5dd30 100644 --- a/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java +++ b/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java @@ -14,8 +14,8 @@ public class Game { private int diceEyes; private Map players; private Statistic gameStatistics; - private ArrayList drawPile; - private ArrayList discardPile = new ArrayList<>(); + private ArrayList drawPile; + private ArrayList discardPile = new ArrayList<>(); private Board board; private Color activeColor; private LinkedList order; @@ -31,11 +31,11 @@ public Game(){ gameStatistics = new Statistic(); drawPile = new ArrayList<>(); for (int i = 0; i < AMOUNT_OF_TURBO_CARDS; i++) { - drawPile.add(new Card(BonusCard.TURBO)); + drawPile.add(BonusCard.TURBO); } for (int i = 0; i < AMOUNT_OF_SHIELD_AND_SWAP_CARDS; i++) { - drawPile.add(new Card(BonusCard.SHIELD)); - drawPile.add(new Card(BonusCard.SWAP)); + drawPile.add(BonusCard.SWAP); + drawPile.add(BonusCard.SHIELD); } board = new Board(); } @@ -117,7 +117,7 @@ public void setGameStatistics(Statistic gameStatistics) { * * @return the draw pile */ - public ArrayList getDrawPile() { + public ArrayList getDrawPile() { return drawPile; } @@ -126,7 +126,7 @@ public ArrayList getDrawPile() { * * @param drawPile the new draw pile */ - public void setDrawPile(ArrayList drawPile) { + public void setDrawPile(ArrayList drawPile) { this.drawPile = drawPile; } @@ -135,7 +135,7 @@ public void setDrawPile(ArrayList drawPile) { * * @return the discard pile */ - public ArrayList getDiscardPile() { + public ArrayList getDiscardPile() { return discardPile; } @@ -144,7 +144,7 @@ public ArrayList getDiscardPile() { * * @param discardPile the new discard pile */ - public void setDiscardPile(ArrayList discardPile) { + public void setDiscardPile(ArrayList discardPile) { this.discardPile = discardPile; } diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java b/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java index cc7d4b05..2a97d27c 100644 --- a/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java +++ b/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java @@ -9,7 +9,7 @@ public class Player { private String name; private Statistic playerStatistic; - private ArrayList handCards; + private ArrayList handCards; private final int id; /** @@ -53,17 +53,17 @@ public Statistic getPlayerStatistic() { * * @return the handCards of the player */ - public ArrayList getHandCards() { + public ArrayList getHandCards() { return handCards; } /** * This method adds a new handCard to the player * - * @param cards the card to be added to the players hand + * @param card the card to be added to the players hand */ - public void addHandCards(Card cards){ - handCards.add(cards); + public void addHandCards(BonusCard card){ + handCards.add(card); } /** @@ -72,8 +72,8 @@ public void addHandCards(Card cards){ * @param card the cards type to be removed * @return the removed card or null if there is none of that card type */ - public Card removeHandCard(Card card) { - Card cardToRemove = handCards.stream().filter(card1 -> card1.getType().equals(card.getType())).findFirst().orElse(null); + public BonusCard removeHandCard(BonusCard card) { + BonusCard cardToRemove = handCards.stream().filter(c -> c.equals(card)).findFirst().orElse(null); if (cardToRemove != null) { handCards.remove(cardToRemove); } diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/message/client/ClientMessage.java b/Projekte/mdga/model/src/main/java/pp.mdga/message/client/ClientMessage.java index 2b9f4111..11dae3e0 100644 --- a/Projekte/mdga/model/src/main/java/pp.mdga/message/client/ClientMessage.java +++ b/Projekte/mdga/model/src/main/java/pp.mdga/message/client/ClientMessage.java @@ -3,8 +3,10 @@ import com.jme3.network.AbstractMessage; public abstract class ClientMessage extends AbstractMessage { + protected ClientMessage() { super(true); } + public abstract void accept(ClientInterpreter interpreter, int from); }