java.lang.Object
it.polimi.ingsw.am13.model.card.Card
it.polimi.ingsw.am13.model.card.CardObjective
- All Implemented Interfaces:
CardIF
,CardObjectiveIF
,Serializable
Represents an objective card.
It stores only the active/front side (the back side has no information). It's then the side that store information
about the points guaranted by the card itself.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CardSideObjectiveActive
Active/front side of the card, where information about the points is stored. -
Constructor Summary
ConstructorsConstructorDescriptionCardObjective
(String id, int points, Color color1, Color color2, Color color3, int pos12, int pos23) Creates a new immutable card side for an objective card of type "x points for each pattern with 3 card in a certain position and with certain colors"CardObjective
(String id, int points, Map<Resource, Integer> set) Creates a new immutable objective card, with points of type "x points for each set of resources/objects" -
Method Summary
Modifier and TypeMethodDescriptionint
calcPoints
(Field field) Calculates the points guaranteed by the card for the field passed as parameterboolean
int
hashCode()
Methods inherited from class it.polimi.ingsw.am13.model.card.Card
getId, getVisibleSide, placeCardInField, removeCardFromField, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface it.polimi.ingsw.am13.model.card.CardIF
getId, getVisibleSide
-
Field Details
-
front
Active/front side of the card, where information about the points is stored.
-
-
Constructor Details
-
CardObjective
Creates a new immutable objective card, with points of type "x points for each set of resources/objects"- Parameters:
id
- Id of the card. Look atclass Card
for more informationpoints
- How many points the card gives for each complete set present in fieldset
- The set of resources/objects that must be present to obtain the points
-
CardObjective
public CardObjective(String id, int points, Color color1, Color color2, Color color3, int pos12, int pos23) throws InvalidCardCreationException Creates a new immutable card side for an objective card of type "x points for each pattern with 3 card in a certain position and with certain colors"- Parameters:
id
- Id of the card. Look atclass Card
for more informationpoints
- How many points the card gives for each complete non-intersecting pattern is present in fieldcolor1
- Color of upper cardcolor2
- Color of middle cardcolor3
- Color of bottom cardpos12
- Position of middle card with respect to upper card. It can only be -1 (to the left), 0 (right under), 1 (to the right)pos23
- Position of bottom card with respect to middle card. It can only be -1 (to the left), 0 (right under), 1 (to the right)- Throws:
InvalidCardCreationException
- If pos12 or pos23 are not among their possible values
-
-
Method Details
-
calcPoints
Calculates the points guaranteed by the card for the field passed as parameter- Parameters:
field
- Field of the player for whom you want to calculate the points given by the card.- Returns:
- Number of points guaranteed by the card objective
-
equals
-
hashCode
public int hashCode() -
getPoints
- Specified by:
getPoints
in interfaceCardObjectiveIF
-