EnemyAttackUseCase

scalata.application.usecases.enemyusecases.EnemyAttackUseCase

Executes the enemy attack phase.

==== Algorithm ====

  • Fetch the current Player from 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
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def execute(currentRoom: Room, gameSession: GameSession): Player

Deal damage from every adjacent enemy.

Deal damage from every adjacent enemy.

Value parameters

currentRoom

room containing the enemies

gameSession

immutable snapshot holding the player

Attributes

Returns

updated player after taking damage

Definition Classes