Enemy

scalata.domain.entities.Enemy
final case class Enemy(id: String, name: String, enemyType: EnemyClasses, position: Point2D, health: Int, maxHealth: Int, attackPower: Int) extends Entity, Alive[Enemy], Movable[Enemy], Combatant[Player]

Hostile creature.

  • enemyType – family/glyph (goblin, pig, …).

  • position – current tile.

  • health / maxHealth – hit-points pool.

  • attackPower – raw damage inflicted to a player.

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

Attributes

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

Members list

Value members

Concrete methods

override def attack(opponent: Player): Player

Resolve an attack against opponent.

Resolve an attack against opponent.

Attributes

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

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): Enemy

Produce a copy of the entity at pos.

Produce a copy of the entity at pos.

Attributes

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

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

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product