Package game

Klasse Player

java.lang.Object
game.Player

public class Player extends Object
This class provides functionalities and properties regarding the players
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    Player(String name)
    Constructor for the class Player
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    discard(game.cards.Card card)
    This method discards one card from this players handcards and adds it to the list of discarded cards
    void
    This method discards all of the cards of this player and adds them to the list of discarded cards
    game.cards.Card
    drawCard(game.cards.Card card)
    This method is used to draw a specific card
    game.cards.Card
    drawCard(Deck deck)
    This method is used to draw a card from the deck
    ArrayList<game.cards.Card>
    This method returns the list of this players handcards
    Returns the cards in this players hands as an arraylist
    int
    This method returns a list of this players handcard value
    int
    Gets the sum of all values of the discarded cards of this player
    Returns the name of this player
    int
    Returns the score of this player
    void
    Increases the score of this player
    boolean
    Returns if this player is an active player of the round
    boolean
    This method checks if this player is currently protected
    void
    Resets this players variables and handcards
    void
    setActiveStatus(boolean status)
    Sets the active status of this player
    void
    setCardList(ArrayList<game.cards.Card> cards)
    This method replaces this players list of handcards with a new one
    void
    setProtection(boolean protection)
    This method sets the protection
    This method shows the card in this players hand

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Konstruktordetails

    • Player

      public Player(String name)
      Constructor for the class Player
      Parameter:
      name - The requested name for this player
  • Methodendetails

    • getName

      public String 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

      public game.cards.Card drawCard(Deck deck)
      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

      public void setCardList(ArrayList<game.cards.Card> cards)
      This method replaces this players list of handcards with a new one
      Parameter:
      cards - The new list of cards
    • getCardList

      public ArrayList<game.cards.Card> getCardList()
      This method returns the list of this players handcards
      Gibt zurück:
      The ArrayList of this players handcards
    • getCardNames

      public ArrayList<String> getCardNames()
      Returns the cards in this players hands as an arraylist
      Gibt zurück:
      The string list of this players handcards names
    • showCards

      public String 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)