Class KamikazeFigure

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class KamikazeFigure
    extends ComputerFigure
    Computer figure, that tends to hunt the player figures.
    See Also:
    Serialized Form
    • Field Detail

      • xt

        protected int xt
        The target x coordinate.
      • yt

        protected int yt
        The target x coordinate.
    • Constructor Detail

      • KamikazeFigure

        public KamikazeFigure​(Game game,
                              FigureInfo figureInfo)
        Creates a new KamikazeFigure.
        Parameters:
        game - The game.
        figureInfo - The figure info.
    • Method Detail

      • calculatePointRating

        protected int calculatePointRating​(Point p)
        Gets a points rating. The ComputerFigures calculation is increased, if the point is in direction of the nearest player figure.
        Overrides:
        calculatePointRating in class ComputerFigure
        Parameters:
        p - The point.
        Returns:
        An int rating of the point.
      • isInTargetDirX

        protected boolean isInTargetDirX​(Point p)
        Checks, if the given point is in target direction, regarding x coordinates.
        Parameters:
        p - The point
        Returns:
        true, if the point is in the same x-direction as the target
      • isInTargetDirY

        protected boolean isInTargetDirY​(Point p)
        Checks, if the given point is in target direction, regarding y coordinates.
        Parameters:
        p - The point
        Returns:
        true, if the point is in the same y-direction as the target
      • calculateTarget

        protected void calculateTarget()
        Determines the next visible PlayerFigure.