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 aFertiliseCropTilesQuestFertiliseCropTilesQuest(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.booleanReturns true if the number of crop tiles the player has fertilised is greater than or equal to the target number of tiles.voidreadProgress(com.badlogic.gdx.utils.JsonValue progress) Read in the amount of debris the player has cleared from a JsonValue.voidregisterMission(EventHandler missionManagerEvents) Registers theFertiliseCropTilesQuestwith theMissionby no listening to the FERTILISE_CROP event.protected voidResets 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, writeMethods inherited from class com.csse3200.game.missions.Mission
getName, notifyUpdate
-
Constructor Details
-
FertiliseCropTilesQuest
Creates aFertiliseCropTilesQuest- Parameters:
name- - the name of theFertiliseCropTilesQuestreward- - 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 theFertiliseCropTilesQuestreward- TheRewardfor completion of theQuestexpiryDuration- The time limit to complete theQuestonce acceptednumberOfTilesToFertilise- The number of crop tiles to fertilise before completing theQuest
-
-
Method Details
-
registerMission
Registers theFertiliseCropTilesQuestwith theMissionby no listening to the FERTILISE_CROP event.- Specified by:
registerMissionin classMission- Parameters:
missionManagerEvents- A reference to theEventHandleron 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:
isCompletedin 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:
getDescriptionin classMission- Returns:
- - Human-readable description of the
FertiliseCropTilesQuest.
-
getShortDescription
Gives the player's progress in theFertiliseCropTilesQuest.- Specified by:
getShortDescriptionin 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:
readProgressin classMission- Parameters:
progress- TheJsonValuerepresenting the progress of theMissionas determined by the value returned ingetProgress().
-
getProgress
Get the number of cropTiles the player has fertilised since Quest was registered.- Specified by:
getProgressin classMission- Returns:
- - number of cropTiles fertilised
-
resetState
protected void resetState()Resets the number of cropTiles the player has fertilised to 0.- Specified by:
resetStatein classQuest
-