All Known Implementing Classes:
AbstractTile, Actor, BlueKey, BlueLock, Coin, Door, Empty, ExitDoor, ExitDoorOpen, Floor, GreenKey, GreenLock, Hero, Info, Item, Key, Null, OrangeKey, OrangeLock, Periphery, Wall, YellowKey, YellowLock

public interface Tile
This is the tile interface that every tile in this game must implement, and it has a wide range of methods most with default implementations.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    This method checks wether a given tile can cause damage/kill the hero.
    Each tile will hold an info object, which stores most "field-like" info that the tile may have.
    default boolean
    Checks wether this tile is an obstruction for enemy tile ,in a given domain.
    default boolean
    Checks wether this tile is an obstruction for hero tile ,in a given domain.
    default void
    Calculates the next state of the tile in the domain(maze/inventory).
    default 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.
    default void
    setOn(Tile t, Domain d)
    Sets the given tile t instead of this tile on maze, changing the domain to do so.
    char
    Each tile type should have a symbol, this is for testing purposes.
    Each tile object will hold a reference to one TileState enum, which determines the behaviour of a number of the tiles important methods.
  • Method Details

    • type

      TileType type()
      Each tile object will hold a reference to one TileState enum, which determines the behaviour of a number of the tiles important methods.
      Returns:
      the enum type of this tile, if custom tile then TileType.Other is returned.
    • info

      TileInfo info()
      Each tile will hold an info object, which stores most "field-like" info that the tile may have. Eg location of tile, number of pings that tile has seen, image name of the tile, etc. This allows us to pass only one parameter when constructing a tile.
      Returns:
      TileInfo object of the this tile
    • symbol

      char symbol()
      Each tile type should have a symbol, this is for testing purposes.
      Returns:
      symbol character for this tile type
    • damagesHero

      default boolean damagesHero(Domain d)
      This method checks wether a given tile can cause damage/kill the hero. this is not a field, since tiles may behave different depending on the state of the game. e.g having armor in inventory NOTE: does not alter the domain or this tile in anyway.
      Parameters:
      d - game domain to check on
      Returns:
      true if damages hero, if not implemented, defaults to false
    • obstructsHero

      default boolean obstructsHero(Domain d)
      Checks wether this tile is an obstruction for hero 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 hero, if not implemented, defaults to false.
    • obstructsEnemy

      default boolean obstructsEnemy(Domain d)
      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

      default Tile replaceWith()
      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

      default void setOn(Tile t, Domain d)

      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.
      Throws:
      NullPointerException - if t or d are null (may also throw other types of runtime exceptions for unexpected inputs, in overriden classes)
    • ping

      default void ping(Domain d)
      Calculates the next state of the tile in the domain(maze/inventory). Based on the tile and domain state, this method may alter the state of the tile and given domain object. NOTE: may alter domain.
      Parameters:
      d - domain object, (maze/inventory), where this change is happening.