Class FertiliseCropTilesQuest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.FertiliseCropTilesQuest
FertiliseCropTilesQuest class is a Quest that tracks the number of CropTiles have been fertilised.
-
Constructor Summary
ConstructorsConstructorDescriptionFertiliseCropTilesQuest
(String name, Reward reward, int numberOfTilesToFertilise) Creates aFertiliseCropTilesQuest
FertiliseCropTilesQuest
(String name, Reward reward, int expiryDuration, int numberOfTilesToFertilise) Creates aFertiliseCropTilesQuest
. -
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 cropTiles the player has fertilised since Quest was registered.Gives the player's progress in theFertiliseCropTilesQuest
.boolean
Returns true if the number of crop tiles the player has fertilised is greater than or equal to the target number of tiles.void
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 theFertiliseCropTilesQuest
with theMission
by no listening to the FERTILISE_CROP event.protected void
Resets the number of cropTiles the player has fertilised 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
-
FertiliseCropTilesQuest
Creates aFertiliseCropTilesQuest
- Parameters:
name
- - the name of theFertiliseCropTilesQuest
reward
- - the Reward a player will receive after completing the QuestnumberOfTilesToFertilise
- - the number of cropTileComponents the player has currently fertilised
-
FertiliseCropTilesQuest
public FertiliseCropTilesQuest(String name, Reward reward, int expiryDuration, int numberOfTilesToFertilise) Creates aFertiliseCropTilesQuest
.- Parameters:
name
- The name of theFertiliseCropTilesQuest
reward
- TheReward
for completion of theQuest
expiryDuration
- The time limit to complete theQuest
once acceptednumberOfTilesToFertilise
- The number of crop tiles to fertilise before completing theQuest
-
-
Method Details
-
registerMission
Registers theFertiliseCropTilesQuest
with theMission
by no listening to the FERTILISE_CROP 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()Returns true if the number of crop tiles the player has fertilised is greater than or equal to the target number of tiles.- Specified by:
isCompleted
in classMission
- Returns:
- True if the player has fertilised the target number of fertilised tiles.
-
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
FertiliseCropTilesQuest
.
-
getShortDescription
Gives the player's progress in theFertiliseCropTilesQuest
.- Specified by:
getShortDescription
in classMission
- Returns:
- - Human-readable String of how many cropTiles the player has fertilised 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 cropTiles the player has fertilised since Quest was registered.- Specified by:
getProgress
in classMission
- Returns:
- - number of cropTiles fertilised
-
resetState
protected void resetState()Resets the number of cropTiles the player has fertilised to 0.- Specified by:
resetState
in classQuest
-