Class FishingQuest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.FishingQuest
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FishingQuest
(String name, Reward reward, int fishToCatch) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns a boolean value representing whether theMission
has been completed.void
readProgress
(com.badlogic.gdx.utils.JsonValue progress) Sets the internal progress of theMission
based on theJsonValue
provided.void
registerMission
(EventHandler missionManagerEvents) Registers theMission
to theMissionManager
, by adding all event listeners to the service which theMission
needs to listen to in order to update its state.protected void
Resets the internal state of theQuest
, to what it was before being accepted/modified.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
-
FishingQuest
-
-
Method Details
-
registerMission
Description copied from class:Mission
Registers theMission
to theMissionManager
, by adding all event listeners to the service which theMission
needs to listen to in order to update its state.- 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()Description copied from class:Mission
Returns a boolean value representing whether theMission
has been completed.- Specified by:
isCompleted
in classMission
- Returns:
- A boolean value representing whether the
Mission
has been completed.
-
getDescription
Description copied from class:Mission
Returns aString
description of theMission
. This can involve an explanation of what the player needs to do to complete theMission
, 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".- Specified by:
getDescription
in classMission
- Returns:
- A
String
description of theMission
, including any relevant details you would like the player to know about.
-
getShortDescription
Description copied from class:Mission
Returns a shortString
description of theMission
. This description should be at most around 50 characters. This might simply contain progress information on theMission
, or a shortened form ofMission.getDescription()
.- Specified by:
getShortDescription
in classMission
- Returns:
- A short
String
description of theMission
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Description copied from class:Mission
Sets the internal progress of theMission
based on theJsonValue
provided. TheJsonValue
provided should match the sameJsonValue.ValueType
returned byMission.getProgress()
. AnException
might be raised otherwise (depending on the methods you use to get the state of theJsonValue
).- Specified by:
readProgress
in classMission
- Parameters:
progress
- TheJsonValue
representing the progress of theMission
as determined by the value returned inMission.getProgress()
.
-
getProgress
Description copied from class:Mission
Gets the progress of theMission
as anObject
, which contains all relevant information about the internal progress of theMission
. All stats which dynamically change should be stored in thisObject
in some way (i.e., all non-final values). Since this value will need to be read later usingMission.readProgress(JsonValue)
as aJsonValue
, you should make sure the returnedObject
'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 forQuest
s, 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 theQuest
.- Specified by:
getProgress
in classMission
- Returns:
- An
Object
, which stores the internal progress of theMission
. ThisObject
should be serialisable, and the data should be able to be read as aJsonValue
inMission.readProgress(JsonValue)
.
-
resetState
protected void resetState()Description copied from class:Quest
Resets the internal state of theQuest
, to what it was before being accepted/modified.- Specified by:
resetState
in classQuest
-