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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user