Class Mission

java.lang.Object
com.csse3200.game.missions.Mission
Direct Known Subclasses:
Achievement, Quest

public abstract class Mission extends Object
  • Constructor Details

    • Mission

      protected Mission(String name)
      Creates a Mission with the given String name.
      Parameters:
      name - The String name of the Mission, visible to the player in-game.
  • Method Details

    • getName

      public String getName()
      Returns the String name of this Mission.
      Returns:
      The String name of this Mission, which will be used by the player to identify the Mission in-game.
    • registerMission

      public abstract void registerMission(EventHandler missionManagerEvents)
      Registers the Mission to the MissionManager, by adding all event listeners to the service which the Mission needs to listen to in order to update its state.
      Parameters:
      missionManagerEvents - A reference to the EventHandler on the MissionManager, with which relevant events should be listened to.
    • isCompleted

      public abstract boolean isCompleted()
      Returns a boolean value representing whether the Mission has been completed.
      Returns:
      A boolean value representing whether the Mission has been completed.
    • getDescription

      public abstract String getDescription()
      Returns a String description of the Mission. This can involve an explanation of what the player needs to do to complete the Mission, and may dynamically change depending on the progress the player has made. For instance, you might choose to include in your description: "You have currently harvested X out of N plants".
      Returns:
      A String description of the Mission, including any relevant details you would like the player to know about.
    • getShortDescription

      public abstract String getShortDescription()
      Returns a short String description of the Mission. This description should be at most around 50 characters. This might simply contain progress information on the Mission, or a shortened form of getDescription().
      Returns:
      A short String description of the Mission
    • notifyUpdate

      public void notifyUpdate()
      Notifies the MissionManager that this Mission has been completed if isCompleted() returns true, else do nothing. You should call this method whenever you update the state of your Mission. If the event has already been triggered on the MissionManager for this Mission, it will not re-trigger the event, unless this method detects the Mission having become incomplete.
    • readProgress

      public abstract void readProgress(com.badlogic.gdx.utils.JsonValue progress)
      Sets the internal progress of the Mission based on the JsonValue provided. The JsonValue provided should match the same JsonValue.ValueType returned by getProgress(). An Exception might be raised otherwise (depending on the methods you use to get the state of the JsonValue).
      Parameters:
      progress - The JsonValue representing the progress of the Mission as determined by the value returned in getProgress().
    • getProgress

      public abstract Object getProgress()
      Gets the progress of the Mission as an Object, which contains all relevant information about the internal progress of the Mission. All stats which dynamically change should be stored in this Object in some way (i.e., all non-final values). Since this value will need to be read later using readProgress(JsonValue) as a JsonValue, you should make sure the returned Object's serialisation is known to you. This is easy for primitive types, lists, and maps, so try to make the data that you actively track of primitive type (or a list/map of primitive types). Note that for Quests, you do not need to store the time to expiry or whether the reward has been collected - you only need to store the changing state specific to the Quest.
      Returns:
      An Object, which stores the internal progress of the Mission. This Object should be serialisable, and the data should be able to be read as a JsonValue in readProgress(JsonValue).