Class Quest

java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
Direct Known Subclasses:
AutoQuest, ClearDebrisQuest, FertiliseCropTilesQuest, FishingQuest, InventoryStateQuest, MainQuest, ManageHostilesQuest, MissionCompleteQuest, OxygenLevelQuest, PlantInteractionQuest, ShipRepairQuest, TameAnimalsQuest

public abstract class Quest extends Mission
  • Constructor Details

    • Quest

      protected Quest(String name, Reward reward)
      Creates a Quest with the given String name, specifying the Reward for completion. Quests created using this constructor cannot expire.
      Parameters:
      name - The String name of the Quest, visible to the player in-game
      reward - The Reward which can be collected upon completion of the Quest
    • Quest

      protected Quest(String name, Reward reward, int expiryDuration, boolean isMandatory)
      Creates a Quest with the given String name, specifying the Reward for completion, the integer duration of the Quest (the number of hours before the Quest expires), and whether the Quest is mandatory. Quests created using this constructor will expire after the specified time limit.
      Parameters:
      name - The String name of the Quest, visible to the player in-game
      reward - The Reward which can be collected upon completion of the Quest
      expiryDuration - An integer value representing the number of hours before this Quest should expire
      isMandatory - A boolean value representing whether the Quest is mandatory. Mandatory Quests will result in a game over if it is not completed before it expires.
  • Method Details

    • updateExpiry

      public void updateExpiry()
      Decrements the duration to expiry of the quest by 1, if the Quest can expire.
    • isExpired

      public boolean isExpired()
      Returns a boolean value representing whether the quest has expired. If the Quest does not expire, then this method will always return false.
      Returns:
      True if the Quest can expire and has expired, false otherwise.
    • isMandatory

      public boolean isMandatory()
      Determines whether the quest is mandatory or not
      Returns:
      boolean value representing whether the quest is mandatory
    • isRewardCollected

      public boolean isRewardCollected()
      Returns a boolean value representing if this quest's rewards has been collected yet.
      Returns:
      True if the reward has been collected, false otherwise.
    • collectReward

      public void collectReward()
      Collects the reward associated with this Quest. If the reward has already been collected, or if the Mission has not been completed, this method will do nothing.
    • resetExpiry

      public void resetExpiry()
      Resets the Quest's time to expiry back to the original expiry duration, and calls the Quest's resetState() method. This method only calls resetState() if it cannot expire.
    • resetState

      protected abstract void resetState()
      Resets the internal state of the Quest, to what it was before being accepted/modified.
    • write

      public void write(com.badlogic.gdx.utils.Json json)
    • read

      public void read(com.badlogic.gdx.utils.JsonValue jsonValue)