Class ItemBigMine

    • Field Detail

      • DEBUG

        protected static boolean DEBUG
        Debug flag.
      • state

        protected BombState state
        Current state. INACTIVE as initial value.
      • clipStr

        protected java.lang.String clipStr
        A clip name after being dropped. "item_bigmine"
      • countDown

        protected int countDown
        Countdown counter.
      • maxcountDown

        protected int maxcountDown
        Initial countdown value.
      • dropPoint

        protected Point dropPoint
        The point to be dropped on.
      • explosionSource

        protected Thing explosionSource
        The source of the detonation.
    • Constructor Detail

      • ItemBigMine

        public ItemBigMine()
        Creates a new ItemBigMine.
    • Method Detail

      • addStateProperties

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

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

        public ItemCategory getCategory()
        Returns the items category.
        Overrides:
        getCategory in class Item
        Returns:
        the category
      • isActive

        public boolean isActive()
        Checks, if the rocket is active.
        Returns:
        state == ACTIVE
      • onEnemyKilled

        public void onEnemyKilled​(Figure enemy,
                                  int round,
                                  DieReason reason,
                                  AnimationInfo animation)
        Called, if the thing killed an enemy.
        Overrides:
        onEnemyKilled in class Item
        Parameters:
        enemy - The killed enemy
        round - The round count.
        reason - The die reason.
        animation - The AnimationInfo.
      • onBePickedUp

        public boolean onBePickedUp​(Figure picker,
                                    AnimationInfo animation)
        If in inactive state, superclass implementation is called. If active, and the picker can pick bombs, he can himself use the bomb, otherwise he explodes.
        Overrides:
        onBePickedUp in class Item
        Parameters:
        picker - The picker
        animation - The AnimationInfo.
        Returns:
        true, if bomb can be picked up.
      • isBomb

        public boolean isBomb()
        Checks, if the item is a bomb.
        Overrides:
        isBomb in class Item
        Returns:
        true, if the bomb is ACTIVE.
      • getPickupText

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

        public boolean onBeHitByItem​(Thing rammer,
                                     AnimationInfo animation)
        Method called if another item moves to this items point (e.g. rockets). Returns true by default.
        Overrides:
        onBeHitByItem in class Item
        Parameters:
        rammer - The ramming item
        animation - The AnimationInfo.
        Returns:
        true, if this item should die and be replaced by the other item. false, if this item should stay and the rammer die.
      • onExplode

        protected int onExplode​(int min,
                                Thing source,
                                AnimationInfo animation)
        Sets the status to exploding (if it is not invulnerabe). Detonates, if active.
        Overrides:
        onExplode in class Thing
        Parameters:
        min - The energy loss.
        source - The source of the explosion.
        animation - The AnimationInfo.
        Returns:
        The modified energy loss.
      • onBeUsed

        public boolean onBeUsed​(Figure user,
                                AnimationInfo animation)
        Uses the big mine, by setting state to TOBEDROPPED, which drops the mine as soon as the user moves.
        Overrides:
        onBeUsed in class Item
        Parameters:
        user - The user.
        animation - The AnimationInfo.
        Returns:
        true, if item can be used.
      • doSpecialUpdate

        protected void doSpecialUpdate​(AnimationInfo animation)
        If the state is TOBEDROPPED, the bomb is placed on the droppoint, and the audio clip set in the clipStr variable is played. If active, the countdown is performed, if 0 is reached, the bomb detonates.
        Overrides:
        doSpecialUpdate in class Item
        Parameters:
        animation - The AnimationInfo.
      • performFieldEffect

        protected void performFieldEffect​(AnimationInfo animation)
        If the state is active, the countdown is performed, if 0 is reached, the bomb detonates.
        Overrides:
        performFieldEffect in class Item
        Parameters:
        animation - The AnimationInfo.
      • die

        public void die​(Thing source,
                        DieReason reason,
                        AnimationInfo animation)
        Sets the status of the thing to exploding (if it is not invulnerabe). Plays an explosion sound with strength 2.
        Overrides:
        die in class Item
        Parameters:
        animation - The AnimationInfo.
        source - The death source.
        reason - The death reason.
      • detonate

        protected void detonate​(AnimationInfo animation)
        Makes the BigMine detonate, if count down ends.
        Parameters:
        animation - The AnimationInfo.
      • doDetonate

        protected void doDetonate()
        Performs the detonation. Override to Detonates with a 3 point radius.
      • getDetonationPower

        public int getDetonationPower()
        Gets the detonation power.
        Returns:
        80 + energy*0.2
      • getCountDown

        public int getCountDown()
        Gets the time till detonation
        Returns:
        The time till detonation in rounds.
      • getState

        public BombState getState()
        Gets the bomb state.
        Returns:
        The bomb state.