java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.domain.TileAnatomy.AbstractTile
nz.ac.vuw.ecs.swen225.gp6.domain.TileGroups.Item
All Implemented Interfaces:
Tile
Direct Known Subclasses:
Coin, Key

public abstract class Item extends AbstractTile
Everything that the player can pick up, including all kinds of key, all kinds of treasure and tool, must extend this class.
  • Constructor Details

    • Item

      public Item(TileInfo info)
      constructor for an item.
      Parameters:
      info - instance of tileInfo for an item
  • Method Details

    • obstructsEnemy

      public boolean obstructsEnemy(Domain d)
      Description copied from interface: Tile
      Checks wether this tile is an obstruction for enemy tile ,in a given domain. NOTE: does not alter the domain or this tile in anyway.
      Parameters:
      d - game domain to check on
      Returns:
      true if obstructs enemy, if not implemented, defaults to false.
    • replaceWith

      public Tile replaceWith()
      Description copied from interface: Tile
      when an actor is moved onto this tile, then is to move off of it, replace it with the tile that this method returns.
      Returns:
      tile that is to replace this tile after an actor going over it. If not implemented, defaults to Floor.
    • setOn

      public void setOn(Tile t, Domain d)
      Description copied from interface: Tile

      Sets the given tile t instead of this tile on maze, changing the domain to do so. NOTE1: may alter domain. NOTE2: does not check wether it's possible for tile t to move on this tile(thoroughly)! Although often it has a set of exceptions that will be thrown if a completely unexpected input is given.

      if not implemented defaults to replacing this tile with given tile on maze.

      Parameters:
      t - tile to replace this tile with, can not be null.
      d - domain where this change is happening, can not be null.