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 anOxygenLevelQuest
OxygenLevelQuest
(String name, Reward reward, OxygenLevel oxygenLevel, String oxygenLevelDescription, int hourTarget, int targetOxygenLevel) Creates anOxygenLevelQuest
-
Method Summary
Modifier and TypeMethodDescriptionGets a description of theOxygenLevelQuest
Gets theOxygenLevelQuest
's progress.Gets a short description of theOxygenLevelQuest
boolean
Checks if theOxygenLevelQuest
void
readProgress
(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentOxygenLevelQuest
from aJsonValue
void
registerMission
(EventHandler ignored) Registers theOxygenLevelQuest
with theMissionManager
by setting up listener to the hourUpdate event in the TimeService.protected void
Resets the current hours back to 0.Methods inherited from class com.csse3200.game.missions.quests.Quest
collectReward, isExpired, isMandatory, isRewardCollected, read, resetExpiry, updateExpiry, write
Methods 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'sOxygenLevel
objectoxygenLevelDescription
- - description of theOxygenLevelQuest
hourTarget
- - hours until the oxygen level has to be reachedtargetOxygenLevel
- - oxygen level game must reach before theOxygenLevelQuest
expires
-
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'sOxygenLevel
objectoxygenLevelDescription
- - description of theOxygenLevelQuest
hourTarget
- - hours until the oxygen level has to be reachedtargetOxygenLevel
- - oxygen level game must reach before theOxygenLevelQuest
expires
-
-
Method Details
-
registerMission
Registers theOxygenLevelQuest
with theMissionManager
by setting up listener to the hourUpdate event in the TimeService.- Specified by:
registerMission
in classMission
- Parameters:
ignored
- A reference to theEventHandler
on theMissionManager
, with which relevant events should be listened to.
-
isCompleted
public boolean isCompleted()Checks if theOxygenLevelQuest
- Specified by:
isCompleted
in 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:
getDescription
in classMission
- Returns:
- - the quest description with the player's progress
-
getShortDescription
Gets a short description of theOxygenLevelQuest
- Specified by:
getShortDescription
in classMission
- Returns:
- - short description containing the player's progress
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentOxygenLevelQuest
from aJsonValue
- Specified by:
readProgress
in classMission
- Parameters:
progress
- TheJsonValue
representing the progress of theMission
as determined by the value returned ingetProgress()
.
-
getProgress
Gets theOxygenLevelQuest
's progress.- Specified by:
getProgress
in classMission
- Returns:
- - number of hours since the quest was initiated
-
resetState
protected void resetState()Resets the current hours back to 0.- Specified by:
resetState
in classQuest
-