Class ManageHostilesQuest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.ManageHostilesQuest
A
Quest that requires the player to kill hostiles in order to be completed.-
Constructor Summary
ConstructorsConstructorDescriptionManageHostilesQuest(String name, Reward reward, int expiryDuration, Set<EntityType> hostileTypes, int numberOfHostilesToBeKilled) Creates aManageHostilesQuestwith a specific expiryManageHostilesQuest(String name, Reward reward, Set<EntityType> hostileTypes, int numberOfHostilesToBeKilled) Creates aManageHostilesQuest -
Method Summary
Modifier and TypeMethodDescriptionGets a description of theManageHostilesQuestGets theManageHostilesQuestprogressGets a short description of theManageHostilesQuestcontaining the player's quest progress.booleanChecks whether theManageHostilesQuestis complete.voidreadProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the progress of theManageHostilesQuestfrom aJsonValuevoidregisterMission(EventHandler missionManagerEvents) Registers theManageHostilesQuestwith theMissionManagerby adding a listener to the ANIMAL_DEFEATED and ANIMAL_EATENMissionManager.MissionEventsprotected voidResets the state of theManageHostilesQuestby setting the number of hostiles killed back to 0Methods 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
-
ManageHostilesQuest
public ManageHostilesQuest(String name, Reward reward, Set<EntityType> hostileTypes, int numberOfHostilesToBeKilled) Creates aManageHostilesQuest- Parameters:
name- - the name of the questreward- - theRewardthe player can collect on completionhostileTypes- - the type of hostiles the player should killnumberOfHostilesToBeKilled- - the number of hostiles the player is required to kill
-
ManageHostilesQuest
public ManageHostilesQuest(String name, Reward reward, int expiryDuration, Set<EntityType> hostileTypes, int numberOfHostilesToBeKilled) Creates aManageHostilesQuestwith a specific expiry- Parameters:
name- - the name of the questreward- - theRewardthe player can collect on completionexpiryDuration- - how many in-game hours untilManageHostilesQuestexpireshostileTypes- - the type of hostiles the player should killnumberOfHostilesToBeKilled- - the number of hostiles the player is required to kill
-
-
Method Details
-
registerMission
Registers theManageHostilesQuestwith theMissionManagerby adding a listener to the ANIMAL_DEFEATED and ANIMAL_EATENMissionManager.MissionEvents- Specified by:
registerMissionin classMission- Parameters:
missionManagerEvents- A reference to theEventHandleron theMissionManager, with which relevant events should be listened to.
-
isCompleted
public boolean isCompleted()Checks whether theManageHostilesQuestis complete.- Specified by:
isCompletedin classMission- Returns:
- - returns true iff the player has killed the required amount of hostiles
-
getDescription
Gets a description of theManageHostilesQuest- Specified by:
getDescriptionin classMission- Returns:
- - a description of the
ManageHostilesQuest
-
getShortDescription
Gets a short description of theManageHostilesQuestcontaining the player's quest progress.- Specified by:
getShortDescriptionin classMission- Returns:
- - the short description of the players kill progress.
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the progress of theManageHostilesQuestfrom aJsonValue- Specified by:
readProgressin classMission- Parameters:
progress- TheJsonValuerepresenting the progress of theMissionas determined by the value returned ingetProgress().
-
getProgress
Gets theManageHostilesQuestprogress- Specified by:
getProgressin classMission- Returns:
- - the number of hostiles the player has killed since the quest creation
-
resetState
protected void resetState()Resets the state of theManageHostilesQuestby setting the number of hostiles killed back to 0- Specified by:
resetStatein classQuest
-