scalata.domain.world

Members list

Type members

Classlikes

final case class GameSession(world: World, gameState: GameState, history: NonEmptyList[(World, GameState)])

Immutable wrapper that couples a World with its GameState and keeps an undo history.

Immutable wrapper that couples a World with its GameState and keeps an undo history.

==== Fields ====

  • world current game world (rooms, player, difficulty).

  • gameState progress on the current run.

  • history non-empty list of previous snapshots, newest first, used for the undo feature.

All “update” methods return a new GameSession; nothing is mutated in place.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object GameSession

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class GameState(currentRoom: String, visitedRooms: Set[String], currentLevel: Int, note: String)

Immutable snapshot of the player’s progress on the current run.

Immutable snapshot of the player’s progress on the current run.

  • currentRoom id of the room the player is standing in.

  • visitedRooms set of room ids already explored on this floor.

  • currentLevel tower floor index (starts at 1).

  • note short message shown to the user (help, errors, etc.).

All mutators return a new GameState; no in-place changes.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
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.

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

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class World(player: Player, difficulty: Int, rooms: Map[String, Room], roomsArrangement: List[List[String]])

Immutable game world.

Immutable game world.

Holds the current player, global difficulty, every generated room and their arrangement grid.

Attributes

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