Class Quest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
- Direct Known Subclasses:
AutoQuest
,ClearDebrisQuest
,FertiliseCropTilesQuest
,FishingQuest
,InventoryStateQuest
,MainQuest
,ManageHostilesQuest
,MissionCompleteQuest
,OxygenLevelQuest
,PlantInteractionQuest
,ShipRepairQuest
,TameAnimalsQuest
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Collects the reward associated with thisQuest
.boolean
Returns a boolean value representing whether the quest has expired.boolean
Determines whether the quest is mandatory or notboolean
Returns a boolean value representing if this quest's rewards has been collected yet.void
read
(com.badlogic.gdx.utils.JsonValue jsonValue) void
Resets theQuest
's time to expiry back to the original expiry duration, and calls theQuest
'sresetState()
method.protected abstract void
Resets the internal state of theQuest
, to what it was before being accepted/modified.void
Decrements the duration to expiry of the quest by 1, if theQuest
can expire.void
write
(com.badlogic.gdx.utils.Json json) Methods inherited from class com.csse3200.game.missions.Mission
getDescription, getName, getProgress, getShortDescription, isCompleted, notifyUpdate, readProgress, registerMission
-
Constructor Details
-
Quest
-
Quest
Creates aQuest
with the givenString
name, specifying theReward
for completion, the integer duration of theQuest
(the number of hours before theQuest
expires), and whether theQuest
is mandatory.Quest
s created using this constructor will expire after the specified time limit.- Parameters:
name
- TheString
name of theQuest
, visible to the player in-gamereward
- TheReward
which can be collected upon completion of theQuest
expiryDuration
- An integer value representing the number of hours before thisQuest
should expireisMandatory
- A boolean value representing whether theQuest
is mandatory. MandatoryQuest
s will result in a game over if it is not completed before it expires.
-
-
Method Details
-
updateExpiry
public void updateExpiry()Decrements the duration to expiry of the quest by 1, if theQuest
can expire. -
isExpired
public boolean isExpired()Returns a boolean value representing whether the quest has expired. If theQuest
does not expire, then this method will always return false.- Returns:
- True if the
Quest
can expire and has expired, false otherwise.
-
isMandatory
public boolean isMandatory()Determines whether the quest is mandatory or not- Returns:
- boolean value representing whether the quest is mandatory
-
isRewardCollected
public boolean isRewardCollected()Returns a boolean value representing if this quest's rewards has been collected yet.- Returns:
- True if the reward has been collected, false otherwise.
-
collectReward
public void collectReward() -
resetExpiry
public void resetExpiry()Resets theQuest
's time to expiry back to the original expiry duration, and calls theQuest
'sresetState()
method. This method only callsresetState()
if it cannot expire. -
resetState
protected abstract void resetState()Resets the internal state of theQuest
, to what it was before being accepted/modified. -
write
public void write(com.badlogic.gdx.utils.Json json) -
read
public void read(com.badlogic.gdx.utils.JsonValue jsonValue)
-