Class PointsResource

java.lang.Object
it.polimi.ingsw.am13.model.card.points.PointsResource
All Implemented Interfaces:
PointsPlayable, Serializable

public class PointsResource extends Object implements PointsPlayable
Representation of points of a playable card side of the type "x points for each resource of type y present on the field immediately after you play it"
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    This variable represents the number of points this card gives for each resource
    private final Resource
    This variable represents the resource required to get points by playing this card
  • Constructor Summary

    Constructors
    Constructor
    Description
    PointsResource(int points, Resource resource)
    The only constructor of the class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    calcPoints(CardSidePlayableIF cardSidePlayable, FieldIF field)
    This method calculates the points given by the card side, according to how many resources of the required type, which is indicated on the card itself, are visible.
    boolean
     
    int
    Return the points multiplier.
    Return the required resource to get points by playing the card.
    int
     
    boolean
    Returns true if the number of points is conditioned to the number of angles the card covers.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • points

      private final int points
      This variable represents the number of points this card gives for each resource
    • resource

      private final Resource resource
      This variable represents the resource required to get points by playing this card
  • Constructor Details

    • PointsResource

      public PointsResource(int points, Resource resource)
      The only constructor of the class. The only way to set the parameters of the class is to instantiate the object via this constructor
      Parameters:
      points - the amount of points this card gives for each resource
      resource - the resource required to get points by playing this card
  • Method Details

    • calcPoints

      public int calcPoints(CardSidePlayableIF cardSidePlayable, FieldIF field)
      This method calculates the points given by the card side, according to how many resources of the required type, which is indicated on the card itself, are visible.
      Specified by:
      calcPoints in interface PointsPlayable
      Parameters:
      cardSidePlayable - side of the playable card that gives these points to the player
      field - Field of the player for whom you want to calculate the points given by the card objective.
      Returns:
      the number of points the player receives after playing this card
    • getPointsMultiplier

      public int getPointsMultiplier()
      Description copied from interface: PointsPlayable
      Return the points multiplier. In other words, the number of points which appears on the card.
      Specified by:
      getPointsMultiplier in interface PointsPlayable
      Returns:
      Points multiplier
    • getPointsResource

      public Resource getPointsResource()
      Description copied from interface: PointsPlayable
      Return the required resource to get points by playing the card.
      Specified by:
      getPointsResource in interface PointsPlayable
      Returns:
      Resource required
    • isCornerTypePoints

      public boolean isCornerTypePoints()
      Description copied from interface: PointsPlayable
      Returns true if the number of points is conditioned to the number of angles the card covers.
      Specified by:
      isCornerTypePoints in interface PointsPlayable
      Returns:
      true if PointsCorner, false otherwise
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object