Player

scalata.domain.entities.Player
final case class Player(id: String, name: String, role: PlayerClasses, health: Int, maxHealth: Int, position: Point2D, weapon: Option[Weapon], inventory: List[Item], attackPower: Int) extends Entity, Movable[Player], Alive[Player], Combatant[Enemy], Inventory[Player]

Playable hero.

  • Stats depend on the chosen role (reach, visibility).

  • Pure API: every mutator returns a new Player.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Inventory[Player]
trait Combatant[Enemy]
trait Alive[Player]
trait Movable[Player]
trait Entity
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def addItem(item: Item): Player

Attributes

Definition Classes
override def attack(opponent: Enemy): Enemy

Resolve an attack against opponent.

Resolve an attack against opponent.

Attributes

Definition Classes
override def equipWeapon(weapon: Weapon): Player

Attributes

Definition Classes
override def getItem(itemName: String): Option[Item]

Attributes

Definition Classes
override def heal(amount: Int): Player

Heal the entity (never exceeds maxHealth).

Heal the entity (never exceeds maxHealth).

Attributes

Definition Classes
override def isAlive: Boolean

true when health > 0.

true when health > 0.

Attributes

Definition Classes
override def move(pos: Point2D): Player

Produce a copy of the entity at pos.

Produce a copy of the entity at pos.

Attributes

Definition Classes
def playerSymbol: String
def reach(): Integer
override def removeItem(item: Item): Player

Attributes

Definition Classes
override def takeDamage(damage: Int): Player

Apply damage and return the updated entity.

Apply damage and return the updated entity.

Attributes

Definition Classes
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def visibility(): Integer

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product