added init for mdga with all states and messages

This commit is contained in:
Cedric Beck
2024-11-12 17:26:10 +01:00
parent ef16a3f92b
commit a684405891
238 changed files with 1596 additions and 44560 deletions

View File

@@ -0,0 +1,82 @@
package pp.mdga.game;
import java.util.ArrayList;
/**
* This class will be used to handle general PlayerData
*/
public class Player {
private String name;
private Statistic playerStatistic;
private ArrayList<Card> handCards;
private final int id;
/**
* This constructor constructs a new Player object
*/
public Player(int id) {
this.id = id;
playerStatistic = new Statistic();
handCards = new ArrayList<>();
}
/**
* This method returns the give name of the Player
*
* @return the name of the player as a String
*/
public String getName() {
return name;
}
/**
* This method sets the name of the player
*
* @param name the new name of the player
*/
public void setName(String name) {
this.name = name;
}
/**
* This methode returns the statistics of the player
*
* @return the statistics of the player
*/
public Statistic getPlayerStatistic() {
return playerStatistic;
}
/**
* This method returns the current handCards of the player
*
* @return the handCards of the player
*/
public ArrayList<Card> getHandCards() {
return handCards;
}
/**
* This method adds a new handCard to the player
*
* @param cards the card to be added to the players hand
*/
public void addHandCards(Card cards){
handCards.add(cards);
}
/**
* This method returns a BonusCard to be removed from the players hand.
*
* @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);
if (cardToRemove != null) {
handCards.remove(cardToRemove);
}
return cardToRemove;
}
}