Class ItemSecretLevel

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

    public class ItemSecretLevel
    extends Item
    Item, that brings the player to a secret level. The item is randomly active for ACTIVITY_DURATION rounds. If it is picked inactive, it teleports away to a free point on the field.
    See Also:
    Serialized Form
    • Field Detail

      • ACTIVITY_DURATION

        public static final int ACTIVITY_DURATION
        Number of rounds the item is active.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ItemSecretLevel

        public ItemSecretLevel()
        Creates a new ItemNextLevel;
    • Method Detail

      • addStateProperties

        protected void addStateProperties​(ThingState state,
                                          AnimationInfo animation)
        Adds properties necessary for secretlevel 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 Item
        Returns:
        "com.starpoints.painter.arena2D.PainterItemSecretLevel"
      • getImageName

        public java.lang.String getImageName​(AnimationInfo animation)
        Returns image name.
        Overrides:
        getImageName in class Thing
        Parameters:
        animation - The AnimationInfo.
        Returns:
        "".
      • getPickupText

        public java.lang.String getPickupText()
        Gets the text, if the item is picked up.
        Overrides:
        getPickupText in class Item
        Returns:
        Value of pickupText.
      • getItemRating

        public int getItemRating()
        Returns an item value for ComputerFigures rating in the items category.
        Overrides:
        getItemRating in class Item
        Returns:
        -10000000.
      • setActivationProbability

        public void setActivationProbability​(int prob)
        Sets the activation probability in percent. If inactive, each round an activation check is made against this probabiliry. After setting the prob. explicitel, the item does not change its activation prob. depending on the energy.
        Parameters:
        prob - The probability in percent. Set to 0 or negative to prevent from reactivating.
      • performFieldEffect

        protected void performFieldEffect​(AnimationInfo animation)
        If the state is active, the countdown is performed, otherwise the item is set randomly active.
        Overrides:
        performFieldEffect in class Item
        Parameters:
        animation - The AnimationInfo.
      • doSpecialUpdate

        protected void doSpecialUpdate​(AnimationInfo animation)
        Performs the update in each round. Sets the activation probability to energy / 10 (if not set explicitely before).
        Overrides:
        doSpecialUpdate in class Item
        Parameters:
        animation - The AnimationInfo
      • activate

        public void activate​(int rounds)
        Activates this ItemSecretLevel for the given number of rounds.
      • removeEnergy

        public void removeEnergy​(int min,
                                 Thing source,
                                 DieReason reason,
                                 AnimationInfo animation)
        Does nothing - item never gets destroyed.
        Overrides:
        removeEnergy in class Thing
        Parameters:
        min - The energy loss.
        source - The source of energy loss.
        reason - The reason.
        animation - The AnimationInfo.
      • onBePickedUp

        public boolean onBePickedUp​(Figure picker,
                                    AnimationInfo animation)
        If the item is active, it switches to the next (secret) level, otherwise teleports to a free point.
        Overrides:
        onBePickedUp in class Item
        Parameters:
        picker - The picker
        animation - The AnimationInfo.
        Returns:
        false