Class Achievement
java.lang.Object
com.csse3200.game.components.quests.Achievement
Represents an achievement.
An achievement has a name, description, completion status, visibility status, type, and an icon path.
Implements the
Json.Serializable
interface for serialization and deserialization of achievement data.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Represents the type of achievement. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the Achievement class used for json.Achievement
(String questName, String questDescription, Boolean completed, Boolean seen, Achievement.AchievementType type, String iconPath) Constructs an Achievement with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
complete()
Complete the current achievement.getPath()
Gets the icon path for the achievement.Getter method for the quest description.Getter method for the quest name.getType()
Gets the type of the achievement.boolean
Checks if the current achievement has been completedboolean
isSeen()
Checks if the current achievement has been seenvoid
setSeen()
Notes the achievement has been seentoString()
Returns a string representation of the achievement.
-
Constructor Details
-
Achievement
public Achievement()Default constructor for the Achievement class used for json. -
Achievement
public Achievement(String questName, String questDescription, Boolean completed, Boolean seen, Achievement.AchievementType type, String iconPath) Constructs an Achievement with the specified parameters.- Parameters:
questName
- The name of the quest.questDescription
- A brief description of the quest.completed
- Indicates whether the achievement is completed.seen
- Indicates whether the achievement has been seen.type
- The type of achievement.iconPath
- The file path to the icon representing the achievement.
-
-
Method Details
-
getQuestName
Getter method for the quest name.- Returns:
- String representation of the quest's name.
-
getQuestDescription
Getter method for the quest description.- Returns:
- String representation of the quest's description
-
isCompleted
public boolean isCompleted()Checks if the current achievement has been completed- Returns:
- True if it has been completed, False otherwise
-
complete
public void complete()Complete the current achievement. -
isSeen
public boolean isSeen()Checks if the current achievement has been seen- Returns:
- True if it has been completed, False otherwise
-
setSeen
public void setSeen()Notes the achievement has been seen -
getType
Gets the type of the achievement.- Returns:
- The achievement type.
-
getPath
Gets the icon path for the achievement.- Returns:
- The file path to the icon representing the achievement.
-
toString
Returns a string representation of the achievement.
-