Class OxygenLevelQuest


public class OxygenLevelQuest extends Quest
A Quest where the player has to reach a certain oxygen level.
  • Constructor Details

    • OxygenLevelQuest

      public OxygenLevelQuest(String name, Reward reward, OxygenLevel oxygenLevel, String oxygenLevelDescription, int hourTarget, int targetOxygenLevel)
      Creates an OxygenLevelQuest
      Parameters:
      name - - quest name
      reward - - the reward the player can collect when quest is complete
      oxygenLevel - - game's OxygenLevel object
      oxygenLevelDescription - - description of the OxygenLevelQuest
      hourTarget - - hours until the oxygen level has to be reached
      targetOxygenLevel - - oxygen level game must reach before the OxygenLevelQuest expires
    • OxygenLevelQuest

      public OxygenLevelQuest(String name, Reward reward, int expiryDuration, OxygenLevel oxygenLevel, String oxygenLevelDescription, int hourTarget, int targetOxygenLevel)
      Creates an OxygenLevelQuest
      Parameters:
      name - - quest name
      reward - - the reward the player can collect when quest is complete
      expiryDuration - - duration until the Quest expires
      oxygenLevel - - game's OxygenLevel object
      oxygenLevelDescription - - description of the OxygenLevelQuest
      hourTarget - - hours until the oxygen level has to be reached
      targetOxygenLevel - - oxygen level game must reach before the OxygenLevelQuest expires
  • Method Details

    • registerMission

      public void registerMission(EventHandler ignored)
      Registers the OxygenLevelQuest with the MissionManager by setting up listener to the hourUpdate event in the TimeService.
      Specified by:
      registerMission in class Mission
      Parameters:
      ignored - A reference to the EventHandler on the MissionManager, with which relevant events should be listened to.
    • isCompleted

      public boolean isCompleted()
      Checks if the OxygenLevelQuest
      Specified by:
      isCompleted in class Mission
      Returns:
      - returns true iff the current hour is at least as big as the hour target and the oxygen level is at least as big as the target oxygen level.
    • getDescription

      public String getDescription()
      Gets a description of the OxygenLevelQuest
      Specified by:
      getDescription in class Mission
      Returns:
      - the quest description with the player's progress
    • getShortDescription

      public String getShortDescription()
      Gets a short description of the OxygenLevelQuest
      Specified by:
      getShortDescription in class Mission
      Returns:
      - short description containing the player's progress
    • readProgress

      public void readProgress(com.badlogic.gdx.utils.JsonValue progress)
      Reads in the current OxygenLevelQuest 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()
      Gets the OxygenLevelQuest's progress.
      Specified by:
      getProgress in class Mission
      Returns:
      - number of hours since the quest was initiated
    • resetState

      protected void resetState()
      Resets the current hours back to 0.
      Specified by:
      resetState in class Quest