-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScoreCommand.java
50 lines (42 loc) · 1018 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
*
*/
/** ScoreCommand deals with any Commands relating to a player checking their score.
* @author Team Red
*
*/
class ScoreCommand extends Command{
private int score;
private String rank;
/** Instantiates a ScoreCommand
*
*/
ScoreCommand()
{
this.score = GameState.instance().getAdventurersScore();
if (score <= 10) {
rank = "Amateur Adventurer";
}
if (score > 10 && score <= 50) {
rank = "Novice Adventurer";
}
if (score > 50 && score <= 100) {
rank = "Proficient Adventurer";
}
if (score > 100) {
rank = "Legendary Adventurer";
}
}
/**
* @override From Command
*/
String execute()
{
/** Edited these out for easy replacement in case of bad things happening **/
//GameState state = GameState.instance();
//int currScore = state.getAdventurersScore();
//return("Your score is "+ currScore);
return "You have accumulated " + score + " points."
+ "This gives you a rank of " + this.rank + ".\n";
}
}