Class Fog

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    FogCool, FogHeal, FogHide, FogHurt, FogInvulnerable, FogSink, FogSlow

    public abstract class Fog
    extends Thing
    implements java.io.Serializable
    Abstract baseclass for all fogs on the field. A Fog is attached to one point independently of items or figures on that point. Fogs might have an effect when entering, when staying in or when leaving a fog.
    See Also:
    Serialized Form
    • Field Detail

      • field

        protected Field field
        The field the fog is on.
    • Constructor Detail

      • Fog

        public Fog()
        Creates a fog on the field.
    • Method Detail

      • performEnterEffect

        protected abstract void performEnterEffect​(Thing t,
                                                   AnimationInfo animation)
        Called, if a thing enters (or is placed on) the fog.
        Parameters:
        t - The entering thing.
        animation - AnimationInfo
      • performLeaveEffect

        protected abstract void performLeaveEffect​(Thing t,
                                                   AnimationInfo animation)
        Called, if a thing leaves the fog.
        Parameters:
        t - The leaving thing.
        animation - The AnimationÍnfo
      • performStayEffect

        protected abstract void performStayEffect​(Thing t,
                                                  AnimationInfo animation)
        Called, if a thing stays in the fog.
        Parameters:
        t - The staying thing.
        animation - AnimationInfo
      • getFog

        public static Fog getFog​(java.lang.Class c)
        Gets a fog of the given class.
        Parameters:
        c - The item class
        Returns:
        An item for the given class
      • getFog

        public static Fog getFog​(java.lang.String classname)
        Gets a fog of the given class.
        Parameters:
        classname - The item class
        Returns:
        An item for the given class
      • getImageIndex

        protected int getImageIndex​(AnimationInfo animation)
        Gets the fog image index.
        Parameters:
        animation - The AnimationInfo
        Returns:
        The index.
      • getRandomImageIndex

        protected int getRandomImageIndex​(int max)
        Gets a random image index.
        Parameters:
        max - The max index.
        Returns:
        A random index.
      • onEnemyKilled

        protected void onEnemyKilled​(Figure figure,
                                     int roundCount,
                                     DieReason reason,
                                     AnimationInfo animation)
        Called, if something is killed by the fog. Does nothing as default.
        Overrides:
        onEnemyKilled in class Thing
        Parameters:
        figure - The killed figure
        roundCount - The round count.
        reason - The die reason.
        animation - The AnimationInfo.
      • getImageName

        public abstract java.lang.String getImageName​(AnimationInfo animation)
        Gets an image name for the fog.
        Overrides:
        getImageName in class Thing
        Parameters:
        animation - The AnimationInfo.
        Returns:
        The image name.
      • toString

        public java.lang.String toString()
        Returns a String represantation for this point containing this points coordinates
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String
      • updateExplodingStatus

        protected void updateExplodingStatus​(AnimationInfo animation)
        Handles the fogs status during update phase of the round when thing is exploding. Sets the status directly to destroyed. Fogs don´t explode in the game (but can be destroyed by calling their die()-method theoretically, though never tried ;-)
        Specified by:
        updateExplodingStatus in class Thing
        Parameters:
        animation - The AnimationInfo.
      • getName

        public java.lang.String getName()
        Description copied from class: Thing
        Returns a display name for the thing.
        Specified by:
        getName in class Thing
        Returns:
        The things name.
      • setName

        public void setName​(java.lang.String name)