Class ItemAbstractChrystal

    • Field Detail

      • exitX

        protected int exitX
      • exitY

        protected int exitY
    • Constructor Detail

      • ItemAbstractChrystal

        public ItemAbstractChrystal()
        Creates a new ItemEnergyPlus.
    • Method Detail

      • isAvailableInEditor

        public boolean isAvailableInEditor()
        Checks, if this item is available in level editor.
        Overrides:
        isAvailableInEditor in class Item
        Returns:
        false.
      • getItemRating

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

        public boolean beforePickup​(Figure picker,
                                    AnimationInfo animation)
        Called when picked up. Frees a permanent item slot and directly adds the chrystal as permanent item.
        Overrides:
        beforePickup in class ItemPermanent
        Parameters:
        picker - The figure picking the item.
        animation - The AnimationInfo.
        Returns:
        true, if the item can be picked up (either if item is unique or picker still has free slots).
      • checkPickup

        protected boolean checkPickup​(Figure picker)
        Checks, if the chrystal will really be picked up - false, if same chrystal is already owned.
        Parameters:
        picker - The figure to check.
        Returns:
        true, if chrystal is not yet owned.
      • freeSlot

        protected void freeSlot​(Figure picker,
                                AnimationInfo animation)
        Does nothing, if picker has free slots. Adds one, if still one to add. Otherwise, searches the last permanent item that is not occupied by a chrystal and removes it.
        Parameters:
        picker - The picker.
        animation - The AnimationInfo.
      • lostPermanentItem

        public void lostPermanentItem​(Figure f,
                                      Item i,
                                      AnimationInfo animation)
        Adds this item as permanent, if the last permanent item was finally removed and removes itself as item listener.
        Specified by:
        lostPermanentItem in interface FigureItemListener
        Overrides:
        lostPermanentItem in class Item
        Parameters:
        f - The figure.
        i - The item.
        animation - The AnimationInfo.
      • getRamPower

        public int getRamPower​(Figure f,
                               Figure rammer,
                               int initialRamPower)
        Description copied from class: Item
        Empty figure listener method.
        Specified by:
        getRamPower in interface FigureRamListener
        Overrides:
        getRamPower in class Item
        Parameters:
        f - The figure.
        rammer - The figure that is rammed.
        initialRamPower - The original ramPower.
        Returns:
        The original ram power.
      • createExit

        protected void createExit​(int x,
                                  int y,
                                  AnimationInfo animation)
        Creates the exit when collected.
        Parameters:
        x - The x coordinate.
        y - The y coordinate.
        animation - AnimationInfo.