Class PlantInteractionQuest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.PlantInteractionQuest
A
Quest
where the player has to interact with a certain amount of plants.-
Constructor Summary
ConstructorsConstructorDescriptionPlantInteractionQuest
(String name, Reward reward, int expiryDuration, MissionManager.MissionEvent interactionType, Set<String> plantTypes, int interactionsTarget) Creates aPlantInteractionQuest
with an expiryPlantInteractionQuest
(String name, Reward reward, MissionManager.MissionEvent interactionType, Set<String> plantTypes, int interactionsTarget) Creates aPlantInteractionQuest
-
Method Summary
Modifier and TypeMethodDescriptionDescription of thePlantInteractionQuest
Gets thePlantInteractionQuest
Short description of thePlantInteractionQuest
boolean
Checks ifPlantInteractionQuest
is completevoid
readProgress
(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentPlantInteractionQuest
from aJsonValue
void
registerMission
(EventHandler missionManagerEvents) Registers thePlantInteractionQuest
with theMissionManager
by adding listeners to the interaction type.protected void
Resets the number of plant interactions to 0Methods 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
-
PlantInteractionQuest
public PlantInteractionQuest(String name, Reward reward, MissionManager.MissionEvent interactionType, Set<String> plantTypes, int interactionsTarget) Creates aPlantInteractionQuest
- Parameters:
name
- Quest namereward
- Reward the player can collect once completeinteractionType
- Type of plant interactionplantTypes
- Plant types the player can interact withinteractionsTarget
- Number of interactions the player needs to complete the quest
-
PlantInteractionQuest
public PlantInteractionQuest(String name, Reward reward, int expiryDuration, MissionManager.MissionEvent interactionType, Set<String> plantTypes, int interactionsTarget) Creates aPlantInteractionQuest
with an expiry- Parameters:
name
- Quest namereward
- Reward the player can collect once completeexpiryDuration
- How long until the Quest will expireinteractionType
- Type of plant interactionplantTypes
- Plant types the player can interact withinteractionsTarget
- Number of interactions the player needs to complete
-
-
Method Details
-
registerMission
Registers thePlantInteractionQuest
with theMissionManager
by adding listeners to the interaction type.- 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 ifPlantInteractionQuest
is complete- Specified by:
isCompleted
in classMission
- Returns:
- True iff player has completed at least the amount of target interactions
-
getDescription
Description of thePlantInteractionQuest
- Specified by:
getDescription
in classMission
- Returns:
- - Long description of the
PlantInteractionQuest
with player progress
-
getShortDescription
Short description of thePlantInteractionQuest
- Specified by:
getShortDescription
in classMission
- Returns:
- - short description of the players plant interaction progress
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentPlantInteractionQuest
from aJsonValue
- Specified by:
readProgress
in classMission
- Parameters:
progress
- TheJsonValue
representing the progress of theMission
as determined by the value returned ingetProgress()
.
-
getProgress
Gets thePlantInteractionQuest
- Specified by:
getProgress
in classMission
- Returns:
- Number of plant interactions the player has made
-
resetState
protected void resetState()Resets the number of plant interactions to 0- Specified by:
resetState
in classQuest
-