Class SwampGhost

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

    public class SwampGhost
    extends CleverComputerFigure
    Computer figure, that fires mudballs frequently (while being stuck for some rounds). Collects BigMines without using them.
    See Also:
    Serialized Form
    • Constructor Detail

      • SwampGhost

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

      • addStateProperties

        protected void addStateProperties​(ThingState state,
                                          AnimationInfo animation)
        Adds properties necessary for SwampGhost painting.
        Overrides:
        addStateProperties in class Thing
        Parameters:
        state - The state to add properties to.
        animation - The current AnimationInfo.
      • getPainterClassname

        public java.lang.String getPainterClassname()
        Gets the fully qualified classname of the Painter to use for this item (in 2D game).
        Overrides:
        getPainterClassname in class Figure
        Returns:
        "com.starpoints.painter.arena2D.PainterSwampGhost"
      • getImageName

        public java.lang.String getImageName​(AnimationInfo animation)
        Returns image name dependent on current game animation index for animation.
        Overrides:
        getImageName in class Figure
        Parameters:
        animation - AnimationInfo.
        Returns:
        "enemy11_"+index.
      • getIq

        public int getIq()
        Gets the IQ of this figure (at least 120).
        Overrides:
        getIq in class CleverComputerFigure
        Returns:
        The IQ.
      • getAnimationImageIndex

        public static int getAnimationImageIndex​(Game g,
                                                 int max,
                                                 int step)
        Gets an animation index between 0 and max depending on the games round cound and AnimationInfo-index.
        Parameters:
        g - The game.
        max - The maximum index.
        step - Number of animations for next index.
        Returns:
        The index.
      • isRamTarget

        protected boolean isRamTarget​(Figure f)
        Checks, if the figure is a good ram target (because it is weaker than this figure).
        Overrides:
        isRamTarget in class ComputerFigure
        Parameters:
        f - The figure to check.
        Returns:
        true, if the figure is a good ram target and no SwampGhost.
      • isDangerous

        protected boolean isDangerous​(Figure f)
        Checks, if the figure is dangerous.
        Overrides:
        isDangerous in class CleverComputerFigure
        Parameters:
        f - The figure
        Returns:
        true, if figure is another SwampGhost or dangerous.
      • isForbiddenItem

        protected boolean isForbiddenItem​(Item i)
        Checks, if the item is not allowed to be picked up by this figure.
        Overrides:
        isForbiddenItem in class ComputerFigure
        Parameters:
        i - The item.
        Returns:
        true for ItemHover and other forbidden items.
      • doSpecialUpdate

        protected void doSpecialUpdate​(AnimationInfo animation)
        This method is called at the end of the regular updateThing()-method. If the number of rounds equal to the fire frequency has passed, since the last item was used, the figure gains a new rocket of the type depending on this rocketeers item nr setting.
        Overrides:
        doSpecialUpdate in class CleverComputerFigure
        Parameters:
        animation - The AnimationInfo.
      • wantsToMove

        protected boolean wantsToMove()
        Checks, if this figure wants to move.
        Overrides:
        wantsToMove in class CleverComputerFigure
        Returns:
        false, if just fired mud.
      • sink

        public void sink​(Thing source,
                         AnimationInfo animation)
        Does nothing - Swamp ghost does not sink.
        Overrides:
        sink in class Figure
        Parameters:
        source - The sink source.
        animation - The AnimationInfo.
      • getFireCounter

        public int getFireCounter()
        Gets the fire coutner value.
        Returns:
        The fire counter. 0-this.fireFrequency-1.
      • reInit

        protected void reInit​(Field f)
        Reinitializes the figure after each level.
        Overrides:
        reInit in class CleverComputerFigure
        Parameters:
        f - The new field