-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelp.java
42 lines (42 loc) · 1.24 KB
/
Help.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
/**
* Class Help - a "help" action by the player.
* It is a subclass of Command class.
* Print out some help information.
* Here we print some stupid, cryptic message and a list of the
* command words.
* This class is part of the "World of Zuul" application.
* "World of Zuul" is a very simple, text based adventure game.
*
* @author Bowen Yan
* @version 6th, April 2008
*/
public class Help extends Command
{
/**
* Constructor for objects of class Help
*/
public Help(String firstWord, String secondWord)
{
super(firstWord,secondWord);
}
/**
* A player can require a help.
* @param command
* @param player
* @return
*/
public boolean executeCommand(Command command, Player player, Parser parser)
{
if(!command.hasSecondWord()) {
// if there is no second word, we don't know how to help the player...
System.out.println("help what?");
return false;
}
System.out.println("You are lost. You are alone. You wander");
System.out.println("around at the university.");
System.out.println();
System.out.println("Your command words are:");
parser.showCommands();
return false;
}
}