removed card and fixed codes style
removed card because it was unnecessary and reworked all classes containing it to implement the change
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,8 @@ public class Game {
|
||||
private int diceEyes;
|
||||
private Map <Color, Player> players;
|
||||
private Statistic gameStatistics;
|
||||
private ArrayList<Card> drawPile;
|
||||
private ArrayList<Card> discardPile = new ArrayList<>();
|
||||
private ArrayList<BonusCard> drawPile;
|
||||
private ArrayList<BonusCard> discardPile = new ArrayList<>();
|
||||
private Board board;
|
||||
private Color activeColor;
|
||||
private LinkedList<Color> 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<Card> getDrawPile() {
|
||||
public ArrayList<BonusCard> getDrawPile() {
|
||||
return drawPile;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public ArrayList<Card> getDrawPile() {
|
||||
*
|
||||
* @param drawPile the new draw pile
|
||||
*/
|
||||
public void setDrawPile(ArrayList<Card> drawPile) {
|
||||
public void setDrawPile(ArrayList<BonusCard> drawPile) {
|
||||
this.drawPile = drawPile;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public void setDrawPile(ArrayList<Card> drawPile) {
|
||||
*
|
||||
* @return the discard pile
|
||||
*/
|
||||
public ArrayList<Card> getDiscardPile() {
|
||||
public ArrayList<BonusCard> getDiscardPile() {
|
||||
return discardPile;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public ArrayList<Card> getDiscardPile() {
|
||||
*
|
||||
* @param discardPile the new discard pile
|
||||
*/
|
||||
public void setDiscardPile(ArrayList<Card> discardPile) {
|
||||
public void setDiscardPile(ArrayList<BonusCard> discardPile) {
|
||||
this.discardPile = discardPile;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public class Player {
|
||||
|
||||
private String name;
|
||||
private Statistic playerStatistic;
|
||||
private ArrayList<Card> handCards;
|
||||
private ArrayList<BonusCard> handCards;
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
@@ -53,17 +53,17 @@ public Statistic getPlayerStatistic() {
|
||||
*
|
||||
* @return the handCards of the player
|
||||
*/
|
||||
public ArrayList<Card> getHandCards() {
|
||||
public ArrayList<BonusCard> 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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user