-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScoreCommand.java
36 lines (30 loc) · 966 Bytes
/
ScoreCommand.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package bork;
/**
* Handles commands to view the players current score
* @author Woodruff and Brian E. Burns
*/
class ScoreCommand extends Command {
ScoreCommand() {}
/**
* Returns the String of the players current score with a message about their ranking/level
* @return String message with the score and ranking
*/
public String execute() {
int score = GameState.instance().getScore();
String desc = "You have accumulated " + score + " points. Your current"
+ " rank is ";
if (score < 25) {
desc += "Amateur Adventurer.\n";
}
else if (score < 50) {
desc += "Common Adventurer.\n";
}
else if (score < 75) {
desc += "Advanced Adventurer.\n";
}
else {
desc += "Expert Adventurer.\n";
}
return desc;
}
}