Class ClearDebrisQuest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.ClearDebrisQuest
- Direct Known Subclasses:
SpaceDebrisQuest
ClearDebrisQuest is a Quest that monitors and tracks the player clearing debris.
-
Constructor Summary
ConstructorsConstructorDescriptionClearDebrisQuest
(String name, Reward reward, int numberOfDebrisToClear) A Quest where player is required to clear a certain amount of debris.ClearDebrisQuest
(String name, Reward reward, int expiryDuration, int numberOfDebrisToClear) Constructor for a ClearDebrisQuest where isMandatory and expiryDuration can be specified. -
Method Summary
Modifier and TypeMethodDescriptionThe description of the Quest to give a representation of the player's progress in the Quest.Get the number of debris the player has cleared since Quest was registered.Gives the player's progress in the ClearDebrisQuest.boolean
Checks if the ClearDebrisQuest is completevoid
readProgress
(com.badlogic.gdx.utils.JsonValue progress) Read in the amount of debris the player has cleared from a JsonValue.void
registerMission
(EventHandler missionManagerEvents) Registers the Quest with theMissionManager
by listening to the DEBRIS_CLEAR Mission event.protected void
Resets the number of debris cleared 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
-
ClearDebrisQuest
A Quest where player is required to clear a certain amount of debris.- Parameters:
name
- - Human-readable name of the Quest.reward
- - Reward player will receive after completing the Quest.numberOfDebrisToClear
- - Amount of debris the player is required to clear.
-
ClearDebrisQuest
Constructor for a ClearDebrisQuest where isMandatory and expiryDuration can be specified.- Parameters:
name
- - Human-readable name of the Quest.reward
- - Reward player will receive after completing the Quest.expiryDuration
- - Number of in-game hours before the Quest is considered expired.numberOfDebrisToClear
- - Amount of debris the player is required to clear.
-
-
Method Details
-
registerMission
Registers the Quest with theMissionManager
by listening to the DEBRIS_CLEAR Mission event.- Specified by:
registerMission
in classMission
- Parameters:
missionManagerEvents
- - A reference to theEventHandler
on theMissionManager
, with which relevant events should be listened to.
-
isCompleted
public boolean isCompleted()Checks if the ClearDebrisQuest is complete- Specified by:
isCompleted
in classMission
- Returns:
- - True if player has cleared at least numberOfDebrisToClear, otherwise False.
-
getDescription
The description of the Quest to give a representation of the player's progress in the Quest.- Specified by:
getDescription
in classMission
- Returns:
- - Human-readable description of the ClearDebrisQuest.
-
getShortDescription
Gives the player's progress in the ClearDebrisQuest.- Specified by:
getShortDescription
in classMission
- Returns:
- - Human-readable String of how much debris the player has cleared and how much they have left to clear.
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Read in the amount of debris the player has cleared from a JsonValue.- Specified by:
readProgress
in classMission
- Parameters:
progress
- TheJsonValue
representing the progress of theMission
as determined by the value returned ingetProgress()
.
-
getProgress
Get the number of debris the player has cleared since Quest was registered.- Specified by:
getProgress
in classMission
- Returns:
- - number of debris cleared
-
resetState
protected void resetState()Resets the number of debris cleared to 0.- Specified by:
resetState
in classQuest
-