Skip to content

Create interface goals with 4 sub-goals checking that a player has fulfilled

Carl Gützkow requested to merge create-goals into main

closes: #7 (closed)

What are the key features of this change

The Goal interface has a method isFulfilled. This method can be called on a player to check if the player's attributes have achieved a certain goal. Each goal that implements this interface has a constructor which sets the value to check the player with. When the isFulfilled method is called, it returns some boolean value representing if the player has the goal fulfilled. The isFulfilled method can be called several times on the same player.

Actions added:

  1. HealthGoal: Uses the player's getHealth method to retrieve the player's health.
  2. ScoreGoal: Uses the player's getScore method to retrieve the player's score.
  3. GoldGoal: Uses the player's getGold method to retrieve the player's gold.
  4. InventoryAddGoal: Adds a non-null and non-blank String to the players inventory. Uses the addToInventory method

Tests for all goals have been added and are seperated into two files. One for the first three which uses integer checking and a second for testing inventory. Player tests were also modified as score can now be negative.


  • Javadoc
  • Relevant tests have been created
  • Build tool test passed
  • Class version is updated where relevant
Edited by Carl Gützkow

Merge request reports