Class OxygenLevelQuest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.OxygenLevelQuest
A
Quest where the player has to reach a certain oxygen level.-
Constructor Summary
ConstructorsConstructorDescriptionOxygenLevelQuest(String name, Reward reward, int expiryDuration, OxygenLevel oxygenLevel, String oxygenLevelDescription, int hourTarget, int targetOxygenLevel) Creates anOxygenLevelQuestOxygenLevelQuest(String name, Reward reward, OxygenLevel oxygenLevel, String oxygenLevelDescription, int hourTarget, int targetOxygenLevel) Creates anOxygenLevelQuest -
Method Summary
Modifier and TypeMethodDescriptionGets a description of theOxygenLevelQuestGets theOxygenLevelQuest's progress.Gets a short description of theOxygenLevelQuestbooleanChecks if theOxygenLevelQuestvoidreadProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentOxygenLevelQuestfrom aJsonValuevoidregisterMission(EventHandler ignored) Registers theOxygenLevelQuestwith theMissionManagerby setting up listener to the hourUpdate event in the TimeService.protected voidResets the current hours back to 0.Methods inherited from class com.csse3200.game.missions.quests.Quest
collectReward, isExpired, isMandatory, isRewardCollected, read, resetExpiry, updateExpiry, writeMethods inherited from class com.csse3200.game.missions.Mission
getName, notifyUpdate
-
Constructor Details
-
OxygenLevelQuest
public OxygenLevelQuest(String name, Reward reward, OxygenLevel oxygenLevel, String oxygenLevelDescription, int hourTarget, int targetOxygenLevel) Creates anOxygenLevelQuest- Parameters:
name- - quest namereward- - the reward the player can collect when quest is completeoxygenLevel- - game'sOxygenLevelobjectoxygenLevelDescription- - description of theOxygenLevelQuesthourTarget- - hours until the oxygen level has to be reachedtargetOxygenLevel- - oxygen level game must reach before theOxygenLevelQuestexpires
-
OxygenLevelQuest
public OxygenLevelQuest(String name, Reward reward, int expiryDuration, OxygenLevel oxygenLevel, String oxygenLevelDescription, int hourTarget, int targetOxygenLevel) Creates anOxygenLevelQuest- Parameters:
name- - quest namereward- - the reward the player can collect when quest is completeexpiryDuration- - duration until the Quest expiresoxygenLevel- - game'sOxygenLevelobjectoxygenLevelDescription- - description of theOxygenLevelQuesthourTarget- - hours until the oxygen level has to be reachedtargetOxygenLevel- - oxygen level game must reach before theOxygenLevelQuestexpires
-
-
Method Details
-
registerMission
Registers theOxygenLevelQuestwith theMissionManagerby setting up listener to the hourUpdate event in the TimeService.- Specified by:
registerMissionin classMission- Parameters:
ignored- A reference to theEventHandleron theMissionManager, with which relevant events should be listened to.
-
isCompleted
public boolean isCompleted()Checks if theOxygenLevelQuest- Specified by:
isCompletedin classMission- 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
Gets a description of theOxygenLevelQuest- Specified by:
getDescriptionin classMission- Returns:
- - the quest description with the player's progress
-
getShortDescription
Gets a short description of theOxygenLevelQuest- Specified by:
getShortDescriptionin classMission- Returns:
- - short description containing the player's progress
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentOxygenLevelQuestfrom aJsonValue- Specified by:
readProgressin classMission- Parameters:
progress- TheJsonValuerepresenting the progress of theMissionas determined by the value returned ingetProgress().
-
getProgress
Gets theOxygenLevelQuest's progress.- Specified by:
getProgressin classMission- Returns:
- - number of hours since the quest was initiated
-
resetState
protected void resetState()Resets the current hours back to 0.- Specified by:
resetStatein classQuest
-