PlayerInventoryUseCase

scalata.application.usecases.playerusecases.PlayerInventoryUseCase

Handles the “use item” command.

  • Looks up the item by itemName in the player’s inventory.
  • Delegates to the Usable type-class to apply the effect (Potion, Weapon, Dust, …).
  • Updates the player inside the World and returns a GameResult.success wrapping the new GameSession.
  • If the player does not own the item, returns GameResult.Error(GameError.ItemNotOwned).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def execute(itemName: String, gameSession: GameSession): GameResult[GameSession]

Apply the effect of the requested item.

Apply the effect of the requested item.

Value parameters

gameSession

immutable snapshot before execution

itemName

user-supplied identifier (case-insensitive, spaces stripped)

Attributes

Returns

updated session in GameResult.success or ItemNotOwned error

Definition Classes