Class ItemRocketeer

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

    public class ItemRocketeer
    extends Item
    implements ItemRammable
    Rocket tower that fires a rocket every 12 rounds.
    See Also:
    Serialized Form
    • Field Detail

      • GRAYROCKET

        protected static final int GRAYROCKET
        Constant for gray rocket.
        See Also:
        Constant Field Values
      • SWIRLROCKET

        protected static final int SWIRLROCKET
        Constant for swirl rocket.
        See Also:
        Constant Field Values
      • DROPROCKET

        protected static final int DROPROCKET
        Constant for drop rocket.
        See Also:
        Constant Field Values
      • itemNr

        protected int itemNr
        The rocket type index. Has the ROCKET value per default.
      • rocket

        protected ItemRocket rocket
        The rocket item.
      • ramPower

        protected int ramPower
        The items ram power. Default is 50.
    • Constructor Detail

      • ItemRocketeer

        public ItemRocketeer()
        Creates a new Rocketeer figure on the field.
    • Method Detail

      • addStateProperties

        protected void addStateProperties​(ThingState state,
                                          AnimationInfo animation)
        Adds properties necessary for energy loss 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.PainterItemRocketeer"
      • getItemRating

        public int getItemRating()
        Returns an item value for ComputerFigures rating in the items category.
        Overrides:
        getItemRating in class Item
        Returns:
        energy * -10.
      • performFieldEffect

        protected void performFieldEffect​(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 rocket was used, the ItemRocketeer gains a new rocket of the type depending on this ItemRocketeers item nr setting and fires it.
        Overrides:
        performFieldEffect in class Item
        Parameters:
        animation - The AnimationInfo.
      • wantsToFire

        protected boolean wantsToFire​(ItemRocket rocket)
        Checks, if the rocketeer wants to fire a rocket.
        Parameters:
        rocket - Teh rocket.
        Returns:
        true.
      • removeEnergy

        public void removeEnergy​(int min,
                                 Thing source,
                                 DieReason reason,
                                 AnimationInfo animation)
        Removes the given amount from this things energy level (if it is not originated by the own rocket).
        Overrides:
        removeEnergy in class Thing
        Parameters:
        min - The energy to remove
        source - The source for the energy removal
        animation - The AnimationInfo.
        reason - The reason for the energy loss.
      • fireRocket

        protected void fireRocket​(AnimationInfo animation)
        Fires the rocket.
        Parameters:
        animation - The AnimationInfo.
      • beRammed

        public boolean beRammed​(Figure rammer,
                                AnimationInfo animation)
        Called, if this item is "picked up" by a figure. Removes the rammers ram power from this items energy.
        Specified by:
        beRammed in interface ItemRammable
        Parameters:
        rammer - The figure that rams this item.
        animation - The AnimationInfo.
        Returns:
        true, if the figure can occupy the point after ramming, false otherwise; returns always false as default.
      • getRamPower

        public int getRamPower()
        Gets this items ram power.
        Specified by:
        getRamPower in interface ItemRammable
        Returns:
        The ram power.
      • getPaintRocket

        public ItemRocket getPaintRocket()
        Gets a rocket for painting effects.
        Returns:
        A rocket.