Package game
Klasse Player
java.lang.Object
game.Player
This class provides functionalities and properties regarding the players
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
discard
(game.cards.Card card) This method discards one card from this players handcards and adds it to the list of discarded cardsvoid
This method discards all of the cards of this player and adds them to the list of discarded cardsgame.cards.Card
drawCard
(game.cards.Card card) This method is used to draw a specific cardgame.cards.Card
This method is used to draw a card from the deckArrayList<game.cards.Card>
This method returns the list of this players handcardsReturns the cards in this players hands as an arraylistint
This method returns a list of this players handcard valueint
Gets the sum of all values of the discarded cards of this playergetName()
Returns the name of this playerint
getScore()
Returns the score of this playervoid
Increases the score of this playerboolean
isActive()
Returns if this player is an active player of the roundboolean
This method checks if this player is currently protectedvoid
reset()
Resets this players variables and handcardsvoid
setActiveStatus
(boolean status) Sets the active status of this playervoid
setCardList
(ArrayList<game.cards.Card> cards) This method replaces this players list of handcards with a new onevoid
setProtection
(boolean protection) This method sets the protectionThis method shows the card in this players hand
-
Konstruktordetails
-
Player
Constructor for the class Player- Parameter:
name
- The requested name for this player
-
-
Methodendetails
-
getName
Returns the name of this player- Gibt zurück:
- The name of this player
-
increaseScore
public void increaseScore()Increases the score of this player -
getScore
public int getScore()Returns the score of this player- Gibt zurück:
- The score of this player
-
isActive
public boolean isActive()Returns if this player is an active player of the round- Gibt zurück:
- The active status
-
isProtected
public boolean isProtected()This method checks if this player is currently protected- Gibt zurück:
- If this player is protected
-
drawCard
This method is used to draw a card from the deck- Parameter:
deck
- The deck to draw the card from- Gibt zurück:
- The drawn card
-
drawCard
public game.cards.Card drawCard(game.cards.Card card) This method is used to draw a specific card- Parameter:
card
- The card to be drawn- Gibt zurück:
- The drawn card
-
setCardList
This method replaces this players list of handcards with a new one- Parameter:
cards
- The new list of cards
-
getCardList
This method returns the list of this players handcards- Gibt zurück:
- The ArrayList of this players handcards
-
getCardNames
Returns the cards in this players hands as an arraylist- Gibt zurück:
- The string list of this players handcards names
-
showCards
This method shows the card in this players hand- Gibt zurück:
- A string that tells about this players hand
-
getCardValue
public int getCardValue()This method returns a list of this players handcard value- Gibt zurück:
- This players card value
-
getDiscardedCardsValues
public int getDiscardedCardsValues()Gets the sum of all values of the discarded cards of this player- Gibt zurück:
- The value of all discarded cards
-
discard
public void discard(game.cards.Card card) This method discards one card from this players handcards and adds it to the list of discarded cards- Parameter:
card
- The card to be discarded
-
discardAll
public void discardAll()This method discards all of the cards of this player and adds them to the list of discarded cards -
reset
public void reset()Resets this players variables and handcards -
setActiveStatus
public void setActiveStatus(boolean status) Sets the active status of this player- Parameter:
status
- The active status
-
setProtection
public void setProtection(boolean protection) This method sets the protection- Parameter:
protection
- The desired protection status (true or false)
-