Package com.mg105.use_cases
Class OpponentSetInteractor
java.lang.Object
com.mg105.use_cases.OpponentSetInteractor
An interactor class that modifies and references GameState with methods relating to OpponentSet.
-
Constructor Summary
ConstructorDescriptionOpponentSetInteractor
(GameState gameState) Creates a new OpponentSetInteractor with a reference to GameState. -
Method Summary
Modifier and TypeMethodDescriptionstatic OpponentSet
compareLists
(Point coordinates, List<OpponentSet> opponents) Checks if a given spot on the map contains an OpponentSet.boolean
Sets the OpponentSet in the GameState to the one adjacent to the player.Checks if an OpponentSet is adjacent to the player character.
-
Constructor Details
-
OpponentSetInteractor
Creates a new OpponentSetInteractor with a reference to GameState.- Parameters:
gameState
- the GameState to be referred to.
-
-
Method Details
-
compareLists
Checks if a given spot on the map contains an OpponentSet.- Parameters:
coordinates
- A Point representing a coordinate being checked for an OpponentSet.opponents
- A collection of OpponentSets being searched for in the given Point.- Returns:
- the OpponentSet if opponent is found, or null if it is not.
-
verifyOpponent
Checks if an OpponentSet is adjacent to the player character.- Returns:
- the OpponentSet if the opponent is found, or null if it is not.
-
setOpponentSet
public boolean setOpponentSet()Sets the OpponentSet in the GameState to the one adjacent to the player.- Returns:
- whether there was an OpponentSet next to the player (true) or not (false).
-