scalata.domain.entities.components

Members list

Type members

Classlikes

trait Alive[E <: Alive[E]]

Capability mix-in for entities that possess hit-points.

Capability mix-in for entities that possess hit-points.

Type parameters

E

concrete entity type that mixes in Alive

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Enemy
class Player
trait Combatant[E]

Entity that can engage in combat.

Entity that can engage in combat.

  • attackPower – base damage dealt by the entity.

  • attack – pure function: returns a new instance of the opponent after damage has been applied.

Type parameters

E

concrete opponent type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Enemy
class Player
trait Interactable

Type-class-style capability for entities that can be interacted with.

Type-class-style capability for entities that can be interacted with.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Item
class Dust
class ExitDoor
class Potion
class Sign
class Weapon
Show all
trait Inventory[E <: Inventory[E]]

Capability mix-in for entities that own a inventory plus an optional equipped weapon.

Capability mix-in for entities that own a inventory plus an optional equipped weapon.

  • inventory – list of items currently held.

  • weapon – optional equipped Weapon.

  • equipWeapon – returns a new instance with the weapon set.

  • addItem – adds an item to the inventory.

  • getItem – finds an item by (trimmed, case-insensitive) name.

  • removeItem – deletes an item from the inventory.

Type parameters

E

concrete entity type that mixes in Inventory

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Player
trait Movable[E <: Movable[E]]

Capability mix-in for entities that can change their position.

Capability mix-in for entities that can change their position.

==== Contract ====

  • position – current tile coordinate.

  • move – returns a new instance at a different Point2D; never mutates in place.

Type parameters

E

concrete entity type that implements the trait

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Enemy
class Player
trait Pickable

Mixin for every item that the player can pick up.

Mixin for every item that the player can pick up.

  • pick removes the item from the current room and adds it to the player’s inventory, returning an updated GameSession.
  • If the room referenced by GameState.currentRoom cannot be found (world corruption), the method throws IllegalStateException.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Dust
class Potion
class Weapon
trait Usable[A <: Item, E <: Entity]

Type-class describing an item that can be used by an entity.

Type-class describing an item that can be used by an entity.

==== Contract ====

  • A – concrete item subtype.

  • E – entity subtype that can own / use the item.

  • use returns a new instance of the owner reflecting the item’s effect (pure, no mutation).

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Usable

Inline helper that tries to use a runtime item if a matching Usable instance is available.

Inline helper that tries to use a runtime item if a matching Usable instance is available.

The method performs an inline pattern-match on the concrete item type and, through summonInline, obtains the given instance for Potion, Dust or Weapon. Unsupported items yield None.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Usable.type