Class ClearDebrisQuest

Direct Known Subclasses:
SpaceDebrisQuest

public class ClearDebrisQuest extends Quest
ClearDebrisQuest is a Quest that monitors and tracks the player clearing debris.
  • Constructor Details

    • ClearDebrisQuest

      public ClearDebrisQuest(String name, Reward reward, int numberOfDebrisToClear)
      A Quest where player is required to clear a certain amount of debris.
      Parameters:
      name - - Human-readable name of the Quest.
      reward - - Reward player will receive after completing the Quest.
      numberOfDebrisToClear - - Amount of debris the player is required to clear.
    • ClearDebrisQuest

      public ClearDebrisQuest(String name, Reward reward, int expiryDuration, int numberOfDebrisToClear)
      Constructor for a ClearDebrisQuest where isMandatory and expiryDuration can be specified.
      Parameters:
      name - - Human-readable name of the Quest.
      reward - - Reward player will receive after completing the Quest.
      expiryDuration - - Number of in-game hours before the Quest is considered expired.
      numberOfDebrisToClear - - Amount of debris the player is required to clear.
  • Method Details

    • registerMission

      public void registerMission(EventHandler missionManagerEvents)
      Registers the Quest with the MissionManager by listening to the DEBRIS_CLEAR Mission 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()
      Checks if the ClearDebrisQuest is complete
      Specified by:
      isCompleted in class Mission
      Returns:
      - True if player has cleared at least numberOfDebrisToClear, otherwise False.
    • 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 ClearDebrisQuest.
    • getShortDescription

      public String getShortDescription()
      Gives the player's progress in the ClearDebrisQuest.
      Specified by:
      getShortDescription in class Mission
      Returns:
      - Human-readable String of how much debris the player has cleared 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 debris the player has cleared since Quest was registered.
      Specified by:
      getProgress in class Mission
      Returns:
      - number of debris cleared
    • resetState

      protected void resetState()
      Resets the number of debris cleared to 0.
      Specified by:
      resetState in class Quest