Class MarketMarble

java.lang.Object
it.polimi.ingsw.model.market.MarketMarble
Direct Known Subclasses:
NormalMarble, RedMarble, WhiteMarble

public abstract class MarketMarble
extends java.lang.Object
Represents a generic market marble
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected MarketMarble​(MarbleColor color)  
  • Method Summary

    Modifier and Type Method Description
    abstract void addResource​(InterfacePlayerBoard playerBoard)
    Adds the resources owed to the player due to this marble possibly converting it with the player's leader cards
    void addResource​(InterfacePlayerBoard playerBoard, LeaderCard leaderCard)
    Adds the resources owed to the player due to this marble converted using the specified leader card if it can be converted, otherwise the default resources corresponding to this marble
    MarbleColor getColor()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MarketMarble

      protected MarketMarble​(MarbleColor color)
  • Method Details

    • addResource

      public abstract void addResource​(InterfacePlayerBoard playerBoard) throws NotEnoughSpaceException, MoreWhiteLeaderCardsException
      Adds the resources owed to the player due to this marble possibly converting it with the player's leader cards
      Parameters:
      playerBoard - the player board of the player to whom the resources belong
      Throws:
      NotEnoughSpaceException - there isn't enough space in the warehouse to add this resource
      MoreWhiteLeaderCardsException - the player has more than one leader card that can modify this type of marble
    • addResource

      public void addResource​(InterfacePlayerBoard playerBoard, LeaderCard leaderCard) throws NotEnoughSpaceException, WrongLeaderCardException
      Adds the resources owed to the player due to this marble converted using the specified leader card if it can be converted, otherwise the default resources corresponding to this marble
      Parameters:
      playerBoard - the player board of the player to whom the resources belong
      leaderCard - the leader card that must be used to convert this marble, if this marble can't be converted this parameter will be ignored
      Throws:
      NotEnoughSpaceException - there isn't enough space in the warehouse to add this resource
      WrongLeaderCardException - this type of marble must be converted, but the specified leader card don't convert it
      java.lang.NullPointerException - this type of marble must be converted, but the specified leader card is null
    • getColor

      public MarbleColor getColor()