Weapon

scalata.domain.entities.items.Weapon
See theWeapon companion object
final case class Weapon(id: String, position: Option[Point2D], name: String, itemClass: ItemClasses, damage: Int) extends Item, Pickable

Equippable weapon.

==== Key points ====

  • damage – base attack value added to the player’s own power.

  • Pickable – calling interact removes the item from the floor and places it in the player inventory.

  • Usable – the given instance in the companion equips the weapon and then deletes it from the bag (one-slot logic).

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Pickable
trait Item
trait Interactable
trait Entity
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def attack(playerAttack: Int): Int

Compute total damage dealt when used by a player.

Compute total damage dealt when used by a player.

Attributes

override def interact(gameSession: GameSession): GameResult[GameSession]

Pick up the weapon.

Pick up the weapon.

Attributes

Definition Classes
override def spawn(pos: Option[Point2D]): Weapon

Create the same item at a given position.

Create the same item at a given position.

Attributes

Definition Classes

Inherited methods

def isPicked: Boolean

true if the item has been removed from the floor.

true if the item has been removed from the floor.

Attributes

Inherited from:
Item
def pick(item: Item, gameSession: GameSession): GameSession

Transfer item from floor to inventory.

Transfer item from floor to inventory.

Value parameters

gameSession

current session snapshot

item

the item being collected

Attributes

Returns

a new session with world and player updated

Inherited from:
Pickable
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
override def toString: String

Glyph used by the ASCII renderer.

Glyph used by the ASCII renderer.

Attributes

Definition Classes
Item -> Any
Inherited from:
Item