Class FertiliseCropTilesQuest

java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.FertiliseCropTilesQuest

public class FertiliseCropTilesQuest extends Quest
FertiliseCropTilesQuest class is a Quest that tracks the number of CropTiles have been fertilised.
  • Constructor Details

    • FertiliseCropTilesQuest

      public FertiliseCropTilesQuest(String name, Reward reward, int numberOfTilesToFertilise)
      Parameters:
      name - - the name of the FertiliseCropTilesQuest
      reward - - the Reward a player will receive after completing the Quest
      numberOfTilesToFertilise - - the number of cropTileComponents the player has currently fertilised
    • FertiliseCropTilesQuest

      public FertiliseCropTilesQuest(String name, Reward reward, int expiryDuration, int numberOfTilesToFertilise)
      Parameters:
      name - The name of the FertiliseCropTilesQuest
      reward - The Reward for completion of the Quest
      expiryDuration - The time limit to complete the Quest once accepted
      numberOfTilesToFertilise - The number of crop tiles to fertilise before completing the Quest
  • Method Details

    • registerMission

      public void registerMission(EventHandler missionManagerEvents)
      Registers the FertiliseCropTilesQuest with the Mission by no listening to the FERTILISE_CROP event.
      Specified by:
      registerMission in class Mission
      Parameters:
      missionManagerEvents - A reference to the EventHandler on the MissionManager, with which relevant events should be listened to.
    • isCompleted

      public boolean isCompleted()
      Returns true if the number of crop tiles the player has fertilised is greater than or equal to the target number of tiles.
      Specified by:
      isCompleted in class Mission
      Returns:
      True if the player has fertilised the target number of fertilised tiles.
    • getDescription

      public String getDescription()
      The description of the Quest to give a representation of the player's progress in the Quest.
      Specified by:
      getDescription in class Mission
      Returns:
      - Human-readable description of the FertiliseCropTilesQuest.
    • getShortDescription

      public String getShortDescription()
      Gives the player's progress in the FertiliseCropTilesQuest.
      Specified by:
      getShortDescription in class Mission
      Returns:
      - Human-readable String of how many cropTiles the player has fertilised and how much they have left to clear.
    • readProgress

      public void readProgress(com.badlogic.gdx.utils.JsonValue progress)
      Read in the amount of debris the player has cleared from a JsonValue.
      Specified by:
      readProgress in class Mission
      Parameters:
      progress - The JsonValue representing the progress of the Mission as determined by the value returned in getProgress().
    • getProgress

      public Object getProgress()
      Get the number of cropTiles the player has fertilised since Quest was registered.
      Specified by:
      getProgress in class Mission
      Returns:
      - number of cropTiles fertilised
    • resetState

      protected void resetState()
      Resets the number of cropTiles the player has fertilised to 0.
      Specified by:
      resetState in class Quest