Class ShipRepairQuest
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.quests.Quest
com.csse3200.game.missions.quests.ShipRepairQuest
A
Quest where player must repair ship to a certain level.-
Constructor Summary
ConstructorsConstructorDescriptionShipRepairQuest(String name, Reward reward, int targetShipRepairProgress) Creates aShipRepairQuestShipRepairQuest(String name, Reward reward, int expiryDuration, int targetShipRepairProgress) Creates aShipRepairQuestwith expiry -
Method Summary
Modifier and TypeMethodDescriptionGets a description of theShipRepairQuestThe progress of theShipRepairQuestGets a short description of theShipRepairQuestbooleanChecks ifShipRepairQuestis completevoidreadProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentShipRepairQuestfrom aJsonValuevoidregisterMission(EventHandler missionManagerEvents) RegistersShipRepairQuestwithMissionManagerby listening to SHIP_PART_ADDED eventprotected voidResets the current ship repair progress back 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
-
ShipRepairQuest
Creates aShipRepairQuest- Parameters:
name- Name of the Questreward- Reward the player can collect on completiontargetShipRepairProgress- How much the player must repair ship by
-
ShipRepairQuest
public ShipRepairQuest(String name, Reward reward, int expiryDuration, int targetShipRepairProgress) Creates aShipRepairQuestwith expiry- Parameters:
name- Name of the Questreward- Reward the player can collect on completionexpiryDuration- How long until theShipRepairQuestis expiredtargetShipRepairProgress- How much the player must repair ship by
-
-
Method Details
-
registerMission
RegistersShipRepairQuestwithMissionManagerby listening to SHIP_PART_ADDED event- Specified by:
registerMissionin classMission- Parameters:
missionManagerEvents- A reference to theEventHandleron theMissionManager, with which relevant events should be listened to.
-
isCompleted
public boolean isCompleted()Checks ifShipRepairQuestis complete- Specified by:
isCompletedin classMission- Returns:
- True iff the player has repaired the ship by at least the target amount
-
getDescription
Gets a description of theShipRepairQuest- Specified by:
getDescriptionin classMission- Returns:
ShipRepairQuestdescription
-
getShortDescription
Gets a short description of theShipRepairQuest- Specified by:
getShortDescriptionin classMission- Returns:
- Short quest description showing the players progress
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the currentShipRepairQuestfrom aJsonValue- Specified by:
readProgressin classMission- Parameters:
progress- TheJsonValuerepresenting the progress of theMissionas determined by the value returned ingetProgress().
-
getProgress
The progress of theShipRepairQuest- Specified by:
getProgressin classMission- Returns:
- current ship repair progress
-
resetState
protected void resetState()Resets the current ship repair progress back to 0.- Specified by:
resetStatein classQuest
-