Class ItemColorBucket

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

    public class ItemColorBucket
    extends Item
    Item, that colors the surrounding fields in the given color when used. Swirling points stop swirling, if colored. Available in red, blue and lightgray. When created without a defined color, a random color of these three will be chosen. If created with another color, it will be lightgray per default.
    See Also:
    Serialized Form
    • Constructor Detail

      • ItemColorBucket

        public ItemColorBucket()
        Creates a new colorbucket with a random color.
      • ItemColorBucket

        public ItemColorBucket​(int c)
        Creates a new colorbucket with the given color. Must be lightGray, red or blue, otherwise a lightGray bucket is created.
        Parameters:
        c - The color.
    • Method Detail

      • addStateProperties

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

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

        public boolean onBeUsed​(Figure user,
                                AnimationInfo animation)
        Colors the surrounding fields in the buckets color, and stops swirling on the points.
        Overrides:
        onBeUsed in class Item
        Parameters:
        user - The figure using the item
        animation - The Animation
        Returns:
        true, if item can be used