Class MainQuest


public class MainQuest extends Quest
MainQuests are to represent the 3 main quests of the game as outlined in the storyline wiki. These MainQuests have a set of quests the player must complete and a timelimit.
  • Constructor Details

    • MainQuest

      public MainQuest(String name, Reward reward, int daysToExpiry, Set<String> questsToComplete, String goal)
      Creates a MainQuest
      Parameters:
      name - - name of the MainQuest
      reward - - Reward player collects on completion
      daysToExpiry - - how many in-game days until MainQuest is expired
      questsToComplete - - set of Quest names for the player to complete
      goal - - short String representation of what the player must do
  • Method Details

    • registerMission

      public void registerMission(EventHandler missionManagerEvents)
      Registers the MainQuest with the MissionManager by adding a listener to the QUEST_REWARD_COLLECTED MissionManager.MissionEvent
      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 MainQuest is complete.
      Specified by:
      isCompleted in class Mission
      Returns:
      - true iff player has completed all of the questsToComplete as specific in constructor.
    • getDescription

      public String getDescription()
      Gets a description of the MainQuest.
      Specified by:
      getDescription in class Mission
      Returns:
      - a description containing the goal and Quests the player has yet to complete.
    • getShortDescription

      public String getShortDescription()
      Gives a short description of the MainQuest's progress
      Specified by:
      getShortDescription in class Mission
      Returns:
      - description with how many Quests are yet to be completed
    • readProgress

      public void readProgress(com.badlogic.gdx.utils.JsonValue progress)
      Reads the progress specified in the JsonValue into the questsCompleted
      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()
      Gives the current progress of the MainQuest.
      Specified by:
      getProgress in class Mission
      Returns:
      - an Array containing the names of the Quests that are completed
    • resetState

      protected void resetState()
      Resets the state of the MainQuest by clearing the questsCompleted set.
      Specified by:
      resetState in class Quest