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 aManageHostilesQuest
with a specific expiryManageHostilesQuest
(String name, Reward reward, Set<EntityType> hostileTypes, int numberOfHostilesToBeKilled) Creates aManageHostilesQuest
-
Method Summary
Modifier and TypeMethodDescriptionGets a description of theManageHostilesQuest
Gets theManageHostilesQuest
progressGets a short description of theManageHostilesQuest
containing the player's quest progress.boolean
Checks whether theManageHostilesQuest
is complete.void
readProgress
(com.badlogic.gdx.utils.JsonValue progress) Reads in the progress of theManageHostilesQuest
from aJsonValue
void
registerMission
(EventHandler missionManagerEvents) Registers theManageHostilesQuest
with theMissionManager
by adding a listener to the ANIMAL_DEFEATED and ANIMAL_EATENMissionManager.MissionEvent
sprotected void
Resets the state of theManageHostilesQuest
by 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, write
Methods 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
- - theReward
the 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 aManageHostilesQuest
with a specific expiry- Parameters:
name
- - the name of the questreward
- - theReward
the player can collect on completionexpiryDuration
- - how many in-game hours untilManageHostilesQuest
expireshostileTypes
- - the type of hostiles the player should killnumberOfHostilesToBeKilled
- - the number of hostiles the player is required to kill
-
-
Method Details
-
registerMission
Registers theManageHostilesQuest
with theMissionManager
by adding a listener to the ANIMAL_DEFEATED and ANIMAL_EATENMissionManager.MissionEvent
s- 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 whether theManageHostilesQuest
is complete.- Specified by:
isCompleted
in classMission
- Returns:
- - returns true iff the player has killed the required amount of hostiles
-
getDescription
Gets a description of theManageHostilesQuest
- Specified by:
getDescription
in classMission
- Returns:
- - a description of the
ManageHostilesQuest
-
getShortDescription
Gets a short description of theManageHostilesQuest
containing the player's quest progress.- Specified by:
getShortDescription
in 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 theManageHostilesQuest
from aJsonValue
- Specified by:
readProgress
in classMission
- Parameters:
progress
- TheJsonValue
representing the progress of theMission
as determined by the value returned ingetProgress()
.
-
getProgress
Gets theManageHostilesQuest
progress- Specified by:
getProgress
in classMission
- Returns:
- - the number of hostiles the player has killed since the quest creation
-
resetState
protected void resetState()Resets the state of theManageHostilesQuest
by setting the number of hostiles killed back to 0- Specified by:
resetState
in classQuest
-