PlayerAttackUseCase
scalata.application.usecases.playerusecases.PlayerAttackUseCase
class PlayerAttackUseCase extends CreatureUseCase[GameResult[GameSession], Direction]
Executes a player attack in the chosen direction.
==== Algorithm ====
-
Compute a reach vector whose length equals the player’s
reachstat. -
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
GameSessionwrapped inGameResult.success.
Failure modes If the room referenced by GameState.currentRoom is missing, an IllegalStateException is thrown (world corruption guard).
Attributes
- Graph
-
- Supertypes
Members list
In this article