java.lang.Object
it.polimi.ingsw.am13.model.card.CardSidePlayable
- All Implemented Interfaces:
CardSidePlayableIF
,Serializable
This class represents one of the two sides of a playable card
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThis possibly empty list contains the resources at the center of the card sideprivate final Color
It stores the color of this cardIt stores the 4 corners of the card side In order, they are: upper left, upper right, lower right, lower leftprivate final String
Unique id of the card: (r, g, s, o for type), number or 3 digits (in order of pdf).private final PointsPlayable
It stores the information needed to calculate the points the player gets when playing this card sideIt stores the resources needed to play this card side(it's empty if no resource is required)private final Side
The side of the card this CardSide corresponds to -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
int
calcPoints
(Field field) clone()
boolean
getColor()
Get the list of resources present in the 4 angles of the card (clockwise order)Return the list of cornersgetId()
Returns the id of the cardReturns the object which describes all the information related to pointsgetSide()
int
hashCode()
toString()
-
Field Details
-
requirements
It stores the resources needed to play this card side(it's empty if no resource is required) -
corners
It stores the 4 corners of the card side In order, they are: upper left, upper right, lower right, lower left -
centerResources
This possibly empty list contains the resources at the center of the card side -
points
It stores the information needed to calculate the points the player gets when playing this card side -
color
It stores the color of this card -
id
Unique id of the card: (r, g, s, o for type), number or 3 digits (in order of pdf). -
side
The side of the card this CardSide corresponds to
-
-
Constructor Details
-
CardSidePlayable
public CardSidePlayable(Map<Resource, Integer> requirements, List<Corner> corners, List<Resource> centerResources, PointsPlayable points, Color color, String id, Side side) throws InvalidCardCreationExceptionThis is the constructor of a cardSidePlayable- Parameters:
requirements
- the resources needed to play this card side(it's empty if no resource is required)corners
- the 4 corners of the card side(in order, they are: upper left, upper right, lower right, lower left)centerResources
- the resources at the center of the card side(it's empty if there are no resources in the center)points
- the points the player gets when playing this card side(use PointsInstant(0) if the card rewards no points)color
- the color of this card- Throws:
InvalidCardCreationException
- If list of corners is not of size 4, or requirements or centerResources containResource.NO_RESOURCE
-
-
Method Details
-
getSide
- Specified by:
getSide
in interfaceCardSidePlayableIF
- Returns:
- Side corresponding to this cardSide
-
getCenterResources
- Specified by:
getCenterResources
in interfaceCardSidePlayableIF
- Returns:
- the resources at the center of the card side
-
getCorners
Description copied from interface:CardSidePlayableIF
Return the list of corners- Specified by:
getCorners
in interfaceCardSidePlayableIF
- Returns:
- the 4 corners of the card side(in order, they are: upper left, upper right, lower right, lower left)
-
getRequirements
- Specified by:
getRequirements
in interfaceCardSidePlayableIF
- Returns:
- the resources needed to play this card side(it's empty if no resource is required)
-
getColor
- Specified by:
getColor
in interfaceCardSidePlayableIF
- Returns:
- the color of this card
-
calcCornersCovered
public int calcCornersCovered()- Specified by:
calcCornersCovered
in interfaceCardSidePlayableIF
- Returns:
- Number of corners covered by this card of that other card cover on this one.
-
getCornerResources
Get the list of resources present in the 4 angles of the card (clockwise order)- Specified by:
getCornerResources
in interfaceCardSidePlayableIF
- Returns:
- A list of card's corner resources
-
getCoveredCorners
- Specified by:
getCoveredCorners
in interfaceCardSidePlayableIF
- Returns:
- list of 4 booleans, true if the corresponding corners is covered
-
getPoints
Returns the object which describes all the information related to points- Specified by:
getPoints
in interfaceCardSidePlayableIF
- Returns:
- PointsPlayable interface of the card side
-
calcPoints
- Parameters:
field
- the field of the player- Returns:
- the points the player gets when playing this card
-
clone
- Specified by:
clone
in interfaceCardSidePlayableIF
- Overrides:
clone
in classObject
- Returns:
- A new instance identical to the object
-
equals
-
hashCode
public int hashCode() -
toString
-
getId
Description copied from interface:CardSidePlayableIF
Returns the id of the card- Specified by:
getId
in interfaceCardSidePlayableIF
-