Room

scalata.domain.world.Room
final case class Room(id: String, topLeft: Point2D, botRight: Point2D, exits: Map[Direction, String], items: List[Item], enemies: List[Enemy])

Immutable description of a rectangular room on a floor.

==== Structure ====

  • id unique room identifier (used by world graph).

  • topLeft / botRight corner coordinates that delimit the rectangle.

  • exits map Direction → roomId for door connectivity.

  • items loot on the ground.

  • enemies creatures currently inhabiting the room.

==== Main operations ====

  • Geometry helpers (size, border checks, isInside).
  • Topology helpers (getNeighbor, getDoorPosition).
  • Pure mutators that return a new room (withItems, withEnemies, removeItem).
  • Queries for entities at a given coordinate.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def getAliveEnemies: List[Enemy]
def getAliveEnemyAtPosition(position: Point2D): Option[Enemy]
def getEnemyAtPosition(position: Point2D): Option[Enemy]
def getItemAtPosition(position: Point2D): Option[Item]
def getNeighbor(direction: Direction): Option[String]
def isInside(point: Point2D): Boolean
def isSideBorder(point: Point2D): Boolean
def isTopBotBorder(point: Point2D): Boolean
def removeItem(item: Item): Room
def size: (Int, Int)
def withEnemies(enemies: List[Enemy]): Room
def withItems(items: List[Item]): Room

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product