EnemyAttackUseCase
scalata.application.usecases.enemyusecases.EnemyAttackUseCase
class EnemyAttackUseCase extends CreatureUseCase[Player, Room]
Executes the enemy attack phase.
==== Algorithm ====
-
Fetch the current
Playerfrom the session. -
For every alive enemy in the room:
-
Compute the four-tile neighbourhood around the enemy (
neighboursFiltered). -
If the player’s position lies in that neighbourhood, apply
enemy.attack(player). -
Return the player after all damage has been accumulated (purely functional fold).
The method is pure: it produces a new Player instance without mutating the session or the room.
Attributes
- Graph
-
- Supertypes
Members list
In this article