PlayerAttackUseCase

scalata.application.usecases.playerusecases.PlayerAttackUseCase

Executes a player attack in the chosen direction.

==== Algorithm ====

  • Compute a reach vector whose length equals the player’s reach stat.

  • Build the inclusive line of points from the player’s position to the target tile (rangeTo).

  • For every enemy in the current room:

  • If the enemy is alive and its position lies on the line, apply player.attack.

  • Return an updated GameSession wrapped in GameResult.success.

Failure modes If the room referenced by GameState.currentRoom is missing, an IllegalStateException is thrown (world corruption guard).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def execute(direction: Direction, gameSession: GameSession): GameResult[GameSession]

Perform one attack action.

Perform one attack action.

Value parameters

direction

direction chosen by the player

gameSession

immutable snapshot before the attack

Attributes

Returns

updated snapshot wrapped in a successful GameResult

Definition Classes